Erster Docker-Stand
This commit is contained in:
525
_node_modules/effect/dist/cjs/internal/stm/core.js
generated
vendored
Normal file
525
_node_modules/effect/dist/cjs/internal/stm/core.js
generated
vendored
Normal file
@@ -0,0 +1,525 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.zipWith = exports.zipRight = exports.zipLeft = exports.zip = exports.withSTMRuntime = exports.unsafeAtomically = exports.sync = exports.succeed = exports.retry = exports.orTry = exports.matchSTM = exports.mapInputContext = exports.map = exports.isSTM = exports.interruptAs = exports.interrupt = exports.flatMap = exports.failSync = exports.fail = exports.ensuring = exports.effect = exports.dieSync = exports.dieMessage = exports.die = exports.contextWithSTM = exports.contextWith = exports.context = exports.commit = exports.catchAll = exports.STMTypeId = exports.STMDriver = void 0;
|
||||
var Cause = _interopRequireWildcard(require("../../Cause.js"));
|
||||
var Context = _interopRequireWildcard(require("../../Context.js"));
|
||||
var Effect = _interopRequireWildcard(require("../../Effect.js"));
|
||||
var Either = _interopRequireWildcard(require("../../Either.js"));
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var Exit = _interopRequireWildcard(require("../../Exit.js"));
|
||||
var FiberRef = _interopRequireWildcard(require("../../FiberRef.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Hash = _interopRequireWildcard(require("../../Hash.js"));
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
var _Utils = require("../../Utils.js");
|
||||
var _coreStream = require("../core-stream.js");
|
||||
var _core = require("../core.js");
|
||||
var _effectable = require("../effectable.js");
|
||||
var _effect = require("../opCodes/effect.js");
|
||||
var _singleShotGen = require("../singleShotGen.js");
|
||||
var _sink = require("../sink.js");
|
||||
var Journal = _interopRequireWildcard(require("./journal.js"));
|
||||
var OpCodes = _interopRequireWildcard(require("./opCodes/stm.js"));
|
||||
var TExitOpCodes = _interopRequireWildcard(require("./opCodes/tExit.js"));
|
||||
var TryCommitOpCodes = _interopRequireWildcard(require("./opCodes/tryCommit.js"));
|
||||
var STMState = _interopRequireWildcard(require("./stmState.js"));
|
||||
var TExit = _interopRequireWildcard(require("./tExit.js"));
|
||||
var TryCommit = _interopRequireWildcard(require("./tryCommit.js"));
|
||||
var TxnId = _interopRequireWildcard(require("./txnId.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const STMSymbolKey = "effect/STM";
|
||||
/** @internal */
|
||||
const STMTypeId = exports.STMTypeId = /*#__PURE__*/Symbol.for(STMSymbolKey);
|
||||
const stmVariance = {
|
||||
/* c8 ignore next */
|
||||
_R: _ => _,
|
||||
/* c8 ignore next */
|
||||
_E: _ => _,
|
||||
/* c8 ignore next */
|
||||
_A: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
class STMPrimitive {
|
||||
effect_instruction_i0;
|
||||
_op = _effect.OP_COMMIT;
|
||||
effect_instruction_i1 = undefined;
|
||||
effect_instruction_i2 = undefined;
|
||||
[Effect.EffectTypeId];
|
||||
[_effectable.StreamTypeId];
|
||||
[_sink.SinkTypeId];
|
||||
[_coreStream.ChannelTypeId];
|
||||
get [STMTypeId]() {
|
||||
return stmVariance;
|
||||
}
|
||||
constructor(effect_instruction_i0) {
|
||||
this.effect_instruction_i0 = effect_instruction_i0;
|
||||
this[Effect.EffectTypeId] = _effectable.effectVariance;
|
||||
this[_effectable.StreamTypeId] = stmVariance;
|
||||
this[_sink.SinkTypeId] = stmVariance;
|
||||
this[_coreStream.ChannelTypeId] = stmVariance;
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return this === that;
|
||||
}
|
||||
[Hash.symbol]() {
|
||||
return Hash.cached(this, Hash.random(this));
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return new _singleShotGen.SingleShotGen(new _Utils.YieldWrap(this));
|
||||
}
|
||||
commit() {
|
||||
return unsafeAtomically(this, _Function.constVoid, _Function.constVoid);
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const isSTM = u => (0, _Predicate.hasProperty)(u, STMTypeId);
|
||||
/** @internal */
|
||||
exports.isSTM = isSTM;
|
||||
const commit = self => unsafeAtomically(self, _Function.constVoid, _Function.constVoid);
|
||||
/** @internal */
|
||||
exports.commit = commit;
|
||||
const unsafeAtomically = (self, onDone, onInterrupt) => (0, _core.withFiberRuntime)(state => {
|
||||
const fiberId = state.id();
|
||||
const env = state.getFiberRef(FiberRef.currentContext);
|
||||
const scheduler = state.getFiberRef(FiberRef.currentScheduler);
|
||||
const priority = state.getFiberRef(FiberRef.currentSchedulingPriority);
|
||||
const commitResult = tryCommitSync(fiberId, self, env, scheduler, priority);
|
||||
switch (commitResult._tag) {
|
||||
case TryCommitOpCodes.OP_DONE:
|
||||
{
|
||||
onDone(commitResult.exit);
|
||||
return commitResult.exit;
|
||||
}
|
||||
case TryCommitOpCodes.OP_SUSPEND:
|
||||
{
|
||||
const txnId = TxnId.make();
|
||||
const state = {
|
||||
value: STMState.running
|
||||
};
|
||||
const effect = Effect.async(k => tryCommitAsync(fiberId, self, txnId, state, env, scheduler, priority, k));
|
||||
return Effect.uninterruptibleMask(restore => (0, _Function.pipe)(restore(effect), Effect.catchAllCause(cause => {
|
||||
let currentState = state.value;
|
||||
if (STMState.isRunning(currentState)) {
|
||||
state.value = STMState.interrupted;
|
||||
}
|
||||
currentState = state.value;
|
||||
if (STMState.isDone(currentState)) {
|
||||
onDone(currentState.exit);
|
||||
return currentState.exit;
|
||||
}
|
||||
onInterrupt();
|
||||
return Effect.failCause(cause);
|
||||
})));
|
||||
}
|
||||
}
|
||||
});
|
||||
/** @internal */
|
||||
exports.unsafeAtomically = unsafeAtomically;
|
||||
const tryCommit = (fiberId, stm, state, env, scheduler, priority) => {
|
||||
const journal = new Map();
|
||||
const tExit = new STMDriver(stm, journal, fiberId, env).run();
|
||||
const analysis = Journal.analyzeJournal(journal);
|
||||
if (analysis === Journal.JournalAnalysisReadWrite) {
|
||||
Journal.commitJournal(journal);
|
||||
} else if (analysis === Journal.JournalAnalysisInvalid) {
|
||||
throw new Error("BUG: STM.TryCommit.tryCommit - please report an issue at https://github.com/Effect-TS/effect/issues");
|
||||
}
|
||||
switch (tExit._tag) {
|
||||
case TExitOpCodes.OP_SUCCEED:
|
||||
{
|
||||
state.value = STMState.fromTExit(tExit);
|
||||
return completeTodos(Exit.succeed(tExit.value), journal, scheduler, priority);
|
||||
}
|
||||
case TExitOpCodes.OP_FAIL:
|
||||
{
|
||||
state.value = STMState.fromTExit(tExit);
|
||||
const cause = Cause.fail(tExit.error);
|
||||
return completeTodos(Exit.failCause(cause), journal, scheduler, priority);
|
||||
}
|
||||
case TExitOpCodes.OP_DIE:
|
||||
{
|
||||
state.value = STMState.fromTExit(tExit);
|
||||
const cause = Cause.die(tExit.defect);
|
||||
return completeTodos(Exit.failCause(cause), journal, scheduler, priority);
|
||||
}
|
||||
case TExitOpCodes.OP_INTERRUPT:
|
||||
{
|
||||
state.value = STMState.fromTExit(tExit);
|
||||
const cause = Cause.interrupt(fiberId);
|
||||
return completeTodos(Exit.failCause(cause), journal, scheduler, priority);
|
||||
}
|
||||
case TExitOpCodes.OP_RETRY:
|
||||
{
|
||||
return TryCommit.suspend(journal);
|
||||
}
|
||||
}
|
||||
};
|
||||
/** @internal */
|
||||
const tryCommitSync = (fiberId, stm, env, scheduler, priority) => {
|
||||
const journal = new Map();
|
||||
const tExit = new STMDriver(stm, journal, fiberId, env).run();
|
||||
const analysis = Journal.analyzeJournal(journal);
|
||||
if (analysis === Journal.JournalAnalysisReadWrite && TExit.isSuccess(tExit)) {
|
||||
Journal.commitJournal(journal);
|
||||
} else if (analysis === Journal.JournalAnalysisInvalid) {
|
||||
throw new Error("BUG: STM.TryCommit.tryCommitSync - please report an issue at https://github.com/Effect-TS/effect/issues");
|
||||
}
|
||||
switch (tExit._tag) {
|
||||
case TExitOpCodes.OP_SUCCEED:
|
||||
{
|
||||
return completeTodos(Exit.succeed(tExit.value), journal, scheduler, priority);
|
||||
}
|
||||
case TExitOpCodes.OP_FAIL:
|
||||
{
|
||||
const cause = Cause.fail(tExit.error);
|
||||
return completeTodos(Exit.failCause(cause), journal, scheduler, priority);
|
||||
}
|
||||
case TExitOpCodes.OP_DIE:
|
||||
{
|
||||
const cause = Cause.die(tExit.defect);
|
||||
return completeTodos(Exit.failCause(cause), journal, scheduler, priority);
|
||||
}
|
||||
case TExitOpCodes.OP_INTERRUPT:
|
||||
{
|
||||
const cause = Cause.interrupt(fiberId);
|
||||
return completeTodos(Exit.failCause(cause), journal, scheduler, priority);
|
||||
}
|
||||
case TExitOpCodes.OP_RETRY:
|
||||
{
|
||||
return TryCommit.suspend(journal);
|
||||
}
|
||||
}
|
||||
};
|
||||
/** @internal */
|
||||
const tryCommitAsync = (fiberId, self, txnId, state, context, scheduler, priority, k) => {
|
||||
if (STMState.isRunning(state.value)) {
|
||||
const result = tryCommit(fiberId, self, state, context, scheduler, priority);
|
||||
switch (result._tag) {
|
||||
case TryCommitOpCodes.OP_DONE:
|
||||
{
|
||||
completeTryCommit(result.exit, k);
|
||||
break;
|
||||
}
|
||||
case TryCommitOpCodes.OP_SUSPEND:
|
||||
{
|
||||
Journal.addTodo(txnId, result.journal, () => tryCommitAsync(fiberId, self, txnId, state, context, scheduler, priority, k));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
/** @internal */
|
||||
const completeTodos = (exit, journal, scheduler, priority) => {
|
||||
const todos = Journal.collectTodos(journal);
|
||||
if (todos.size > 0) {
|
||||
scheduler.scheduleTask(() => Journal.execTodos(todos), priority);
|
||||
}
|
||||
return TryCommit.done(exit);
|
||||
};
|
||||
/** @internal */
|
||||
const completeTryCommit = (exit, k) => {
|
||||
k(exit);
|
||||
};
|
||||
/** @internal */
|
||||
const context = () => effect((_, __, env) => env);
|
||||
/** @internal */
|
||||
exports.context = context;
|
||||
const contextWith = f => map(context(), f);
|
||||
/** @internal */
|
||||
exports.contextWith = contextWith;
|
||||
const contextWithSTM = f => flatMap(context(), f);
|
||||
/** @internal */
|
||||
exports.contextWithSTM = contextWithSTM;
|
||||
class STMDriver {
|
||||
self;
|
||||
journal;
|
||||
fiberId;
|
||||
contStack = [];
|
||||
env;
|
||||
constructor(self, journal, fiberId, r0) {
|
||||
this.self = self;
|
||||
this.journal = journal;
|
||||
this.fiberId = fiberId;
|
||||
this.env = r0;
|
||||
}
|
||||
getEnv() {
|
||||
return this.env;
|
||||
}
|
||||
pushStack(cont) {
|
||||
this.contStack.push(cont);
|
||||
}
|
||||
popStack() {
|
||||
return this.contStack.pop();
|
||||
}
|
||||
nextSuccess() {
|
||||
let current = this.popStack();
|
||||
while (current !== undefined && current.effect_instruction_i0 !== OpCodes.OP_ON_SUCCESS) {
|
||||
current = this.popStack();
|
||||
}
|
||||
return current;
|
||||
}
|
||||
nextFailure() {
|
||||
let current = this.popStack();
|
||||
while (current !== undefined && current.effect_instruction_i0 !== OpCodes.OP_ON_FAILURE) {
|
||||
current = this.popStack();
|
||||
}
|
||||
return current;
|
||||
}
|
||||
nextRetry() {
|
||||
let current = this.popStack();
|
||||
while (current !== undefined && current.effect_instruction_i0 !== OpCodes.OP_ON_RETRY) {
|
||||
current = this.popStack();
|
||||
}
|
||||
return current;
|
||||
}
|
||||
run() {
|
||||
let curr = this.self;
|
||||
let exit = undefined;
|
||||
while (exit === undefined && curr !== undefined) {
|
||||
try {
|
||||
const current = curr;
|
||||
if (current) {
|
||||
switch (current._op) {
|
||||
case "Tag":
|
||||
{
|
||||
curr = effect((_, __, env) => Context.unsafeGet(env, current));
|
||||
break;
|
||||
}
|
||||
case "Left":
|
||||
{
|
||||
curr = fail(current.left);
|
||||
break;
|
||||
}
|
||||
case "None":
|
||||
{
|
||||
curr = fail(new Cause.NoSuchElementException());
|
||||
break;
|
||||
}
|
||||
case "Right":
|
||||
{
|
||||
curr = succeed(current.right);
|
||||
break;
|
||||
}
|
||||
case "Some":
|
||||
{
|
||||
curr = succeed(current.value);
|
||||
break;
|
||||
}
|
||||
case "Commit":
|
||||
{
|
||||
switch (current.effect_instruction_i0) {
|
||||
case OpCodes.OP_DIE:
|
||||
{
|
||||
exit = TExit.die((0, _Utils.internalCall)(() => current.effect_instruction_i1()));
|
||||
break;
|
||||
}
|
||||
case OpCodes.OP_FAIL:
|
||||
{
|
||||
const cont = this.nextFailure();
|
||||
if (cont === undefined) {
|
||||
exit = TExit.fail((0, _Utils.internalCall)(() => current.effect_instruction_i1()));
|
||||
} else {
|
||||
curr = (0, _Utils.internalCall)(() => cont.effect_instruction_i2((0, _Utils.internalCall)(() => current.effect_instruction_i1())));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OpCodes.OP_RETRY:
|
||||
{
|
||||
const cont = this.nextRetry();
|
||||
if (cont === undefined) {
|
||||
exit = TExit.retry;
|
||||
} else {
|
||||
curr = (0, _Utils.internalCall)(() => cont.effect_instruction_i2());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OpCodes.OP_INTERRUPT:
|
||||
{
|
||||
exit = TExit.interrupt(this.fiberId);
|
||||
break;
|
||||
}
|
||||
case OpCodes.OP_WITH_STM_RUNTIME:
|
||||
{
|
||||
curr = (0, _Utils.internalCall)(() => current.effect_instruction_i1(this));
|
||||
break;
|
||||
}
|
||||
case OpCodes.OP_ON_SUCCESS:
|
||||
case OpCodes.OP_ON_FAILURE:
|
||||
case OpCodes.OP_ON_RETRY:
|
||||
{
|
||||
this.pushStack(current);
|
||||
curr = current.effect_instruction_i1;
|
||||
break;
|
||||
}
|
||||
case OpCodes.OP_PROVIDE:
|
||||
{
|
||||
const env = this.env;
|
||||
this.env = (0, _Utils.internalCall)(() => current.effect_instruction_i2(env));
|
||||
curr = (0, _Function.pipe)(current.effect_instruction_i1, ensuring(sync(() => this.env = env)));
|
||||
break;
|
||||
}
|
||||
case OpCodes.OP_SUCCEED:
|
||||
{
|
||||
const value = current.effect_instruction_i1;
|
||||
const cont = this.nextSuccess();
|
||||
if (cont === undefined) {
|
||||
exit = TExit.succeed(value);
|
||||
} else {
|
||||
curr = (0, _Utils.internalCall)(() => cont.effect_instruction_i2(value));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OpCodes.OP_SYNC:
|
||||
{
|
||||
const value = (0, _Utils.internalCall)(() => current.effect_instruction_i1());
|
||||
const cont = this.nextSuccess();
|
||||
if (cont === undefined) {
|
||||
exit = TExit.succeed(value);
|
||||
} else {
|
||||
curr = (0, _Utils.internalCall)(() => cont.effect_instruction_i2(value));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
curr = die(e);
|
||||
}
|
||||
}
|
||||
return exit;
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
exports.STMDriver = STMDriver;
|
||||
const catchAll = exports.catchAll = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_ON_FAILURE);
|
||||
stm.effect_instruction_i1 = self;
|
||||
stm.effect_instruction_i2 = f;
|
||||
return stm;
|
||||
});
|
||||
/** @internal */
|
||||
const mapInputContext = exports.mapInputContext = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_PROVIDE);
|
||||
stm.effect_instruction_i1 = self;
|
||||
stm.effect_instruction_i2 = f;
|
||||
return stm;
|
||||
});
|
||||
/** @internal */
|
||||
const die = defect => dieSync(() => defect);
|
||||
/** @internal */
|
||||
exports.die = die;
|
||||
const dieMessage = message => dieSync(() => new Cause.RuntimeException(message));
|
||||
/** @internal */
|
||||
exports.dieMessage = dieMessage;
|
||||
const dieSync = evaluate => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_DIE);
|
||||
stm.effect_instruction_i1 = evaluate;
|
||||
return stm;
|
||||
};
|
||||
/** @internal */
|
||||
exports.dieSync = dieSync;
|
||||
const effect = f => withSTMRuntime(_ => succeed(f(_.journal, _.fiberId, _.getEnv())));
|
||||
/** @internal */
|
||||
exports.effect = effect;
|
||||
const ensuring = exports.ensuring = /*#__PURE__*/(0, _Function.dual)(2, (self, finalizer) => matchSTM(self, {
|
||||
onFailure: e => zipRight(finalizer, fail(e)),
|
||||
onSuccess: a => zipRight(finalizer, succeed(a))
|
||||
}));
|
||||
/** @internal */
|
||||
const fail = error => failSync(() => error);
|
||||
/** @internal */
|
||||
exports.fail = fail;
|
||||
const failSync = evaluate => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_FAIL);
|
||||
stm.effect_instruction_i1 = evaluate;
|
||||
return stm;
|
||||
};
|
||||
/** @internal */
|
||||
exports.failSync = failSync;
|
||||
const flatMap = exports.flatMap = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_ON_SUCCESS);
|
||||
stm.effect_instruction_i1 = self;
|
||||
stm.effect_instruction_i2 = f;
|
||||
return stm;
|
||||
});
|
||||
/** @internal */
|
||||
const matchSTM = exports.matchSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, {
|
||||
onFailure,
|
||||
onSuccess
|
||||
}) => (0, _Function.pipe)(self, map(Either.right), catchAll(e => (0, _Function.pipe)(onFailure(e), map(Either.left))), flatMap(either => {
|
||||
switch (either._tag) {
|
||||
case "Left":
|
||||
{
|
||||
return succeed(either.left);
|
||||
}
|
||||
case "Right":
|
||||
{
|
||||
return onSuccess(either.right);
|
||||
}
|
||||
}
|
||||
})));
|
||||
/** @internal */
|
||||
const withSTMRuntime = f => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_WITH_STM_RUNTIME);
|
||||
stm.effect_instruction_i1 = f;
|
||||
return stm;
|
||||
};
|
||||
/** @internal */
|
||||
exports.withSTMRuntime = withSTMRuntime;
|
||||
const interrupt = exports.interrupt = /*#__PURE__*/withSTMRuntime(_ => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_INTERRUPT);
|
||||
stm.effect_instruction_i1 = _.fiberId;
|
||||
return stm;
|
||||
});
|
||||
/** @internal */
|
||||
const interruptAs = fiberId => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_INTERRUPT);
|
||||
stm.effect_instruction_i1 = fiberId;
|
||||
return stm;
|
||||
};
|
||||
/** @internal */
|
||||
exports.interruptAs = interruptAs;
|
||||
const map = exports.map = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => (0, _Function.pipe)(self, flatMap(a => sync(() => f(a)))));
|
||||
/** @internal */
|
||||
const orTry = exports.orTry = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_ON_RETRY);
|
||||
stm.effect_instruction_i1 = self;
|
||||
stm.effect_instruction_i2 = that;
|
||||
return stm;
|
||||
});
|
||||
/** @internal */
|
||||
const retry = exports.retry = /*#__PURE__*/new STMPrimitive(OpCodes.OP_RETRY);
|
||||
/** @internal */
|
||||
const succeed = value => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_SUCCEED);
|
||||
stm.effect_instruction_i1 = value;
|
||||
return stm;
|
||||
};
|
||||
/** @internal */
|
||||
exports.succeed = succeed;
|
||||
const sync = evaluate => {
|
||||
const stm = new STMPrimitive(OpCodes.OP_SYNC);
|
||||
stm.effect_instruction_i1 = evaluate;
|
||||
return stm;
|
||||
};
|
||||
/** @internal */
|
||||
exports.sync = sync;
|
||||
const zip = exports.zip = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => (0, _Function.pipe)(self, zipWith(that, (a, a1) => [a, a1])));
|
||||
/** @internal */
|
||||
const zipLeft = exports.zipLeft = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => (0, _Function.pipe)(self, flatMap(a => (0, _Function.pipe)(that, map(() => a)))));
|
||||
/** @internal */
|
||||
const zipRight = exports.zipRight = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => (0, _Function.pipe)(self, flatMap(() => that)));
|
||||
/** @internal */
|
||||
const zipWith = exports.zipWith = /*#__PURE__*/(0, _Function.dual)(3, (self, that, f) => (0, _Function.pipe)(self, flatMap(a => (0, _Function.pipe)(that, map(b => f(a, b))))));
|
||||
//# sourceMappingURL=core.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/core.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/core.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
57
_node_modules/effect/dist/cjs/internal/stm/entry.js
generated
vendored
Normal file
57
_node_modules/effect/dist/cjs/internal/stm/entry.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.unsafeSet = exports.unsafeGet = exports.make = exports.isValid = exports.isInvalid = exports.isChanged = exports.copy = exports.commit = void 0;
|
||||
var Versioned = _interopRequireWildcard(require("./versioned.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const make = (ref, isNew) => ({
|
||||
ref,
|
||||
isNew,
|
||||
isChanged: false,
|
||||
expected: ref.versioned,
|
||||
newValue: ref.versioned.value
|
||||
});
|
||||
exports.make = make;
|
||||
const unsafeGet = self => {
|
||||
return self.newValue;
|
||||
};
|
||||
/** @internal */
|
||||
exports.unsafeGet = unsafeGet;
|
||||
const unsafeSet = (self, value) => {
|
||||
self.isChanged = true;
|
||||
self.newValue = value;
|
||||
};
|
||||
/** @internal */
|
||||
exports.unsafeSet = unsafeSet;
|
||||
const commit = self => {
|
||||
self.ref.versioned = new Versioned.Versioned(self.newValue);
|
||||
};
|
||||
/** @internal */
|
||||
exports.commit = commit;
|
||||
const copy = self => ({
|
||||
ref: self.ref,
|
||||
isNew: self.isNew,
|
||||
isChanged: self.isChanged,
|
||||
expected: self.expected,
|
||||
newValue: self.newValue
|
||||
});
|
||||
/** @internal */
|
||||
exports.copy = copy;
|
||||
const isValid = self => {
|
||||
return self.ref.versioned === self.expected;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isValid = isValid;
|
||||
const isInvalid = self => {
|
||||
return self.ref.versioned !== self.expected;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isInvalid = isInvalid;
|
||||
const isChanged = self => {
|
||||
return self.isChanged;
|
||||
};
|
||||
exports.isChanged = isChanged;
|
||||
//# sourceMappingURL=entry.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/entry.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/entry.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"entry.js","names":["Versioned","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","make","ref","isNew","isChanged","expected","versioned","newValue","value","exports","unsafeGet","self","unsafeSet","commit","copy","isValid","isInvalid"],"sources":["../../../../src/internal/stm/entry.ts"],"sourcesContent":[null],"mappings":";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AACvB,CAAC;AAAAK,OAAA,CAAAL,SAAA,GAAAA,SAAA","ignoreList":[]}
|
||||
104
_node_modules/effect/dist/cjs/internal/stm/journal.js
generated
vendored
Normal file
104
_node_modules/effect/dist/cjs/internal/stm/journal.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.prepareResetJournal = exports.isValid = exports.isInvalid = exports.execTodos = exports.commitJournal = exports.collectTodos = exports.analyzeJournal = exports.addTodo = exports.JournalAnalysisReadWrite = exports.JournalAnalysisReadOnly = exports.JournalAnalysisInvalid = void 0;
|
||||
var Entry = _interopRequireWildcard(require("./entry.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const JournalAnalysisInvalid = exports.JournalAnalysisInvalid = "Invalid";
|
||||
/** @internal */
|
||||
const JournalAnalysisReadWrite = exports.JournalAnalysisReadWrite = "ReadWrite";
|
||||
/** @internal */
|
||||
const JournalAnalysisReadOnly = exports.JournalAnalysisReadOnly = "ReadOnly";
|
||||
/** @internal */
|
||||
const commitJournal = journal => {
|
||||
for (const entry of journal) {
|
||||
Entry.commit(entry[1]);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Analyzes the journal, determining whether it is valid and whether it is
|
||||
* read only in a single pass. Note that information on whether the
|
||||
* journal is read only will only be accurate if the journal is valid, due
|
||||
* to short-circuiting that occurs on an invalid journal.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
exports.commitJournal = commitJournal;
|
||||
const analyzeJournal = journal => {
|
||||
let val = JournalAnalysisReadOnly;
|
||||
for (const [, entry] of journal) {
|
||||
val = Entry.isInvalid(entry) ? JournalAnalysisInvalid : Entry.isChanged(entry) ? JournalAnalysisReadWrite : val;
|
||||
if (val === JournalAnalysisInvalid) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
};
|
||||
/** @internal */
|
||||
exports.analyzeJournal = analyzeJournal;
|
||||
const prepareResetJournal = journal => {
|
||||
const saved = new Map();
|
||||
for (const entry of journal) {
|
||||
saved.set(entry[0], Entry.copy(entry[1]));
|
||||
}
|
||||
return () => {
|
||||
journal.clear();
|
||||
for (const entry of saved) {
|
||||
journal.set(entry[0], entry[1]);
|
||||
}
|
||||
};
|
||||
};
|
||||
/** @internal */
|
||||
exports.prepareResetJournal = prepareResetJournal;
|
||||
const collectTodos = journal => {
|
||||
const allTodos = new Map();
|
||||
for (const [, entry] of journal) {
|
||||
for (const todo of entry.ref.todos) {
|
||||
allTodos.set(todo[0], todo[1]);
|
||||
}
|
||||
entry.ref.todos = new Map();
|
||||
}
|
||||
return allTodos;
|
||||
};
|
||||
/** @internal */
|
||||
exports.collectTodos = collectTodos;
|
||||
const execTodos = todos => {
|
||||
const todosSorted = Array.from(todos.entries()).sort((x, y) => x[0] - y[0]);
|
||||
for (const [_, todo] of todosSorted) {
|
||||
todo();
|
||||
}
|
||||
};
|
||||
/** @internal */
|
||||
exports.execTodos = execTodos;
|
||||
const addTodo = (txnId, journal, todoEffect) => {
|
||||
let added = false;
|
||||
for (const [, entry] of journal) {
|
||||
if (!entry.ref.todos.has(txnId)) {
|
||||
entry.ref.todos.set(txnId, todoEffect);
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
return added;
|
||||
};
|
||||
/** @internal */
|
||||
exports.addTodo = addTodo;
|
||||
const isValid = journal => {
|
||||
let valid = true;
|
||||
for (const [, entry] of journal) {
|
||||
valid = Entry.isValid(entry);
|
||||
if (!valid) {
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isValid = isValid;
|
||||
const isInvalid = journal => {
|
||||
return !isValid(journal);
|
||||
};
|
||||
exports.isInvalid = isInvalid;
|
||||
//# sourceMappingURL=journal.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/journal.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/journal.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"journal.js","names":["Entry","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","JournalAnalysisInvalid","exports","JournalAnalysisReadWrite","JournalAnalysisReadOnly","commitJournal","journal","entry","commit","analyzeJournal","val","isInvalid","isChanged","prepareResetJournal","saved","Map","copy","clear","collectTodos","allTodos","todo","ref","todos","execTodos","todosSorted","Array","from","entries","sort","x","y","_","addTodo","txnId","todoEffect","added","isValid","valid"],"sources":["../../../../src/internal/stm/journal.ts"],"sourcesContent":[null],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAA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
_node_modules/effect/dist/cjs/internal/stm/opCodes/stm.js
generated
vendored
Normal file
31
_node_modules/effect/dist/cjs/internal/stm/opCodes/stm.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.OP_WITH_STM_RUNTIME = exports.OP_TRACED = exports.OP_SYNC = exports.OP_SUCCEED = exports.OP_RETRY = exports.OP_PROVIDE = exports.OP_ON_SUCCESS = exports.OP_ON_RETRY = exports.OP_ON_FAILURE = exports.OP_INTERRUPT = exports.OP_FAIL = exports.OP_DIE = void 0;
|
||||
/** @internal */
|
||||
const OP_WITH_STM_RUNTIME = exports.OP_WITH_STM_RUNTIME = "WithSTMRuntime";
|
||||
/** @internal */
|
||||
const OP_ON_FAILURE = exports.OP_ON_FAILURE = "OnFailure";
|
||||
/** @internal */
|
||||
const OP_ON_RETRY = exports.OP_ON_RETRY = "OnRetry";
|
||||
/** @internal */
|
||||
const OP_ON_SUCCESS = exports.OP_ON_SUCCESS = "OnSuccess";
|
||||
/** @internal */
|
||||
const OP_PROVIDE = exports.OP_PROVIDE = "Provide";
|
||||
/** @internal */
|
||||
const OP_SYNC = exports.OP_SYNC = "Sync";
|
||||
/** @internal */
|
||||
const OP_SUCCEED = exports.OP_SUCCEED = "Succeed";
|
||||
/** @internal */
|
||||
const OP_RETRY = exports.OP_RETRY = "Retry";
|
||||
/** @internal */
|
||||
const OP_FAIL = exports.OP_FAIL = "Fail";
|
||||
/** @internal */
|
||||
const OP_DIE = exports.OP_DIE = "Die";
|
||||
/** @internal */
|
||||
const OP_INTERRUPT = exports.OP_INTERRUPT = "Interrupt";
|
||||
/** @internal */
|
||||
const OP_TRACED = exports.OP_TRACED = "Traced";
|
||||
//# sourceMappingURL=stm.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/opCodes/stm.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/opCodes/stm.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stm.js","names":["OP_WITH_STM_RUNTIME","exports","OP_ON_FAILURE","OP_ON_RETRY","OP_ON_SUCCESS","OP_PROVIDE","OP_SYNC","OP_SUCCEED","OP_RETRY","OP_FAIL","OP_DIE","OP_INTERRUPT","OP_TRACED"],"sources":["../../../../../src/internal/stm/opCodes/stm.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA;AACO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,gBAAyB;AAK5D;AACO,MAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GAAG,WAAoB;AAKjD;AACO,MAAMC,WAAW,GAAAF,OAAA,CAAAE,WAAA,GAAG,SAAkB;AAK7C;AACO,MAAMC,aAAa,GAAAH,OAAA,CAAAG,aAAA,GAAG,WAAoB;AAKjD;AACO,MAAMC,UAAU,GAAAJ,OAAA,CAAAI,UAAA,GAAG,SAAkB;AAK5C;AACO,MAAMC,OAAO,GAAAL,OAAA,CAAAK,OAAA,GAAG,MAAe;AAKtC;AACO,MAAMC,UAAU,GAAAN,OAAA,CAAAM,UAAA,GAAG,SAAkB;AAK5C;AACO,MAAMC,QAAQ,GAAAP,OAAA,CAAAO,QAAA,GAAG,OAAgB;AAKxC;AACO,MAAMC,OAAO,GAAAR,OAAA,CAAAQ,OAAA,GAAG,MAAe;AAKtC;AACO,MAAMC,MAAM,GAAAT,OAAA,CAAAS,MAAA,GAAG,KAAc;AAKpC;AACO,MAAMC,YAAY,GAAAV,OAAA,CAAAU,YAAA,GAAG,WAAoB;AAKhD;AACO,MAAMC,SAAS,GAAAX,OAAA,CAAAW,SAAA,GAAG,QAAiB","ignoreList":[]}
|
||||
13
_node_modules/effect/dist/cjs/internal/stm/opCodes/stmState.js
generated
vendored
Normal file
13
_node_modules/effect/dist/cjs/internal/stm/opCodes/stmState.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.OP_RUNNING = exports.OP_INTERRUPTED = exports.OP_DONE = void 0;
|
||||
/** @internal */
|
||||
const OP_DONE = exports.OP_DONE = "Done";
|
||||
/** @internal */
|
||||
const OP_INTERRUPTED = exports.OP_INTERRUPTED = "Interrupted";
|
||||
/** @internal */
|
||||
const OP_RUNNING = exports.OP_RUNNING = "Running";
|
||||
//# sourceMappingURL=stmState.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/opCodes/stmState.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/opCodes/stmState.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stmState.js","names":["OP_DONE","exports","OP_INTERRUPTED","OP_RUNNING"],"sources":["../../../../../src/internal/stm/opCodes/stmState.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,MAAe;AAKtC;AACO,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG,aAAsB;AAKpD;AACO,MAAMC,UAAU,GAAAF,OAAA,CAAAE,UAAA,GAAG,SAAkB","ignoreList":[]}
|
||||
13
_node_modules/effect/dist/cjs/internal/stm/opCodes/strategy.js
generated
vendored
Normal file
13
_node_modules/effect/dist/cjs/internal/stm/opCodes/strategy.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.OP_SLIDING_STRATEGY = exports.OP_DROPPING_STRATEGY = exports.OP_BACKPRESSURE_STRATEGY = void 0;
|
||||
/** @internal */
|
||||
const OP_BACKPRESSURE_STRATEGY = exports.OP_BACKPRESSURE_STRATEGY = "BackPressure";
|
||||
/** @internal */
|
||||
const OP_DROPPING_STRATEGY = exports.OP_DROPPING_STRATEGY = "Dropping";
|
||||
/** @internal */
|
||||
const OP_SLIDING_STRATEGY = exports.OP_SLIDING_STRATEGY = "Sliding";
|
||||
//# sourceMappingURL=strategy.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/opCodes/strategy.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/opCodes/strategy.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"strategy.js","names":["OP_BACKPRESSURE_STRATEGY","exports","OP_DROPPING_STRATEGY","OP_SLIDING_STRATEGY"],"sources":["../../../../../src/internal/stm/opCodes/strategy.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA;AACO,MAAMA,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,cAAuB;AAK/D;AACO,MAAME,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,GAAG,UAAmB;AAKvD;AACO,MAAMC,mBAAmB,GAAAF,OAAA,CAAAE,mBAAA,GAAG,SAAkB","ignoreList":[]}
|
||||
17
_node_modules/effect/dist/cjs/internal/stm/opCodes/tExit.js
generated
vendored
Normal file
17
_node_modules/effect/dist/cjs/internal/stm/opCodes/tExit.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.OP_SUCCEED = exports.OP_RETRY = exports.OP_INTERRUPT = exports.OP_FAIL = exports.OP_DIE = void 0;
|
||||
/** @internal */
|
||||
const OP_FAIL = exports.OP_FAIL = "Fail";
|
||||
/** @internal */
|
||||
const OP_DIE = exports.OP_DIE = "Die";
|
||||
/** @internal */
|
||||
const OP_INTERRUPT = exports.OP_INTERRUPT = "Interrupt";
|
||||
/** @internal */
|
||||
const OP_SUCCEED = exports.OP_SUCCEED = "Succeed";
|
||||
/** @internal */
|
||||
const OP_RETRY = exports.OP_RETRY = "Retry";
|
||||
//# sourceMappingURL=tExit.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/opCodes/tExit.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/opCodes/tExit.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tExit.js","names":["OP_FAIL","exports","OP_DIE","OP_INTERRUPT","OP_SUCCEED","OP_RETRY"],"sources":["../../../../../src/internal/stm/opCodes/tExit.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,MAAe;AAKtC;AACO,MAAME,MAAM,GAAAD,OAAA,CAAAC,MAAA,GAAG,KAAc;AAKpC;AACO,MAAMC,YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAG,WAAoB;AAKhD;AACO,MAAMC,UAAU,GAAAH,OAAA,CAAAG,UAAA,GAAG,SAAkB;AAK5C;AACO,MAAMC,QAAQ,GAAAJ,OAAA,CAAAI,QAAA,GAAG,OAAgB","ignoreList":[]}
|
||||
11
_node_modules/effect/dist/cjs/internal/stm/opCodes/tryCommit.js
generated
vendored
Normal file
11
_node_modules/effect/dist/cjs/internal/stm/opCodes/tryCommit.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.OP_SUSPEND = exports.OP_DONE = void 0;
|
||||
/** @internal */
|
||||
const OP_DONE = exports.OP_DONE = "Done";
|
||||
/** @internal */
|
||||
const OP_SUSPEND = exports.OP_SUSPEND = "Suspend";
|
||||
//# sourceMappingURL=tryCommit.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/opCodes/tryCommit.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/opCodes/tryCommit.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tryCommit.js","names":["OP_DONE","exports","OP_SUSPEND"],"sources":["../../../../../src/internal/stm/opCodes/tryCommit.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,MAAe;AAKtC;AACO,MAAME,UAAU,GAAAD,OAAA,CAAAC,UAAA,GAAG,SAAkB","ignoreList":[]}
|
||||
514
_node_modules/effect/dist/cjs/internal/stm/stm.js
generated
vendored
Normal file
514
_node_modules/effect/dist/cjs/internal/stm/stm.js
generated
vendored
Normal file
@@ -0,0 +1,514 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.whenSTM = exports.when = exports.void = exports.validateFirst = exports.validateAll = exports.unsome = exports.unlessSTM = exports.unless = exports.try_ = exports.tapError = exports.tapBoth = exports.tap = exports.suspend = exports.summarized = exports.succeedSome = exports.succeedNone = exports.some = exports.retryWhile = exports.retryUntil = exports.replicateSTMDiscard = exports.replicateSTM = exports.replicate = exports.repeatWhile = exports.repeatUntil = exports.rejectSTM = exports.reject = exports.refineOrDieWith = exports.refineOrDie = exports.reduceRight = exports.reduceAll = exports.reduce = exports.provideSomeContext = exports.provideServiceSTM = exports.provideService = exports.provideContext = exports.partition = exports.orElseSucceed = exports.orElseOptional = exports.orElseFail = exports.orElseEither = exports.orElse = exports.orDieWith = exports.orDie = exports.option = exports.none = exports.negate = exports.mergeAll = exports.merge = exports.match = exports.mapError = exports.mapBoth = exports.mapAttempt = exports.loop = exports.let_ = exports.iterate = exports.isSuccess = exports.isFailure = exports.ignore = exports.if_ = exports.head = exports.gen = exports.fromOption = exports.fromEither = exports.forEach = exports.flipWith = exports.flip = exports.flatten = exports.filterOrFail = exports.filterOrElse = exports.filterOrDieMessage = exports.filterOrDie = exports.filterNot = exports.filter = exports.fiberId = exports.exists = exports.every = exports.eventually = exports.either = exports.cond = exports.commitEither = exports.collectSTM = exports.collect = exports.check = exports.catchTags = exports.catchTag = exports.catchSome = exports.bindTo = exports.bind = exports.attempt = exports.asVoid = exports.asSomeError = exports.asSome = exports.as = exports.all = exports.acquireUseRelease = void 0;
|
||||
var RA = _interopRequireWildcard(require("../../Array.js"));
|
||||
var Cause = _interopRequireWildcard(require("../../Cause.js"));
|
||||
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
|
||||
var Context = _interopRequireWildcard(require("../../Context.js"));
|
||||
var Effect = _interopRequireWildcard(require("../../Effect.js"));
|
||||
var Either = _interopRequireWildcard(require("../../Either.js"));
|
||||
var Exit = _interopRequireWildcard(require("../../Exit.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var predicate = _interopRequireWildcard(require("../../Predicate.js"));
|
||||
var _Utils = require("../../Utils.js");
|
||||
var effectCore = _interopRequireWildcard(require("../core.js"));
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var Journal = _interopRequireWildcard(require("./journal.js"));
|
||||
var STMState = _interopRequireWildcard(require("./stmState.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const acquireUseRelease = exports.acquireUseRelease = /*#__PURE__*/(0, _Function.dual)(3, (acquire, use, release) => Effect.uninterruptibleMask(restore => {
|
||||
let state = STMState.running;
|
||||
return (0, _Function.pipe)(restore(core.unsafeAtomically(acquire, exit => {
|
||||
state = STMState.done(exit);
|
||||
}, () => {
|
||||
state = STMState.interrupted;
|
||||
})), Effect.matchCauseEffect({
|
||||
onFailure: cause => {
|
||||
if (STMState.isDone(state) && Exit.isSuccess(state.exit)) {
|
||||
return (0, _Function.pipe)(release(state.exit.value), Effect.matchCauseEffect({
|
||||
onFailure: cause2 => Effect.failCause(Cause.parallel(cause, cause2)),
|
||||
onSuccess: () => Effect.failCause(cause)
|
||||
}));
|
||||
}
|
||||
return Effect.failCause(cause);
|
||||
},
|
||||
onSuccess: a => (0, _Function.pipe)(restore(use(a)), Effect.matchCauseEffect({
|
||||
onFailure: cause => (0, _Function.pipe)(release(a), Effect.matchCauseEffect({
|
||||
onFailure: cause2 => Effect.failCause(Cause.parallel(cause, cause2)),
|
||||
onSuccess: () => Effect.failCause(cause)
|
||||
})),
|
||||
onSuccess: a2 => (0, _Function.pipe)(release(a), Effect.as(a2))
|
||||
}))
|
||||
}));
|
||||
}));
|
||||
/** @internal */
|
||||
const as = exports.as = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => (0, _Function.pipe)(self, core.map(() => value)));
|
||||
/** @internal */
|
||||
const asSome = self => (0, _Function.pipe)(self, core.map(Option.some));
|
||||
/** @internal */
|
||||
exports.asSome = asSome;
|
||||
const asSomeError = self => (0, _Function.pipe)(self, mapError(Option.some));
|
||||
/** @internal */
|
||||
exports.asSomeError = asSomeError;
|
||||
const asVoid = self => (0, _Function.pipe)(self, core.map(_Function.constVoid));
|
||||
/** @internal */
|
||||
exports.asVoid = asVoid;
|
||||
const attempt = evaluate => suspend(() => {
|
||||
try {
|
||||
return core.succeed(evaluate());
|
||||
} catch (defect) {
|
||||
return core.fail(defect);
|
||||
}
|
||||
});
|
||||
exports.attempt = attempt;
|
||||
const bind = exports.bind = /*#__PURE__*/(0, _Function.dual)(3, (self, tag, f) => core.flatMap(self, k => core.map(f(k), a => ({
|
||||
...k,
|
||||
[tag]: a
|
||||
}))));
|
||||
/* @internal */
|
||||
const bindTo = exports.bindTo = /*#__PURE__*/(0, _Function.dual)(2, (self, tag) => core.map(self, a => ({
|
||||
[tag]: a
|
||||
})));
|
||||
/* @internal */
|
||||
const let_ = exports.let_ = /*#__PURE__*/(0, _Function.dual)(3, (self, tag, f) => core.map(self, k => ({
|
||||
...k,
|
||||
[tag]: f(k)
|
||||
})));
|
||||
/** @internal */
|
||||
const catchSome = exports.catchSome = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => core.catchAll(self, e => Option.getOrElse(pf(e), () => core.fail(e))));
|
||||
/** @internal */
|
||||
const catchTag = exports.catchTag = /*#__PURE__*/(0, _Function.dual)(3, (self, k, f) => core.catchAll(self, e => {
|
||||
if ("_tag" in e && e["_tag"] === k) {
|
||||
return f(e);
|
||||
}
|
||||
return core.fail(e);
|
||||
}));
|
||||
/** @internal */
|
||||
const catchTags = exports.catchTags = /*#__PURE__*/(0, _Function.dual)(2, (self, cases) => core.catchAll(self, e => {
|
||||
const keys = Object.keys(cases);
|
||||
if ("_tag" in e && keys.includes(e["_tag"])) {
|
||||
return cases[e["_tag"]](e);
|
||||
}
|
||||
return core.fail(e);
|
||||
}));
|
||||
/** @internal */
|
||||
const check = predicate => suspend(() => predicate() ? void_ : core.retry);
|
||||
/** @internal */
|
||||
exports.check = check;
|
||||
const collect = exports.collect = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => collectSTM(self, a => Option.map(pf(a), core.succeed)));
|
||||
/** @internal */
|
||||
const collectSTM = exports.collectSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => core.matchSTM(self, {
|
||||
onFailure: core.fail,
|
||||
onSuccess: a => {
|
||||
const option = pf(a);
|
||||
return Option.isSome(option) ? option.value : core.retry;
|
||||
}
|
||||
}));
|
||||
/** @internal */
|
||||
const commitEither = self => Effect.flatten(core.commit(either(self)));
|
||||
/** @internal */
|
||||
exports.commitEither = commitEither;
|
||||
const cond = (predicate, error, result) => {
|
||||
return suspend(() => predicate() ? core.sync(result) : core.failSync(error));
|
||||
};
|
||||
/** @internal */
|
||||
exports.cond = cond;
|
||||
const either = self => match(self, {
|
||||
onFailure: Either.left,
|
||||
onSuccess: Either.right
|
||||
});
|
||||
/** @internal */
|
||||
exports.either = either;
|
||||
const eventually = self => core.matchSTM(self, {
|
||||
onFailure: () => eventually(self),
|
||||
onSuccess: core.succeed
|
||||
});
|
||||
/** @internal */
|
||||
exports.eventually = eventually;
|
||||
const every = exports.every = /*#__PURE__*/(0, _Function.dual)(2, (iterable, predicate) => core.flatMap(core.sync(() => iterable[Symbol.iterator]()), iterator => {
|
||||
const loop = suspend(() => {
|
||||
const next = iterator.next();
|
||||
if (next.done) {
|
||||
return core.succeed(true);
|
||||
}
|
||||
return (0, _Function.pipe)(predicate(next.value), core.flatMap(bool => bool ? loop : core.succeed(bool)));
|
||||
});
|
||||
return loop;
|
||||
}));
|
||||
/** @internal */
|
||||
const exists = exports.exists = /*#__PURE__*/(0, _Function.dual)(2, (iterable, predicate) => core.flatMap(core.sync(() => iterable[Symbol.iterator]()), iterator => {
|
||||
const loop = suspend(() => {
|
||||
const next = iterator.next();
|
||||
if (next.done) {
|
||||
return core.succeed(false);
|
||||
}
|
||||
return core.flatMap(predicate(next.value), bool => bool ? core.succeed(bool) : loop);
|
||||
});
|
||||
return loop;
|
||||
}));
|
||||
/** @internal */
|
||||
const fiberId = exports.fiberId = /*#__PURE__*/core.effect((_, fiberId) => fiberId);
|
||||
/** @internal */
|
||||
const filter = exports.filter = /*#__PURE__*/(0, _Function.dual)(2, (iterable, predicate) => Array.from(iterable).reduce((acc, curr) => (0, _Function.pipe)(acc, core.zipWith(predicate(curr), (as, p) => {
|
||||
if (p) {
|
||||
as.push(curr);
|
||||
return as;
|
||||
}
|
||||
return as;
|
||||
})), core.succeed([])));
|
||||
/** @internal */
|
||||
const filterNot = exports.filterNot = /*#__PURE__*/(0, _Function.dual)(2, (iterable, predicate) => filter(iterable, a => negate(predicate(a))));
|
||||
/** @internal */
|
||||
const filterOrDie = exports.filterOrDie = /*#__PURE__*/(0, _Function.dual)(3, (self, predicate, defect) => filterOrElse(self, predicate, () => core.dieSync(defect)));
|
||||
/** @internal */
|
||||
const filterOrDieMessage = exports.filterOrDieMessage = /*#__PURE__*/(0, _Function.dual)(3, (self, predicate, message) => filterOrElse(self, predicate, () => core.dieMessage(message)));
|
||||
/** @internal */
|
||||
const filterOrElse = exports.filterOrElse = /*#__PURE__*/(0, _Function.dual)(3, (self, predicate, orElse) => core.flatMap(self, a => predicate(a) ? core.succeed(a) : orElse(a)));
|
||||
/** @internal */
|
||||
const filterOrFail = exports.filterOrFail = /*#__PURE__*/(0, _Function.dual)(3, (self, predicate, orFailWith) => filterOrElse(self, predicate, a => core.failSync(() => orFailWith(a))));
|
||||
/** @internal */
|
||||
const flatten = self => core.flatMap(self, _Function.identity);
|
||||
/** @internal */
|
||||
exports.flatten = flatten;
|
||||
const flip = self => core.matchSTM(self, {
|
||||
onFailure: core.succeed,
|
||||
onSuccess: core.fail
|
||||
});
|
||||
/** @internal */
|
||||
exports.flip = flip;
|
||||
const flipWith = exports.flipWith = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => flip(f(flip(self))));
|
||||
/** @internal */
|
||||
const match = exports.match = /*#__PURE__*/(0, _Function.dual)(2, (self, {
|
||||
onFailure,
|
||||
onSuccess
|
||||
}) => core.matchSTM(self, {
|
||||
onFailure: e => core.succeed(onFailure(e)),
|
||||
onSuccess: a => core.succeed(onSuccess(a))
|
||||
}));
|
||||
/** @internal */
|
||||
const forEach = exports.forEach = /*#__PURE__*/(0, _Function.dual)(args => predicate.isIterable(args[0]), (iterable, f, options) => {
|
||||
if (options?.discard) {
|
||||
return (0, _Function.pipe)(core.sync(() => iterable[Symbol.iterator]()), core.flatMap(iterator => {
|
||||
const loop = suspend(() => {
|
||||
const next = iterator.next();
|
||||
if (next.done) {
|
||||
return void_;
|
||||
}
|
||||
return (0, _Function.pipe)(f(next.value), core.flatMap(() => loop));
|
||||
});
|
||||
return loop;
|
||||
}));
|
||||
}
|
||||
return suspend(() => RA.fromIterable(iterable).reduce((acc, curr) => core.zipWith(acc, f(curr), (array, elem) => {
|
||||
array.push(elem);
|
||||
return array;
|
||||
}), core.succeed([])));
|
||||
});
|
||||
/** @internal */
|
||||
const fromEither = either => {
|
||||
switch (either._tag) {
|
||||
case "Left":
|
||||
{
|
||||
return core.fail(either.left);
|
||||
}
|
||||
case "Right":
|
||||
{
|
||||
return core.succeed(either.right);
|
||||
}
|
||||
}
|
||||
};
|
||||
/** @internal */
|
||||
exports.fromEither = fromEither;
|
||||
const fromOption = option => Option.match(option, {
|
||||
onNone: () => core.fail(Option.none()),
|
||||
onSome: core.succeed
|
||||
});
|
||||
/**
|
||||
* Inspired by https://github.com/tusharmath/qio/pull/22 (revised)
|
||||
* @internal
|
||||
*/
|
||||
exports.fromOption = fromOption;
|
||||
const gen = (...args) => suspend(() => {
|
||||
const f = args.length === 1 ? args[0] : args[1].bind(args[0]);
|
||||
const iterator = f(_Function.pipe);
|
||||
const state = iterator.next();
|
||||
const run = state => state.done ? core.succeed(state.value) : core.flatMap((0, _Utils.yieldWrapGet)(state.value), val => run(iterator.next(val)));
|
||||
return run(state);
|
||||
});
|
||||
/** @internal */
|
||||
exports.gen = gen;
|
||||
const head = self => (0, _Function.pipe)(self, core.matchSTM({
|
||||
onFailure: e => core.fail(Option.some(e)),
|
||||
onSuccess: a => {
|
||||
const i = a[Symbol.iterator]();
|
||||
const res = i.next();
|
||||
if (res.done) {
|
||||
return core.fail(Option.none());
|
||||
} else {
|
||||
return core.succeed(res.value);
|
||||
}
|
||||
}
|
||||
}));
|
||||
/** @internal */
|
||||
exports.head = head;
|
||||
const if_ = exports.if_ = /*#__PURE__*/(0, _Function.dual)(args => typeof args[0] === "boolean" || core.isSTM(args[0]), (self, {
|
||||
onFalse,
|
||||
onTrue
|
||||
}) => {
|
||||
if (typeof self === "boolean") {
|
||||
return self ? onTrue : onFalse;
|
||||
}
|
||||
return core.flatMap(self, bool => bool ? onTrue : onFalse);
|
||||
});
|
||||
/** @internal */
|
||||
const ignore = self => match(self, {
|
||||
onFailure: () => void_,
|
||||
onSuccess: () => void_
|
||||
});
|
||||
/** @internal */
|
||||
exports.ignore = ignore;
|
||||
const isFailure = self => match(self, {
|
||||
onFailure: _Function.constTrue,
|
||||
onSuccess: _Function.constFalse
|
||||
});
|
||||
/** @internal */
|
||||
exports.isFailure = isFailure;
|
||||
const isSuccess = self => match(self, {
|
||||
onFailure: _Function.constFalse,
|
||||
onSuccess: _Function.constTrue
|
||||
});
|
||||
/** @internal */
|
||||
exports.isSuccess = isSuccess;
|
||||
const iterate = (initial, options) => iterateLoop(initial, options.while, options.body);
|
||||
exports.iterate = iterate;
|
||||
const iterateLoop = (initial, cont, body) => {
|
||||
if (cont(initial)) {
|
||||
return (0, _Function.pipe)(body(initial), core.flatMap(z => iterateLoop(z, cont, body)));
|
||||
}
|
||||
return core.succeed(initial);
|
||||
};
|
||||
/** @internal */
|
||||
const loop = (initial, options) => options.discard ? loopDiscardLoop(initial, options.while, options.step, options.body) : core.map(loopLoop(initial, options.while, options.step, options.body), a => Array.from(a));
|
||||
exports.loop = loop;
|
||||
const loopLoop = (initial, cont, inc, body) => {
|
||||
if (cont(initial)) {
|
||||
return (0, _Function.pipe)(body(initial), core.flatMap(a => (0, _Function.pipe)(loopLoop(inc(initial), cont, inc, body), core.map(Chunk.append(a)))));
|
||||
}
|
||||
return core.succeed(Chunk.empty());
|
||||
};
|
||||
const loopDiscardLoop = (initial, cont, inc, body) => {
|
||||
if (cont(initial)) {
|
||||
return (0, _Function.pipe)(body(initial), core.flatMap(() => loopDiscardLoop(inc(initial), cont, inc, body)));
|
||||
}
|
||||
return void_;
|
||||
};
|
||||
/** @internal */
|
||||
const mapAttempt = exports.mapAttempt = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => core.matchSTM(self, {
|
||||
onFailure: e => core.fail(e),
|
||||
onSuccess: a => attempt(() => f(a))
|
||||
}));
|
||||
/** @internal */
|
||||
const mapBoth = exports.mapBoth = /*#__PURE__*/(0, _Function.dual)(2, (self, {
|
||||
onFailure,
|
||||
onSuccess
|
||||
}) => core.matchSTM(self, {
|
||||
onFailure: e => core.fail(onFailure(e)),
|
||||
onSuccess: a => core.succeed(onSuccess(a))
|
||||
}));
|
||||
/** @internal */
|
||||
const mapError = exports.mapError = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => core.matchSTM(self, {
|
||||
onFailure: e => core.fail(f(e)),
|
||||
onSuccess: core.succeed
|
||||
}));
|
||||
/** @internal */
|
||||
const merge = self => core.matchSTM(self, {
|
||||
onFailure: e => core.succeed(e),
|
||||
onSuccess: core.succeed
|
||||
});
|
||||
/** @internal */
|
||||
exports.merge = merge;
|
||||
const mergeAll = exports.mergeAll = /*#__PURE__*/(0, _Function.dual)(3, (iterable, zero, f) => suspend(() => Array.from(iterable).reduce((acc, curr) => (0, _Function.pipe)(acc, core.zipWith(curr, f)), core.succeed(zero))));
|
||||
/** @internal */
|
||||
const negate = self => (0, _Function.pipe)(self, core.map(b => !b));
|
||||
/** @internal */
|
||||
exports.negate = negate;
|
||||
const none = self => core.matchSTM(self, {
|
||||
onFailure: e => core.fail(Option.some(e)),
|
||||
onSuccess: Option.match({
|
||||
onNone: () => void_,
|
||||
onSome: () => core.fail(Option.none())
|
||||
})
|
||||
});
|
||||
/** @internal */
|
||||
exports.none = none;
|
||||
const option = self => match(self, {
|
||||
onFailure: () => Option.none(),
|
||||
onSuccess: Option.some
|
||||
});
|
||||
/** @internal */
|
||||
exports.option = option;
|
||||
const orDie = self => (0, _Function.pipe)(self, orDieWith(_Function.identity));
|
||||
/** @internal */
|
||||
exports.orDie = orDie;
|
||||
const orDieWith = exports.orDieWith = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => (0, _Function.pipe)(self, mapError(f), core.catchAll(core.die)));
|
||||
/** @internal */
|
||||
const orElse = exports.orElse = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => core.flatMap(core.effect(journal => Journal.prepareResetJournal(journal)), reset => (0, _Function.pipe)(core.orTry(self, () => core.flatMap(core.sync(reset), that)), core.catchAll(() => core.flatMap(core.sync(reset), that)))));
|
||||
/** @internal */
|
||||
const orElseEither = exports.orElseEither = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => orElse(core.map(self, Either.left), () => core.map(that(), Either.right)));
|
||||
/** @internal */
|
||||
const orElseFail = exports.orElseFail = /*#__PURE__*/(0, _Function.dual)(2, (self, error) => orElse(self, () => core.failSync(error)));
|
||||
/** @internal */
|
||||
const orElseOptional = exports.orElseOptional = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => core.catchAll(self, Option.match({
|
||||
onNone: that,
|
||||
onSome: e => core.fail(Option.some(e))
|
||||
})));
|
||||
/** @internal */
|
||||
const orElseSucceed = exports.orElseSucceed = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => orElse(self, () => core.sync(value)));
|
||||
/** @internal */
|
||||
const provideContext = exports.provideContext = /*#__PURE__*/(0, _Function.dual)(2, (self, env) => core.mapInputContext(self, _ => env));
|
||||
/** @internal */
|
||||
const provideSomeContext = exports.provideSomeContext = /*#__PURE__*/(0, _Function.dual)(2, (self, context) => core.mapInputContext(self, parent => Context.merge(parent, context)));
|
||||
/** @internal */
|
||||
const provideService = exports.provideService = /*#__PURE__*/(0, _Function.dual)(3, (self, tag, resource) => provideServiceSTM(self, tag, core.succeed(resource)));
|
||||
/** @internal */
|
||||
const provideServiceSTM = exports.provideServiceSTM = /*#__PURE__*/(0, _Function.dual)(3, (self, tag, stm) => core.contextWithSTM(env => core.flatMap(stm, service => provideContext(self, Context.add(env, tag, service)))));
|
||||
/** @internal */
|
||||
const reduce = exports.reduce = /*#__PURE__*/(0, _Function.dual)(3, (iterable, zero, f) => suspend(() => Array.from(iterable).reduce((acc, curr) => (0, _Function.pipe)(acc, core.flatMap(s => f(s, curr))), core.succeed(zero))));
|
||||
/** @internal */
|
||||
const reduceAll = exports.reduceAll = /*#__PURE__*/(0, _Function.dual)(3, (iterable, initial, f) => suspend(() => Array.from(iterable).reduce((acc, curr) => (0, _Function.pipe)(acc, core.zipWith(curr, f)), initial)));
|
||||
/** @internal */
|
||||
const reduceRight = exports.reduceRight = /*#__PURE__*/(0, _Function.dual)(3, (iterable, zero, f) => suspend(() => Array.from(iterable).reduceRight((acc, curr) => (0, _Function.pipe)(acc, core.flatMap(s => f(s, curr))), core.succeed(zero))));
|
||||
/** @internal */
|
||||
const refineOrDie = exports.refineOrDie = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => refineOrDieWith(self, pf, _Function.identity));
|
||||
/** @internal */
|
||||
const refineOrDieWith = exports.refineOrDieWith = /*#__PURE__*/(0, _Function.dual)(3, (self, pf, f) => core.catchAll(self, e => Option.match(pf(e), {
|
||||
onNone: () => core.die(f(e)),
|
||||
onSome: core.fail
|
||||
})));
|
||||
/** @internal */
|
||||
const reject = exports.reject = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => rejectSTM(self, a => Option.map(pf(a), core.fail)));
|
||||
/** @internal */
|
||||
const rejectSTM = exports.rejectSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => core.flatMap(self, a => Option.match(pf(a), {
|
||||
onNone: () => core.succeed(a),
|
||||
onSome: core.flatMap(core.fail)
|
||||
})));
|
||||
/** @internal */
|
||||
const repeatUntil = exports.repeatUntil = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => repeatUntilLoop(self, predicate));
|
||||
const repeatUntilLoop = (self, predicate) => core.flatMap(self, a => predicate(a) ? core.succeed(a) : repeatUntilLoop(self, predicate));
|
||||
/** @internal */
|
||||
const repeatWhile = exports.repeatWhile = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => repeatWhileLoop(self, predicate));
|
||||
const repeatWhileLoop = (self, predicate) => core.flatMap(self, a => predicate(a) ? repeatWhileLoop(self, predicate) : core.succeed(a));
|
||||
/** @internal */
|
||||
const replicate = exports.replicate = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => Array.from({
|
||||
length: n
|
||||
}, () => self));
|
||||
/** @internal */
|
||||
const replicateSTM = exports.replicateSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => all(replicate(self, n)));
|
||||
/** @internal */
|
||||
const replicateSTMDiscard = exports.replicateSTMDiscard = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => all(replicate(self, n), {
|
||||
discard: true
|
||||
}));
|
||||
/** @internal */
|
||||
const retryUntil = exports.retryUntil = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => core.matchSTM(self, {
|
||||
onFailure: core.fail,
|
||||
onSuccess: a => predicate(a) ? core.succeed(a) : core.retry
|
||||
}));
|
||||
/** @internal */
|
||||
const retryWhile = exports.retryWhile = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => core.matchSTM(self, {
|
||||
onFailure: core.fail,
|
||||
onSuccess: a => !predicate(a) ? core.succeed(a) : core.retry
|
||||
}));
|
||||
/** @internal */
|
||||
const partition = exports.partition = /*#__PURE__*/(0, _Function.dual)(2, (elements, f) => (0, _Function.pipe)(forEach(elements, a => either(f(a))), core.map(as => effectCore.partitionMap(as, _Function.identity))));
|
||||
/** @internal */
|
||||
const some = self => core.matchSTM(self, {
|
||||
onFailure: e => core.fail(Option.some(e)),
|
||||
onSuccess: Option.match({
|
||||
onNone: () => core.fail(Option.none()),
|
||||
onSome: core.succeed
|
||||
})
|
||||
});
|
||||
/* @internal */
|
||||
exports.some = some;
|
||||
const all = (input, options) => {
|
||||
if (Symbol.iterator in input) {
|
||||
return forEach(input, _Function.identity, options);
|
||||
} else if (options?.discard) {
|
||||
return forEach(Object.values(input), _Function.identity, options);
|
||||
}
|
||||
return core.map(forEach(Object.entries(input), ([_, e]) => core.map(e, a => [_, a])), values => {
|
||||
const res = {};
|
||||
for (const [k, v] of values) {
|
||||
;
|
||||
res[k] = v;
|
||||
}
|
||||
return res;
|
||||
});
|
||||
};
|
||||
/** @internal */
|
||||
exports.all = all;
|
||||
const succeedNone = exports.succeedNone = /*#__PURE__*/core.succeed(/*#__PURE__*/Option.none());
|
||||
/** @internal */
|
||||
const succeedSome = value => core.succeed(Option.some(value));
|
||||
/** @internal */
|
||||
exports.succeedSome = succeedSome;
|
||||
const summarized = exports.summarized = /*#__PURE__*/(0, _Function.dual)(3, (self, summary, f) => core.flatMap(summary, start => core.flatMap(self, value => core.map(summary, end => [f(start, end), value]))));
|
||||
/** @internal */
|
||||
const suspend = evaluate => flatten(core.sync(evaluate));
|
||||
/** @internal */
|
||||
exports.suspend = suspend;
|
||||
const tap = exports.tap = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => core.flatMap(self, a => as(f(a), a)));
|
||||
/** @internal */
|
||||
const tapBoth = exports.tapBoth = /*#__PURE__*/(0, _Function.dual)(2, (self, {
|
||||
onFailure,
|
||||
onSuccess
|
||||
}) => core.matchSTM(self, {
|
||||
onFailure: e => (0, _Function.pipe)(onFailure(e), core.zipRight(core.fail(e))),
|
||||
onSuccess: a => (0, _Function.pipe)(onSuccess(a), as(a))
|
||||
}));
|
||||
/** @internal */
|
||||
const tapError = exports.tapError = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => core.matchSTM(self, {
|
||||
onFailure: e => core.zipRight(f(e), core.fail(e)),
|
||||
onSuccess: core.succeed
|
||||
}));
|
||||
/** @internal */
|
||||
const try_ = arg => {
|
||||
const evaluate = typeof arg === "function" ? arg : arg.try;
|
||||
return suspend(() => {
|
||||
try {
|
||||
return core.succeed(evaluate());
|
||||
} catch (error) {
|
||||
return core.fail("catch" in arg ? arg.catch(error) : error);
|
||||
}
|
||||
});
|
||||
};
|
||||
/** @internal */
|
||||
exports.try_ = try_;
|
||||
const void_ = exports.void = /*#__PURE__*/core.succeed(void 0);
|
||||
/** @internal */
|
||||
const unless = exports.unless = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => suspend(() => predicate() ? succeedNone : asSome(self)));
|
||||
/** @internal */
|
||||
const unlessSTM = exports.unlessSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => core.flatMap(predicate, bool => bool ? succeedNone : asSome(self)));
|
||||
/** @internal */
|
||||
const unsome = self => core.matchSTM(self, {
|
||||
onFailure: Option.match({
|
||||
onNone: () => core.succeed(Option.none()),
|
||||
onSome: core.fail
|
||||
}),
|
||||
onSuccess: a => core.succeed(Option.some(a))
|
||||
});
|
||||
/** @internal */
|
||||
exports.unsome = unsome;
|
||||
const validateAll = exports.validateAll = /*#__PURE__*/(0, _Function.dual)(2, (elements, f) => core.flatMap(partition(elements, f), ([errors, values]) => RA.isNonEmptyArray(errors) ? core.fail(errors) : core.succeed(values)));
|
||||
/** @internal */
|
||||
const validateFirst = exports.validateFirst = /*#__PURE__*/(0, _Function.dual)(2, (elements, f) => flip(forEach(elements, a => flip(f(a)))));
|
||||
/** @internal */
|
||||
const when = exports.when = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => suspend(() => predicate() ? asSome(self) : succeedNone));
|
||||
/** @internal */
|
||||
const whenSTM = exports.whenSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => core.flatMap(predicate, bool => bool ? asSome(self) : succeedNone));
|
||||
//# sourceMappingURL=stm.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/stm.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/stm.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
102
_node_modules/effect/dist/cjs/internal/stm/stmState.js
generated
vendored
Normal file
102
_node_modules/effect/dist/cjs/internal/stm/stmState.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.running = exports.isSTMState = exports.isRunning = exports.isInterrupted = exports.isDone = exports.interrupted = exports.fromTExit = exports.done = exports.STMStateTypeId = void 0;
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var Exit = _interopRequireWildcard(require("../../Exit.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Hash = _interopRequireWildcard(require("../../Hash.js"));
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
var OpCodes = _interopRequireWildcard(require("./opCodes/stmState.js"));
|
||||
var TExitOpCodes = _interopRequireWildcard(require("./opCodes/tExit.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const STMStateSymbolKey = "effect/STM/State";
|
||||
/** @internal */
|
||||
const STMStateTypeId = exports.STMStateTypeId = /*#__PURE__*/Symbol.for(STMStateSymbolKey);
|
||||
/** @internal */
|
||||
const isSTMState = u => (0, _Predicate.hasProperty)(u, STMStateTypeId);
|
||||
/** @internal */
|
||||
exports.isSTMState = isSTMState;
|
||||
const isRunning = self => {
|
||||
return self._tag === OpCodes.OP_RUNNING;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isRunning = isRunning;
|
||||
const isDone = self => {
|
||||
return self._tag === OpCodes.OP_DONE;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isDone = isDone;
|
||||
const isInterrupted = self => {
|
||||
return self._tag === OpCodes.OP_INTERRUPTED;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isInterrupted = isInterrupted;
|
||||
const done = exit => {
|
||||
return {
|
||||
[STMStateTypeId]: STMStateTypeId,
|
||||
_tag: OpCodes.OP_DONE,
|
||||
exit,
|
||||
[Hash.symbol]() {
|
||||
return (0, _Function.pipe)(Hash.hash(STMStateSymbolKey), Hash.combine(Hash.hash(OpCodes.OP_DONE)), Hash.combine(Hash.hash(exit)), Hash.cached(this));
|
||||
},
|
||||
[Equal.symbol](that) {
|
||||
return isSTMState(that) && that._tag === OpCodes.OP_DONE && Equal.equals(exit, that.exit);
|
||||
}
|
||||
};
|
||||
};
|
||||
exports.done = done;
|
||||
const interruptedHash = /*#__PURE__*/(0, _Function.pipe)(/*#__PURE__*/Hash.hash(STMStateSymbolKey), /*#__PURE__*/Hash.combine(/*#__PURE__*/Hash.hash(OpCodes.OP_INTERRUPTED)), /*#__PURE__*/Hash.combine(/*#__PURE__*/Hash.hash("interrupted")));
|
||||
/** @internal */
|
||||
const interrupted = exports.interrupted = {
|
||||
[STMStateTypeId]: STMStateTypeId,
|
||||
_tag: OpCodes.OP_INTERRUPTED,
|
||||
[Hash.symbol]() {
|
||||
return interruptedHash;
|
||||
},
|
||||
[Equal.symbol](that) {
|
||||
return isSTMState(that) && that._tag === OpCodes.OP_INTERRUPTED;
|
||||
}
|
||||
};
|
||||
const runningHash = /*#__PURE__*/(0, _Function.pipe)(/*#__PURE__*/Hash.hash(STMStateSymbolKey), /*#__PURE__*/Hash.combine(/*#__PURE__*/Hash.hash(OpCodes.OP_RUNNING)), /*#__PURE__*/Hash.combine(/*#__PURE__*/Hash.hash("running")));
|
||||
/** @internal */
|
||||
const running = exports.running = {
|
||||
[STMStateTypeId]: STMStateTypeId,
|
||||
_tag: OpCodes.OP_RUNNING,
|
||||
[Hash.symbol]() {
|
||||
return runningHash;
|
||||
},
|
||||
[Equal.symbol](that) {
|
||||
return isSTMState(that) && that._tag === OpCodes.OP_RUNNING;
|
||||
}
|
||||
};
|
||||
/** @internal */
|
||||
const fromTExit = tExit => {
|
||||
switch (tExit._tag) {
|
||||
case TExitOpCodes.OP_FAIL:
|
||||
{
|
||||
return done(Exit.fail(tExit.error));
|
||||
}
|
||||
case TExitOpCodes.OP_DIE:
|
||||
{
|
||||
return done(Exit.die(tExit.defect));
|
||||
}
|
||||
case TExitOpCodes.OP_INTERRUPT:
|
||||
{
|
||||
return done(Exit.interrupt(tExit.fiberId));
|
||||
}
|
||||
case TExitOpCodes.OP_SUCCEED:
|
||||
{
|
||||
return done(Exit.succeed(tExit.value));
|
||||
}
|
||||
case TExitOpCodes.OP_RETRY:
|
||||
{
|
||||
throw new Error("BUG: STM.STMState.fromTExit - please report an issue at https://github.com/Effect-TS/effect/issues");
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.fromTExit = fromTExit;
|
||||
//# sourceMappingURL=stmState.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/stmState.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/stmState.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stmState.js","names":["Equal","_interopRequireWildcard","require","Exit","_Function","Hash","_Predicate","OpCodes","TExitOpCodes","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","STMStateSymbolKey","STMStateTypeId","exports","Symbol","for","isSTMState","u","hasProperty","isRunning","self","_tag","OP_RUNNING","isDone","OP_DONE","isInterrupted","OP_INTERRUPTED","done","exit","symbol","pipe","hash","combine","cached","that","equals","interruptedHash","interrupted","runningHash","running","fromTExit","tExit","OP_FAIL","fail","error","OP_DIE","die","defect","OP_INTERRUPT","interrupt","fiberId","OP_SUCCEED","succeed","value","OP_RETRY","Error"],"sources":["../../../../src/internal/stm/stmState.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAJ,uBAAA,CAAAC,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAN,uBAAA,CAAAC,OAAA;AACA,IAAAM,YAAA,GAAAP,uBAAA,CAAAC,OAAA;AAAkD,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA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MAAE;QACzB,OAAOf,IAAI,CAACzC,IAAI,CAACyD,IAAI,CAACF,KAAK,CAACG,KAAK,CAAC,CAAC;MACrC;IACA,KAAKrD,YAAY,CAACsD,MAAM;MAAE;QACxB,OAAOlB,IAAI,CAACzC,IAAI,CAAC4D,GAAG,CAACL,KAAK,CAACM,MAAM,CAAC,CAAC;MACrC;IACA,KAAKxD,YAAY,CAACyD,YAAY;MAAE;QAC9B,OAAOrB,IAAI,CAACzC,IAAI,CAAC+D,SAAS,CAACR,KAAK,CAACS,OAAO,CAAC,CAAC;MAC5C;IACA,KAAK3D,YAAY,CAAC4D,UAAU;MAAE;QAC5B,OAAOxB,IAAI,CAACzC,IAAI,CAACkE,OAAO,CAACX,KAAK,CAACY,KAAK,CAAC,CAAC;MACxC;IACA,KAAK9D,YAAY,CAAC+D,QAAQ;MAAE;QAC1B,MAAM,IAAIC,KAAK,CACb,oGAAoG,CACrG;MACH;EACF;AACF,CAAC;AAAA1C,OAAA,CAAA2B,SAAA,GAAAA,SAAA","ignoreList":[]}
|
||||
258
_node_modules/effect/dist/cjs/internal/stm/tArray.js
generated
vendored
Normal file
258
_node_modules/effect/dist/cjs/internal/stm/tArray.js
generated
vendored
Normal file
@@ -0,0 +1,258 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.updateSTM = exports.update = exports.transformSTM = exports.transform = exports.toArray = exports.someSTM = exports.some = exports.size = exports.reduceSTM = exports.reduceOptionSTM = exports.reduceOption = exports.reduce = exports.minOption = exports.maxOption = exports.make = exports.lastOption = exports.headOption = exports.get = exports.fromIterable = exports.forEach = exports.findLastSTM = exports.findLastIndexFrom = exports.findLastIndex = exports.findLast = exports.findFirstSTM = exports.findFirstIndexWhereSTM = exports.findFirstIndexWhereFromSTM = exports.findFirstIndexWhereFrom = exports.findFirstIndexWhere = exports.findFirstIndexFrom = exports.findFirstIndex = exports.findFirst = exports.everySTM = exports.every = exports.empty = exports.countSTM = exports.count = exports.contains = exports.collectFirstSTM = exports.collectFirst = exports.TArrayTypeId = exports.TArrayImpl = void 0;
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var Order = _interopRequireWildcard(require("../../Order.js"));
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var stm = _interopRequireWildcard(require("./stm.js"));
|
||||
var tRef = _interopRequireWildcard(require("./tRef.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const TArraySymbolKey = "effect/TArray";
|
||||
/** @internal */
|
||||
const TArrayTypeId = exports.TArrayTypeId = /*#__PURE__*/Symbol.for(TArraySymbolKey);
|
||||
const tArrayVariance = {
|
||||
/* c8 ignore next */
|
||||
_A: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
class TArrayImpl {
|
||||
chunk;
|
||||
[TArrayTypeId] = tArrayVariance;
|
||||
constructor(chunk) {
|
||||
this.chunk = chunk;
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
exports.TArrayImpl = TArrayImpl;
|
||||
const collectFirst = exports.collectFirst = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => collectFirstSTM(self, a => (0, _Function.pipe)(pf(a), Option.map(core.succeed))));
|
||||
/** @internal */
|
||||
const collectFirstSTM = exports.collectFirstSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => core.withSTMRuntime(runtime => {
|
||||
let index = 0;
|
||||
let result = Option.none();
|
||||
while (Option.isNone(result) && index < self.chunk.length) {
|
||||
const element = (0, _Function.pipe)(self.chunk[index], tRef.unsafeGet(runtime.journal));
|
||||
const option = pf(element);
|
||||
if (Option.isSome(option)) {
|
||||
result = option;
|
||||
}
|
||||
index = index + 1;
|
||||
}
|
||||
return (0, _Function.pipe)(result, Option.match({
|
||||
onNone: () => stm.succeedNone,
|
||||
onSome: core.map(Option.some)
|
||||
}));
|
||||
}));
|
||||
/** @internal */
|
||||
const contains = exports.contains = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => some(self, a => Equal.equals(a)(value)));
|
||||
/** @internal */
|
||||
const count = exports.count = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => reduce(self, 0, (n, a) => predicate(a) ? n + 1 : n));
|
||||
/** @internal */
|
||||
const countSTM = exports.countSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => reduceSTM(self, 0, (n, a) => core.map(predicate(a), bool => bool ? n + 1 : n)));
|
||||
/** @internal */
|
||||
const empty = () => fromIterable([]);
|
||||
/** @internal */
|
||||
exports.empty = empty;
|
||||
const every = exports.every = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => stm.negate(some(self, a => !predicate(a))));
|
||||
/** @internal */
|
||||
const everySTM = exports.everySTM = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => core.map(countSTM(self, predicate), count => count === self.chunk.length));
|
||||
/** @internal */
|
||||
const findFirst = exports.findFirst = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => collectFirst(self, a => predicate(a) ? Option.some(a) : Option.none()));
|
||||
/** @internal */
|
||||
const findFirstIndex = exports.findFirstIndex = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => findFirstIndexFrom(self, value, 0));
|
||||
/** @internal */
|
||||
const findFirstIndexFrom = exports.findFirstIndexFrom = /*#__PURE__*/(0, _Function.dual)(3, (self, value, from) => findFirstIndexWhereFrom(self, a => Equal.equals(a)(value), from));
|
||||
/** @internal */
|
||||
const findFirstIndexWhere = exports.findFirstIndexWhere = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => findFirstIndexWhereFrom(self, predicate, 0));
|
||||
/** @internal */
|
||||
const findFirstIndexWhereFrom = exports.findFirstIndexWhereFrom = /*#__PURE__*/(0, _Function.dual)(3, (self, predicate, from) => {
|
||||
if (from < 0) {
|
||||
return stm.succeedNone;
|
||||
}
|
||||
return core.effect(journal => {
|
||||
let index = from;
|
||||
let found = false;
|
||||
while (!found && index < self.chunk.length) {
|
||||
const element = tRef.unsafeGet(self.chunk[index], journal);
|
||||
found = predicate(element);
|
||||
index = index + 1;
|
||||
}
|
||||
if (found) {
|
||||
return Option.some(index - 1);
|
||||
}
|
||||
return Option.none();
|
||||
});
|
||||
});
|
||||
/** @internal */
|
||||
const findFirstIndexWhereSTM = exports.findFirstIndexWhereSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => findFirstIndexWhereFromSTM(self, predicate, 0));
|
||||
/** @internal */
|
||||
const findFirstIndexWhereFromSTM = exports.findFirstIndexWhereFromSTM = /*#__PURE__*/(0, _Function.dual)(3, (self, predicate, from) => {
|
||||
const forIndex = index => index < self.chunk.length ? (0, _Function.pipe)(tRef.get(self.chunk[index]), core.flatMap(predicate), core.flatMap(bool => bool ? core.succeed(Option.some(index)) : forIndex(index + 1))) : stm.succeedNone;
|
||||
return from < 0 ? stm.succeedNone : forIndex(from);
|
||||
});
|
||||
/** @internal */
|
||||
const findFirstSTM = exports.findFirstSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => {
|
||||
const init = [Option.none(), 0];
|
||||
const cont = state => Option.isNone(state[0]) && state[1] < self.chunk.length - 1;
|
||||
return core.map(stm.iterate(init, {
|
||||
while: cont,
|
||||
body: state => {
|
||||
const index = state[1];
|
||||
return (0, _Function.pipe)(tRef.get(self.chunk[index]), core.flatMap(value => core.map(predicate(value), bool => [bool ? Option.some(value) : Option.none(), index + 1])));
|
||||
}
|
||||
}), state => state[0]);
|
||||
});
|
||||
/** @internal */
|
||||
const findLast = exports.findLast = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => core.effect(journal => {
|
||||
let index = self.chunk.length - 1;
|
||||
let result = Option.none();
|
||||
while (Option.isNone(result) && index >= 0) {
|
||||
const element = tRef.unsafeGet(self.chunk[index], journal);
|
||||
if (predicate(element)) {
|
||||
result = Option.some(element);
|
||||
}
|
||||
index = index - 1;
|
||||
}
|
||||
return result;
|
||||
}));
|
||||
/** @internal */
|
||||
const findLastIndex = exports.findLastIndex = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => findLastIndexFrom(self, value, self.chunk.length - 1));
|
||||
/** @internal */
|
||||
const findLastIndexFrom = exports.findLastIndexFrom = /*#__PURE__*/(0, _Function.dual)(3, (self, value, end) => {
|
||||
if (end >= self.chunk.length) {
|
||||
return stm.succeedNone;
|
||||
}
|
||||
return core.effect(journal => {
|
||||
let index = end;
|
||||
let found = false;
|
||||
while (!found && index >= 0) {
|
||||
const element = tRef.unsafeGet(self.chunk[index], journal);
|
||||
found = Equal.equals(element)(value);
|
||||
index = index - 1;
|
||||
}
|
||||
if (found) {
|
||||
return Option.some(index + 1);
|
||||
}
|
||||
return Option.none();
|
||||
});
|
||||
});
|
||||
/** @internal */
|
||||
const findLastSTM = exports.findLastSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => {
|
||||
const init = [Option.none(), self.chunk.length - 1];
|
||||
const cont = state => Option.isNone(state[0]) && state[1] >= 0;
|
||||
return core.map(stm.iterate(init, {
|
||||
while: cont,
|
||||
body: state => {
|
||||
const index = state[1];
|
||||
return (0, _Function.pipe)(tRef.get(self.chunk[index]), core.flatMap(value => core.map(predicate(value), bool => [bool ? Option.some(value) : Option.none(), index - 1])));
|
||||
}
|
||||
}), state => state[0]);
|
||||
});
|
||||
/** @internal */
|
||||
const forEach = exports.forEach = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => reduceSTM(self, void 0, (_, a) => f(a)));
|
||||
/** @internal */
|
||||
const fromIterable = iterable => core.map(stm.forEach(iterable, tRef.make), chunk => new TArrayImpl(chunk));
|
||||
/** @internal */
|
||||
exports.fromIterable = fromIterable;
|
||||
const get = exports.get = /*#__PURE__*/(0, _Function.dual)(2, (self, index) => {
|
||||
if (index < 0 || index >= self.chunk.length) {
|
||||
return core.dieMessage("Index out of bounds");
|
||||
}
|
||||
return tRef.get(self.chunk[index]);
|
||||
});
|
||||
/** @internal */
|
||||
const headOption = self => self.chunk.length === 0 ? core.succeed(Option.none()) : core.map(tRef.get(self.chunk[0]), Option.some);
|
||||
/** @internal */
|
||||
exports.headOption = headOption;
|
||||
const lastOption = self => self.chunk.length === 0 ? stm.succeedNone : core.map(tRef.get(self.chunk[self.chunk.length - 1]), Option.some);
|
||||
/** @internal */
|
||||
exports.lastOption = lastOption;
|
||||
const make = (...elements) => fromIterable(elements);
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const maxOption = exports.maxOption = /*#__PURE__*/(0, _Function.dual)(2, (self, order) => {
|
||||
const greaterThan = Order.greaterThan(order);
|
||||
return reduceOption(self, (acc, curr) => greaterThan(acc)(curr) ? curr : acc);
|
||||
});
|
||||
/** @internal */
|
||||
const minOption = exports.minOption = /*#__PURE__*/(0, _Function.dual)(2, (self, order) => {
|
||||
const lessThan = Order.lessThan(order);
|
||||
return reduceOption(self, (acc, curr) => lessThan(acc)(curr) ? curr : acc);
|
||||
});
|
||||
/** @internal */
|
||||
const reduce = exports.reduce = /*#__PURE__*/(0, _Function.dual)(3, (self, zero, f) => core.effect(journal => {
|
||||
let index = 0;
|
||||
let result = zero;
|
||||
while (index < self.chunk.length) {
|
||||
const element = tRef.unsafeGet(self.chunk[index], journal);
|
||||
result = f(result, element);
|
||||
index = index + 1;
|
||||
}
|
||||
return result;
|
||||
}));
|
||||
/** @internal */
|
||||
const reduceOption = exports.reduceOption = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => core.effect(journal => {
|
||||
let index = 0;
|
||||
let result = undefined;
|
||||
while (index < self.chunk.length) {
|
||||
const element = tRef.unsafeGet(self.chunk[index], journal);
|
||||
result = result === undefined ? element : f(result, element);
|
||||
index = index + 1;
|
||||
}
|
||||
return Option.fromNullable(result);
|
||||
}));
|
||||
/** @internal */
|
||||
const reduceOptionSTM = exports.reduceOptionSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => reduceSTM(self, Option.none(), (acc, curr) => Option.isSome(acc) ? core.map(f(acc.value, curr), Option.some) : stm.succeedSome(curr)));
|
||||
/** @internal */
|
||||
const reduceSTM = exports.reduceSTM = /*#__PURE__*/(0, _Function.dual)(3, (self, zero, f) => core.flatMap(toArray(self), stm.reduce(zero, f)));
|
||||
/** @internal */
|
||||
const size = self => self.chunk.length;
|
||||
/** @internal */
|
||||
exports.size = size;
|
||||
const some = exports.some = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => core.map(findFirst(self, predicate), Option.isSome));
|
||||
/** @internal */
|
||||
const someSTM = exports.someSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => core.map(countSTM(self, predicate), n => n > 0));
|
||||
/** @internal */
|
||||
const toArray = self => stm.forEach(self.chunk, tRef.get);
|
||||
/** @internal */
|
||||
exports.toArray = toArray;
|
||||
const transform = exports.transform = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => core.effect(journal => {
|
||||
let index = 0;
|
||||
while (index < self.chunk.length) {
|
||||
const ref = self.chunk[index];
|
||||
tRef.unsafeSet(ref, f(tRef.unsafeGet(ref, journal)), journal);
|
||||
index = index + 1;
|
||||
}
|
||||
return void 0;
|
||||
}));
|
||||
/** @internal */
|
||||
const transformSTM = exports.transformSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => core.flatMap(stm.forEach(self.chunk, ref => core.flatMap(tRef.get(ref), f)), chunk => core.effect(journal => {
|
||||
const iterator = chunk[Symbol.iterator]();
|
||||
let index = 0;
|
||||
let next;
|
||||
while ((next = iterator.next()) && !next.done) {
|
||||
tRef.unsafeSet(self.chunk[index], next.value, journal);
|
||||
index = index + 1;
|
||||
}
|
||||
return void 0;
|
||||
})));
|
||||
/** @internal */
|
||||
const update = exports.update = /*#__PURE__*/(0, _Function.dual)(3, (self, index, f) => {
|
||||
if (index < 0 || index >= self.chunk.length) {
|
||||
return core.dieMessage("Index out of bounds");
|
||||
}
|
||||
return tRef.update(self.chunk[index], f);
|
||||
});
|
||||
/** @internal */
|
||||
const updateSTM = exports.updateSTM = /*#__PURE__*/(0, _Function.dual)(3, (self, index, f) => {
|
||||
if (index < 0 || index >= self.chunk.length) {
|
||||
return core.dieMessage("Index out of bounds");
|
||||
}
|
||||
return (0, _Function.pipe)(tRef.get(self.chunk[index]), core.flatMap(f), core.flatMap(updated => tRef.set(self.chunk[index], updated)));
|
||||
});
|
||||
//# sourceMappingURL=tArray.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tArray.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tArray.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
51
_node_modules/effect/dist/cjs/internal/stm/tDeferred.js
generated
vendored
Normal file
51
_node_modules/effect/dist/cjs/internal/stm/tDeferred.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.succeed = exports.poll = exports.make = exports.fail = exports.done = exports._await = exports.TDeferredTypeId = void 0;
|
||||
var Either = _interopRequireWildcard(require("../../Either.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var stm = _interopRequireWildcard(require("./stm.js"));
|
||||
var tRef = _interopRequireWildcard(require("./tRef.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const TDeferredSymbolKey = "effect/TDeferred";
|
||||
/** @internal */
|
||||
const TDeferredTypeId = exports.TDeferredTypeId = /*#__PURE__*/Symbol.for(TDeferredSymbolKey);
|
||||
/** @internal */
|
||||
const tDeferredVariance = {
|
||||
/* c8 ignore next */
|
||||
_A: _ => _,
|
||||
/* c8 ignore next */
|
||||
_E: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
class TDeferredImpl {
|
||||
ref;
|
||||
[TDeferredTypeId] = tDeferredVariance;
|
||||
constructor(ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const _await = self => stm.flatten(stm.collect(tRef.get(self.ref), option => Option.isSome(option) ? Option.some(stm.fromEither(option.value)) : Option.none()));
|
||||
/** @internal */
|
||||
exports._await = _await;
|
||||
const done = exports.done = /*#__PURE__*/(0, _Function.dual)(2, (self, either) => core.flatMap(tRef.get(self.ref), Option.match({
|
||||
onNone: () => core.zipRight(tRef.set(self.ref, Option.some(either)), core.succeed(true)),
|
||||
onSome: () => core.succeed(false)
|
||||
})));
|
||||
/** @internal */
|
||||
const fail = exports.fail = /*#__PURE__*/(0, _Function.dual)(2, (self, error) => done(self, Either.left(error)));
|
||||
/** @internal */
|
||||
const make = () => core.map(tRef.make(Option.none()), ref => new TDeferredImpl(ref));
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const poll = self => tRef.get(self.ref);
|
||||
/** @internal */
|
||||
exports.poll = poll;
|
||||
const succeed = exports.succeed = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => done(self, Either.right(value)));
|
||||
//# sourceMappingURL=tDeferred.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tDeferred.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tDeferred.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tDeferred.js","names":["Either","_interopRequireWildcard","require","_Function","Option","core","stm","tRef","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","TDeferredSymbolKey","TDeferredTypeId","exports","Symbol","for","tDeferredVariance","_A","_","_E","TDeferredImpl","ref","constructor","_await","self","flatten","collect","option","isSome","some","fromEither","value","none","done","dual","either","flatMap","match","onNone","zipRight","succeed","onSome","fail","error","left","make","map","poll","right"],"sources":["../../../../src/internal/stm/tDeferred.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,uBAAA,CAAAC,OAAA;AAIA,IAAAG,IAAA,GAAAJ,uBAAA,CAAAC,OAAA;AACA,IAAAI,GAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,IAAA,GAAAN,uBAAA,CAAAC,OAAA;AAAiC,SAAAD,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAO,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA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AAMP,OAAO,GAAA3B,OAAA,CAAA2B,OAAA,gBAAG,IAAAN,cAAI,EAGzB,CAAC,EAAE,CAACV,IAAI,EAAEO,KAAK,KAAKE,IAAI,CAACT,IAAI,EAAExC,MAAM,CAACgE,KAAK,CAACjB,KAAK,CAAC,CAAC,CAAC","ignoreList":[]}
|
||||
116
_node_modules/effect/dist/cjs/internal/stm/tExit.js
generated
vendored
Normal file
116
_node_modules/effect/dist/cjs/internal/stm/tExit.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.void = exports.succeed = exports.retry = exports.isSuccess = exports.isRetry = exports.isInterrupt = exports.isFail = exports.isExit = exports.isDie = exports.interrupt = exports.fail = exports.die = exports.TExitTypeId = void 0;
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Hash = _interopRequireWildcard(require("../../Hash.js"));
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
var OpCodes = _interopRequireWildcard(require("./opCodes/tExit.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const TExitSymbolKey = "effect/TExit";
|
||||
/** @internal */
|
||||
const TExitTypeId = exports.TExitTypeId = /*#__PURE__*/Symbol.for(TExitSymbolKey);
|
||||
const variance = {
|
||||
/* c8 ignore next */
|
||||
_A: _ => _,
|
||||
/* c8 ignore next */
|
||||
_E: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
const isExit = u => (0, _Predicate.hasProperty)(u, TExitTypeId);
|
||||
/** @internal */
|
||||
exports.isExit = isExit;
|
||||
const isFail = self => {
|
||||
return self._tag === OpCodes.OP_FAIL;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isFail = isFail;
|
||||
const isDie = self => {
|
||||
return self._tag === OpCodes.OP_DIE;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isDie = isDie;
|
||||
const isInterrupt = self => {
|
||||
return self._tag === OpCodes.OP_INTERRUPT;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isInterrupt = isInterrupt;
|
||||
const isSuccess = self => {
|
||||
return self._tag === OpCodes.OP_SUCCEED;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isSuccess = isSuccess;
|
||||
const isRetry = self => {
|
||||
return self._tag === OpCodes.OP_RETRY;
|
||||
};
|
||||
/** @internal */
|
||||
exports.isRetry = isRetry;
|
||||
const fail = error => ({
|
||||
[TExitTypeId]: variance,
|
||||
_tag: OpCodes.OP_FAIL,
|
||||
error,
|
||||
[Hash.symbol]() {
|
||||
return (0, _Function.pipe)(Hash.hash(TExitSymbolKey), Hash.combine(Hash.hash(OpCodes.OP_FAIL)), Hash.combine(Hash.hash(error)), Hash.cached(this));
|
||||
},
|
||||
[Equal.symbol](that) {
|
||||
return isExit(that) && that._tag === OpCodes.OP_FAIL && Equal.equals(error, that.error);
|
||||
}
|
||||
});
|
||||
/** @internal */
|
||||
exports.fail = fail;
|
||||
const die = defect => ({
|
||||
[TExitTypeId]: variance,
|
||||
_tag: OpCodes.OP_DIE,
|
||||
defect,
|
||||
[Hash.symbol]() {
|
||||
return (0, _Function.pipe)(Hash.hash(TExitSymbolKey), Hash.combine(Hash.hash(OpCodes.OP_DIE)), Hash.combine(Hash.hash(defect)), Hash.cached(this));
|
||||
},
|
||||
[Equal.symbol](that) {
|
||||
return isExit(that) && that._tag === OpCodes.OP_DIE && Equal.equals(defect, that.defect);
|
||||
}
|
||||
});
|
||||
/** @internal */
|
||||
exports.die = die;
|
||||
const interrupt = fiberId => ({
|
||||
[TExitTypeId]: variance,
|
||||
_tag: OpCodes.OP_INTERRUPT,
|
||||
fiberId,
|
||||
[Hash.symbol]() {
|
||||
return (0, _Function.pipe)(Hash.hash(TExitSymbolKey), Hash.combine(Hash.hash(OpCodes.OP_INTERRUPT)), Hash.combine(Hash.hash(fiberId)), Hash.cached(this));
|
||||
},
|
||||
[Equal.symbol](that) {
|
||||
return isExit(that) && that._tag === OpCodes.OP_INTERRUPT && Equal.equals(fiberId, that.fiberId);
|
||||
}
|
||||
});
|
||||
/** @internal */
|
||||
exports.interrupt = interrupt;
|
||||
const succeed = value => ({
|
||||
[TExitTypeId]: variance,
|
||||
_tag: OpCodes.OP_SUCCEED,
|
||||
value,
|
||||
[Hash.symbol]() {
|
||||
return (0, _Function.pipe)(Hash.hash(TExitSymbolKey), Hash.combine(Hash.hash(OpCodes.OP_SUCCEED)), Hash.combine(Hash.hash(value)), Hash.cached(this));
|
||||
},
|
||||
[Equal.symbol](that) {
|
||||
return isExit(that) && that._tag === OpCodes.OP_SUCCEED && Equal.equals(value, that.value);
|
||||
}
|
||||
});
|
||||
exports.succeed = succeed;
|
||||
const retryHash = /*#__PURE__*/(0, _Function.pipe)(/*#__PURE__*/Hash.hash(TExitSymbolKey), /*#__PURE__*/Hash.combine(/*#__PURE__*/Hash.hash(OpCodes.OP_RETRY)), /*#__PURE__*/Hash.combine(/*#__PURE__*/Hash.hash("retry")));
|
||||
/** @internal */
|
||||
const retry = exports.retry = {
|
||||
[TExitTypeId]: variance,
|
||||
_tag: OpCodes.OP_RETRY,
|
||||
[Hash.symbol]() {
|
||||
return retryHash;
|
||||
},
|
||||
[Equal.symbol](that) {
|
||||
return isExit(that) && isRetry(that);
|
||||
}
|
||||
};
|
||||
const void_ = exports.void = /*#__PURE__*/succeed(undefined);
|
||||
//# sourceMappingURL=tExit.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tExit.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tExit.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
448
_node_modules/effect/dist/cjs/internal/stm/tMap.js
generated
vendored
Normal file
448
_node_modules/effect/dist/cjs/internal/stm/tMap.js
generated
vendored
Normal file
@@ -0,0 +1,448 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.values = exports.updateWith = exports.transformValuesSTM = exports.transformValues = exports.transformSTM = exports.transform = exports.toMap = exports.toHashMap = exports.toChunk = exports.toArray = exports.takeSomeSTM = exports.takeSome = exports.takeFirstSTM = exports.takeFirst = exports.size = exports.setIfAbsent = exports.set = exports.retainIf = exports.removeIf = exports.removeAll = exports.remove = exports.reduceSTM = exports.reduce = exports.merge = exports.make = exports.keys = exports.isEmpty = exports.has = exports.getOrElse = exports.get = exports.fromIterable = exports.forEach = exports.findSTM = exports.findAllSTM = exports.findAll = exports.find = exports.empty = exports.TMapTypeId = void 0;
|
||||
var RA = _interopRequireWildcard(require("../../Array.js"));
|
||||
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Hash = _interopRequireWildcard(require("../../Hash.js"));
|
||||
var HashMap = _interopRequireWildcard(require("../../HashMap.js"));
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
var STM = _interopRequireWildcard(require("../../STM.js"));
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var stm = _interopRequireWildcard(require("./stm.js"));
|
||||
var tArray = _interopRequireWildcard(require("./tArray.js"));
|
||||
var tRef = _interopRequireWildcard(require("./tRef.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const TMapSymbolKey = "effect/TMap";
|
||||
/** @internal */
|
||||
const TMapTypeId = exports.TMapTypeId = /*#__PURE__*/Symbol.for(TMapSymbolKey);
|
||||
const tMapVariance = {
|
||||
/* c8 ignore next */
|
||||
_K: _ => _,
|
||||
/* c8 ignore next */
|
||||
_V: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
class TMapImpl {
|
||||
tBuckets;
|
||||
tSize;
|
||||
[TMapTypeId] = tMapVariance;
|
||||
constructor(tBuckets, tSize) {
|
||||
this.tBuckets = tBuckets;
|
||||
this.tSize = tSize;
|
||||
}
|
||||
}
|
||||
const isTMap = u => (0, _Predicate.hasProperty)(u, TMapTypeId);
|
||||
/** @internal */
|
||||
const InitialCapacity = 16;
|
||||
const LoadFactor = 0.75;
|
||||
/** @internal */
|
||||
const nextPowerOfTwo = size => {
|
||||
const n = -1 >>> Math.clz32(size - 1);
|
||||
return n < 0 ? 1 : n + 1;
|
||||
};
|
||||
/** @internal */
|
||||
const hash = key => {
|
||||
const h = Hash.hash(key);
|
||||
return h ^ h >>> 16;
|
||||
};
|
||||
/** @internal */
|
||||
const indexOf = (k, capacity) => hash(k) & capacity - 1;
|
||||
/** @internal */
|
||||
const allocate = (capacity, data) => {
|
||||
const buckets = Array.from({
|
||||
length: capacity
|
||||
}, () => Chunk.empty());
|
||||
const distinct = new Map(data);
|
||||
let size = 0;
|
||||
for (const entry of distinct) {
|
||||
const index = indexOf(entry[0], capacity);
|
||||
buckets[index] = (0, _Function.pipe)(buckets[index], Chunk.prepend(entry));
|
||||
size = size + 1;
|
||||
}
|
||||
return (0, _Function.pipe)(tArray.fromIterable(buckets), core.flatMap(buckets => (0, _Function.pipe)(tRef.make(buckets), core.flatMap(tBuckets => (0, _Function.pipe)(tRef.make(size), core.map(tSize => new TMapImpl(tBuckets, tSize)))))));
|
||||
};
|
||||
/** @internal */
|
||||
const empty = () => fromIterable([]);
|
||||
/** @internal */
|
||||
exports.empty = empty;
|
||||
const find = exports.find = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => findSTM(self, (key, value) => {
|
||||
const option = pf(key, value);
|
||||
if (Option.isSome(option)) {
|
||||
return core.succeed(option.value);
|
||||
}
|
||||
return core.fail(Option.none());
|
||||
}));
|
||||
/** @internal */
|
||||
const findSTM = exports.findSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => reduceSTM(self, Option.none(), (acc, value, key) => Option.isNone(acc) ? core.matchSTM(f(key, value), {
|
||||
onFailure: Option.match({
|
||||
onNone: () => stm.succeedNone,
|
||||
onSome: core.fail
|
||||
}),
|
||||
onSuccess: stm.succeedSome
|
||||
}) : STM.succeed(acc)));
|
||||
/** @internal */
|
||||
const findAll = exports.findAll = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => findAllSTM(self, (key, value) => {
|
||||
const option = pf(key, value);
|
||||
if (Option.isSome(option)) {
|
||||
return core.succeed(option.value);
|
||||
}
|
||||
return core.fail(Option.none());
|
||||
}));
|
||||
/** @internal */
|
||||
const findAllSTM = exports.findAllSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => core.map(reduceSTM(self, Chunk.empty(), (acc, value, key) => core.matchSTM(pf(key, value), {
|
||||
onFailure: Option.match({
|
||||
onNone: () => core.succeed(acc),
|
||||
onSome: core.fail
|
||||
}),
|
||||
onSuccess: a => core.succeed(Chunk.append(acc, a))
|
||||
})), a => Array.from(a)));
|
||||
/** @internal */
|
||||
const forEach = exports.forEach = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => reduceSTM(self, void 0, (_, value, key) => stm.asVoid(f(key, value))));
|
||||
/** @internal */
|
||||
const fromIterable = iterable => stm.suspend(() => {
|
||||
const data = Chunk.fromIterable(iterable);
|
||||
const capacity = data.length < InitialCapacity ? InitialCapacity : nextPowerOfTwo(data.length);
|
||||
return allocate(capacity, data);
|
||||
});
|
||||
/** @internal */
|
||||
exports.fromIterable = fromIterable;
|
||||
const get = exports.get = /*#__PURE__*/(0, _Function.dual)(2, (self, key) => core.effect(journal => {
|
||||
const buckets = tRef.unsafeGet(self.tBuckets, journal);
|
||||
const index = indexOf(key, buckets.chunk.length);
|
||||
const bucket = tRef.unsafeGet(buckets.chunk[index], journal);
|
||||
return (0, _Function.pipe)(Chunk.findFirst(bucket, entry => Equal.equals(entry[0])(key)), Option.map(entry => entry[1]));
|
||||
}));
|
||||
/** @internal */
|
||||
const getOrElse = exports.getOrElse = /*#__PURE__*/(0, _Function.dual)(3, (self, key, fallback) => core.map(get(self, key), Option.getOrElse(fallback)));
|
||||
/** @internal */
|
||||
const has = exports.has = /*#__PURE__*/(0, _Function.dual)(2, (self, key) => core.map(get(self, key), Option.isSome));
|
||||
/** @internal */
|
||||
const isEmpty = self => core.map(tRef.get(self.tSize), size => size === 0);
|
||||
/** @internal */
|
||||
exports.isEmpty = isEmpty;
|
||||
const keys = self => core.map(toReadonlyArray(self), RA.map(entry => entry[0]));
|
||||
/** @internal */
|
||||
exports.keys = keys;
|
||||
const make = (...entries) => fromIterable(entries);
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const merge = exports.merge = /*#__PURE__*/(0, _Function.dual)(4, (self, key, value, f) => core.flatMap(get(self, key), Option.match({
|
||||
onNone: () => stm.as(set(self, key, value), value),
|
||||
onSome: v0 => {
|
||||
const v1 = f(v0, value);
|
||||
return stm.as(set(self, key, v1), v1);
|
||||
}
|
||||
})));
|
||||
/** @internal */
|
||||
const reduce = exports.reduce = /*#__PURE__*/(0, _Function.dual)(3, (self, zero, f) => core.effect(journal => {
|
||||
const buckets = tRef.unsafeGet(self.tBuckets, journal);
|
||||
let result = zero;
|
||||
let index = 0;
|
||||
while (index < buckets.chunk.length) {
|
||||
const bucket = buckets.chunk[index];
|
||||
const items = tRef.unsafeGet(bucket, journal);
|
||||
result = Chunk.reduce(items, result, (acc, entry) => f(acc, entry[1], entry[0]));
|
||||
index = index + 1;
|
||||
}
|
||||
return result;
|
||||
}));
|
||||
/** @internal */
|
||||
const reduceSTM = exports.reduceSTM = /*#__PURE__*/(0, _Function.dual)(3, (self, zero, f) => core.flatMap(toReadonlyArray(self), stm.reduce(zero, (acc, entry) => f(acc, entry[1], entry[0]))));
|
||||
/** @internal */
|
||||
const remove = exports.remove = /*#__PURE__*/(0, _Function.dual)(2, (self, key) => core.effect(journal => {
|
||||
const buckets = tRef.unsafeGet(self.tBuckets, journal);
|
||||
const index = indexOf(key, buckets.chunk.length);
|
||||
const bucket = tRef.unsafeGet(buckets.chunk[index], journal);
|
||||
const [toRemove, toRetain] = Chunk.partition(bucket, entry => Equal.equals(entry[1], key));
|
||||
if (Chunk.isNonEmpty(toRemove)) {
|
||||
const currentSize = tRef.unsafeGet(self.tSize, journal);
|
||||
tRef.unsafeSet(buckets.chunk[index], toRetain, journal);
|
||||
tRef.unsafeSet(self.tSize, currentSize - 1, journal);
|
||||
}
|
||||
}));
|
||||
/** @internal */
|
||||
const removeAll = exports.removeAll = /*#__PURE__*/(0, _Function.dual)(2, (self, keys) => core.effect(journal => {
|
||||
const iterator = keys[Symbol.iterator]();
|
||||
let next;
|
||||
while ((next = iterator.next()) && !next.done) {
|
||||
const buckets = tRef.unsafeGet(self.tBuckets, journal);
|
||||
const index = indexOf(next.value, buckets.chunk.length);
|
||||
const bucket = tRef.unsafeGet(buckets.chunk[index], journal);
|
||||
const [toRemove, toRetain] = Chunk.partition(bucket, entry => Equal.equals(next.value)(entry[0]));
|
||||
if (Chunk.isNonEmpty(toRemove)) {
|
||||
const currentSize = tRef.unsafeGet(self.tSize, journal);
|
||||
tRef.unsafeSet(buckets.chunk[index], toRetain, journal);
|
||||
tRef.unsafeSet(self.tSize, currentSize - 1, journal);
|
||||
}
|
||||
}
|
||||
}));
|
||||
/** @internal */
|
||||
const removeIf = exports.removeIf = /*#__PURE__*/(0, _Function.dual)(args => isTMap(args[0]), (self, predicate, options) => core.effect(journal => {
|
||||
const discard = options?.discard === true;
|
||||
const buckets = tRef.unsafeGet(self.tBuckets, journal);
|
||||
const capacity = buckets.chunk.length;
|
||||
const removed = [];
|
||||
let index = 0;
|
||||
let newSize = 0;
|
||||
while (index < capacity) {
|
||||
const bucket = tRef.unsafeGet(buckets.chunk[index], journal);
|
||||
const iterator = bucket[Symbol.iterator]();
|
||||
let next;
|
||||
let newBucket = Chunk.empty();
|
||||
while ((next = iterator.next()) && !next.done) {
|
||||
const [k, v] = next.value;
|
||||
if (!predicate(k, v)) {
|
||||
newBucket = Chunk.prepend(newBucket, next.value);
|
||||
newSize = newSize + 1;
|
||||
} else {
|
||||
if (!discard) {
|
||||
removed.push([k, v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
tRef.unsafeSet(buckets.chunk[index], newBucket, journal);
|
||||
index = index + 1;
|
||||
}
|
||||
tRef.unsafeSet(self.tSize, newSize, journal);
|
||||
if (!discard) {
|
||||
return removed;
|
||||
}
|
||||
}));
|
||||
/** @internal */
|
||||
const retainIf = exports.retainIf = /*#__PURE__*/(0, _Function.dual)(args => isTMap(args[0]), (self, predicate, options) => removeIf(self, (key, value) => !predicate(key, value), options));
|
||||
/** @internal */
|
||||
const set = exports.set = /*#__PURE__*/(0, _Function.dual)(3, (self, key, value) => {
|
||||
const resize = (journal, buckets) => {
|
||||
const capacity = buckets.chunk.length;
|
||||
const newCapacity = capacity << 1;
|
||||
const newBuckets = Array.from({
|
||||
length: newCapacity
|
||||
}, () => Chunk.empty());
|
||||
let index = 0;
|
||||
while (index < capacity) {
|
||||
const pairs = tRef.unsafeGet(buckets.chunk[index], journal);
|
||||
const iterator = pairs[Symbol.iterator]();
|
||||
let next;
|
||||
while ((next = iterator.next()) && !next.done) {
|
||||
const newIndex = indexOf(next.value[0], newCapacity);
|
||||
newBuckets[newIndex] = Chunk.prepend(newBuckets[newIndex], next.value);
|
||||
}
|
||||
index = index + 1;
|
||||
}
|
||||
// insert new pair
|
||||
const newIndex = indexOf(key, newCapacity);
|
||||
newBuckets[newIndex] = Chunk.prepend(newBuckets[newIndex], [key, value]);
|
||||
const newArray = [];
|
||||
index = 0;
|
||||
while (index < newCapacity) {
|
||||
newArray[index] = new tRef.TRefImpl(newBuckets[index]);
|
||||
index = index + 1;
|
||||
}
|
||||
const newTArray = new tArray.TArrayImpl(newArray);
|
||||
tRef.unsafeSet(self.tBuckets, newTArray, journal);
|
||||
};
|
||||
return core.effect(journal => {
|
||||
const buckets = tRef.unsafeGet(self.tBuckets, journal);
|
||||
const capacity = buckets.chunk.length;
|
||||
const index = indexOf(key, capacity);
|
||||
const bucket = tRef.unsafeGet(buckets.chunk[index], journal);
|
||||
const shouldUpdate = Chunk.some(bucket, entry => Equal.equals(key)(entry[0]));
|
||||
if (shouldUpdate) {
|
||||
const newBucket = Chunk.map(bucket, entry => Equal.equals(key)(entry[0]) ? [key, value] : entry);
|
||||
tRef.unsafeSet(buckets.chunk[index], newBucket, journal);
|
||||
} else {
|
||||
const newSize = tRef.unsafeGet(self.tSize, journal) + 1;
|
||||
tRef.unsafeSet(self.tSize, newSize, journal);
|
||||
if (capacity * LoadFactor < newSize) {
|
||||
resize(journal, buckets);
|
||||
} else {
|
||||
const newBucket = Chunk.prepend(bucket, [key, value]);
|
||||
tRef.unsafeSet(buckets.chunk[index], newBucket, journal);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
/** @internal */
|
||||
const setIfAbsent = exports.setIfAbsent = /*#__PURE__*/(0, _Function.dual)(3, (self, key, value) => core.flatMap(get(self, key), Option.match({
|
||||
onNone: () => set(self, key, value),
|
||||
onSome: () => stm.void
|
||||
})));
|
||||
/** @internal */
|
||||
const size = self => tRef.get(self.tSize);
|
||||
/** @internal */
|
||||
exports.size = size;
|
||||
const takeFirst = exports.takeFirst = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => (0, _Function.pipe)(core.effect(journal => {
|
||||
const buckets = tRef.unsafeGet(self.tBuckets, journal);
|
||||
const capacity = buckets.chunk.length;
|
||||
const size = tRef.unsafeGet(self.tSize, journal);
|
||||
let result = Option.none();
|
||||
let index = 0;
|
||||
while (index < capacity && Option.isNone(result)) {
|
||||
const bucket = tRef.unsafeGet(buckets.chunk[index], journal);
|
||||
const recreate = Chunk.some(bucket, entry => Option.isSome(pf(entry[0], entry[1])));
|
||||
if (recreate) {
|
||||
const iterator = bucket[Symbol.iterator]();
|
||||
let newBucket = Chunk.empty();
|
||||
let next;
|
||||
while ((next = iterator.next()) && !next.done && Option.isNone(result)) {
|
||||
const option = pf(next.value[0], next.value[1]);
|
||||
if (Option.isSome(option) && Option.isNone(result)) {
|
||||
result = option;
|
||||
} else {
|
||||
newBucket = Chunk.prepend(newBucket, next.value);
|
||||
}
|
||||
}
|
||||
tRef.unsafeSet(buckets.chunk[index], newBucket, journal);
|
||||
}
|
||||
index = index + 1;
|
||||
}
|
||||
if (Option.isSome(result)) {
|
||||
tRef.unsafeSet(self.tSize, size - 1, journal);
|
||||
}
|
||||
return result;
|
||||
}), stm.collect(option => Option.isSome(option) ? Option.some(option.value) : Option.none())));
|
||||
/** @internal */
|
||||
const takeFirstSTM = exports.takeFirstSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => (0, _Function.pipe)(findSTM(self, (key, value) => core.map(pf(key, value), a => [key, a])), stm.collect(option => Option.isSome(option) ? Option.some(option.value) : Option.none()), core.flatMap(entry => stm.as(remove(self, entry[0]), entry[1]))));
|
||||
/** @internal */
|
||||
const takeSome = exports.takeSome = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => (0, _Function.pipe)(core.effect(journal => {
|
||||
const buckets = tRef.unsafeGet(self.tBuckets, journal);
|
||||
const capacity = buckets.chunk.length;
|
||||
const builder = [];
|
||||
let newSize = 0;
|
||||
let index = 0;
|
||||
while (index < capacity) {
|
||||
const bucket = tRef.unsafeGet(buckets.chunk[index], journal);
|
||||
const recreate = Chunk.some(bucket, entry => Option.isSome(pf(entry[0], entry[1])));
|
||||
if (recreate) {
|
||||
const iterator = bucket[Symbol.iterator]();
|
||||
let newBucket = Chunk.empty();
|
||||
let next;
|
||||
while ((next = iterator.next()) && !next.done) {
|
||||
const option = pf(next.value[0], next.value[1]);
|
||||
if (Option.isSome(option)) {
|
||||
builder.push(option.value);
|
||||
} else {
|
||||
newBucket = Chunk.prepend(newBucket, next.value);
|
||||
newSize = newSize + 1;
|
||||
}
|
||||
}
|
||||
tRef.unsafeSet(buckets.chunk[index], newBucket, journal);
|
||||
} else {
|
||||
newSize = newSize + bucket.length;
|
||||
}
|
||||
index = index + 1;
|
||||
}
|
||||
tRef.unsafeSet(self.tSize, newSize, journal);
|
||||
if (builder.length > 0) {
|
||||
return Option.some(builder);
|
||||
}
|
||||
return Option.none();
|
||||
}), stm.collect(option => Option.isSome(option) ? Option.some(option.value) : Option.none())));
|
||||
/** @internal */
|
||||
const takeSomeSTM = exports.takeSomeSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => (0, _Function.pipe)(findAllSTM(self, (key, value) => core.map(pf(key, value), a => [key, a])), core.map(chunk => RA.isNonEmptyArray(chunk) ? Option.some(chunk) : Option.none()), stm.collect(option => Option.isSome(option) ? Option.some(option.value) : Option.none()), core.flatMap(entries => stm.as(removeAll(self, entries.map(entry => entry[0])), RA.map(entries, entry => entry[1])))));
|
||||
const toReadonlyArray = self => core.effect(journal => {
|
||||
const buckets = tRef.unsafeGet(self.tBuckets, journal);
|
||||
const capacity = buckets.chunk.length;
|
||||
const builder = [];
|
||||
let index = 0;
|
||||
while (index < capacity) {
|
||||
const bucket = buckets.chunk[index];
|
||||
for (const entry of tRef.unsafeGet(bucket, journal)) {
|
||||
builder.push(entry);
|
||||
}
|
||||
index = index + 1;
|
||||
}
|
||||
return builder;
|
||||
});
|
||||
/** @internal */
|
||||
const toChunk = self => reduce(self, Chunk.empty(), (acc, value, key) => Chunk.append(acc, [key, value]));
|
||||
/** @internal */
|
||||
exports.toChunk = toChunk;
|
||||
const toHashMap = self => reduce(self, HashMap.empty(), (acc, value, key) => (0, _Function.pipe)(acc, HashMap.set(key, value)));
|
||||
/** @internal */
|
||||
exports.toHashMap = toHashMap;
|
||||
const toArray = self => reduce(self, [], (acc, value, key) => {
|
||||
acc.unshift([key, value]);
|
||||
return acc;
|
||||
});
|
||||
/** @internal */
|
||||
exports.toArray = toArray;
|
||||
const toMap = self => reduce(self, new Map(), (acc, value, key) => acc.set(key, value));
|
||||
/** @internal */
|
||||
exports.toMap = toMap;
|
||||
const transform = exports.transform = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => core.effect(journal => {
|
||||
const buckets = (0, _Function.pipe)(self.tBuckets, tRef.unsafeGet(journal));
|
||||
const capacity = buckets.chunk.length;
|
||||
const newBuckets = Array.from({
|
||||
length: capacity
|
||||
}, () => Chunk.empty());
|
||||
let newSize = 0;
|
||||
let index = 0;
|
||||
while (index < capacity) {
|
||||
const bucket = buckets.chunk[index];
|
||||
const pairs = tRef.unsafeGet(bucket, journal);
|
||||
const iterator = pairs[Symbol.iterator]();
|
||||
let next;
|
||||
while ((next = iterator.next()) && !next.done) {
|
||||
const newPair = f(next.value[0], next.value[1]);
|
||||
const index = indexOf(newPair[0], capacity);
|
||||
const newBucket = newBuckets[index];
|
||||
if (!Chunk.some(newBucket, entry => Equal.equals(entry[0], newPair[0]))) {
|
||||
newBuckets[index] = Chunk.prepend(newBucket, newPair);
|
||||
newSize = newSize + 1;
|
||||
}
|
||||
}
|
||||
index = index + 1;
|
||||
}
|
||||
index = 0;
|
||||
while (index < capacity) {
|
||||
tRef.unsafeSet(buckets.chunk[index], newBuckets[index], journal);
|
||||
index = index + 1;
|
||||
}
|
||||
tRef.unsafeSet(self.tSize, newSize, journal);
|
||||
}));
|
||||
/** @internal */
|
||||
const transformSTM = exports.transformSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => (0, _Function.pipe)(core.flatMap(toReadonlyArray(self), stm.forEach(entry => f(entry[0], entry[1]))), core.flatMap(newData => core.effect(journal => {
|
||||
const buckets = tRef.unsafeGet(self.tBuckets, journal);
|
||||
const capacity = buckets.chunk.length;
|
||||
const newBuckets = Array.from({
|
||||
length: capacity
|
||||
}, () => Chunk.empty());
|
||||
const iterator = newData[Symbol.iterator]();
|
||||
let newSize = 0;
|
||||
let next;
|
||||
while ((next = iterator.next()) && !next.done) {
|
||||
const index = indexOf(next.value[0], capacity);
|
||||
const newBucket = newBuckets[index];
|
||||
if (!Chunk.some(newBucket, entry => Equal.equals(entry[0])(next.value[0]))) {
|
||||
newBuckets[index] = Chunk.prepend(newBucket, next.value);
|
||||
newSize = newSize + 1;
|
||||
}
|
||||
}
|
||||
let index = 0;
|
||||
while (index < capacity) {
|
||||
tRef.unsafeSet(buckets.chunk[index], newBuckets[index], journal);
|
||||
index = index + 1;
|
||||
}
|
||||
tRef.unsafeSet(self.tSize, newSize, journal);
|
||||
}))));
|
||||
/** @internal */
|
||||
const transformValues = exports.transformValues = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => transform(self, (key, value) => [key, f(value)]));
|
||||
/** @internal */
|
||||
const transformValuesSTM = exports.transformValuesSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => transformSTM(self, (key, value) => core.map(f(value), value => [key, value])));
|
||||
/** @internal */
|
||||
const updateWith = exports.updateWith = /*#__PURE__*/(0, _Function.dual)(3, (self, key, f) => core.flatMap(get(self, key), option => Option.match(f(option), {
|
||||
onNone: () => stm.as(remove(self, key), Option.none()),
|
||||
onSome: value => stm.as(set(self, key, value), Option.some(value))
|
||||
})));
|
||||
/** @internal */
|
||||
const values = self => core.map(toReadonlyArray(self), RA.map(entry => entry[1]));
|
||||
exports.values = values;
|
||||
//# sourceMappingURL=tMap.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tMap.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tMap.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
164
_node_modules/effect/dist/cjs/internal/stm/tPriorityQueue.js
generated
vendored
Normal file
164
_node_modules/effect/dist/cjs/internal/stm/tPriorityQueue.js
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toChunk = exports.toArray = exports.takeUpTo = exports.takeOption = exports.takeAll = exports.take = exports.size = exports.retainIf = exports.removeIf = exports.peekOption = exports.peek = exports.offerAll = exports.offer = exports.make = exports.isNonEmpty = exports.isEmpty = exports.fromIterable = exports.empty = exports.TPriorityQueueTypeId = exports.TPriorityQueueImpl = void 0;
|
||||
var Arr = _interopRequireWildcard(require("../../Array.js"));
|
||||
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var SortedMap = _interopRequireWildcard(require("../../SortedMap.js"));
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var tRef = _interopRequireWildcard(require("./tRef.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const TPriorityQueueSymbolKey = "effect/TPriorityQueue";
|
||||
/** @internal */
|
||||
const TPriorityQueueTypeId = exports.TPriorityQueueTypeId = /*#__PURE__*/Symbol.for(TPriorityQueueSymbolKey);
|
||||
const tPriorityQueueVariance = {
|
||||
/* c8 ignore next */
|
||||
_A: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
class TPriorityQueueImpl {
|
||||
ref;
|
||||
[TPriorityQueueTypeId] = tPriorityQueueVariance;
|
||||
constructor(ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
exports.TPriorityQueueImpl = TPriorityQueueImpl;
|
||||
const empty = order => (0, _Function.pipe)(tRef.make(SortedMap.empty(order)), core.map(ref => new TPriorityQueueImpl(ref)));
|
||||
/** @internal */
|
||||
exports.empty = empty;
|
||||
const fromIterable = order => iterable => (0, _Function.pipe)(tRef.make(Arr.fromIterable(iterable).reduce((map, value) => (0, _Function.pipe)(map, SortedMap.set(value, (0, _Function.pipe)(map, SortedMap.get(value), Option.match({
|
||||
onNone: () => Arr.of(value),
|
||||
onSome: Arr.prepend(value)
|
||||
})))), SortedMap.empty(order))), core.map(ref => new TPriorityQueueImpl(ref)));
|
||||
/** @internal */
|
||||
exports.fromIterable = fromIterable;
|
||||
const isEmpty = self => core.map(tRef.get(self.ref), SortedMap.isEmpty);
|
||||
/** @internal */
|
||||
exports.isEmpty = isEmpty;
|
||||
const isNonEmpty = self => core.map(tRef.get(self.ref), SortedMap.isNonEmpty);
|
||||
/** @internal */
|
||||
exports.isNonEmpty = isNonEmpty;
|
||||
const make = order => (...elements) => fromIterable(order)(elements);
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const offer = exports.offer = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => tRef.update(self.ref, map => SortedMap.set(map, value, Option.match(SortedMap.get(map, value), {
|
||||
onNone: () => Arr.of(value),
|
||||
onSome: Arr.prepend(value)
|
||||
}))));
|
||||
/** @internal */
|
||||
const offerAll = exports.offerAll = /*#__PURE__*/(0, _Function.dual)(2, (self, values) => tRef.update(self.ref, map => Arr.fromIterable(values).reduce((map, value) => SortedMap.set(map, value, Option.match(SortedMap.get(map, value), {
|
||||
onNone: () => Arr.of(value),
|
||||
onSome: Arr.prepend(value)
|
||||
})), map)));
|
||||
/** @internal */
|
||||
const peek = self => core.withSTMRuntime(runtime => {
|
||||
const map = tRef.unsafeGet(self.ref, runtime.journal);
|
||||
return Option.match(SortedMap.headOption(map), {
|
||||
onNone: () => core.retry,
|
||||
onSome: elements => core.succeed(elements[0])
|
||||
});
|
||||
});
|
||||
/** @internal */
|
||||
exports.peek = peek;
|
||||
const peekOption = self => tRef.modify(self.ref, map => [Option.map(SortedMap.headOption(map), elements => elements[0]), map]);
|
||||
/** @internal */
|
||||
exports.peekOption = peekOption;
|
||||
const removeIf = exports.removeIf = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => retainIf(self, a => !predicate(a)));
|
||||
/** @internal */
|
||||
const retainIf = exports.retainIf = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => tRef.update(self.ref, map => SortedMap.reduce(map, SortedMap.empty(SortedMap.getOrder(map)), (map, value, key) => {
|
||||
const filtered = Arr.filter(value, predicate);
|
||||
return filtered.length > 0 ? SortedMap.set(map, key, filtered) : SortedMap.remove(map, key);
|
||||
})));
|
||||
/** @internal */
|
||||
const size = self => tRef.modify(self.ref, map => [SortedMap.reduce(map, 0, (n, as) => n + as.length), map]);
|
||||
/** @internal */
|
||||
exports.size = size;
|
||||
const take = self => core.withSTMRuntime(runtime => {
|
||||
const map = tRef.unsafeGet(self.ref, runtime.journal);
|
||||
return Option.match(SortedMap.headOption(map), {
|
||||
onNone: () => core.retry,
|
||||
onSome: values => {
|
||||
const head = values[1][0];
|
||||
const tail = values[1].slice(1);
|
||||
tRef.unsafeSet(self.ref, tail.length > 0 ? SortedMap.set(map, head, tail) : SortedMap.remove(map, head), runtime.journal);
|
||||
return core.succeed(head);
|
||||
}
|
||||
});
|
||||
});
|
||||
/** @internal */
|
||||
exports.take = take;
|
||||
const takeAll = self => tRef.modify(self.ref, map => {
|
||||
const builder = [];
|
||||
for (const entry of map) {
|
||||
for (const value of entry[1]) {
|
||||
builder.push(value);
|
||||
}
|
||||
}
|
||||
return [builder, SortedMap.empty(SortedMap.getOrder(map))];
|
||||
});
|
||||
/** @internal */
|
||||
exports.takeAll = takeAll;
|
||||
const takeOption = self => core.effect(journal => {
|
||||
const map = (0, _Function.pipe)(self.ref, tRef.unsafeGet(journal));
|
||||
return Option.match(SortedMap.headOption(map), {
|
||||
onNone: () => Option.none(),
|
||||
onSome: ([key, value]) => {
|
||||
const tail = value.slice(1);
|
||||
tRef.unsafeSet(self.ref, tail.length > 0 ? SortedMap.set(map, key, tail) : SortedMap.remove(map, key), journal);
|
||||
return Option.some(value[0]);
|
||||
}
|
||||
});
|
||||
});
|
||||
/** @internal */
|
||||
exports.takeOption = takeOption;
|
||||
const takeUpTo = exports.takeUpTo = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => tRef.modify(self.ref, map => {
|
||||
const builder = [];
|
||||
const iterator = map[Symbol.iterator]();
|
||||
let updated = map;
|
||||
let index = 0;
|
||||
let next;
|
||||
while ((next = iterator.next()) && !next.done && index < n) {
|
||||
const [key, value] = next.value;
|
||||
const [left, right] = (0, _Function.pipe)(value, Arr.splitAt(n - index));
|
||||
for (const value of left) {
|
||||
builder.push(value);
|
||||
}
|
||||
if (right.length > 0) {
|
||||
updated = SortedMap.set(updated, key, right);
|
||||
} else {
|
||||
updated = SortedMap.remove(updated, key);
|
||||
}
|
||||
index = index + left.length;
|
||||
}
|
||||
return [builder, updated];
|
||||
}));
|
||||
/** @internal */
|
||||
const toChunk = self => tRef.modify(self.ref, map => {
|
||||
const builder = [];
|
||||
for (const entry of map) {
|
||||
for (const value of entry[1]) {
|
||||
builder.push(value);
|
||||
}
|
||||
}
|
||||
return [Chunk.unsafeFromArray(builder), map];
|
||||
});
|
||||
/** @internal */
|
||||
exports.toChunk = toChunk;
|
||||
const toArray = self => tRef.modify(self.ref, map => {
|
||||
const builder = [];
|
||||
for (const entry of map) {
|
||||
for (const value of entry[1]) {
|
||||
builder.push(value);
|
||||
}
|
||||
}
|
||||
return [builder, map];
|
||||
});
|
||||
exports.toArray = toArray;
|
||||
//# sourceMappingURL=tPriorityQueue.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tPriorityQueue.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tPriorityQueue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
397
_node_modules/effect/dist/cjs/internal/stm/tPubSub.js
generated
vendored
Normal file
397
_node_modules/effect/dist/cjs/internal/stm/tPubSub.js
generated
vendored
Normal file
@@ -0,0 +1,397 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.unbounded = exports.subscribeScoped = exports.subscribe = exports.sliding = exports.size = exports.shutdown = exports.publishAll = exports.publish = exports.makeNode = exports.isShutdown = exports.isFull = exports.isEmpty = exports.dropping = exports.capacity = exports.bounded = exports.awaitShutdown = exports.TPubSubTypeId = void 0;
|
||||
var RA = _interopRequireWildcard(require("../../Array.js"));
|
||||
var Effect = _interopRequireWildcard(require("../../Effect.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var HashSet = _interopRequireWildcard(require("../../HashSet.js"));
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var OpCodes = _interopRequireWildcard(require("./opCodes/strategy.js"));
|
||||
var stm = _interopRequireWildcard(require("./stm.js"));
|
||||
var tQueue = _interopRequireWildcard(require("./tQueue.js"));
|
||||
var tRef = _interopRequireWildcard(require("./tRef.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const TPubSubSymbolKey = "effect/TPubSub";
|
||||
/** @internal */
|
||||
const TPubSubTypeId = exports.TPubSubTypeId = /*#__PURE__*/Symbol.for(TPubSubSymbolKey);
|
||||
const AbsentValue = /*#__PURE__*/Symbol.for("effect/TPubSub/AbsentValue");
|
||||
/** @internal */
|
||||
const makeNode = (head, subscribers, tail) => ({
|
||||
head,
|
||||
subscribers,
|
||||
tail
|
||||
});
|
||||
/** @internal */
|
||||
exports.makeNode = makeNode;
|
||||
class TPubSubImpl {
|
||||
pubsubSize;
|
||||
publisherHead;
|
||||
publisherTail;
|
||||
requestedCapacity;
|
||||
strategy;
|
||||
subscriberCount;
|
||||
subscribers;
|
||||
[TPubSubTypeId] = {
|
||||
_A: _ => _
|
||||
};
|
||||
[tQueue.TEnqueueTypeId] = tQueue.tEnqueueVariance;
|
||||
constructor(pubsubSize, publisherHead, publisherTail, requestedCapacity, strategy, subscriberCount, subscribers) {
|
||||
this.pubsubSize = pubsubSize;
|
||||
this.publisherHead = publisherHead;
|
||||
this.publisherTail = publisherTail;
|
||||
this.requestedCapacity = requestedCapacity;
|
||||
this.strategy = strategy;
|
||||
this.subscriberCount = subscriberCount;
|
||||
this.subscribers = subscribers;
|
||||
}
|
||||
isShutdown = /*#__PURE__*/core.effect(journal => {
|
||||
const currentPublisherTail = tRef.unsafeGet(this.publisherTail, journal);
|
||||
return currentPublisherTail === undefined;
|
||||
});
|
||||
awaitShutdown = /*#__PURE__*/core.flatMap(this.isShutdown, isShutdown => isShutdown ? stm.void : core.retry);
|
||||
capacity() {
|
||||
return this.requestedCapacity;
|
||||
}
|
||||
size = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
const currentPublisherTail = tRef.unsafeGet(this.publisherTail, runtime.journal);
|
||||
if (currentPublisherTail === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
return core.succeed(tRef.unsafeGet(this.pubsubSize, runtime.journal));
|
||||
});
|
||||
isEmpty = /*#__PURE__*/core.map(this.size, size => size === 0);
|
||||
isFull = /*#__PURE__*/core.map(this.size, size => size === this.capacity());
|
||||
offer(value) {
|
||||
return core.withSTMRuntime(runtime => {
|
||||
const currentPublisherTail = tRef.unsafeGet(this.publisherTail, runtime.journal);
|
||||
if (currentPublisherTail === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
const currentSubscriberCount = tRef.unsafeGet(this.subscriberCount, runtime.journal);
|
||||
if (currentSubscriberCount === 0) {
|
||||
return core.succeed(true);
|
||||
}
|
||||
const currentPubSubSize = tRef.unsafeGet(this.pubsubSize, runtime.journal);
|
||||
if (currentPubSubSize < this.requestedCapacity) {
|
||||
const updatedPublisherTail = new tRef.TRefImpl(void 0);
|
||||
const updatedNode = makeNode(value, currentSubscriberCount, updatedPublisherTail);
|
||||
tRef.unsafeSet(currentPublisherTail, updatedNode, runtime.journal);
|
||||
tRef.unsafeSet(this.publisherTail, updatedPublisherTail, runtime.journal);
|
||||
tRef.unsafeSet(this.pubsubSize, currentPubSubSize + 1, runtime.journal);
|
||||
return core.succeed(true);
|
||||
}
|
||||
switch (this.strategy._tag) {
|
||||
case OpCodes.OP_BACKPRESSURE_STRATEGY:
|
||||
{
|
||||
return core.retry;
|
||||
}
|
||||
case OpCodes.OP_DROPPING_STRATEGY:
|
||||
{
|
||||
return core.succeed(false);
|
||||
}
|
||||
case OpCodes.OP_SLIDING_STRATEGY:
|
||||
{
|
||||
if (this.requestedCapacity > 0) {
|
||||
let currentPublisherHead = tRef.unsafeGet(this.publisherHead, runtime.journal);
|
||||
let loop = true;
|
||||
while (loop) {
|
||||
const node = tRef.unsafeGet(currentPublisherHead, runtime.journal);
|
||||
if (node === undefined) {
|
||||
return core.retry;
|
||||
}
|
||||
const head = node.head;
|
||||
const tail = node.tail;
|
||||
if (head !== AbsentValue) {
|
||||
const updatedNode = makeNode(AbsentValue, node.subscribers, node.tail);
|
||||
tRef.unsafeSet(currentPublisherHead, updatedNode, runtime.journal);
|
||||
tRef.unsafeSet(this.publisherHead, tail, runtime.journal);
|
||||
loop = false;
|
||||
} else {
|
||||
currentPublisherHead = tail;
|
||||
}
|
||||
}
|
||||
}
|
||||
const updatedPublisherTail = new tRef.TRefImpl(void 0);
|
||||
const updatedNode = makeNode(value, currentSubscriberCount, updatedPublisherTail);
|
||||
tRef.unsafeSet(currentPublisherTail, updatedNode, runtime.journal);
|
||||
tRef.unsafeSet(this.publisherTail, updatedPublisherTail, runtime.journal);
|
||||
return core.succeed(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
offerAll(iterable) {
|
||||
return core.map(stm.forEach(iterable, a => this.offer(a)), RA.every(_Function.identity));
|
||||
}
|
||||
shutdown = /*#__PURE__*/core.effect(journal => {
|
||||
const currentPublisherTail = tRef.unsafeGet(this.publisherTail, journal);
|
||||
if (currentPublisherTail !== undefined) {
|
||||
tRef.unsafeSet(this.publisherTail, void 0, journal);
|
||||
const currentSubscribers = tRef.unsafeGet(this.subscribers, journal);
|
||||
HashSet.forEach(currentSubscribers, subscriber => {
|
||||
tRef.unsafeSet(subscriber, void 0, journal);
|
||||
});
|
||||
tRef.unsafeSet(this.subscribers, HashSet.empty(), journal);
|
||||
}
|
||||
});
|
||||
}
|
||||
/** @internal */
|
||||
class TPubSubSubscriptionImpl {
|
||||
pubsubSize;
|
||||
publisherHead;
|
||||
requestedCapacity;
|
||||
subscriberHead;
|
||||
subscriberCount;
|
||||
subscribers;
|
||||
[TPubSubTypeId] = TPubSubTypeId;
|
||||
[tQueue.TDequeueTypeId] = tQueue.tDequeueVariance;
|
||||
constructor(pubsubSize, publisherHead, requestedCapacity, subscriberHead, subscriberCount, subscribers) {
|
||||
this.pubsubSize = pubsubSize;
|
||||
this.publisherHead = publisherHead;
|
||||
this.requestedCapacity = requestedCapacity;
|
||||
this.subscriberHead = subscriberHead;
|
||||
this.subscriberCount = subscriberCount;
|
||||
this.subscribers = subscribers;
|
||||
}
|
||||
isShutdown = /*#__PURE__*/core.effect(journal => {
|
||||
const currentSubscriberHead = tRef.unsafeGet(this.subscriberHead, journal);
|
||||
return currentSubscriberHead === undefined;
|
||||
});
|
||||
awaitShutdown = /*#__PURE__*/core.flatMap(this.isShutdown, isShutdown => isShutdown ? stm.void : core.retry);
|
||||
capacity() {
|
||||
return this.requestedCapacity;
|
||||
}
|
||||
size = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
let currentSubscriberHead = tRef.unsafeGet(this.subscriberHead, runtime.journal);
|
||||
if (currentSubscriberHead === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
let loop = true;
|
||||
let size = 0;
|
||||
while (loop) {
|
||||
const node = tRef.unsafeGet(currentSubscriberHead, runtime.journal);
|
||||
if (node === undefined) {
|
||||
loop = false;
|
||||
} else {
|
||||
const head = node.head;
|
||||
const tail = node.tail;
|
||||
if (head !== AbsentValue) {
|
||||
size = size + 1;
|
||||
if (size >= Number.MAX_SAFE_INTEGER) {
|
||||
loop = false;
|
||||
}
|
||||
}
|
||||
currentSubscriberHead = tail;
|
||||
}
|
||||
}
|
||||
return core.succeed(size);
|
||||
});
|
||||
isEmpty = /*#__PURE__*/core.map(this.size, size => size === 0);
|
||||
isFull = /*#__PURE__*/core.map(this.size, size => size === this.capacity());
|
||||
peek = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
let currentSubscriberHead = tRef.unsafeGet(this.subscriberHead, runtime.journal);
|
||||
if (currentSubscriberHead === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
let value = AbsentValue;
|
||||
let loop = true;
|
||||
while (loop) {
|
||||
const node = tRef.unsafeGet(currentSubscriberHead, runtime.journal);
|
||||
if (node === undefined) {
|
||||
return core.retry;
|
||||
}
|
||||
const head = node.head;
|
||||
const tail = node.tail;
|
||||
if (head !== AbsentValue) {
|
||||
value = head;
|
||||
loop = false;
|
||||
} else {
|
||||
currentSubscriberHead = tail;
|
||||
}
|
||||
}
|
||||
return core.succeed(value);
|
||||
});
|
||||
peekOption = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
let currentSubscriberHead = tRef.unsafeGet(this.subscriberHead, runtime.journal);
|
||||
if (currentSubscriberHead === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
let value = Option.none();
|
||||
let loop = true;
|
||||
while (loop) {
|
||||
const node = tRef.unsafeGet(currentSubscriberHead, runtime.journal);
|
||||
if (node === undefined) {
|
||||
value = Option.none();
|
||||
loop = false;
|
||||
} else {
|
||||
const head = node.head;
|
||||
const tail = node.tail;
|
||||
if (head !== AbsentValue) {
|
||||
value = Option.some(head);
|
||||
loop = false;
|
||||
} else {
|
||||
currentSubscriberHead = tail;
|
||||
}
|
||||
}
|
||||
}
|
||||
return core.succeed(value);
|
||||
});
|
||||
shutdown = /*#__PURE__*/core.effect(journal => {
|
||||
let currentSubscriberHead = tRef.unsafeGet(this.subscriberHead, journal);
|
||||
if (currentSubscriberHead !== undefined) {
|
||||
tRef.unsafeSet(this.subscriberHead, void 0, journal);
|
||||
let loop = true;
|
||||
while (loop) {
|
||||
const node = tRef.unsafeGet(currentSubscriberHead, journal);
|
||||
if (node === undefined) {
|
||||
loop = false;
|
||||
} else {
|
||||
const head = node.head;
|
||||
const tail = node.tail;
|
||||
if (head !== AbsentValue) {
|
||||
const subscribers = node.subscribers;
|
||||
if (subscribers === 1) {
|
||||
const size = tRef.unsafeGet(this.pubsubSize, journal);
|
||||
const updatedNode = makeNode(AbsentValue, 0, tail);
|
||||
tRef.unsafeSet(currentSubscriberHead, updatedNode, journal);
|
||||
tRef.unsafeSet(this.publisherHead, tail, journal);
|
||||
tRef.unsafeSet(this.pubsubSize, size - 1, journal);
|
||||
} else {
|
||||
const updatedNode = makeNode(head, subscribers - 1, tail);
|
||||
tRef.unsafeSet(currentSubscriberHead, updatedNode, journal);
|
||||
}
|
||||
}
|
||||
currentSubscriberHead = tail;
|
||||
}
|
||||
}
|
||||
const currentSubscriberCount = tRef.unsafeGet(this.subscriberCount, journal);
|
||||
tRef.unsafeSet(this.subscriberCount, currentSubscriberCount - 1, journal);
|
||||
tRef.unsafeSet(this.subscribers, HashSet.remove(tRef.unsafeGet(this.subscribers, journal), this.subscriberHead), journal);
|
||||
}
|
||||
});
|
||||
take = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
let currentSubscriberHead = tRef.unsafeGet(this.subscriberHead, runtime.journal);
|
||||
if (currentSubscriberHead === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
let value = AbsentValue;
|
||||
let loop = true;
|
||||
while (loop) {
|
||||
const node = tRef.unsafeGet(currentSubscriberHead, runtime.journal);
|
||||
if (node === undefined) {
|
||||
return core.retry;
|
||||
}
|
||||
const head = node.head;
|
||||
const tail = node.tail;
|
||||
if (head !== AbsentValue) {
|
||||
const subscribers = node.subscribers;
|
||||
if (subscribers === 1) {
|
||||
const size = tRef.unsafeGet(this.pubsubSize, runtime.journal);
|
||||
const updatedNode = makeNode(AbsentValue, 0, tail);
|
||||
tRef.unsafeSet(currentSubscriberHead, updatedNode, runtime.journal);
|
||||
tRef.unsafeSet(this.publisherHead, tail, runtime.journal);
|
||||
tRef.unsafeSet(this.pubsubSize, size - 1, runtime.journal);
|
||||
} else {
|
||||
const updatedNode = makeNode(head, subscribers - 1, tail);
|
||||
tRef.unsafeSet(currentSubscriberHead, updatedNode, runtime.journal);
|
||||
}
|
||||
tRef.unsafeSet(this.subscriberHead, tail, runtime.journal);
|
||||
value = head;
|
||||
loop = false;
|
||||
} else {
|
||||
currentSubscriberHead = tail;
|
||||
}
|
||||
}
|
||||
return core.succeed(value);
|
||||
});
|
||||
takeAll = /*#__PURE__*/this.takeUpTo(Number.POSITIVE_INFINITY);
|
||||
takeUpTo(max) {
|
||||
return core.withSTMRuntime(runtime => {
|
||||
let currentSubscriberHead = tRef.unsafeGet(this.subscriberHead, runtime.journal);
|
||||
if (currentSubscriberHead === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
const builder = [];
|
||||
let n = 0;
|
||||
while (n !== max) {
|
||||
const node = tRef.unsafeGet(currentSubscriberHead, runtime.journal);
|
||||
if (node === undefined) {
|
||||
n = max;
|
||||
} else {
|
||||
const head = node.head;
|
||||
const tail = node.tail;
|
||||
if (head !== AbsentValue) {
|
||||
const subscribers = node.subscribers;
|
||||
if (subscribers === 1) {
|
||||
const size = tRef.unsafeGet(this.pubsubSize, runtime.journal);
|
||||
const updatedNode = makeNode(AbsentValue, 0, tail);
|
||||
tRef.unsafeSet(currentSubscriberHead, updatedNode, runtime.journal);
|
||||
tRef.unsafeSet(this.publisherHead, tail, runtime.journal);
|
||||
tRef.unsafeSet(this.pubsubSize, size - 1, runtime.journal);
|
||||
} else {
|
||||
const updatedNode = makeNode(head, subscribers - 1, tail);
|
||||
tRef.unsafeSet(currentSubscriberHead, updatedNode, runtime.journal);
|
||||
}
|
||||
builder.push(head);
|
||||
n = n + 1;
|
||||
}
|
||||
currentSubscriberHead = tail;
|
||||
}
|
||||
}
|
||||
tRef.unsafeSet(this.subscriberHead, currentSubscriberHead, runtime.journal);
|
||||
return core.succeed(builder);
|
||||
});
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const makeTPubSub = (requestedCapacity, strategy) => (0, _Function.pipe)(stm.all([tRef.make(void 0), tRef.make(0)]), core.flatMap(([empty, pubsubSize]) => (0, _Function.pipe)(stm.all([tRef.make(empty), tRef.make(empty), tRef.make(0), tRef.make(HashSet.empty())]), core.map(([publisherHead, publisherTail, subscriberCount, subscribers]) => new TPubSubImpl(pubsubSize, publisherHead, publisherTail, requestedCapacity, strategy, subscriberCount, subscribers)))));
|
||||
const makeSubscription = (pubsubSize, publisherHead, publisherTail, requestedCapacity, subscriberCount, subscribers) => (0, _Function.pipe)(tRef.get(publisherTail), core.flatMap(currentPublisherTail => (0, _Function.pipe)(stm.all([tRef.make(currentPublisherTail), tRef.get(subscriberCount), tRef.get(subscribers)]), stm.tap(([_, currentSubscriberCount]) => (0, _Function.pipe)(subscriberCount, tRef.set(currentSubscriberCount + 1))), stm.tap(([subscriberHead, _, currentSubscribers]) => (0, _Function.pipe)(subscribers, tRef.set((0, _Function.pipe)(currentSubscribers, HashSet.add(subscriberHead))))), core.map(([subscriberHead]) => new TPubSubSubscriptionImpl(pubsubSize, publisherHead, requestedCapacity, subscriberHead, subscriberCount, subscribers)))));
|
||||
/** @internal */
|
||||
const awaitShutdown = self => self.awaitShutdown;
|
||||
/** @internal */
|
||||
exports.awaitShutdown = awaitShutdown;
|
||||
const bounded = requestedCapacity => makeTPubSub(requestedCapacity, tQueue.BackPressure);
|
||||
/** @internal */
|
||||
exports.bounded = bounded;
|
||||
const capacity = self => self.capacity();
|
||||
/** @internal */
|
||||
exports.capacity = capacity;
|
||||
const dropping = requestedCapacity => makeTPubSub(requestedCapacity, tQueue.Dropping);
|
||||
/** @internal */
|
||||
exports.dropping = dropping;
|
||||
const isEmpty = self => self.isEmpty;
|
||||
/** @internal */
|
||||
exports.isEmpty = isEmpty;
|
||||
const isFull = self => self.isFull;
|
||||
/** @internal */
|
||||
exports.isFull = isFull;
|
||||
const isShutdown = self => self.isShutdown;
|
||||
/** @internal */
|
||||
exports.isShutdown = isShutdown;
|
||||
const publish = exports.publish = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => self.offer(value));
|
||||
/** @internal */
|
||||
const publishAll = exports.publishAll = /*#__PURE__*/(0, _Function.dual)(2, (self, iterable) => self.offerAll(iterable));
|
||||
/** @internal */
|
||||
const size = self => self.size;
|
||||
/** @internal */
|
||||
exports.size = size;
|
||||
const shutdown = self => self.shutdown;
|
||||
/** @internal */
|
||||
exports.shutdown = shutdown;
|
||||
const sliding = requestedCapacity => makeTPubSub(requestedCapacity, tQueue.Sliding);
|
||||
/** @internal */
|
||||
exports.sliding = sliding;
|
||||
const subscribe = self => makeSubscription(self.pubsubSize, self.publisherHead, self.publisherTail, self.requestedCapacity, self.subscriberCount, self.subscribers);
|
||||
/** @internal */
|
||||
exports.subscribe = subscribe;
|
||||
const subscribeScoped = self => Effect.acquireRelease(subscribe(self), dequeue => tQueue.shutdown(dequeue));
|
||||
/** @internal */
|
||||
exports.subscribeScoped = subscribeScoped;
|
||||
const unbounded = () => makeTPubSub(Number.MAX_SAFE_INTEGER, tQueue.Dropping);
|
||||
exports.unbounded = unbounded;
|
||||
//# sourceMappingURL=tPubSub.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tPubSub.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tPubSub.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
284
_node_modules/effect/dist/cjs/internal/stm/tQueue.js
generated
vendored
Normal file
284
_node_modules/effect/dist/cjs/internal/stm/tQueue.js
generated
vendored
Normal file
@@ -0,0 +1,284 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.unbounded = exports.takeUpTo = exports.takeN = exports.takeBetween = exports.takeAll = exports.take = exports.tEnqueueVariance = exports.tDequeueVariance = exports.sliding = exports.size = exports.shutdown = exports.seek = exports.poll = exports.peekOption = exports.peek = exports.offerAll = exports.offer = exports.isTQueue = exports.isTEnqueue = exports.isTDequeue = exports.isShutdown = exports.isFull = exports.isEmpty = exports.dropping = exports.capacity = exports.bounded = exports.awaitShutdown = exports.TEnqueueTypeId = exports.TDequeueTypeId = exports.Sliding = exports.Dropping = exports.BackPressure = void 0;
|
||||
var RA = _interopRequireWildcard(require("../../Array.js"));
|
||||
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var OpCodes = _interopRequireWildcard(require("./opCodes/strategy.js"));
|
||||
var stm = _interopRequireWildcard(require("./stm.js"));
|
||||
var tRef = _interopRequireWildcard(require("./tRef.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
const TEnqueueSymbolKey = "effect/TQueue/TEnqueue";
|
||||
/** @internal */
|
||||
const TEnqueueTypeId = exports.TEnqueueTypeId = /*#__PURE__*/Symbol.for(TEnqueueSymbolKey);
|
||||
const TDequeueSymbolKey = "effect/TQueue/TDequeue";
|
||||
/** @internal */
|
||||
const TDequeueTypeId = exports.TDequeueTypeId = /*#__PURE__*/Symbol.for(TDequeueSymbolKey);
|
||||
/** @internal */
|
||||
const BackPressure = exports.BackPressure = {
|
||||
_tag: OpCodes.OP_BACKPRESSURE_STRATEGY
|
||||
};
|
||||
/** @internal */
|
||||
const Dropping = exports.Dropping = {
|
||||
_tag: OpCodes.OP_DROPPING_STRATEGY
|
||||
};
|
||||
/** @internal */
|
||||
const Sliding = exports.Sliding = {
|
||||
_tag: OpCodes.OP_SLIDING_STRATEGY
|
||||
};
|
||||
/** @internal */
|
||||
const tDequeueVariance = exports.tDequeueVariance = {
|
||||
/* c8 ignore next */
|
||||
_Out: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
const tEnqueueVariance = exports.tEnqueueVariance = {
|
||||
/* c8 ignore next */
|
||||
_In: _ => _
|
||||
};
|
||||
class TQueueImpl {
|
||||
ref;
|
||||
requestedCapacity;
|
||||
strategy;
|
||||
[TDequeueTypeId] = tDequeueVariance;
|
||||
[TEnqueueTypeId] = tEnqueueVariance;
|
||||
constructor(ref, requestedCapacity, strategy) {
|
||||
this.ref = ref;
|
||||
this.requestedCapacity = requestedCapacity;
|
||||
this.strategy = strategy;
|
||||
}
|
||||
capacity() {
|
||||
return this.requestedCapacity;
|
||||
}
|
||||
size = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
const queue = tRef.unsafeGet(this.ref, runtime.journal);
|
||||
if (queue === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
return core.succeed(queue.length);
|
||||
});
|
||||
isFull = /*#__PURE__*/core.map(this.size, size => size === this.requestedCapacity);
|
||||
isEmpty = /*#__PURE__*/core.map(this.size, size => size === 0);
|
||||
shutdown = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
tRef.unsafeSet(this.ref, void 0, runtime.journal);
|
||||
return stm.void;
|
||||
});
|
||||
isShutdown = /*#__PURE__*/core.effect(journal => {
|
||||
const queue = tRef.unsafeGet(this.ref, journal);
|
||||
return queue === undefined;
|
||||
});
|
||||
awaitShutdown = /*#__PURE__*/core.flatMap(this.isShutdown, isShutdown => isShutdown ? stm.void : core.retry);
|
||||
offer(value) {
|
||||
return core.withSTMRuntime(runtime => {
|
||||
const queue = (0, _Function.pipe)(this.ref, tRef.unsafeGet(runtime.journal));
|
||||
if (queue === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
if (queue.length < this.requestedCapacity) {
|
||||
queue.push(value);
|
||||
tRef.unsafeSet(this.ref, queue, runtime.journal);
|
||||
return core.succeed(true);
|
||||
}
|
||||
switch (this.strategy._tag) {
|
||||
case OpCodes.OP_BACKPRESSURE_STRATEGY:
|
||||
{
|
||||
return core.retry;
|
||||
}
|
||||
case OpCodes.OP_DROPPING_STRATEGY:
|
||||
{
|
||||
return core.succeed(false);
|
||||
}
|
||||
case OpCodes.OP_SLIDING_STRATEGY:
|
||||
{
|
||||
if (queue.length === 0) {
|
||||
return core.succeed(true);
|
||||
}
|
||||
queue.shift();
|
||||
queue.push(value);
|
||||
tRef.unsafeSet(this.ref, queue, runtime.journal);
|
||||
return core.succeed(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
offerAll(iterable) {
|
||||
return core.withSTMRuntime(runtime => {
|
||||
const as = Array.from(iterable);
|
||||
const queue = tRef.unsafeGet(this.ref, runtime.journal);
|
||||
if (queue === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
if (queue.length + as.length <= this.requestedCapacity) {
|
||||
tRef.unsafeSet(this.ref, [...queue, ...as], runtime.journal);
|
||||
return core.succeed(true);
|
||||
}
|
||||
switch (this.strategy._tag) {
|
||||
case OpCodes.OP_BACKPRESSURE_STRATEGY:
|
||||
{
|
||||
return core.retry;
|
||||
}
|
||||
case OpCodes.OP_DROPPING_STRATEGY:
|
||||
{
|
||||
const forQueue = as.slice(0, this.requestedCapacity - queue.length);
|
||||
tRef.unsafeSet(this.ref, [...queue, ...forQueue], runtime.journal);
|
||||
return core.succeed(false);
|
||||
}
|
||||
case OpCodes.OP_SLIDING_STRATEGY:
|
||||
{
|
||||
const forQueue = as.slice(0, this.requestedCapacity - queue.length);
|
||||
const toDrop = queue.length + forQueue.length - this.requestedCapacity;
|
||||
const newQueue = queue.slice(toDrop);
|
||||
tRef.unsafeSet(this.ref, [...newQueue, ...forQueue], runtime.journal);
|
||||
return core.succeed(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
peek = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
const queue = tRef.unsafeGet(this.ref, runtime.journal);
|
||||
if (queue === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
if (queue.length === 0) {
|
||||
return core.retry;
|
||||
}
|
||||
return core.succeed(queue[0]);
|
||||
});
|
||||
peekOption = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
const queue = tRef.unsafeGet(this.ref, runtime.journal);
|
||||
if (queue === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
return core.succeed(Option.fromNullable(queue[0]));
|
||||
});
|
||||
take = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
const queue = tRef.unsafeGet(this.ref, runtime.journal);
|
||||
if (queue === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
if (queue.length === 0) {
|
||||
return core.retry;
|
||||
}
|
||||
const dequeued = queue.shift();
|
||||
tRef.unsafeSet(this.ref, queue, runtime.journal);
|
||||
return core.succeed(dequeued);
|
||||
});
|
||||
takeAll = /*#__PURE__*/core.withSTMRuntime(runtime => {
|
||||
const queue = tRef.unsafeGet(this.ref, runtime.journal);
|
||||
if (queue === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
tRef.unsafeSet(this.ref, [], runtime.journal);
|
||||
return core.succeed(queue);
|
||||
});
|
||||
takeUpTo(max) {
|
||||
return core.withSTMRuntime(runtime => {
|
||||
const queue = tRef.unsafeGet(this.ref, runtime.journal);
|
||||
if (queue === undefined) {
|
||||
return core.interruptAs(runtime.fiberId);
|
||||
}
|
||||
const [toTake, remaining] = Chunk.splitAt(Chunk.unsafeFromArray(queue), max);
|
||||
tRef.unsafeSet(this.ref, Array.from(remaining), runtime.journal);
|
||||
return core.succeed(Array.from(toTake));
|
||||
});
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const isTQueue = u => {
|
||||
return isTEnqueue(u) && isTDequeue(u);
|
||||
};
|
||||
/** @internal */
|
||||
exports.isTQueue = isTQueue;
|
||||
const isTEnqueue = u => (0, _Predicate.hasProperty)(u, TEnqueueTypeId);
|
||||
/** @internal */
|
||||
exports.isTEnqueue = isTEnqueue;
|
||||
const isTDequeue = u => (0, _Predicate.hasProperty)(u, TDequeueTypeId);
|
||||
/** @internal */
|
||||
exports.isTDequeue = isTDequeue;
|
||||
const awaitShutdown = self => self.awaitShutdown;
|
||||
/** @internal */
|
||||
exports.awaitShutdown = awaitShutdown;
|
||||
const bounded = requestedCapacity => makeQueue(requestedCapacity, BackPressure);
|
||||
/** @internal */
|
||||
exports.bounded = bounded;
|
||||
const capacity = self => {
|
||||
return self.capacity();
|
||||
};
|
||||
/** @internal */
|
||||
exports.capacity = capacity;
|
||||
const dropping = requestedCapacity => makeQueue(requestedCapacity, Dropping);
|
||||
/** @internal */
|
||||
exports.dropping = dropping;
|
||||
const isEmpty = self => self.isEmpty;
|
||||
/** @internal */
|
||||
exports.isEmpty = isEmpty;
|
||||
const isFull = self => self.isFull;
|
||||
/** @internal */
|
||||
exports.isFull = isFull;
|
||||
const isShutdown = self => self.isShutdown;
|
||||
/** @internal */
|
||||
exports.isShutdown = isShutdown;
|
||||
const offer = exports.offer = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => self.offer(value));
|
||||
/** @internal */
|
||||
const offerAll = exports.offerAll = /*#__PURE__*/(0, _Function.dual)(2, (self, iterable) => self.offerAll(iterable));
|
||||
/** @internal */
|
||||
const peek = self => self.peek;
|
||||
/** @internal */
|
||||
exports.peek = peek;
|
||||
const peekOption = self => self.peekOption;
|
||||
/** @internal */
|
||||
exports.peekOption = peekOption;
|
||||
const poll = self => (0, _Function.pipe)(self.takeUpTo(1), core.map(RA.head));
|
||||
/** @internal */
|
||||
exports.poll = poll;
|
||||
const seek = exports.seek = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate) => seekLoop(self, predicate));
|
||||
const seekLoop = (self, predicate) => core.flatMap(self.take, a => predicate(a) ? core.succeed(a) : seekLoop(self, predicate));
|
||||
/** @internal */
|
||||
const shutdown = self => self.shutdown;
|
||||
/** @internal */
|
||||
exports.shutdown = shutdown;
|
||||
const size = self => self.size;
|
||||
/** @internal */
|
||||
exports.size = size;
|
||||
const sliding = requestedCapacity => makeQueue(requestedCapacity, Sliding);
|
||||
/** @internal */
|
||||
exports.sliding = sliding;
|
||||
const take = self => self.take;
|
||||
/** @internal */
|
||||
exports.take = take;
|
||||
const takeAll = self => self.takeAll;
|
||||
/** @internal */
|
||||
exports.takeAll = takeAll;
|
||||
const takeBetween = exports.takeBetween = /*#__PURE__*/(0, _Function.dual)(3, (self, min, max) => stm.suspend(() => {
|
||||
const takeRemainder = (min, max, acc) => {
|
||||
if (max < min) {
|
||||
return core.succeed(acc);
|
||||
}
|
||||
return (0, _Function.pipe)(self.takeUpTo(max), core.flatMap(taken => {
|
||||
const remaining = min - taken.length;
|
||||
if (remaining === 1) {
|
||||
return (0, _Function.pipe)(self.take, core.map(a => (0, _Function.pipe)(acc, Chunk.appendAll(Chunk.unsafeFromArray(taken)), Chunk.append(a))));
|
||||
}
|
||||
if (remaining > 1) {
|
||||
return (0, _Function.pipe)(self.take, core.flatMap(a => takeRemainder(remaining - 1, max - taken.length - 1, (0, _Function.pipe)(acc, Chunk.appendAll(Chunk.unsafeFromArray(taken)), Chunk.append(a)))));
|
||||
}
|
||||
return core.succeed((0, _Function.pipe)(acc, Chunk.appendAll(Chunk.unsafeFromArray(taken))));
|
||||
}));
|
||||
};
|
||||
return core.map(takeRemainder(min, max, Chunk.empty()), c => Array.from(c));
|
||||
}));
|
||||
/** @internal */
|
||||
const takeN = exports.takeN = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => (0, _Function.pipe)(self, takeBetween(n, n)));
|
||||
/** @internal */
|
||||
const takeUpTo = exports.takeUpTo = /*#__PURE__*/(0, _Function.dual)(2, (self, max) => self.takeUpTo(max));
|
||||
/** @internal */
|
||||
const unbounded = () => makeQueue(Number.MAX_SAFE_INTEGER, Dropping);
|
||||
exports.unbounded = unbounded;
|
||||
const makeQueue = (requestedCapacity, strategy) => core.map(tRef.make([]), ref => new TQueueImpl(ref, requestedCapacity, strategy));
|
||||
//# sourceMappingURL=tQueue.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tQueue.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tQueue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
92
_node_modules/effect/dist/cjs/internal/stm/tRandom.js
generated
vendored
Normal file
92
_node_modules/effect/dist/cjs/internal/stm/tRandom.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.shuffle = exports.nextRange = exports.nextIntBetween = exports.nextInt = exports.nextBoolean = exports.next = exports.live = exports.Tag = exports.TRandomTypeId = void 0;
|
||||
var Context = _interopRequireWildcard(require("../../Context.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Layer = _interopRequireWildcard(require("../../Layer.js"));
|
||||
var Random = _interopRequireWildcard(require("../../Utils.js"));
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var stm = _interopRequireWildcard(require("./stm.js"));
|
||||
var tArray = _interopRequireWildcard(require("./tArray.js"));
|
||||
var tRef = _interopRequireWildcard(require("./tRef.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
const TRandomSymbolKey = "effect/TRandom";
|
||||
/** @internal */
|
||||
const TRandomTypeId = exports.TRandomTypeId = /*#__PURE__*/Symbol.for(TRandomSymbolKey);
|
||||
const randomInteger = state => {
|
||||
const prng = new Random.PCGRandom();
|
||||
prng.setState(state);
|
||||
return [prng.integer(0), prng.getState()];
|
||||
};
|
||||
const randomIntegerBetween = (low, high) => {
|
||||
return state => {
|
||||
const prng = new Random.PCGRandom();
|
||||
prng.setState(state);
|
||||
return [prng.integer(high - low) + low, prng.getState()];
|
||||
};
|
||||
};
|
||||
const randomNumber = state => {
|
||||
const prng = new Random.PCGRandom();
|
||||
prng.setState(state);
|
||||
return [prng.number(), prng.getState()];
|
||||
};
|
||||
const withState = (state, f) => {
|
||||
return (0, _Function.pipe)(state, tRef.modify(f));
|
||||
};
|
||||
const shuffleWith = (iterable, nextIntBounded) => {
|
||||
const swap = (buffer, index1, index2) => (0, _Function.pipe)(buffer, tArray.get(index1), core.flatMap(tmp => (0, _Function.pipe)(buffer, tArray.updateSTM(index1, () => (0, _Function.pipe)(buffer, tArray.get(index2))), core.zipRight((0, _Function.pipe)(buffer, tArray.update(index2, () => tmp))))));
|
||||
return (0, _Function.pipe)(tArray.fromIterable(iterable), core.flatMap(buffer => {
|
||||
const array = [];
|
||||
for (let i = array.length; i >= 2; i = i - 1) {
|
||||
array.push(i);
|
||||
}
|
||||
return (0, _Function.pipe)(array, stm.forEach(n => (0, _Function.pipe)(nextIntBounded(n), core.flatMap(k => swap(buffer, n - 1, k))), {
|
||||
discard: true
|
||||
}), core.zipRight(tArray.toArray(buffer)));
|
||||
}));
|
||||
};
|
||||
/** @internal */
|
||||
const Tag = exports.Tag = /*#__PURE__*/Context.GenericTag("effect/TRandom");
|
||||
class TRandomImpl {
|
||||
state;
|
||||
[TRandomTypeId] = TRandomTypeId;
|
||||
constructor(state) {
|
||||
this.state = state;
|
||||
this.next = withState(this.state, randomNumber);
|
||||
this.nextBoolean = core.flatMap(this.next, n => core.succeed(n > 0.5));
|
||||
this.nextInt = withState(this.state, randomInteger);
|
||||
}
|
||||
next;
|
||||
nextBoolean;
|
||||
nextInt;
|
||||
nextRange(min, max) {
|
||||
return core.flatMap(this.next, n => core.succeed((max - min) * n + min));
|
||||
}
|
||||
nextIntBetween(low, high) {
|
||||
return withState(this.state, randomIntegerBetween(low, high));
|
||||
}
|
||||
shuffle(elements) {
|
||||
return shuffleWith(elements, n => this.nextIntBetween(0, n));
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const live = exports.live = /*#__PURE__*/Layer.effect(Tag, /*#__PURE__*/(0, _Function.pipe)(/*#__PURE__*/tRef.make(/*#__PURE__*/new Random.PCGRandom(Math.random() * 4294967296 >>> 0).getState()), /*#__PURE__*/core.map(seed => new TRandomImpl(seed)), core.commit));
|
||||
/** @internal */
|
||||
const next = exports.next = /*#__PURE__*/core.flatMap(Tag, random => random.next);
|
||||
/** @internal */
|
||||
const nextBoolean = exports.nextBoolean = /*#__PURE__*/core.flatMap(Tag, random => random.nextBoolean);
|
||||
/** @internal */
|
||||
const nextInt = exports.nextInt = /*#__PURE__*/core.flatMap(Tag, random => random.nextInt);
|
||||
/** @internal */
|
||||
const nextIntBetween = (low, high) => core.flatMap(Tag, random => random.nextIntBetween(low, high));
|
||||
/** @internal */
|
||||
exports.nextIntBetween = nextIntBetween;
|
||||
const nextRange = (min, max) => core.flatMap(Tag, random => random.nextRange(min, max));
|
||||
/** @internal */
|
||||
exports.nextRange = nextRange;
|
||||
const shuffle = elements => core.flatMap(Tag, random => random.shuffle(elements));
|
||||
exports.shuffle = shuffle;
|
||||
//# sourceMappingURL=tRandom.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tRandom.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tRandom.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
215
_node_modules/effect/dist/cjs/internal/stm/tReentrantLock.js
generated
vendored
Normal file
215
_node_modules/effect/dist/cjs/internal/stm/tReentrantLock.js
generated
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.writeLocks = exports.writeLocked = exports.writeLock = exports.withWriteLock = exports.withReadLock = exports.withLock = exports.releaseWrite = exports.releaseRead = exports.readLocks = exports.readLocked = exports.readLock = exports.make = exports.locked = exports.lock = exports.fiberWriteLocks = exports.fiberReadLocks = exports.acquireWrite = exports.acquireRead = exports.WriteLock = exports.TReentrantLockTypeId = exports.ReadLock = void 0;
|
||||
var Effect = _interopRequireWildcard(require("../../Effect.js"));
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var FiberId = _interopRequireWildcard(require("../../FiberId.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var HashMap = _interopRequireWildcard(require("../../HashMap.js"));
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var tRef = _interopRequireWildcard(require("./tRef.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
const TReentrantLockSymbolKey = "effect/TReentrantLock";
|
||||
/** @internal */
|
||||
const TReentrantLockTypeId = exports.TReentrantLockTypeId = /*#__PURE__*/Symbol.for(TReentrantLockSymbolKey);
|
||||
const WriteLockTypeId = /*#__PURE__*/Symbol.for("effect/TReentrantLock/WriteLock");
|
||||
const ReadLockTypeId = /*#__PURE__*/Symbol.for("effect/TReentrantLock/ReadLock");
|
||||
class TReentranLockImpl {
|
||||
state;
|
||||
[TReentrantLockTypeId] = TReentrantLockTypeId;
|
||||
constructor(state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This data structure describes the state of the lock when multiple fibers
|
||||
* have acquired read locks. The state is tracked as a map from fiber identity
|
||||
* to number of read locks acquired by the fiber. This level of detail permits
|
||||
* upgrading a read lock to a write lock.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ReadLock {
|
||||
readers;
|
||||
[ReadLockTypeId] = ReadLockTypeId;
|
||||
constructor(readers) {
|
||||
this.readers = readers;
|
||||
}
|
||||
get readLocks() {
|
||||
return Array.from(this.readers).reduce((acc, curr) => acc + curr[1], 0);
|
||||
}
|
||||
get writeLocks() {
|
||||
return 0;
|
||||
}
|
||||
readLocksHeld(fiberId) {
|
||||
return Option.getOrElse(HashMap.get(this.readers, fiberId), () => 0);
|
||||
}
|
||||
writeLocksHeld(_fiberId) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This data structure describes the state of the lock when a single fiber has
|
||||
* a write lock. The fiber has an identity, and may also have acquired a
|
||||
* certain number of read locks.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
exports.ReadLock = ReadLock;
|
||||
class WriteLock {
|
||||
readLocks;
|
||||
writeLocks;
|
||||
fiberId;
|
||||
[WriteLockTypeId] = WriteLockTypeId;
|
||||
constructor(readLocks, writeLocks, fiberId) {
|
||||
this.readLocks = readLocks;
|
||||
this.writeLocks = writeLocks;
|
||||
this.fiberId = fiberId;
|
||||
}
|
||||
readLocksHeld(fiberId) {
|
||||
return Equal.equals(fiberId)(this.fiberId) ? this.readLocks : 0;
|
||||
}
|
||||
writeLocksHeld(fiberId) {
|
||||
return Equal.equals(fiberId)(this.fiberId) ? this.writeLocks : 0;
|
||||
}
|
||||
}
|
||||
exports.WriteLock = WriteLock;
|
||||
const isReadLock = lock => {
|
||||
return ReadLockTypeId in lock;
|
||||
};
|
||||
const isWriteLock = lock => {
|
||||
return WriteLockTypeId in lock;
|
||||
};
|
||||
/**
|
||||
* An empty read lock state, in which no fiber holds any read locks.
|
||||
*/
|
||||
const emptyReadLock = /*#__PURE__*/new ReadLock(/*#__PURE__*/HashMap.empty());
|
||||
/**
|
||||
* Creates a new read lock where the specified fiber holds the specified
|
||||
* number of read locks.
|
||||
*/
|
||||
const makeReadLock = (fiberId, count) => {
|
||||
if (count <= 0) {
|
||||
return emptyReadLock;
|
||||
}
|
||||
return new ReadLock(HashMap.make([fiberId, count]));
|
||||
};
|
||||
/**
|
||||
* Determines if there is no other holder of read locks aside from the
|
||||
* specified fiber id. If there are no other holders of read locks aside
|
||||
* from the specified fiber id, then it is safe to upgrade the read lock
|
||||
* into a write lock.
|
||||
*/
|
||||
const noOtherHolder = (readLock, fiberId) => {
|
||||
return HashMap.isEmpty(readLock.readers) || HashMap.size(readLock.readers) === 1 && HashMap.has(readLock.readers, fiberId);
|
||||
};
|
||||
/**
|
||||
* Adjusts the number of read locks held by the specified fiber id.
|
||||
*/
|
||||
const adjustReadLock = (readLock, fiberId, adjustment) => {
|
||||
const total = readLock.readLocksHeld(fiberId);
|
||||
const newTotal = total + adjustment;
|
||||
if (newTotal < 0) {
|
||||
throw new Error("BUG - TReentrantLock.ReadLock.adjust - please report an issue at https://github.com/Effect-TS/effect/issues");
|
||||
}
|
||||
if (newTotal === 0) {
|
||||
return new ReadLock(HashMap.remove(readLock.readers, fiberId));
|
||||
}
|
||||
return new ReadLock(HashMap.set(readLock.readers, fiberId, newTotal));
|
||||
};
|
||||
const adjustRead = (self, delta) => core.withSTMRuntime(runtime => {
|
||||
const lock = tRef.unsafeGet(self.state, runtime.journal);
|
||||
if (isReadLock(lock)) {
|
||||
const result = adjustReadLock(lock, runtime.fiberId, delta);
|
||||
tRef.unsafeSet(self.state, result, runtime.journal);
|
||||
return core.succeed(result.readLocksHeld(runtime.fiberId));
|
||||
}
|
||||
if (isWriteLock(lock) && Equal.equals(runtime.fiberId)(lock.fiberId)) {
|
||||
const newTotal = lock.readLocks + delta;
|
||||
if (newTotal < 0) {
|
||||
throw new Error(`Defect: Fiber ${FiberId.threadName(runtime.fiberId)} releasing read locks it does not hold, newTotal: ${newTotal}`);
|
||||
}
|
||||
tRef.unsafeSet(self.state, new WriteLock(newTotal, lock.writeLocks, runtime.fiberId), runtime.journal);
|
||||
return core.succeed(newTotal);
|
||||
}
|
||||
return core.retry;
|
||||
});
|
||||
/** @internal */
|
||||
const acquireRead = self => adjustRead(self, 1);
|
||||
/** @internal */
|
||||
exports.acquireRead = acquireRead;
|
||||
const acquireWrite = self => core.withSTMRuntime(runtime => {
|
||||
const lock = tRef.unsafeGet(self.state, runtime.journal);
|
||||
if (isReadLock(lock) && noOtherHolder(lock, runtime.fiberId)) {
|
||||
tRef.unsafeSet(self.state, new WriteLock(lock.readLocksHeld(runtime.fiberId), 1, runtime.fiberId), runtime.journal);
|
||||
return core.succeed(1);
|
||||
}
|
||||
if (isWriteLock(lock) && Equal.equals(runtime.fiberId)(lock.fiberId)) {
|
||||
tRef.unsafeSet(self.state, new WriteLock(lock.readLocks, lock.writeLocks + 1, runtime.fiberId), runtime.journal);
|
||||
return core.succeed(lock.writeLocks + 1);
|
||||
}
|
||||
return core.retry;
|
||||
});
|
||||
/** @internal */
|
||||
exports.acquireWrite = acquireWrite;
|
||||
const fiberReadLocks = self => core.effect((journal, fiberId) => tRef.unsafeGet(self.state, journal).readLocksHeld(fiberId));
|
||||
/** @internal */
|
||||
exports.fiberReadLocks = fiberReadLocks;
|
||||
const fiberWriteLocks = self => core.effect((journal, fiberId) => tRef.unsafeGet(self.state, journal).writeLocksHeld(fiberId));
|
||||
/** @internal */
|
||||
exports.fiberWriteLocks = fiberWriteLocks;
|
||||
const lock = self => writeLock(self);
|
||||
/** @internal */
|
||||
exports.lock = lock;
|
||||
const locked = self => core.zipWith(readLocked(self), writeLocked(self), (x, y) => x || y);
|
||||
/** @internal */
|
||||
exports.locked = locked;
|
||||
const make = exports.make = /*#__PURE__*/core.map(/*#__PURE__*/tRef.make(emptyReadLock), readLock => new TReentranLockImpl(readLock));
|
||||
/** @internal */
|
||||
const readLock = self => Effect.acquireRelease(core.commit(acquireRead(self)), () => core.commit(releaseRead(self)));
|
||||
/** @internal */
|
||||
exports.readLock = readLock;
|
||||
const readLocks = self => core.map(tRef.get(self.state), state => state.readLocks);
|
||||
/** @internal */
|
||||
exports.readLocks = readLocks;
|
||||
const readLocked = self => core.map(tRef.get(self.state), state => state.readLocks > 0);
|
||||
/** @internal */
|
||||
exports.readLocked = readLocked;
|
||||
const releaseRead = self => adjustRead(self, -1);
|
||||
/** @internal */
|
||||
exports.releaseRead = releaseRead;
|
||||
const releaseWrite = self => core.withSTMRuntime(runtime => {
|
||||
const lock = tRef.unsafeGet(self.state, runtime.journal);
|
||||
if (isWriteLock(lock) && lock.writeLocks === 1 && Equal.equals(runtime.fiberId)(lock.fiberId)) {
|
||||
const result = makeReadLock(lock.fiberId, lock.readLocks);
|
||||
tRef.unsafeSet(self.state, result, runtime.journal);
|
||||
return core.succeed(result.writeLocksHeld(runtime.fiberId));
|
||||
}
|
||||
if (isWriteLock(lock) && Equal.equals(runtime.fiberId)(lock.fiberId)) {
|
||||
const result = new WriteLock(lock.readLocks, lock.writeLocks - 1, runtime.fiberId);
|
||||
tRef.unsafeSet(self.state, result, runtime.journal);
|
||||
return core.succeed(result.writeLocksHeld(runtime.fiberId));
|
||||
}
|
||||
throw new Error(`Defect: Fiber ${FiberId.threadName(runtime.fiberId)} releasing write lock it does not hold`);
|
||||
});
|
||||
/** @internal */
|
||||
exports.releaseWrite = releaseWrite;
|
||||
const withLock = exports.withLock = /*#__PURE__*/(0, _Function.dual)(2, (effect, self) => withWriteLock(effect, self));
|
||||
/** @internal */
|
||||
const withReadLock = exports.withReadLock = /*#__PURE__*/(0, _Function.dual)(2, (effect, self) => Effect.uninterruptibleMask(restore => Effect.zipRight(restore(core.commit(acquireRead(self))), Effect.ensuring(effect, core.commit(releaseRead(self))))));
|
||||
/** @internal */
|
||||
const withWriteLock = exports.withWriteLock = /*#__PURE__*/(0, _Function.dual)(2, (effect, self) => Effect.uninterruptibleMask(restore => Effect.zipRight(restore(core.commit(acquireWrite(self))), Effect.ensuring(effect, core.commit(releaseWrite(self))))));
|
||||
/** @internal */
|
||||
const writeLock = self => Effect.acquireRelease(core.commit(acquireWrite(self)), () => core.commit(releaseWrite(self)));
|
||||
/** @internal */
|
||||
exports.writeLock = writeLock;
|
||||
const writeLocked = self => core.map(tRef.get(self.state), state => state.writeLocks > 0);
|
||||
/** @internal */
|
||||
exports.writeLocked = writeLocked;
|
||||
const writeLocks = self => core.map(tRef.get(self.state), state => state.writeLocks);
|
||||
exports.writeLocks = writeLocks;
|
||||
//# sourceMappingURL=tReentrantLock.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tReentrantLock.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tReentrantLock.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
110
_node_modules/effect/dist/cjs/internal/stm/tRef.js
generated
vendored
Normal file
110
_node_modules/effect/dist/cjs/internal/stm/tRef.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.updateSomeAndGet = exports.updateSome = exports.updateAndGet = exports.update = exports.unsafeSet = exports.unsafeGet = exports.tRefVariance = exports.setAndGet = exports.set = exports.modifySome = exports.modify = exports.make = exports.getAndUpdateSome = exports.getAndUpdate = exports.getAndSet = exports.get = exports.TRefTypeId = exports.TRefImpl = void 0;
|
||||
var _Function = require("../../Function.js");
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var Entry = _interopRequireWildcard(require("./entry.js"));
|
||||
var Versioned = _interopRequireWildcard(require("./versioned.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const TRefSymbolKey = "effect/TRef";
|
||||
/** @internal */
|
||||
const TRefTypeId = exports.TRefTypeId = /*#__PURE__*/Symbol.for(TRefSymbolKey);
|
||||
const tRefVariance = exports.tRefVariance = {
|
||||
/* c8 ignore next */
|
||||
_A: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
class TRefImpl {
|
||||
[TRefTypeId] = tRefVariance;
|
||||
/** @internal */
|
||||
todos;
|
||||
/** @internal */
|
||||
versioned;
|
||||
constructor(value) {
|
||||
this.versioned = new Versioned.Versioned(value);
|
||||
this.todos = new Map();
|
||||
}
|
||||
modify(f) {
|
||||
return core.effect(journal => {
|
||||
const entry = getOrMakeEntry(this, journal);
|
||||
const [retValue, newValue] = f(Entry.unsafeGet(entry));
|
||||
Entry.unsafeSet(entry, newValue);
|
||||
return retValue;
|
||||
});
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
exports.TRefImpl = TRefImpl;
|
||||
const make = value => core.effect(journal => {
|
||||
const ref = new TRefImpl(value);
|
||||
journal.set(ref, Entry.make(ref, true));
|
||||
return ref;
|
||||
});
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const get = self => self.modify(a => [a, a]);
|
||||
/** @internal */
|
||||
exports.get = get;
|
||||
const set = exports.set = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => self.modify(() => [void 0, value]));
|
||||
/** @internal */
|
||||
const getAndSet = exports.getAndSet = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => self.modify(a => [a, value]));
|
||||
/** @internal */
|
||||
const getAndUpdate = exports.getAndUpdate = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => [a, f(a)]));
|
||||
/** @internal */
|
||||
const getAndUpdateSome = exports.getAndUpdateSome = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => Option.match(f(a), {
|
||||
onNone: () => [a, a],
|
||||
onSome: b => [a, b]
|
||||
})));
|
||||
/** @internal */
|
||||
const setAndGet = exports.setAndGet = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => self.modify(() => [value, value]));
|
||||
/** @internal */
|
||||
const modify = exports.modify = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(f));
|
||||
/** @internal */
|
||||
const modifySome = exports.modifySome = /*#__PURE__*/(0, _Function.dual)(3, (self, fallback, f) => self.modify(a => Option.match(f(a), {
|
||||
onNone: () => [fallback, a],
|
||||
onSome: b => b
|
||||
})));
|
||||
/** @internal */
|
||||
const update = exports.update = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => [void 0, f(a)]));
|
||||
/** @internal */
|
||||
const updateAndGet = exports.updateAndGet = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => {
|
||||
const b = f(a);
|
||||
return [b, b];
|
||||
}));
|
||||
/** @internal */
|
||||
const updateSome = exports.updateSome = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => [void 0, Option.match(f(a), {
|
||||
onNone: () => a,
|
||||
onSome: b => b
|
||||
})]));
|
||||
/** @internal */
|
||||
const updateSomeAndGet = exports.updateSomeAndGet = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => Option.match(f(a), {
|
||||
onNone: () => [a, a],
|
||||
onSome: b => [b, b]
|
||||
})));
|
||||
/** @internal */
|
||||
const getOrMakeEntry = (self, journal) => {
|
||||
if (journal.has(self)) {
|
||||
return journal.get(self);
|
||||
}
|
||||
const entry = Entry.make(self, false);
|
||||
journal.set(self, entry);
|
||||
return entry;
|
||||
};
|
||||
/** @internal */
|
||||
const unsafeGet = exports.unsafeGet = /*#__PURE__*/(0, _Function.dual)(2, (self, journal) => Entry.unsafeGet(getOrMakeEntry(self, journal)));
|
||||
/** @internal */
|
||||
const unsafeSet = exports.unsafeSet = /*#__PURE__*/(0, _Function.dual)(3, (self, value, journal) => {
|
||||
const entry = getOrMakeEntry(self, journal);
|
||||
Entry.unsafeSet(entry, value);
|
||||
return undefined;
|
||||
});
|
||||
//# sourceMappingURL=tRef.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tRef.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tRef.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
72
_node_modules/effect/dist/cjs/internal/stm/tSemaphore.js
generated
vendored
Normal file
72
_node_modules/effect/dist/cjs/internal/stm/tSemaphore.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.withPermitsScoped = exports.withPermits = exports.withPermitScoped = exports.withPermit = exports.unsafeMakeSemaphore = exports.releaseN = exports.release = exports.make = exports.available = exports.acquireN = exports.acquire = exports.TSemaphoreTypeId = void 0;
|
||||
var Cause = _interopRequireWildcard(require("../../Cause.js"));
|
||||
var Effect = _interopRequireWildcard(require("../../Effect.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var STM = _interopRequireWildcard(require("../../STM.js"));
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var tRef = _interopRequireWildcard(require("./tRef.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const TSemaphoreSymbolKey = "effect/TSemaphore";
|
||||
/** @internal */
|
||||
const TSemaphoreTypeId = exports.TSemaphoreTypeId = /*#__PURE__*/Symbol.for(TSemaphoreSymbolKey);
|
||||
/** @internal */
|
||||
class TSemaphoreImpl {
|
||||
permits;
|
||||
[TSemaphoreTypeId] = TSemaphoreTypeId;
|
||||
constructor(permits) {
|
||||
this.permits = permits;
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const make = permits => STM.map(tRef.make(permits), permits => new TSemaphoreImpl(permits));
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const acquire = self => acquireN(self, 1);
|
||||
/** @internal */
|
||||
exports.acquire = acquire;
|
||||
const acquireN = exports.acquireN = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => core.withSTMRuntime(driver => {
|
||||
if (n < 0) {
|
||||
throw new Cause.IllegalArgumentException(`Unexpected negative value ${n} passed to Semaphore.acquireN`);
|
||||
}
|
||||
const value = tRef.unsafeGet(self.permits, driver.journal);
|
||||
if (value < n) {
|
||||
return STM.retry;
|
||||
} else {
|
||||
return STM.succeed(tRef.unsafeSet(self.permits, value - n, driver.journal));
|
||||
}
|
||||
}));
|
||||
/** @internal */
|
||||
const available = self => tRef.get(self.permits);
|
||||
/** @internal */
|
||||
exports.available = available;
|
||||
const release = self => releaseN(self, 1);
|
||||
/** @internal */
|
||||
exports.release = release;
|
||||
const releaseN = exports.releaseN = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => core.withSTMRuntime(driver => {
|
||||
if (n < 0) {
|
||||
throw new Cause.IllegalArgumentException(`Unexpected negative value ${n} passed to Semaphore.releaseN`);
|
||||
}
|
||||
const current = tRef.unsafeGet(self.permits, driver.journal);
|
||||
return STM.succeed(tRef.unsafeSet(self.permits, current + n, driver.journal));
|
||||
}));
|
||||
/** @internal */
|
||||
const withPermit = exports.withPermit = /*#__PURE__*/(0, _Function.dual)(2, (self, semaphore) => withPermits(self, semaphore, 1));
|
||||
/** @internal */
|
||||
const withPermits = exports.withPermits = /*#__PURE__*/(0, _Function.dual)(3, (self, semaphore, permits) => Effect.uninterruptibleMask(restore => Effect.zipRight(restore(core.commit(acquireN(permits)(semaphore))), Effect.ensuring(self, core.commit(releaseN(permits)(semaphore))))));
|
||||
/** @internal */
|
||||
const withPermitScoped = self => withPermitsScoped(self, 1);
|
||||
/** @internal */
|
||||
exports.withPermitScoped = withPermitScoped;
|
||||
const withPermitsScoped = exports.withPermitsScoped = /*#__PURE__*/(0, _Function.dual)(2, (self, permits) => Effect.acquireReleaseInterruptible(core.commit(acquireN(self, permits)), () => core.commit(releaseN(self, permits))));
|
||||
/** @internal */
|
||||
const unsafeMakeSemaphore = permits => {
|
||||
return new TSemaphoreImpl(new tRef.TRefImpl(permits));
|
||||
};
|
||||
exports.unsafeMakeSemaphore = unsafeMakeSemaphore;
|
||||
//# sourceMappingURL=tSemaphore.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tSemaphore.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tSemaphore.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tSemaphore.js","names":["Cause","_interopRequireWildcard","require","Effect","_Function","STM","core","tRef","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","TSemaphoreSymbolKey","TSemaphoreTypeId","exports","Symbol","for","TSemaphoreImpl","permits","constructor","make","map","acquire","self","acquireN","dual","withSTMRuntime","driver","IllegalArgumentException","value","unsafeGet","journal","retry","succeed","unsafeSet","available","release","releaseN","current","withPermit","semaphore","withPermits","uninterruptibleMask","restore","zipRight","commit","ensuring","withPermitScoped","withPermitsScoped","acquireReleaseInterruptible","unsafeMakeSemaphore","TRefImpl"],"sources":["../../../../src/internal/stm/tSemaphore.ts"],"sourcesContent":[null],"mappings":";;;;;;AA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OAAO,IACjCvD,MAAM,CAACwD,QAAQ,CACbD,OAAO,CAACpD,IAAI,CAACsD,MAAM,CAACrB,QAAQ,CAACN,OAAO,CAAC,CAACsB,SAAS,CAAC,CAAC,CAAC,EAClDpD,MAAM,CAAC0D,QAAQ,CACbvB,IAAI,EACJhC,IAAI,CAACsD,MAAM,CAACR,QAAQ,CAACnB,OAAO,CAAC,CAACsB,SAAS,CAAC,CAAC,CAC1C,CACF,CACF,CAAC;AAEJ;AACO,MAAMO,gBAAgB,GAAIxB,IAA2B,IAC1DyB,iBAAiB,CAACzB,IAAI,EAAE,CAAC,CAAC;AAE5B;AAAAT,OAAA,CAAAiC,gBAAA,GAAAA,gBAAA;AACO,MAAMC,iBAAiB,GAAAlC,OAAA,CAAAkC,iBAAA,gBAAG,IAAAvB,cAAI,EAGnC,CAAC,EAAE,CAACF,IAAI,EAAEL,OAAO,KACjB9B,MAAM,CAAC6D,2BAA2B,CAChC1D,IAAI,CAACsD,MAAM,CAACrB,QAAQ,CAACD,IAAI,EAAEL,OAAO,CAAC,CAAC,EACpC,MAAM3B,IAAI,CAACsD,MAAM,CAACR,QAAQ,CAACd,IAAI,EAAEL,OAAO,CAAC,CAAC,CAC3C,CAAC;AAEJ;AACO,MAAMgC,mBAAmB,GAAIhC,OAAe,IAA2B;EAC5E,OAAO,IAAID,cAAc,CAAC,IAAIzB,IAAI,CAAC2D,QAAQ,CAACjC,OAAO,CAAC,CAAC;AACvD,CAAC;AAAAJ,OAAA,CAAAoC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
||||
104
_node_modules/effect/dist/cjs/internal/stm/tSet.js
generated
vendored
Normal file
104
_node_modules/effect/dist/cjs/internal/stm/tSet.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.union = exports.transformSTM = exports.transform = exports.toReadonlySet = exports.toHashSet = exports.toChunk = exports.toArray = exports.takeSomeSTM = exports.takeSome = exports.takeFirstSTM = exports.takeFirst = exports.size = exports.retainIf = exports.removeIf = exports.removeAll = exports.remove = exports.reduceSTM = exports.reduce = exports.make = exports.isEmpty = exports.intersection = exports.has = exports.fromIterable = exports.forEach = exports.empty = exports.difference = exports.add = exports.TSetTypeId = void 0;
|
||||
var RA = _interopRequireWildcard(require("../../Array.js"));
|
||||
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var HashSet = _interopRequireWildcard(require("../../HashSet.js"));
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
var STM = _interopRequireWildcard(require("../../STM.js"));
|
||||
var core = _interopRequireWildcard(require("./core.js"));
|
||||
var tMap = _interopRequireWildcard(require("./tMap.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const TSetSymbolKey = "effect/TSet";
|
||||
/** @internal */
|
||||
const TSetTypeId = exports.TSetTypeId = /*#__PURE__*/Symbol.for(TSetSymbolKey);
|
||||
const tSetVariance = {
|
||||
/* c8 ignore next */
|
||||
_A: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
class TSetImpl {
|
||||
tMap;
|
||||
[TSetTypeId] = tSetVariance;
|
||||
constructor(tMap) {
|
||||
this.tMap = tMap;
|
||||
}
|
||||
}
|
||||
const isTSet = u => (0, _Predicate.hasProperty)(u, TSetTypeId);
|
||||
/** @internal */
|
||||
const add = exports.add = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => tMap.set(self.tMap, value, void 0));
|
||||
/** @internal */
|
||||
const difference = exports.difference = /*#__PURE__*/(0, _Function.dual)(2, (self, other) => core.flatMap(toHashSet(other), values => removeIf(self, value => HashSet.has(values, value), {
|
||||
discard: true
|
||||
})));
|
||||
/** @internal */
|
||||
const empty = () => fromIterable([]);
|
||||
/** @internal */
|
||||
exports.empty = empty;
|
||||
const forEach = exports.forEach = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => reduceSTM(self, void 0, (_, value) => f(value)));
|
||||
/** @internal */
|
||||
const fromIterable = iterable => core.map(tMap.fromIterable(Array.from(iterable).map(a => [a, void 0])), tMap => new TSetImpl(tMap));
|
||||
/** @internal */
|
||||
exports.fromIterable = fromIterable;
|
||||
const has = exports.has = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => tMap.has(self.tMap, value));
|
||||
/** @internal */
|
||||
const intersection = exports.intersection = /*#__PURE__*/(0, _Function.dual)(2, (self, other) => core.flatMap(toHashSet(other), values => (0, _Function.pipe)(self, retainIf(value => (0, _Function.pipe)(values, HashSet.has(value)), {
|
||||
discard: true
|
||||
}))));
|
||||
/** @internal */
|
||||
const isEmpty = self => tMap.isEmpty(self.tMap);
|
||||
/** @internal */
|
||||
exports.isEmpty = isEmpty;
|
||||
const make = (...elements) => fromIterable(elements);
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const reduce = exports.reduce = /*#__PURE__*/(0, _Function.dual)(3, (self, zero, f) => tMap.reduce(self.tMap, zero, (acc, _, key) => f(acc, key)));
|
||||
/** @internal */
|
||||
const reduceSTM = exports.reduceSTM = /*#__PURE__*/(0, _Function.dual)(3, (self, zero, f) => tMap.reduceSTM(self.tMap, zero, (acc, _, key) => f(acc, key)));
|
||||
/** @internal */
|
||||
const remove = exports.remove = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => tMap.remove(self.tMap, value));
|
||||
/** @internal */
|
||||
const removeAll = exports.removeAll = /*#__PURE__*/(0, _Function.dual)(2, (self, iterable) => tMap.removeAll(self.tMap, iterable));
|
||||
/** @internal */
|
||||
const removeIf = exports.removeIf = /*#__PURE__*/(0, _Function.dual)(args => isTSet(args[0]), (self, predicate, options) => options?.discard === true ? tMap.removeIf(self.tMap, key => predicate(key), {
|
||||
discard: true
|
||||
}) : (0, _Function.pipe)(tMap.removeIf(self.tMap, key => predicate(key)), core.map(RA.map(entry => entry[0]))));
|
||||
/** @internal */
|
||||
const retainIf = exports.retainIf = /*#__PURE__*/(0, _Function.dual)(args => isTSet(args[0]), (self, predicate, options) => options?.discard === true ? tMap.retainIf(self.tMap, key => predicate(key), {
|
||||
discard: true
|
||||
}) : (0, _Function.pipe)(tMap.retainIf(self.tMap, key => predicate(key)), core.map(RA.map(entry => entry[0]))));
|
||||
/** @internal */
|
||||
const size = self => core.map(toChunk(self), chunk => chunk.length);
|
||||
/** @internal */
|
||||
exports.size = size;
|
||||
const takeFirst = exports.takeFirst = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => tMap.takeFirst(self.tMap, key => pf(key)));
|
||||
/** @internal */
|
||||
const takeFirstSTM = exports.takeFirstSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => tMap.takeFirstSTM(self.tMap, key => pf(key)));
|
||||
/** @internal */
|
||||
const takeSome = exports.takeSome = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => tMap.takeSome(self.tMap, key => pf(key)));
|
||||
/** @internal */
|
||||
const takeSomeSTM = exports.takeSomeSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, pf) => tMap.takeSomeSTM(self.tMap, key => pf(key)));
|
||||
/** @internal */
|
||||
const toChunk = self => tMap.keys(self.tMap).pipe(STM.map(Chunk.unsafeFromArray));
|
||||
/** @internal */
|
||||
exports.toChunk = toChunk;
|
||||
const toHashSet = self => reduce(self, HashSet.empty(), (acc, value) => (0, _Function.pipe)(acc, HashSet.add(value)));
|
||||
/** @internal */
|
||||
exports.toHashSet = toHashSet;
|
||||
const toArray = self => reduce(self, [], (acc, value) => [...acc, value]);
|
||||
/** @internal */
|
||||
exports.toArray = toArray;
|
||||
const toReadonlySet = self => core.map(toArray(self), values => new Set(values));
|
||||
/** @internal */
|
||||
exports.toReadonlySet = toReadonlySet;
|
||||
const transform = exports.transform = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => tMap.transform(self.tMap, (key, value) => [f(key), value]));
|
||||
/** @internal */
|
||||
const transformSTM = exports.transformSTM = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => tMap.transformSTM(self.tMap, (key, value) => core.map(f(key), a => [a, value])));
|
||||
/** @internal */
|
||||
const union = exports.union = /*#__PURE__*/(0, _Function.dual)(2, (self, other) => forEach(other, value => add(self, value)));
|
||||
//# sourceMappingURL=tSet.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tSet.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tSet.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
177
_node_modules/effect/dist/cjs/internal/stm/tSubscriptionRef.js
generated
vendored
Normal file
177
_node_modules/effect/dist/cjs/internal/stm/tSubscriptionRef.js
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.updateSomeAndGet = exports.updateSome = exports.updateAndGet = exports.update = exports.setAndGet = exports.set = exports.modifySome = exports.modify = exports.make = exports.getAndUpdateSome = exports.getAndUpdate = exports.getAndSet = exports.get = exports.changesStream = exports.changesScoped = exports.TSubscriptionRefTypeId = void 0;
|
||||
var Effect = _interopRequireWildcard(require("../../Effect.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
var STM = _interopRequireWildcard(require("../../STM.js"));
|
||||
var TPubSub = _interopRequireWildcard(require("../../TPubSub.js"));
|
||||
var TQueue = _interopRequireWildcard(require("../../TQueue.js"));
|
||||
var TRef = _interopRequireWildcard(require("../../TRef.js"));
|
||||
var stream = _interopRequireWildcard(require("../stream.js"));
|
||||
var _tQueue = require("./tQueue.js");
|
||||
var _tRef = require("./tRef.js");
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const TSubscriptionRefSymbolKey = "effect/TSubscriptionRef";
|
||||
/** @internal */
|
||||
const TSubscriptionRefTypeId = exports.TSubscriptionRefTypeId = /*#__PURE__*/Symbol.for(TSubscriptionRefSymbolKey);
|
||||
const TSubscriptionRefVariance = {
|
||||
/* c8 ignore next */
|
||||
_A: _ => _
|
||||
};
|
||||
class TDequeueMerge {
|
||||
first;
|
||||
second;
|
||||
[TQueue.TDequeueTypeId] = _tQueue.tDequeueVariance;
|
||||
constructor(first, second) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
}
|
||||
peek = /*#__PURE__*/STM.gen(this, function* () {
|
||||
const first = yield* this.peekOption;
|
||||
if (first._tag === "Some") {
|
||||
return first.value;
|
||||
}
|
||||
return yield* STM.retry;
|
||||
});
|
||||
peekOption = /*#__PURE__*/STM.gen(this, function* () {
|
||||
const first = yield* this.first.peekOption;
|
||||
if (first._tag === "Some") {
|
||||
return first;
|
||||
}
|
||||
const second = yield* this.second.peekOption;
|
||||
if (second._tag === "Some") {
|
||||
return second;
|
||||
}
|
||||
return Option.none();
|
||||
});
|
||||
take = /*#__PURE__*/STM.gen(this, function* () {
|
||||
if (!(yield* this.first.isEmpty)) {
|
||||
return yield* this.first.take;
|
||||
}
|
||||
if (!(yield* this.second.isEmpty)) {
|
||||
return yield* this.second.take;
|
||||
}
|
||||
return yield* STM.retry;
|
||||
});
|
||||
takeAll = /*#__PURE__*/STM.gen(this, function* () {
|
||||
return [...(yield* this.first.takeAll), ...(yield* this.second.takeAll)];
|
||||
});
|
||||
takeUpTo(max) {
|
||||
return STM.gen(this, function* () {
|
||||
const first = yield* this.first.takeUpTo(max);
|
||||
if (first.length >= max) {
|
||||
return first;
|
||||
}
|
||||
return [...first, ...(yield* this.second.takeUpTo(max - first.length))];
|
||||
});
|
||||
}
|
||||
capacity() {
|
||||
return this.first.capacity() + this.second.capacity();
|
||||
}
|
||||
size = /*#__PURE__*/STM.gen(this, function* () {
|
||||
return (yield* this.first.size) + (yield* this.second.size);
|
||||
});
|
||||
isFull = /*#__PURE__*/STM.gen(this, function* () {
|
||||
return (yield* this.first.isFull) && (yield* this.second.isFull);
|
||||
});
|
||||
isEmpty = /*#__PURE__*/STM.gen(this, function* () {
|
||||
return (yield* this.first.isEmpty) && (yield* this.second.isEmpty);
|
||||
});
|
||||
shutdown = /*#__PURE__*/STM.gen(this, function* () {
|
||||
yield* this.first.shutdown;
|
||||
yield* this.second.shutdown;
|
||||
});
|
||||
isShutdown = /*#__PURE__*/STM.gen(this, function* () {
|
||||
return (yield* this.first.isShutdown) && (yield* this.second.isShutdown);
|
||||
});
|
||||
awaitShutdown = /*#__PURE__*/STM.gen(this, function* () {
|
||||
yield* this.first.awaitShutdown;
|
||||
yield* this.second.awaitShutdown;
|
||||
});
|
||||
}
|
||||
/** @internal */
|
||||
class TSubscriptionRefImpl {
|
||||
ref;
|
||||
pubsub;
|
||||
[TSubscriptionRefTypeId] = TSubscriptionRefVariance;
|
||||
[TRef.TRefTypeId] = _tRef.tRefVariance;
|
||||
constructor(ref, pubsub) {
|
||||
this.ref = ref;
|
||||
this.pubsub = pubsub;
|
||||
}
|
||||
get todos() {
|
||||
return this.ref.todos;
|
||||
}
|
||||
get versioned() {
|
||||
return this.ref.versioned;
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
get changes() {
|
||||
return STM.gen(this, function* () {
|
||||
const first = yield* TQueue.unbounded();
|
||||
yield* TQueue.offer(first, yield* TRef.get(this.ref));
|
||||
return new TDequeueMerge(first, yield* TPubSub.subscribe(this.pubsub));
|
||||
});
|
||||
}
|
||||
modify(f) {
|
||||
return (0, _Function.pipe)(TRef.get(this.ref), STM.map(f), STM.flatMap(([b, a]) => (0, _Function.pipe)(TRef.set(this.ref, a), STM.as(b), STM.zipLeft(TPubSub.publish(this.pubsub, a)))));
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const make = value => (0, _Function.pipe)(STM.all([TPubSub.unbounded(), TRef.make(value)]), STM.map(([pubsub, ref]) => new TSubscriptionRefImpl(ref, pubsub)));
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const get = self => TRef.get(self.ref);
|
||||
/** @internal */
|
||||
exports.get = get;
|
||||
const set = exports.set = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => self.modify(() => [void 0, value]));
|
||||
/** @internal */
|
||||
const getAndSet = exports.getAndSet = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => self.modify(a => [a, value]));
|
||||
/** @internal */
|
||||
const getAndUpdate = exports.getAndUpdate = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => [a, f(a)]));
|
||||
/** @internal */
|
||||
const getAndUpdateSome = exports.getAndUpdateSome = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => Option.match(f(a), {
|
||||
onNone: () => [a, a],
|
||||
onSome: b => [a, b]
|
||||
})));
|
||||
/** @internal */
|
||||
const setAndGet = exports.setAndGet = /*#__PURE__*/(0, _Function.dual)(2, (self, value) => self.modify(() => [value, value]));
|
||||
/** @internal */
|
||||
const modify = exports.modify = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(f));
|
||||
/** @internal */
|
||||
const modifySome = exports.modifySome = /*#__PURE__*/(0, _Function.dual)(3, (self, fallback, f) => self.modify(a => Option.match(f(a), {
|
||||
onNone: () => [fallback, a],
|
||||
onSome: b => b
|
||||
})));
|
||||
/** @internal */
|
||||
const update = exports.update = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => [void 0, f(a)]));
|
||||
/** @internal */
|
||||
const updateAndGet = exports.updateAndGet = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => {
|
||||
const b = f(a);
|
||||
return [b, b];
|
||||
}));
|
||||
/** @internal */
|
||||
const updateSome = exports.updateSome = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => [void 0, Option.match(f(a), {
|
||||
onNone: () => a,
|
||||
onSome: b => b
|
||||
})]));
|
||||
/** @internal */
|
||||
const updateSomeAndGet = exports.updateSomeAndGet = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => self.modify(a => Option.match(f(a), {
|
||||
onNone: () => [a, a],
|
||||
onSome: b => [b, b]
|
||||
})));
|
||||
/** @internal */
|
||||
const changesScoped = self => Effect.acquireRelease(self.changes, TQueue.shutdown);
|
||||
/** @internal */
|
||||
exports.changesScoped = changesScoped;
|
||||
const changesStream = self => stream.unwrap(Effect.map(self.changes, stream.fromTQueue));
|
||||
exports.changesStream = changesStream;
|
||||
//# sourceMappingURL=tSubscriptionRef.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tSubscriptionRef.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tSubscriptionRef.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
25
_node_modules/effect/dist/cjs/internal/stm/tryCommit.js
generated
vendored
Normal file
25
_node_modules/effect/dist/cjs/internal/stm/tryCommit.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.suspend = exports.done = void 0;
|
||||
var OpCodes = _interopRequireWildcard(require("./opCodes/tryCommit.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const done = exit => {
|
||||
return {
|
||||
_tag: OpCodes.OP_DONE,
|
||||
exit
|
||||
};
|
||||
};
|
||||
/** @internal */
|
||||
exports.done = done;
|
||||
const suspend = journal => {
|
||||
return {
|
||||
_tag: OpCodes.OP_SUSPEND,
|
||||
journal
|
||||
};
|
||||
};
|
||||
exports.suspend = suspend;
|
||||
//# sourceMappingURL=tryCommit.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/tryCommit.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/tryCommit.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tryCommit.js","names":["OpCodes","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","done","exit","_tag","OP_DONE","exports","suspend","journal","OP_SUSPEND"],"sources":["../../../../src/internal/stm/tryCommit.ts"],"sourcesContent":[null],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAiD,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAA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
_node_modules/effect/dist/cjs/internal/stm/txnId.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.make = void 0;
|
||||
/** @internal */
|
||||
const txnCounter = {
|
||||
ref: 0
|
||||
};
|
||||
/** @internal */
|
||||
const make = () => {
|
||||
const newId = txnCounter.ref + 1;
|
||||
txnCounter.ref = newId;
|
||||
return newId;
|
||||
};
|
||||
exports.make = make;
|
||||
//# sourceMappingURL=txnId.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/txnId.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/txnId.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"txnId.js","names":["txnCounter","ref","make","newId","exports"],"sources":["../../../../src/internal/stm/txnId.ts"],"sourcesContent":[null],"mappings":";;;;;;AAKA;AACA,MAAMA,UAAU,GAAG;EAAEC,GAAG,EAAE;AAAC,CAAE;AAE7B;AACO,MAAMC,IAAI,GAAGA,CAAA,KAAY;EAC9B,MAAMC,KAAK,GAAGH,UAAU,CAACC,GAAG,GAAG,CAAC;EAChCD,UAAU,CAACC,GAAG,GAAGE,KAAK;EACtB,OAAOA,KAAc;AACvB,CAAC;AAAAC,OAAA,CAAAF,IAAA,GAAAA,IAAA","ignoreList":[]}
|
||||
15
_node_modules/effect/dist/cjs/internal/stm/versioned.js
generated
vendored
Normal file
15
_node_modules/effect/dist/cjs/internal/stm/versioned.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Versioned = void 0;
|
||||
/** @internal */
|
||||
class Versioned {
|
||||
value;
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
exports.Versioned = Versioned;
|
||||
//# sourceMappingURL=versioned.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/stm/versioned.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/stm/versioned.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"versioned.js","names":["Versioned","value","constructor"],"sources":["../../../../src/internal/stm/versioned.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA;AACM,MAAOA,SAAS;EACCC,KAAA;EAArBC,YAAqBD,KAAQ;IAAR,KAAAA,KAAK,GAALA,KAAK;EAAM","ignoreList":[]}
|
||||
Reference in New Issue
Block a user