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.27.1 to 0.27.2

20

internal_effect_untraced/metric/hook.js

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

};
const snapshot = () => HashMap.fromIterable(Array.from(values.entries()).map(([k, v]) => [k, v]));
const snapshot = () => HashMap.fromIterable(values.entries());
return make(() => metricState.frequency(snapshot()), update);

@@ -79,4 +79,4 @@ };

const size = bounds.length;
const values = Array(size + 1);
const boundaries = Array(size);
const values = new Uint32Array(size + 1);
const boundaries = new Float32Array(size);
let count = 0;

@@ -86,3 +86,3 @@ let sum = 0;

let max = Number.MIN_VALUE;
Chunk.mapWithIndex((i, n) => {
Chunk.mapWithIndex((n, i) => {
boundaries[i] = n;

@@ -122,13 +122,11 @@ })(Chunk.sort(number.Order)(bounds));

const getBuckets = () => {
const builder = [];
let i = 0;
const builder = Array(size);
let cumulated = 0;
while (i != size) {
for (let i = 0; i < size; i++) {
const boundary = boundaries[i];
const value = values[i];
cumulated = cumulated + value;
builder.push([boundary, cumulated]);
i = i + 1;
builder[i] = [boundary, cumulated];
}
return Chunk.fromIterable(builder);
return Chunk.unsafeFromArray(builder);
};

@@ -180,3 +178,3 @@ return make(() => metricState.histogram(getBuckets(), count, min, max, sum), update);

}
return calculateQuantiles(error, sortedQuantiles, Chunk.sort(number.Order)(Chunk.fromIterable(builder)));
return calculateQuantiles(error, sortedQuantiles, Chunk.sort(number.Order)(Chunk.unsafeFromArray(builder)));
};

@@ -183,0 +181,0 @@ const observe = (value, timestamp) => {

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

});
exports.unsafeRunSyncExitEffect = exports.unsafeRunSyncExit = exports.unsafeRunSyncEitherEffect = exports.unsafeRunSyncEither = exports.unsafeRunSyncEffect = exports.unsafeRunSync = exports.unsafeRunPromiseExitEffect = exports.unsafeRunPromiseExit = exports.unsafeRunPromiseEitherEffect = exports.unsafeRunPromiseEither = exports.unsafeRunPromiseEffect = exports.unsafeRunPromise = exports.unsafeRunEffect = exports.unsafeRunCallback = exports.unsafeForkEffect = exports.unsafeFork = exports.runtime = exports.make = exports.isFiberFailure = exports.fiberFailure = exports.defaultRuntimeFlags = exports.defaultRuntime = exports.asyncEffect = exports.RuntimeImpl = exports.NodePrint = exports.FiberFailureId = exports.FiberFailureCauseId = exports.AsyncFiber = void 0;
exports.unsafeRunSyncExitEffect = exports.unsafeRunSyncExit = exports.unsafeRunSyncEitherEffect = exports.unsafeRunSyncEither = exports.unsafeRunSyncEffect = exports.unsafeRunSync = exports.unsafeRunPromiseExitEffect = exports.unsafeRunPromiseExit = exports.unsafeRunPromiseEitherEffect = exports.unsafeRunPromiseEither = exports.unsafeRunPromiseEffect = exports.unsafeRunPromise = exports.unsafeRunEffect = exports.unsafeRunCallback = exports.unsafeForkEffect = exports.unsafeFork = exports.runtime = exports.make = exports.isFiberFailure = exports.isAsyncFiberException = exports.fiberFailure = exports.defaultRuntimeFlags = exports.defaultRuntime = exports.asyncEffect = exports.RuntimeImpl = exports.NodePrint = exports.FiberFailureId = exports.FiberFailureCauseId = void 0;
var Context = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Context"));

@@ -73,20 +73,40 @@ var Debug = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Debug"));

}
throw new AsyncFiber(fiberRuntime);
throw asyncFiberException(fiberRuntime);
});
/** @internal */
exports.unsafeRunSync = unsafeRunSync;
class AsyncFiber {
constructor(fiber) {
this.fiber = fiber;
this._tag = "AsyncFiber";
}
toString() {
return `Fiber #${this.fiber.id().id} has suspended work asyncroniously`;
}
[Symbol.for("nodejs.util.inspect.custom")]() {
return this.toString();
}
}
const asyncFiberException = fiber => {
const limit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = limit;
const message = `Fiber #${fiber.id().id} has suspended work asyncroniously`;
const _tag = "AsyncFiberException";
Object.defineProperties(error, {
_tag: {
value: _tag
},
message: {
value: message
},
name: {
value: _tag
},
toString: {
get() {
return () => message;
}
},
[NodePrint]: {
get() {
return () => message;
}
}
});
return error;
};
/** @internal */
exports.AsyncFiber = AsyncFiber;
const isAsyncFiberException = u => typeof u === "object" && u !== null && "_tag" in u && u._tag === "AsyncFiberException" && "fiber" in u;
/** @internal */
exports.isAsyncFiberException = isAsyncFiberException;
const FiberFailureId = /*#__PURE__*/Symbol.for("@effect/io/Runtime/FiberFailure");

@@ -141,3 +161,3 @@ /** @internal */

}
throw new AsyncFiber(fiberRuntime);
throw asyncFiberException(fiberRuntime);
});

@@ -144,0 +164,0 @@ /** @internal */

{
"name": "@effect/io",
"version": "0.27.1",
"version": "0.27.2",
"license": "MIT",

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

@@ -18,4 +18,4 @@ /**

*/
export interface AsyncFiber<E, A> {
readonly _tag: "AsyncFiber";
export interface AsyncFiberException<E, A> {
readonly _tag: "AsyncFiberException";
readonly fiber: Fiber.RuntimeFiber<E, A>;

@@ -200,2 +200,7 @@ }

*/
export declare const isAsyncFiberException: (u: unknown) => u is AsyncFiberException<unknown, unknown>;
/**
* @since 1.0.0
* @category guards
*/
export declare const isFiberFailure: (u: unknown) => u is FiberFailure;

@@ -202,0 +207,0 @@ /**

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

});
exports.runSyncExit = exports.runSyncEither = exports.runSync = exports.runPromiseExit = exports.runPromiseEither = exports.runPromise = exports.runFork = exports.runCallback = exports.makeFiberFailure = exports.make = exports.isFiberFailure = exports.defaultRuntimeFlags = exports.defaultRuntime = exports.NodePrint = exports.FiberFailureId = exports.FiberFailureCauseId = void 0;
exports.runSyncExit = exports.runSyncEither = exports.runSync = exports.runPromiseExit = exports.runPromiseEither = exports.runPromise = exports.runFork = exports.runCallback = exports.makeFiberFailure = exports.make = exports.isFiberFailure = exports.isAsyncFiberException = exports.defaultRuntimeFlags = exports.defaultRuntime = exports.NodePrint = exports.FiberFailureId = exports.FiberFailureCauseId = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/runtime"));

@@ -145,2 +145,8 @@ 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); }

exports.NodePrint = NodePrint;
const isAsyncFiberException = internal.isAsyncFiberException;
/**
* @since 1.0.0
* @category guards
*/
exports.isAsyncFiberException = isAsyncFiberException;
const isFiberFailure = internal.isFiberFailure;

@@ -147,0 +153,0 @@ /**

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

}
const snapshot = () => HashMap.fromIterable(Array.from(values.entries()).map(([k, v]) => [k, v] as const))
const snapshot = () => HashMap.fromIterable(values.entries())
return make(() => metricState.frequency(snapshot()), update)

@@ -91,4 +91,4 @@ }

const size = bounds.length
const values = Array<number>(size + 1)
const boundaries = Array<number>(size)
const values = new Uint32Array(size + 1)
const boundaries = new Float32Array(size)
let count = 0

@@ -102,3 +102,3 @@ let sum = 0

Chunk.sort(number.Order),
Chunk.mapWithIndex((i, n) => {
Chunk.mapWithIndex((n, i) => {
boundaries[i] = n

@@ -114,3 +114,3 @@ })

const mid = Math.floor(from + (to - from) / 2)
const boundary = boundaries[mid]!
const boundary = boundaries[mid]
if (value <= boundary) {

@@ -123,3 +123,3 @@ to = mid

if (to === from + 1) {
if (value <= boundaries[from]!) {
if (value <= boundaries[from]) {
to = from

@@ -143,13 +143,11 @@ } else {

const getBuckets = (): Chunk.Chunk<readonly [number, number]> => {
const builder: Array<readonly [number, number]> = []
let i = 0
const builder: Array<readonly [number, number]> = Array(size)
let cumulated = 0
while (i != size) {
const boundary = boundaries[i]!
const value = values[i]!
for (let i = 0; i < size; i++) {
const boundary = boundaries[i]
const value = values[i]
cumulated = cumulated + value
builder.push([boundary, cumulated] as const)
i = i + 1
builder[i] = [boundary, cumulated]
}
return Chunk.fromIterable(builder)
return Chunk.unsafeFromArray(builder)
}

@@ -205,3 +203,3 @@

sortedQuantiles,
pipe(Chunk.fromIterable(builder), Chunk.sort(number.Order))
pipe(Chunk.unsafeFromArray(builder), Chunk.sort(number.Order))
)

@@ -208,0 +206,0 @@ }

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

}
throw new AsyncFiber(fiberRuntime)
throw asyncFiberException(fiberRuntime)
}

@@ -122,14 +122,38 @@ )

/** @internal */
export class AsyncFiber<E, A> implements Runtime.AsyncFiber<E, A> {
readonly _tag = "AsyncFiber"
constructor(readonly fiber: Fiber.RuntimeFiber<E, A>) {}
toString() {
return `Fiber #${this.fiber.id().id} has suspended work asyncroniously`
}
[Symbol.for("nodejs.util.inspect.custom")]() {
return this.toString()
}
const asyncFiberException = <E, A>(fiber: Fiber.RuntimeFiber<E, A>): Runtime.AsyncFiberException<E, A> => {
const limit = Error.stackTraceLimit
Error.stackTraceLimit = 0
const error = (new Error()) as any
Error.stackTraceLimit = limit
const message = `Fiber #${fiber.id().id} has suspended work asyncroniously`
const _tag = "AsyncFiberException"
Object.defineProperties(error, {
_tag: {
value: _tag
},
message: {
value: message
},
name: {
value: _tag
},
toString: {
get() {
return () => message
}
},
[NodePrint]: {
get() {
return () => message
}
}
})
return error
}
/** @internal */
export const isAsyncFiberException = (u: unknown): u is Runtime.AsyncFiberException<unknown, unknown> =>
typeof u === "object" && u !== null && "_tag" in u && u._tag === "AsyncFiberException" && "fiber" in u
/** @internal */
export const FiberFailureId: Runtime.FiberFailureId = Symbol.for("@effect/io/Runtime/FiberFailure") as any

@@ -189,3 +213,3 @@ /** @internal */

}
throw new AsyncFiber(fiberRuntime)
throw asyncFiberException(fiberRuntime)
}

@@ -192,0 +216,0 @@ )

@@ -20,4 +20,4 @@ /**

*/
export interface AsyncFiber<E, A> {
readonly _tag: "AsyncFiber"
export interface AsyncFiberException<E, A> {
readonly _tag: "AsyncFiberException"
readonly fiber: Fiber.RuntimeFiber<E, A>

@@ -243,2 +243,9 @@ }

*/
export const isAsyncFiberException: (u: unknown) => u is AsyncFiberException<unknown, unknown> =
internal.isAsyncFiberException
/**
* @since 1.0.0
* @category guards
*/
export const isFiberFailure: (u: unknown) => u is FiberFailure = internal.isFiberFailure

@@ -245,0 +252,0 @@

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

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