Socket
Socket
Sign inDemoInstall

@effect/io

Package Overview
Dependencies
Maintainers
3
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/io - npm Package Compare versions

Comparing version 0.40.3 to 0.41.0

internal/timeout.d.ts

49

Cause.d.ts

@@ -33,3 +33,2 @@ /**

import type * as FiberId from "@effect/io/FiberId";
import type { Span } from "@effect/io/Tracer";
/**

@@ -96,21 +95,2 @@ * @since 1.0.0

/**
* @since 1.0.0
* @category symbols
*/
export declare const SpanAnnotationTypeId: unique symbol;
/**
* @since 1.0.0
* @category symbols
*/
export type SpanAnnotationTypeId = typeof SpanAnnotationTypeId;
/**
* @since 1.0.0
* @category annotations
*/
export interface SpanAnnotation {
readonly _tag: "SpanAnnotation";
readonly [SpanAnnotationTypeId]: SpanAnnotationTypeId;
readonly span: Span;
}
/**
* A `Cause` represents the full history of a failure resulting from running an

@@ -127,3 +107,3 @@ * `Effect` workflow.

*/
export type Cause<E> = Empty | Fail<E> | Die | Interrupt | Annotated<E> | Sequential<E> | Parallel<E>;
export type Cause<E> = Empty | Fail<E> | Die | Interrupt | Sequential<E> | Parallel<E>;
/**

@@ -144,7 +124,2 @@ * @since 1.0.0

/**
* @since 1.0.0
* @category stack
*/
export declare const globalErrorSeq: import("@effect/data/MutableRef").MutableRef<number>;
/**
* Represents a set of methods that can be used to reduce a `Cause<E>` to a

@@ -161,3 +136,2 @@ * specified value of type `Z` with access to a context of type `C`.

readonly interruptCase: (context: C, fiberId: FiberId.FiberId) => Z;
readonly annotatedCase: (context: C, value: Z, annotation: unknown) => Z;
readonly sequentialCase: (context: C, left: Z, right: Z) => Z;

@@ -345,9 +319,2 @@ readonly parallelCase: (context: C, left: Z, right: Z) => Z;

/**
* Constructs a new `Annotated` cause from the specified `annotation`.
*
* @since 1.0.0
* @category constructors
*/
export declare const annotated: <E>(cause: Cause<E>, annotation: unknown) => Cause<E>;
/**
* Constructs a new `Parallel` cause from the specified `left` and `right`

@@ -408,10 +375,2 @@ * causes.

/**
* Returns `true` if the specified `Cause` is an `Annotated` type, `false`
* otherwise.
*
* @since 1.0.0
* @category refinements
*/
export declare const isAnnotatedType: <E>(self: Cause<E>) => self is Annotated<E>;
/**
* Returns `true` if the specified `Cause` is a `Sequential` type, `false`

@@ -776,8 +735,8 @@ * otherwise.

/**
* Removes any annotation from the cause
* Returns the original, unproxied, instance of a thrown error
*
* @since 1.0.0
* @category filtering
* @category errors
*/
export declare const unannotate: <E>(cause: Cause<E>) => Cause<E>;
export declare const originalError: <E>(obj: E) => E;
//# sourceMappingURL=Cause.d.ts.map

@@ -6,4 +6,5 @@ "use strict";

});
exports.unannotate = exports.stripSomeDefects = exports.stripFailures = exports.squashWith = exports.squash = exports.size = exports.sequential = exports.reduceWithContext = exports.reduce = exports.pretty = exports.parallel = exports.match = exports.map = exports.linearize = exports.keepDefects = exports.isSequentialType = exports.isRuntimeException = exports.isParallelType = exports.isNoSuchElementException = exports.isInterruptedOnly = exports.isInterruptedException = exports.isInterrupted = exports.isInterruptType = exports.isIllegalArgumentException = exports.isFailure = exports.isFailType = exports.isEmptyType = exports.isEmpty = exports.isDieType = exports.isDie = exports.isCause = exports.isAnnotatedType = exports.interruptors = exports.interruptOption = exports.interrupt = exports.globalErrorSeq = exports.flipCauseOption = exports.flatten = exports.flatMap = exports.find = exports.filter = exports.failures = exports.failureOrCause = exports.failureOption = exports.fail = exports.empty = exports.dieOption = exports.die = exports.defects = exports.contains = exports.as = exports.annotated = exports.SpanAnnotationTypeId = exports.RuntimeExceptionTypeId = exports.RuntimeException = exports.NoSuchElementExceptionTypeId = exports.NoSuchElementException = exports.InvalidHubCapacityExceptionTypeId = exports.InterruptedExceptionTypeId = exports.InterruptedException = exports.IllegalArgumentExceptionTypeId = exports.IllegalArgumentException = exports.CauseTypeId = void 0;
exports.stripSomeDefects = exports.stripFailures = exports.squashWith = exports.squash = exports.size = exports.sequential = exports.reduceWithContext = exports.reduce = exports.pretty = exports.parallel = exports.originalError = exports.match = exports.map = exports.linearize = exports.keepDefects = exports.isSequentialType = exports.isRuntimeException = exports.isParallelType = exports.isNoSuchElementException = exports.isInterruptedOnly = exports.isInterruptedException = exports.isInterrupted = exports.isInterruptType = exports.isIllegalArgumentException = exports.isFailure = exports.isFailType = exports.isEmptyType = exports.isEmpty = exports.isDieType = exports.isDie = exports.isCause = exports.interruptors = exports.interruptOption = exports.interrupt = exports.flipCauseOption = exports.flatten = exports.flatMap = exports.find = exports.filter = exports.failures = exports.failureOrCause = exports.failureOption = exports.fail = exports.empty = exports.dieOption = exports.die = exports.defects = exports.contains = exports.as = exports.RuntimeExceptionTypeId = exports.RuntimeException = exports.NoSuchElementExceptionTypeId = exports.NoSuchElementException = exports.InvalidHubCapacityExceptionTypeId = exports.InterruptedExceptionTypeId = exports.InterruptedException = exports.IllegalArgumentExceptionTypeId = exports.IllegalArgumentException = exports.CauseTypeId = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/cause"));
var _core = /*#__PURE__*/require("@effect/io/internal/core");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -47,14 +48,2 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
* @since 1.0.0
* @category symbols
*/
exports.InvalidHubCapacityExceptionTypeId = InvalidHubCapacityExceptionTypeId;
const SpanAnnotationTypeId = internal.SpanAnnotationTypeId;
/**
* @since 1.0.0
* @category stack
*/
exports.SpanAnnotationTypeId = SpanAnnotationTypeId;
const globalErrorSeq = internal.globalErrorSeq;
/**
* Constructs a new `Empty` cause.

@@ -65,3 +54,3 @@ *

*/
exports.globalErrorSeq = globalErrorSeq;
exports.InvalidHubCapacityExceptionTypeId = InvalidHubCapacityExceptionTypeId;
const empty = internal.empty;

@@ -93,10 +82,2 @@ /**

/**
* Constructs a new `Annotated` cause from the specified `annotation`.
*
* @since 1.0.0
* @category constructors
*/
exports.interrupt = interrupt;
const annotated = internal.annotated;
/**
* Constructs a new `Parallel` cause from the specified `left` and `right`

@@ -108,3 +89,3 @@ * causes.

*/
exports.annotated = annotated;
exports.interrupt = interrupt;
const parallel = internal.parallel;

@@ -165,3 +146,3 @@ /**

/**
* Returns `true` if the specified `Cause` is an `Annotated` type, `false`
* Returns `true` if the specified `Cause` is a `Sequential` type, `false`
* otherwise.

@@ -173,11 +154,2 @@ *

exports.isInterruptType = isInterruptType;
const isAnnotatedType = internal.isAnnotatedType;
/**
* Returns `true` if the specified `Cause` is a `Sequential` type, `false`
* otherwise.
*
* @since 1.0.0
* @category refinements
*/
exports.isAnnotatedType = isAnnotatedType;
const isSequentialType = internal.isSequentialType;

@@ -527,10 +499,10 @@ /**

/**
* Removes any annotation from the cause
* Returns the original, unproxied, instance of a thrown error
*
* @since 1.0.0
* @category filtering
* @category errors
*/
exports.pretty = pretty;
const unannotate = internal.unannotate;
exports.unannotate = unannotate;
const originalError = _core.originalInstance;
exports.originalError = originalError;
//# sourceMappingURL=Cause.js.map

@@ -315,9 +315,2 @@ /**

/**
* Removes any annotation from the failure cause
*
* @since 1.0.0
* @category filtering
*/
export declare const unannotate: <E, A>(exit: Exit<E, A>) => Exit<E, A>;
/**
* Represents an `Exit` which succeeds with `undefined`.

@@ -324,0 +317,0 @@ *

@@ -6,3 +6,3 @@ "use strict";

});
exports.zipWith = exports.zipRight = exports.zipParRight = exports.zipParLeft = exports.zipPar = exports.zipLeft = exports.zip = exports.unit = exports.unannotate = exports.succeed = exports.matchEffect = exports.match = exports.mapErrorCause = exports.mapError = exports.mapBoth = exports.map = exports.isSuccess = exports.isInterrupted = exports.isFailure = exports.isExit = exports.interrupt = exports.getOrElse = exports.fromOption = exports.fromEither = exports.forEachEffect = exports.flatten = exports.flatMapEffect = exports.flatMap = exports.failCause = exports.fail = exports.exists = exports.die = exports.causeOption = exports.asUnit = exports.as = exports.all = void 0;
exports.zipWith = exports.zipRight = exports.zipParRight = exports.zipParLeft = exports.zipPar = exports.zipLeft = exports.zip = exports.unit = exports.succeed = exports.matchEffect = exports.match = exports.mapErrorCause = exports.mapError = exports.mapBoth = exports.map = exports.isSuccess = exports.isInterrupted = exports.isFailure = exports.isExit = exports.interrupt = exports.getOrElse = exports.fromOption = exports.fromEither = exports.forEachEffect = exports.flatten = exports.flatMapEffect = exports.flatMap = exports.failCause = exports.fail = exports.exists = exports.die = exports.causeOption = exports.asUnit = exports.as = exports.all = void 0;
var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/core"));

@@ -228,10 +228,2 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

/**
* Removes any annotation from the failure cause
*
* @since 1.0.0
* @category filtering
*/
exports.succeed = succeed;
const unannotate = core.exitUnannotate;
/**
* Represents an `Exit` which succeeds with `undefined`.

@@ -242,3 +234,3 @@ *

*/
exports.unannotate = unannotate;
exports.succeed = succeed;
const unit = core.exitUnit;

@@ -245,0 +237,0 @@ /**

@@ -6,3 +6,3 @@ "use strict";

});
exports.unannotate = exports.stripSomeDefects = exports.stripFailures = exports.squashWith = exports.squash = exports.size = exports.sequential = exports.reduceWithContext = exports.reduce = exports.prettyErrors = exports.prettyErrorMessage = exports.pretty = exports.parallel = exports.match = exports.map = exports.makeSpanAnnotation = exports.linearize = exports.keepDefectsAndElectFailures = exports.keepDefects = exports.isSpanAnnotation = exports.isSequentialType = exports.isRuntimeException = exports.isParallelType = exports.isNoSuchElementException = exports.isInvalidCapacityError = exports.isInterruptedOnly = exports.isInterruptedException = exports.isInterrupted = exports.isInterruptType = exports.isIllegalArgumentException = exports.isFailure = exports.isFailType = exports.isEmptyType = exports.isEmpty = exports.isDieType = exports.isDie = exports.isCause = exports.isAnnotatedType = exports.interruptors = exports.interruptOption = exports.interrupt = exports.globalErrorSeq = exports.flipCauseOption = exports.flatten = exports.flatMap = exports.find = exports.filter = exports.failures = exports.failureOrCause = exports.failureOption = exports.fail = exports.empty = exports.electFailures = exports.dieOption = exports.die = exports.defects = exports.contains = exports.as = exports.annotated = exports.SpanAnnotationTypeId = exports.RuntimeExceptionTypeId = exports.RuntimeException = exports.NoSuchElementExceptionTypeId = exports.NoSuchElementException = exports.InvalidHubCapacityExceptionTypeId = exports.InvalidHubCapacityException = exports.InterruptedExceptionTypeId = exports.InterruptedException = exports.IllegalArgumentExceptionTypeId = exports.IllegalArgumentException = exports.CauseTypeId = void 0;
exports.stripSomeDefects = exports.stripFailures = exports.squashWith = exports.squash = exports.size = exports.sequential = exports.reduceWithContext = exports.reduce = exports.prettyErrors = exports.prettyErrorMessage = exports.pretty = exports.parallel = exports.match = exports.map = exports.linearize = exports.keepDefectsAndElectFailures = exports.keepDefects = exports.isSequentialType = exports.isRuntimeException = exports.isParallelType = exports.isNoSuchElementException = exports.isInvalidCapacityError = exports.isInterruptedOnly = exports.isInterruptedException = exports.isInterrupted = exports.isInterruptType = exports.isIllegalArgumentException = exports.isFailure = exports.isFailType = exports.isEmptyType = exports.isEmpty = exports.isDieType = exports.isDie = exports.isCause = exports.interruptors = exports.interruptOption = exports.interrupt = exports.flipCauseOption = exports.flatten = exports.flatMap = exports.find = exports.filter = exports.failures = exports.failureOrCause = exports.failureOption = exports.fail = exports.empty = exports.electFailures = exports.dieOption = exports.die = exports.defects = exports.contains = exports.as = exports.RuntimeExceptionTypeId = exports.RuntimeException = exports.NoSuchElementExceptionTypeId = exports.NoSuchElementException = exports.InvalidHubCapacityExceptionTypeId = exports.InvalidHubCapacityException = exports.InterruptedExceptionTypeId = exports.InterruptedException = exports.IllegalArgumentExceptionTypeId = exports.IllegalArgumentException = exports.CauseTypeId = void 0;
var Chunk = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Chunk"));

@@ -15,3 +15,2 @@ var Either = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Either"));

var _Inspectable = /*#__PURE__*/require("@effect/data/Inspectable");
var MRef = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/MutableRef"));
var Option = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Option"));

@@ -73,9 +72,2 @@ var _Pipeable = /*#__PURE__*/require("@effect/data/Pipeable");

};
case "Annotated":
return {
_id: "Cause",
_tag: this._tag,
cause: this.cause.toJSON(),
annotation: (0, _Inspectable.toJSON)(this.annotation)
};
case "Sequential":

@@ -132,11 +124,2 @@ case "Parallel":

exports.interrupt = interrupt;
const annotated = (cause, annotation) => {
const o = Object.create(proto);
o._tag = OpCodes.OP_ANNOTATED;
o.cause = cause;
o.annotation = annotation;
return o;
};
/** @internal */
exports.annotated = annotated;
const parallel = (left, right) => {

@@ -178,5 +161,2 @@ const o = Object.create(proto);

exports.isInterruptType = isInterruptType;
const isAnnotatedType = self => self._tag === OpCodes.OP_ANNOTATED;
/** @internal */
exports.isAnnotatedType = isAnnotatedType;
const isSequentialType = self => self._tag === OpCodes.OP_SEQUENTIAL;

@@ -267,3 +247,2 @@ /** @internal */

onInterrupt: fiberId => Option.some(interrupt(fiberId)),
onAnnotated: (causeOption, annotation) => Option.map(cause => annotated(cause, annotation))(causeOption),
onSequential: (left, right) => {

@@ -304,3 +283,2 @@ if (Option.isSome(left) && Option.isSome(right)) {

onInterrupt: () => Option.none(),
onAnnotated: (option, annotation) => Option.map(cause => annotated(cause, annotation))(option),
onSequential: (left, right) => {

@@ -338,3 +316,2 @@ if (Option.isSome(left) && Option.isSome(right)) {

onInterrupt: () => Option.none(),
onAnnotated: (option, annotation) => Option.map(cause => annotated(cause, annotation))(option),
onSequential: (left, right) => {

@@ -372,3 +349,2 @@ if (Option.isSome(left) && Option.isSome(right)) {

onInterrupt: fiberId => HashSet.make(interrupt(fiberId)),
onAnnotated: (set, annotation) => HashSet.map(cause => annotated(cause, annotation))(set),
onSequential: (leftSet, rightSet) => HashSet.flatMap(leftCause => HashSet.map(rightCause => sequential(leftCause, rightCause))(rightSet))(leftSet),

@@ -384,3 +360,2 @@ onParallel: (leftSet, rightSet) => HashSet.flatMap(leftCause => HashSet.map(rightCause => parallel(leftCause, rightCause))(rightSet))(leftSet)

onInterrupt: fiberId => interrupt(fiberId),
onAnnotated: (cause, annotation) => isEmptyType(cause) ? cause : annotated(cause, annotation),
onSequential: sequential,

@@ -396,3 +371,2 @@ onParallel: parallel

onInterrupt: fiberId => interrupt(fiberId),
onAnnotated: (cause, annotation) => isEmptyType(cause) ? cause : annotated(cause, annotation),
onSequential: (left, right) => sequential(left, right),

@@ -411,3 +385,2 @@ onParallel: (left, right) => parallel(left, right)

onInterrupt: fiberId => Option.some(interrupt(fiberId)),
onAnnotated: (option, annotation) => Option.map(cause => annotated(cause, annotation))(option),
onSequential: (left, right) => {

@@ -457,3 +430,2 @@ if (Option.isSome(left) && Option.isSome(right)) {

onInterrupt: fiberId => interrupt(fiberId),
onAnnotated: (cause, annotation) => annotated(cause, annotation),
onSequential: (left, right) => sequential(left, right),

@@ -579,7 +551,2 @@ onParallel: (left, right) => parallel(left, right)

}
case OpCodes.OP_ANNOTATED:
{
stack.push(item.cause);
break;
}
}

@@ -654,7 +621,2 @@ break;

}
case OpCodes.OP_ANNOTATED:
{
cause = cause.cause;
break;
}
case OpCodes.OP_SEQUENTIAL:

@@ -678,7 +640,2 @@ {

}
case OpCodes.OP_ANNOTATED:
{
cause = sequential(cause.left.cause, cause.right);
break;
}
default:

@@ -712,3 +669,2 @@ {

interruptCase: () => 1,
annotatedCase: (_, value) => value,
sequentialCase: (_, left, right) => left + right,

@@ -723,3 +679,2 @@ parallelCase: (_, left, right) => left + right

interruptCase: _Function.constTrue,
annotatedCase: (_, value) => value,
sequentialCase: (_, left, right) => left && right,

@@ -734,3 +689,2 @@ parallelCase: (_, left, right) => left && right

interruptCase: (_, fiberId) => interrupt(fiberId),
annotatedCase: (_, cause, annotation) => annotated(cause, annotation),
sequentialCase: (_, left, right) => {

@@ -763,6 +717,4 @@ if (predicate(left)) {

const OP_PARALLEL_CASE = "ParallelCase";
const OP_ANNOTATED_CASE = "AnnotatedCase";
/** @internal */
const match = /*#__PURE__*/(0, _Function.dual)(2, (self, {
onAnnotated,
onDie,

@@ -780,3 +732,2 @@ onEmpty,

interruptCase: (_, fiberId) => onInterrupt(fiberId),
annotatedCase: (_, value, annotation) => onAnnotated(value, annotation),
sequentialCase: (_, left, right) => onSequential(left, right),

@@ -808,7 +759,2 @@ parallelCase: (_, left, right) => onParallel(left, right)

}
case OpCodes.OP_ANNOTATED:
{
cause = cause.cause;
break;
}
default:

@@ -854,11 +800,2 @@ {

}
case OpCodes.OP_ANNOTATED:
{
input.push(cause.cause);
output.push(Either.left({
_tag: OP_ANNOTATED_CASE,
annotation: cause.annotation
}));
break;
}
case OpCodes.OP_SEQUENTIAL:

@@ -907,9 +844,2 @@ {

}
case OP_ANNOTATED_CASE:
{
const cause = accumulator.pop();
const value = reducer.annotatedCase(context, cause, either.left.annotation);
accumulator.push(value);
break;
}
}

@@ -1018,37 +948,5 @@ break;

// -----------------------------------------------------------------------------
// Stack Annotations
// Pretty Printing
// -----------------------------------------------------------------------------
/** @internal */
exports.isInvalidCapacityError = isInvalidCapacityError;
const SpanAnnotationTypeId = /*#__PURE__*/Symbol.for("@effect/io/Cause/SpanAnnotation");
/** @internal */
exports.SpanAnnotationTypeId = SpanAnnotationTypeId;
const isSpanAnnotation = u => typeof u === "object" && u !== null && SpanAnnotationTypeId in u;
/** @internal */
exports.isSpanAnnotation = isSpanAnnotation;
const makeSpanAnnotation = span => ({
_tag: "SpanAnnotation",
[SpanAnnotationTypeId]: SpanAnnotationTypeId,
span
});
/** @internal */
exports.makeSpanAnnotation = makeSpanAnnotation;
const globalErrorSeq = /*#__PURE__*/MRef.make(0);
/** @internal */
exports.globalErrorSeq = globalErrorSeq;
const UnAnnotateCauseReducer = () => ({
emptyCase: () => empty,
failCase: (_, error) => fail(error),
dieCase: (_, defect) => die(defect),
interruptCase: (_, fiberId) => interrupt(fiberId),
annotatedCase: (_, cause, __) => cause,
sequentialCase: (_, left, right) => sequential(left, right),
parallelCase: (_, left, right) => parallel(left, right)
});
/** @internal */
const unannotate = self => reduceWithContext(self, void 0, UnAnnotateCauseReducer());
// -----------------------------------------------------------------------------
// Pretty Printing
// -----------------------------------------------------------------------------
exports.unannotate = unannotate;
const filterStack = stack => {

@@ -1130,3 +1028,3 @@ const lines = stack.split("\n");

if (typeof u === "object" && u != null && "toString" in u && typeof u["toString"] === "function" && u["toString"] !== Object.prototype.toString) {
return `Error: ${u["toString"]()}`;
return u["toString"]();
}

@@ -1152,7 +1050,9 @@ // 3)

exports.prettyErrorMessage = prettyErrorMessage;
const spanSymbol = /*#__PURE__*/Symbol.for("@effect/io/SpanAnnotation");
const defaultRenderError = error => {
if (error instanceof Error) {
return new PrettyError(prettyErrorMessage(error), error.stack?.split("\n").filter(_ => !_.startsWith("Error")).join("\n"), void 0);
const span = typeof error === "object" && error !== null && spanSymbol in error && error[spanSymbol];
if (typeof error === "object" && error !== null && error instanceof Error) {
return new PrettyError(prettyErrorMessage(error), error.stack?.split("\n").filter(_ => !_.startsWith("Error")).join("\n"), span);
}
return new PrettyError(prettyErrorMessage(error), void 0, void 0);
return new PrettyError(prettyErrorMessage(error), void 0, span);
};

@@ -1170,6 +1070,5 @@ /** @internal */

parallelCase: (_, l, r) => [...l, ...r],
sequentialCase: (_, l, r) => [...l, ...r],
annotatedCase: (_, renderErrors, annotation) => isSpanAnnotation(annotation) ? renderErrors.map(error => new PrettyError(error.message, error.stack, error.span ?? annotation.span)) : renderErrors
sequentialCase: (_, l, r) => [...l, ...r]
});
exports.prettyErrors = prettyErrors;
//# sourceMappingURL=cause.js.map

@@ -12,2 +12,3 @@ "use strict";

var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/core"));
var timeout = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/timeout"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -37,3 +38,3 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

let completed = false;
const handle = setTimeout(() => {
const handle = timeout.set(() => {
completed = true;

@@ -43,3 +44,3 @@ task();

return () => {
clearTimeout(handle);
timeout.clear(handle);
return !completed;

@@ -46,0 +47,0 @@ };

@@ -6,5 +6,5 @@ "use strict";

});
exports.fromEffect = exports.fresh = exports.flatten = exports.flatMap = exports.fiberRefLocallyWith = exports.fiberRefLocallyScopedWith = exports.fiberRefLocallyScoped = exports.fiberRefLocally = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.extendScope = exports.discard = exports.dieSync = exports.die = exports.context = exports.catchAllCause = exports.catchAll = exports.buildWithScope = exports.build = exports.LayerTypeId = void 0;
exports.fromEffect = exports.fresh = exports.flatten = exports.flatMap = exports.fiberRefLocallyWith = exports.fiberRefLocallyScopedWith = exports.fiberRefLocallyScoped = exports.fiberRefLocally = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.extendScope = exports.effect_provide = exports.discard = exports.dieSync = exports.die = exports.context = exports.catchAllCause = exports.catchAll = exports.buildWithScope = exports.build = exports.LayerTypeId = void 0;
exports.fromEffectContext = fromEffectContext;
exports.zipWithPar = exports.useMerge = exports.use = exports.toRuntime = exports.tapErrorCause = exports.tapError = exports.tap = exports.syncContext = exports.sync = exports.suspend = exports.succeedContext = exports.succeed = exports.service = exports.scopedDiscard = exports.scopedContext = exports.scoped = exports.scope = exports.retry = exports.provideSomeLayer = exports.provideMerge = exports.provideLayer = exports.provide = exports.project = exports.passthrough = exports.orElse = exports.orDie = exports.mergeAll = exports.merge = exports.memoize = exports.matchCause = exports.match = exports.mapError = exports.map = exports.locallyEffect = exports.launch = exports.isLayer = exports.isFresh = exports.fromFunction = exports.fromEffectDiscard = void 0;
exports.zipWithPar = exports.useMerge = exports.use = exports.toRuntime = exports.tapErrorCause = exports.tapError = exports.tap = exports.syncContext = exports.sync = exports.suspend = exports.succeedContext = exports.succeed = exports.service = exports.scopedDiscard = exports.scopedContext = exports.scoped = exports.scope = exports.retry = exports.provideSomeRuntime = exports.provideMerge = exports.provideLayer = exports.provide = exports.project = exports.passthrough = exports.orElse = exports.orDie = exports.mergeAll = exports.merge = exports.memoize = exports.matchCause = exports.match = exports.mapError = exports.map = exports.locallyEffect = exports.launch = exports.isLayer = exports.isFresh = exports.fromFunction = exports.fromEffectDiscard = void 0;
var Context = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Context"));

@@ -16,2 +16,3 @@ var Duration = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Duration"));

var Clock = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Clock"));
var FiberRefsPatch = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/FiberRefsPatch"));
var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/core"));

@@ -25,2 +26,3 @@ var effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/effect"));

var runtime = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/runtime"));
var runtimeFlags = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/runtimeFlags"));
var synchronized = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/synchronizedRef"));

@@ -519,4 +521,13 @@ var ScheduleDecision = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/ScheduleDecision"));

exports.provideLayer = provideLayer;
const provideSomeLayer = /*#__PURE__*/(0, _Function.dual)(2, (self, layer) => provideLayer(self, merge(context(), layer)));
exports.provideSomeLayer = provideSomeLayer;
const provideSomeRuntime = /*#__PURE__*/(0, _Function.dual)(2, (self, rt) => {
const patchFlags = runtimeFlags.diff(runtime.defaultRuntime.runtimeFlags, rt.runtimeFlags);
const inversePatchFlags = runtimeFlags.diff(rt.runtimeFlags, runtime.defaultRuntime.runtimeFlags);
const patchRefs = FiberRefsPatch.diff(runtime.defaultRuntime.fiberRefs, rt.fiberRefs);
const inversePatchRefs = FiberRefsPatch.diff(rt.fiberRefs, runtime.defaultRuntime.fiberRefs);
return core.acquireUseRelease(core.flatMap(core.updateRuntimeFlags(patchFlags), () => effect.patchFiberRefs(patchRefs)), () => core.provideSomeContext(self, rt.context), () => core.flatMap(core.updateRuntimeFlags(inversePatchFlags), () => effect.patchFiberRefs(inversePatchRefs)));
});
/** @internal */
exports.provideSomeRuntime = provideSomeRuntime;
const effect_provide = /*#__PURE__*/(0, _Function.dual)(2, (self, source) => isLayer(source) ? provideLayer(self, merge(context(), source)) : Context.isContext(source) ? core.provideSomeContext(self, source) : provideSomeRuntime(self, source));
exports.effect_provide = effect_provide;
//# sourceMappingURL=layer.js.map

@@ -6,3 +6,3 @@ "use strict";

});
exports.OP_SEQUENTIAL = exports.OP_PARALLEL = exports.OP_INTERRUPT = exports.OP_FAIL = exports.OP_EMPTY = exports.OP_DIE = exports.OP_ANNOTATED = void 0;
exports.OP_SEQUENTIAL = exports.OP_PARALLEL = exports.OP_INTERRUPT = exports.OP_FAIL = exports.OP_EMPTY = exports.OP_DIE = void 0;
/** @internal */

@@ -21,5 +21,2 @@ const OP_DIE = "Die";

exports.OP_INTERRUPT = OP_INTERRUPT;
const OP_ANNOTATED = "Annotated";
/** @internal */
exports.OP_ANNOTATED = OP_ANNOTATED;
const OP_PARALLEL = "Parallel";

@@ -26,0 +23,0 @@ /** @internal */

@@ -6,3 +6,3 @@ "use strict";

});
exports.OP_YIELD = exports.OP_WITH_RUNTIME = exports.OP_WHILE = exports.OP_UPDATE_RUNTIME_FLAGS = exports.OP_TAG = exports.OP_SYNC = exports.OP_SUCCESS = exports.OP_REVERT_FLAGS = exports.OP_ON_SUCCESS_AND_FAILURE = exports.OP_ON_SUCCESS = exports.OP_ON_FAILURE = exports.OP_FAILURE_WITH_ANNOTATION = exports.OP_FAILURE = exports.OP_COMMIT = exports.OP_ASYNC = void 0;
exports.OP_YIELD = exports.OP_WITH_RUNTIME = exports.OP_WHILE = exports.OP_UPDATE_RUNTIME_FLAGS = exports.OP_TAG = exports.OP_SYNC = exports.OP_SUCCESS = exports.OP_REVERT_FLAGS = exports.OP_ON_SUCCESS_AND_FAILURE = exports.OP_ON_SUCCESS = exports.OP_ON_FAILURE = exports.OP_FAILURE = exports.OP_COMMIT = exports.OP_ASYNC = void 0;
/** @internal */

@@ -18,5 +18,2 @@ const OP_ASYNC = "Async";

exports.OP_FAILURE = OP_FAILURE;
const OP_FAILURE_WITH_ANNOTATION = "FailureWithAnnotation";
/** @internal */
exports.OP_FAILURE_WITH_ANNOTATION = OP_FAILURE_WITH_ANNOTATION;
const OP_ON_FAILURE = "OnFailure";

@@ -23,0 +20,0 @@ /** @internal */

@@ -89,2 +89,5 @@ "use strict";

},
fiber: {
value: fiber
},
message: {

@@ -91,0 +94,0 @@ value: message

{
"name": "@effect/io",
"version": "0.40.3",
"version": "0.41.0",
"description": "Functional programming in TypeScript",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -10,2 +10,3 @@ "use strict";

var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/core"));
var timeout = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/timeout"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -99,3 +100,3 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

if (depth >= this.maxNextTickBeforeTimer) {
setTimeout(() => this.starveInternal(0), 0);
timeout.set(() => this.starveInternal(0), 0);
} else {

@@ -304,3 +305,3 @@ Promise.resolve(void 0).then(() => this.starveInternal(depth + 1));

exports.makeBatched = makeBatched;
const timer = (ms, shouldYield = defaultShouldYield) => make(task => setTimeout(task, ms), shouldYield);
const timer = (ms, shouldYield = defaultShouldYield) => make(task => timeout.set(task, ms), shouldYield);
/**

@@ -311,3 +312,3 @@ * @since 1.0.0

exports.timer = timer;
const timerBatched = (ms, shouldYield = defaultShouldYield) => makeBatched(task => setTimeout(task, ms), shouldYield);
const timerBatched = (ms, shouldYield = defaultShouldYield) => makeBatched(task => timeout.set(task, ms), shouldYield);
/** @internal */

@@ -314,0 +315,0 @@ exports.timerBatched = timerBatched;

@@ -35,2 +35,3 @@ /**

readonly [ScopeTypeId]: ScopeTypeId;
readonly strategy: ExecutionStrategy.ExecutionStrategy;
}

@@ -37,0 +38,0 @@ /**

@@ -34,3 +34,3 @@ /**

import * as internal from "@effect/io/internal/cause"
import type { Span } from "@effect/io/Tracer"
import { originalInstance } from "@effect/io/internal/core"

@@ -110,24 +110,2 @@ /**

/**
* @since 1.0.0
* @category symbols
*/
export const SpanAnnotationTypeId: unique symbol = internal.SpanAnnotationTypeId
/**
* @since 1.0.0
* @category symbols
*/
export type SpanAnnotationTypeId = typeof SpanAnnotationTypeId
/**
* @since 1.0.0
* @category annotations
*/
export interface SpanAnnotation {
readonly _tag: "SpanAnnotation"
readonly [SpanAnnotationTypeId]: SpanAnnotationTypeId
readonly span: Span
}
/**
* A `Cause` represents the full history of a failure resulting from running an

@@ -149,3 +127,2 @@ * `Effect` workflow.

| Interrupt
| Annotated<E>
| Sequential<E>

@@ -170,8 +147,2 @@ | Parallel<E>

/**
* @since 1.0.0
* @category stack
*/
export const globalErrorSeq = internal.globalErrorSeq
/**
* Represents a set of methods that can be used to reduce a `Cause<E>` to a

@@ -188,3 +159,2 @@ * specified value of type `Z` with access to a context of type `C`.

readonly interruptCase: (context: C, fiberId: FiberId.FiberId) => Z
readonly annotatedCase: (context: C, value: Z, annotation: unknown) => Z
readonly sequentialCase: (context: C, left: Z, right: Z) => Z

@@ -389,10 +359,2 @@ readonly parallelCase: (context: C, left: Z, right: Z) => Z

/**
* Constructs a new `Annotated` cause from the specified `annotation`.
*
* @since 1.0.0
* @category constructors
*/
export const annotated: <E>(cause: Cause<E>, annotation: unknown) => Cause<E> = internal.annotated
/**
* Constructs a new `Parallel` cause from the specified `left` and `right`

@@ -460,11 +422,2 @@ * causes.

/**
* Returns `true` if the specified `Cause` is an `Annotated` type, `false`
* otherwise.
*
* @since 1.0.0
* @category refinements
*/
export const isAnnotatedType: <E>(self: Cause<E>) => self is Annotated<E> = internal.isAnnotatedType
/**
* Returns `true` if the specified `Cause` is a `Sequential` type, `false`

@@ -879,7 +832,7 @@ * otherwise.

/**
* Removes any annotation from the cause
* Returns the original, unproxied, instance of a thrown error
*
* @since 1.0.0
* @category filtering
* @category errors
*/
export const unannotate: <E>(cause: Cause<E>) => Cause<E> = internal.unannotate
export const originalError: <E>(obj: E) => E = originalInstance

@@ -360,10 +360,2 @@ /**

/**
* Removes any annotation from the failure cause
*
* @since 1.0.0
* @category filtering
*/
export const unannotate: <E, A>(exit: Exit<E, A>) => Exit<E, A> = core.exitUnannotate
/**
* Represents an `Exit` which succeeds with `undefined`.

@@ -370,0 +362,0 @@ *

@@ -8,3 +8,2 @@ import * as Chunk from "@effect/data/Chunk"

import { NodeInspectSymbol, toJSON } from "@effect/data/Inspectable"
import * as MRef from "@effect/data/MutableRef"
import * as Option from "@effect/data/Option"

@@ -17,2 +16,3 @@ import { pipeArguments } from "@effect/data/Pipeable"

import * as OpCodes from "@effect/io/internal/opCodes/cause"
import type { ParentSpan, Span } from "@effect/io/Tracer"

@@ -62,4 +62,2 @@

return { _id: "Cause", _tag: this._tag, failure: toJSON(this.error) }
case "Annotated":
return { _id: "Cause", _tag: this._tag, cause: this.cause.toJSON(), annotation: toJSON(this.annotation) }
case "Sequential":

@@ -114,11 +112,2 @@ case "Parallel":

/** @internal */
export const annotated = <E>(cause: Cause.Cause<E>, annotation: unknown): Cause.Cause<E> => {
const o = Object.create(proto)
o._tag = OpCodes.OP_ANNOTATED
o.cause = cause
o.annotation = annotation
return o
}
/** @internal */
export const parallel = <E, E2>(left: Cause.Cause<E>, right: Cause.Cause<E2>): Cause.Cause<E | E2> => {

@@ -161,6 +150,2 @@ const o = Object.create(proto)

/** @internal */
export const isAnnotatedType = <E>(self: Cause.Cause<E>): self is Cause.Annotated<E> =>
self._tag === OpCodes.OP_ANNOTATED
/** @internal */
export const isSequentialType = <E>(self: Cause.Cause<E>): self is Cause.Sequential<E> =>

@@ -282,3 +267,2 @@ self._tag === OpCodes.OP_SEQUENTIAL

onInterrupt: (fiberId) => Option.some(interrupt(fiberId)),
onAnnotated: (causeOption, annotation) => pipe(causeOption, Option.map((cause) => annotated(cause, annotation))),
onSequential: (left, right) => {

@@ -324,3 +308,2 @@ if (Option.isSome(left) && Option.isSome(right)) {

onInterrupt: () => Option.none(),
onAnnotated: (option, annotation) => pipe(option, Option.map((cause) => annotated(cause, annotation))),
onSequential: (left, right) => {

@@ -359,3 +342,2 @@ if (Option.isSome(left) && Option.isSome(right)) {

onInterrupt: () => Option.none(),
onAnnotated: (option, annotation) => pipe(option, Option.map((cause) => annotated(cause, annotation))),
onSequential: (left, right) => {

@@ -394,3 +376,2 @@ if (Option.isSome(left) && Option.isSome(right)) {

onInterrupt: (fiberId) => HashSet.make(interrupt(fiberId)),
onAnnotated: (set, annotation) => pipe(set, HashSet.map((cause) => annotated(cause, annotation))),
onSequential: (leftSet, rightSet) =>

@@ -425,3 +406,2 @@ pipe(

onInterrupt: (fiberId) => interrupt(fiberId),
onAnnotated: (cause, annotation) => isEmptyType(cause) ? cause : annotated(cause, annotation),
onSequential: sequential,

@@ -438,3 +418,2 @@ onParallel: parallel

onInterrupt: (fiberId) => interrupt(fiberId),
onAnnotated: (cause, annotation) => isEmptyType(cause) ? cause : annotated(cause, annotation),
onSequential: (left, right) => sequential(left, right),

@@ -457,3 +436,2 @@ onParallel: (left, right) => parallel(left, right)

onInterrupt: (fiberId) => Option.some(interrupt(fiberId)),
onAnnotated: (option, annotation) => pipe(option, Option.map((cause) => annotated(cause, annotation))),
onSequential: (left, right) => {

@@ -515,3 +493,2 @@ if (Option.isSome(left) && Option.isSome(right)) {

onInterrupt: (fiberId) => interrupt(fiberId),
onAnnotated: (cause, annotation) => annotated(cause, annotation),
onSequential: (left, right) => sequential(left, right),

@@ -691,6 +668,2 @@ onParallel: (left, right) => parallel(left, right)

}
case OpCodes.OP_ANNOTATED: {
stack.push(item.cause)
break
}
}

@@ -767,6 +740,2 @@ break

}
case OpCodes.OP_ANNOTATED: {
cause = cause.cause
break
}
case OpCodes.OP_SEQUENTIAL: {

@@ -789,6 +758,2 @@ switch (cause.left._tag) {

}
case OpCodes.OP_ANNOTATED: {
cause = sequential(cause.left.cause, cause.right)
break
}
default: {

@@ -822,3 +787,2 @@ _sequential = pipe(_sequential, Chunk.prepend(cause.right))

interruptCase: () => 1,
annotatedCase: (_, value) => value,
sequentialCase: (_, left, right) => left + right,

@@ -834,3 +798,2 @@ parallelCase: (_, left, right) => left + right

interruptCase: constTrue,
annotatedCase: (_, value) => value,
sequentialCase: (_, left, right) => left && right,

@@ -848,3 +811,2 @@ parallelCase: (_, left, right) => left && right

interruptCase: (_, fiberId) => interrupt(fiberId),
annotatedCase: (_, cause, annotation) => annotated(cause, annotation),
sequentialCase: (_, left, right) => {

@@ -877,3 +839,3 @@ if (predicate(left)) {

/** @internal */
type CauseCase = SequentialCase | ParallelCase | AnnotatedCase
type CauseCase = SequentialCase | ParallelCase

@@ -884,4 +846,2 @@ const OP_SEQUENTIAL_CASE = "SequentialCase"

const OP_ANNOTATED_CASE = "AnnotatedCase"
/** @internal */

@@ -898,8 +858,2 @@ interface SequentialCase {

/** @internal */
interface AnnotatedCase {
readonly _tag: typeof OP_ANNOTATED_CASE
readonly annotation: unknown
}
/** @internal */
export const match = dual<

@@ -912,3 +866,2 @@ <Z, E>(

readonly onInterrupt: (fiberId: FiberId.FiberId) => Z
readonly onAnnotated: (value: Z, annotation: unknown) => Z
readonly onSequential: (left: Z, right: Z) => Z

@@ -925,3 +878,2 @@ readonly onParallel: (left: Z, right: Z) => Z

readonly onInterrupt: (fiberId: FiberId.FiberId) => Z
readonly onAnnotated: (value: Z, annotation: unknown) => Z
readonly onSequential: (left: Z, right: Z) => Z

@@ -931,3 +883,3 @@ readonly onParallel: (left: Z, right: Z) => Z

) => Z
>(2, (self, { onAnnotated, onDie, onEmpty, onFail, onInterrupt, onParallel, onSequential }) => {
>(2, (self, { onDie, onEmpty, onFail, onInterrupt, onParallel, onSequential }) => {
return reduceWithContext(self, void 0, {

@@ -938,3 +890,2 @@ emptyCase: () => onEmpty,

interruptCase: (_, fiberId) => onInterrupt(fiberId),
annotatedCase: (_, value, annotation) => onAnnotated(value, annotation),
sequentialCase: (_, left, right) => onSequential(left, right),

@@ -967,6 +918,2 @@ parallelCase: (_, left, right) => onParallel(left, right)

}
case OpCodes.OP_ANNOTATED: {
cause = cause.cause
break
}
default: {

@@ -1010,7 +957,2 @@ cause = undefined

}
case OpCodes.OP_ANNOTATED: {
input.push(cause.cause)
output.push(Either.left({ _tag: OP_ANNOTATED_CASE, annotation: cause.annotation }))
break
}
case OpCodes.OP_SEQUENTIAL: {

@@ -1050,8 +992,2 @@ input.push(cause.right)

}
case OP_ANNOTATED_CASE: {
const cause = accumulator.pop()!
const value = reducer.annotatedCase(context, cause, either.left.annotation)
accumulator.push(value)
break
}
}

@@ -1176,39 +1112,2 @@ break

// -----------------------------------------------------------------------------
// Stack Annotations
// -----------------------------------------------------------------------------
/** @internal */
export const SpanAnnotationTypeId: Cause.SpanAnnotationTypeId = Symbol.for(
"@effect/io/Cause/SpanAnnotation"
) as Cause.SpanAnnotationTypeId
/** @internal */
export const isSpanAnnotation = (u: unknown): u is Cause.SpanAnnotation =>
typeof u === "object" && u !== null && SpanAnnotationTypeId in u
/** @internal */
export const makeSpanAnnotation = (span: Span): Cause.SpanAnnotation => ({
_tag: "SpanAnnotation",
[SpanAnnotationTypeId]: SpanAnnotationTypeId,
span
})
/** @internal */
export const globalErrorSeq = MRef.make(0)
/** @internal */
const UnAnnotateCauseReducer = <E>(): Cause.CauseReducer<unknown, E, Cause.Cause<E>> => ({
emptyCase: () => empty,
failCase: (_, error) => fail(error),
dieCase: (_, defect) => die(defect),
interruptCase: (_, fiberId) => interrupt(fiberId),
annotatedCase: (_, cause, __) => cause,
sequentialCase: (_, left, right) => sequential(left, right),
parallelCase: (_, left, right) => parallel(left, right)
})
/** @internal */
export const unannotate = <E>(self: Cause.Cause<E>) => reduceWithContext(self, void 0, UnAnnotateCauseReducer<E>())
// -----------------------------------------------------------------------------
// Pretty Printing

@@ -1303,3 +1202,3 @@ // -----------------------------------------------------------------------------

) {
return `Error: ${u["toString"]()}`
return u["toString"]()
}

@@ -1325,11 +1224,14 @@ // 3)

const spanSymbol = Symbol.for("@effect/io/SpanAnnotation")
const defaultRenderError = (error: unknown): PrettyError => {
if (error instanceof Error) {
const span = typeof error === "object" && error !== null && spanSymbol in error && (error as any)[spanSymbol]
if (typeof error === "object" && error !== null && error instanceof Error) {
return new PrettyError(
prettyErrorMessage(error),
error.stack?.split("\n").filter((_) => !_.startsWith("Error")).join("\n"),
void 0
span
)
}
return new PrettyError(prettyErrorMessage(error), void 0, void 0)
return new PrettyError(prettyErrorMessage(error), void 0, span)
}

@@ -1349,7 +1251,3 @@

parallelCase: (_, l, r) => [...l, ...r],
sequentialCase: (_, l, r) => [...l, ...r],
annotatedCase: (_, renderErrors, annotation) =>
isSpanAnnotation(annotation) ?
renderErrors.map((error) => new PrettyError(error.message, error.stack, error.span ?? annotation.span)) :
renderErrors
sequentialCase: (_, l, r) => [...l, ...r]
})

@@ -8,2 +8,3 @@ import * as Context from "@effect/data/Context"

import * as core from "@effect/io/internal/core"
import * as timeout from "@effect/io/internal/timeout"

@@ -32,3 +33,3 @@ /** @internal */

let completed = false
const handle = setTimeout(() => {
const handle = timeout.set(() => {
completed = true

@@ -38,3 +39,3 @@ task()

return () => {
clearTimeout(handle)
timeout.clear(handle)
return !completed

@@ -41,0 +42,0 @@ }

@@ -11,3 +11,3 @@ import * as Context from "@effect/data/Context"

import type { FiberRef } from "@effect/io/FiberRef"
import type * as FiberRefsPatch from "@effect/io/FiberRefsPatch"
import * as FiberRefsPatch from "@effect/io/FiberRefsPatch"
import * as core from "@effect/io/internal/core"

@@ -21,2 +21,3 @@ import * as effect from "@effect/io/internal/effect"

import * as runtime from "@effect/io/internal/runtime"
import * as runtimeFlags from "@effect/io/internal/runtimeFlags"
import * as synchronized from "@effect/io/internal/synchronizedRef"

@@ -1120,10 +1121,65 @@ import type * as Layer from "@effect/io/Layer"

/** @internal */
export const provideSomeLayer: {
<R2, E2, A2>(
layer: Layer.Layer<R2, E2, A2>
): <R, E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<R2 | Exclude<R, A2>, E | E2, A>
<R, E, A, R2, E2, A2>(
export const provideSomeRuntime: {
<R>(context: Runtime.Runtime<R>): <R1, E, A>(self: Effect.Effect<R1, E, A>) => Effect.Effect<Exclude<R1, R>, E, A>
<R, R1, E, A>(self: Effect.Effect<R1, E, A>, context: Runtime.Runtime<R>): Effect.Effect<Exclude<R1, R>, E, A>
} = dual<
<R>(context: Runtime.Runtime<R>) => <R1, E, A>(self: Effect.Effect<R1, E, A>) => Effect.Effect<Exclude<R1, R>, E, A>,
<R, R1, E, A>(self: Effect.Effect<R1, E, A>, context: Runtime.Runtime<R>) => Effect.Effect<Exclude<R1, R>, E, A>
>(2, (self, rt) => {
const patchFlags = runtimeFlags.diff(runtime.defaultRuntime.runtimeFlags, rt.runtimeFlags)
const inversePatchFlags = runtimeFlags.diff(rt.runtimeFlags, runtime.defaultRuntime.runtimeFlags)
const patchRefs = FiberRefsPatch.diff(runtime.defaultRuntime.fiberRefs, rt.fiberRefs)
const inversePatchRefs = FiberRefsPatch.diff(rt.fiberRefs, runtime.defaultRuntime.fiberRefs)
return core.acquireUseRelease(
core.flatMap(
core.updateRuntimeFlags(patchFlags),
() => effect.patchFiberRefs(patchRefs)
),
() => core.provideSomeContext(self, rt.context),
() =>
core.flatMap(
core.updateRuntimeFlags(inversePatchFlags),
() => effect.patchFiberRefs(inversePatchRefs)
)
)
})
/** @internal */
export const effect_provide = dual<
{
<R2, E2, A2>(
layer: Layer.Layer<R2, E2, A2>
): <R, E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<R2 | Exclude<R, A2>, E | E2, A>
<R2>(
context: Context.Context<R2>
): <R, E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<Exclude<R, R2>, E, A>
<R2>(
runtime: Runtime.Runtime<R2>
): <R, E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<Exclude<R, R2>, E, A>
},
{
<R, E, A, R2, E2, A2>(
self: Effect.Effect<R, E, A>,
layer: Layer.Layer<R2, E2, A2>
): Effect.Effect<R2 | Exclude<R, A2>, E | E2, A>
<R, E, A, R2>(
self: Effect.Effect<R, E, A>,
context: Context.Context<R2>
): Effect.Effect<Exclude<R, R2>, E, A>
<R, E, A, R2>(
self: Effect.Effect<R, E, A>,
runtime: Runtime.Runtime<R2>
): Effect.Effect<Exclude<R, R2>, E, A>
}
>(
2,
<R, E, A, R2>(
self: Effect.Effect<R, E, A>,
layer: Layer.Layer<R2, E2, A2>
): Effect.Effect<R2 | Exclude<R, A2>, E | E2, A>
} = dual(2, (self, layer) => provideLayer(self, merge(context(), layer)))
source: Layer.Layer<any, any, R2> | Context.Context<R2> | Runtime.Runtime<R2>
): Effect.Effect<Exclude<R, R2>, any, any> =>
isLayer(source)
? provideLayer(self as any, merge(context(), source as Layer.Layer<any, any, R2>))
: Context.isContext(source)
? core.provideSomeContext(self, source)
: provideSomeRuntime(self, source as Runtime.Runtime<R2>)
)

@@ -26,8 +26,2 @@ /** @internal */

/** @internal */
export const OP_ANNOTATED = "Annotated" as const
/** @internal */
export type OP_ANNOTATED = typeof OP_ANNOTATED
/** @internal */
export const OP_PARALLEL = "Parallel" as const

@@ -34,0 +28,0 @@

@@ -20,8 +20,2 @@ /** @internal */

/** @internal */
export type OP_FAILURE_WITH_ANNOTATION = typeof OP_FAILURE_WITH_ANNOTATION
/** @internal */
export const OP_FAILURE_WITH_ANNOTATION = "FailureWithAnnotation" as const
/** @internal */
export type OP_ON_FAILURE = typeof OP_ON_FAILURE

@@ -28,0 +22,0 @@

@@ -120,2 +120,5 @@ import * as Context from "@effect/data/Context"

},
fiber: {
value: fiber
},
message: {

@@ -122,0 +125,0 @@ value: message

@@ -11,2 +11,3 @@ /**

import * as core from "@effect/io/internal/core"
import * as timeout from "@effect/io/internal/timeout"

@@ -110,3 +111,3 @@ /**

if (depth >= this.maxNextTickBeforeTimer) {
setTimeout(() => this.starveInternal(0), 0)
timeout.set(() => this.starveInternal(0), 0)
} else {

@@ -341,3 +342,3 @@ Promise.resolve(void 0).then(() => this.starveInternal(depth + 1))

export const timer = (ms: number, shouldYield: Scheduler["shouldYield"] = defaultShouldYield) =>
make((task) => setTimeout(task, ms), shouldYield)
make((task) => timeout.set(task, ms), shouldYield)

@@ -349,3 +350,3 @@ /**

export const timerBatched = (ms: number, shouldYield: Scheduler["shouldYield"] = defaultShouldYield) =>
makeBatched((task) => setTimeout(task, ms), shouldYield)
makeBatched((task) => timeout.set(task, ms), shouldYield)

@@ -352,0 +353,0 @@ /** @internal */

@@ -43,3 +43,3 @@ /**

readonly [ScopeTypeId]: ScopeTypeId
readonly strategy: ExecutionStrategy.ExecutionStrategy
/**

@@ -46,0 +46,0 @@ * @internal

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc