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.35.2 to 0.35.3

14

Cause.d.ts

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

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

@@ -97,3 +98,3 @@ * @since 1.0.0

*/
export declare const StackAnnotationTypeId: unique symbol;
export declare const SpanAnnotationTypeId: unique symbol;
/**

@@ -103,4 +104,13 @@ * @since 1.0.0

*/
export type StackAnnotationTypeId = typeof StackAnnotationTypeId;
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

@@ -107,0 +117,0 @@ * `Effect` workflow.

6

Cause.js

@@ -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.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.StackAnnotationTypeId = exports.RuntimeExceptionTypeId = exports.RuntimeException = exports.NoSuchElementExceptionTypeId = exports.NoSuchElementException = exports.InvalidHubCapacityExceptionTypeId = exports.InterruptedExceptionTypeId = exports.InterruptedException = exports.IllegalArgumentExceptionTypeId = exports.IllegalArgumentException = exports.CauseTypeId = void 0;
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;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/cause"));

@@ -52,3 +52,3 @@ var _pretty = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/cause-pretty"));

exports.InvalidHubCapacityExceptionTypeId = InvalidHubCapacityExceptionTypeId;
const StackAnnotationTypeId = internal.StackAnnotationTypeId;
const SpanAnnotationTypeId = internal.SpanAnnotationTypeId;
/**

@@ -58,3 +58,3 @@ * @since 1.0.0

*/
exports.StackAnnotationTypeId = StackAnnotationTypeId;
exports.SpanAnnotationTypeId = SpanAnnotationTypeId;
const globalErrorSeq = internal.globalErrorSeq;

@@ -61,0 +61,0 @@ /**

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

exports.prettyErrors = exports.pretty = void 0;
var Option = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Option"));
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/cause"));

@@ -44,7 +45,20 @@ 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); }

class RenderError {
constructor(message, stack) {
constructor(message, stack, span) {
this.message = message;
this.stack = stack;
this.span = span;
}
}
const filterStack = stack => {
const lines = stack.split("\n");
const out = [];
for (let i = 0; i < lines.length; i++) {
if (lines[i].includes("EffectPrimitive") || lines[i].includes("Generator.next") || lines[i].includes("FiberRuntime")) {
return out.join("\n");
} else {
out.push(lines[i]);
}
}
return out.join("\n");
};
/** @internal */

@@ -58,4 +72,13 @@ const pretty = cause => {

if (e.stack) {
message += `\r\n${e.stack}`;
message += `\r\n${filterStack(e.stack)}`;
}
if (e.span) {
let current = e.span;
let i = 0;
while (current && current._tag === "Span" && i < 10) {
message += `\r\n at ${current.name}`;
current = Option.getOrUndefined(current.parent);
i++;
}
}
return message;

@@ -76,3 +99,4 @@ }).join("\r\n\r\n");

message: rendered[0],
stack: rendered[1]
stack: rendered[1],
span: undefined
}];

@@ -84,3 +108,4 @@ },

message: rendered[0],
stack: rendered[1]
stack: rendered[1],
span: undefined
}];

@@ -91,5 +116,8 @@ },

sequentialCase: (_, l, r) => [...l, ...r],
annotatedCase: (_, v, _parent) => v
annotatedCase: (_, v, annotation) => internal.isSpanAnnotation(annotation) ? v.map(error => ({
...error,
span: error.span ?? annotation.span
})) : v
});
exports.prettyErrors = prettyErrors;
//# sourceMappingURL=cause-pretty.js.map

@@ -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.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.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.StackAnnotationTypeId = 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.unannotate = exports.stripSomeDefects = exports.stripFailures = exports.squashWith = exports.squash = exports.size = exports.sequential = exports.reduceWithContext = exports.reduce = 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;
var Chunk = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Chunk"));

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

exports.isInvalidCapacityError = isInvalidCapacityError;
const StackAnnotationTypeId = /*#__PURE__*/Symbol.for("@effect/io/Cause/StackAnnotation");
const SpanAnnotationTypeId = /*#__PURE__*/Symbol.for("@effect/io/Cause/SpanAnnotation");
/** @internal */
exports.StackAnnotationTypeId = StackAnnotationTypeId;
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);

@@ -956,0 +966,0 @@ /** @internal */

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

Error.stackTraceLimit = limit;
const message = `Fiber #${fiber.id().id} has suspended work asyncroniously`;
const message = `Fiber #${fiber.id().id} cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work`;
const _tag = "AsyncFiberException";

@@ -92,0 +92,0 @@ Object.defineProperties(error, {

{
"name": "@effect/io",
"version": "0.35.2",
"version": "0.35.3",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

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

import * as _pretty from "@effect/io/internal/cause-pretty"
import type { Span } from "@effect/io/Tracer"

@@ -112,3 +113,3 @@ /**

*/
export const StackAnnotationTypeId: unique symbol = internal.StackAnnotationTypeId
export const SpanAnnotationTypeId: unique symbol = internal.SpanAnnotationTypeId

@@ -119,5 +120,15 @@ /**

*/
export type StackAnnotationTypeId = typeof StackAnnotationTypeId
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

@@ -124,0 +135,0 @@ * `Effect` workflow.

@@ -0,3 +1,5 @@

import * as Option from "@effect/data/Option"
import type * as Cause from "@effect/io/Cause"
import * as internal from "@effect/io/internal/cause"
import type { ParentSpan, Span } from "@effect/io/Tracer"

@@ -50,6 +52,24 @@ // -----------------------------------------------------------------------------

readonly message: string,
readonly stack: string | undefined
readonly stack: string | undefined,
readonly span: Span | undefined
) {}
}
const filterStack = (stack: string) => {
const lines = stack.split("\n")
const out: Array<string> = []
for (let i = 0; i < lines.length; i++) {
if (
lines[i].includes("EffectPrimitive")
|| lines[i].includes("Generator.next")
|| lines[i].includes("FiberRuntime")
) {
return out.join("\n")
} else {
out.push(lines[i])
}
}
return out.join("\n")
}
/** @internal */

@@ -63,4 +83,13 @@ export const pretty = <E>(cause: Cause.Cause<E>): string => {

if (e.stack) {
message += `\r\n${e.stack}`
message += `\r\n${filterStack(e.stack)}`
}
if (e.span) {
let current: Span | ParentSpan | undefined = e.span
let i = 0
while (current && current._tag === "Span" && i < 10) {
message += `\r\n at ${current.name}`
current = Option.getOrUndefined(current.parent)
i++
}
}
return message

@@ -80,7 +109,7 @@ }).join("\r\n\r\n")

const rendered = defaultErrorToLines(err)
return [{ message: rendered[0], stack: rendered[1] }]
return [{ message: rendered[0], stack: rendered[1], span: undefined }]
},
failCase: (_, err) => {
const rendered = defaultErrorToLines(err)
return [{ message: rendered[0], stack: rendered[1] }]
return [{ message: rendered[0], stack: rendered[1], span: undefined }]
},

@@ -90,3 +119,6 @@ interruptCase: () => [],

sequentialCase: (_, l, r) => [...l, ...r],
annotatedCase: (_, v, _parent) => v
annotatedCase: (_, v, annotation) =>
internal.isSpanAnnotation(annotation) ?
v.map((error) => ({ ...error, span: error.span ?? annotation.span })) :
v
})

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

import { pipeArguments } from "@effect/data/Pipeable"
import type { Span } from "@effect/io/Tracer"

@@ -1128,7 +1129,18 @@ // -----------------------------------------------------------------------------

/** @internal */
export const StackAnnotationTypeId: Cause.StackAnnotationTypeId = Symbol.for(
"@effect/io/Cause/StackAnnotation"
) as Cause.StackAnnotationTypeId
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)

@@ -1135,0 +1147,0 @@

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

Error.stackTraceLimit = limit
const message = `Fiber #${fiber.id().id} has suspended work asyncroniously`
const message =
`Fiber #${fiber.id().id} cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work`
const _tag = "AsyncFiberException"

@@ -120,0 +121,0 @@ Object.defineProperties(error, {

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 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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc