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.31.1 to 0.31.2

10

internal/core.js

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

exports.withFiberRuntime = withFiberRuntime;
const acquireUseRelease = options => uninterruptibleMask(restore => flatMap(options.acquire, a => flatMap(exit(suspend(() => restore(options.use(a)))), exit => suspend(() => options.release(a, exit)).pipe(matchCauseEffect({
const acquireUseRelease = /*#__PURE__*/(0, _Function.dual)(3, (acquire, use, release) => uninterruptibleMask(restore => flatMap(acquire, a => flatMap(exit(suspend(() => restore(use(a)))), exit => suspend(() => release(a, exit)).pipe(matchCauseEffect({
onFailure: cause => {

@@ -185,3 +185,3 @@ switch (exit._tag) {

onSuccess: () => exit
})))));
}))))));
/* @internal */

@@ -875,7 +875,3 @@ exports.acquireUseRelease = acquireUseRelease;

/* @internal */
const fiberRefLocally = /*#__PURE__*/(0, _Function.dual)(3, (use, self, value) => flatMap(acquireUseRelease({
acquire: zipLeft(fiberRefSet(self, value))(fiberRefGet(self)),
use: () => step(use),
release: oldValue => fiberRefSet(self, oldValue)
}), res => {
const fiberRefLocally = /*#__PURE__*/(0, _Function.dual)(3, (use, self, value) => flatMap(acquireUseRelease(zipLeft(fiberRefGet(self), fiberRefSet(self, value)), () => step(use), oldValue => fiberRefSet(self, oldValue)), res => {
if (res._tag === "Blocked") {

@@ -882,0 +878,0 @@ return blocked(res.i0, fiberRefLocally(res.i1, self, value));

@@ -24,25 +24,19 @@ "use strict";

exports.makeWithEntry = makeWithEntry;
const makeBatched = run => new core.RequestResolverImpl(requests => requests.length > 1 ? Effect.forEach(requests, block => (0, _fiberRuntime.invokeWithInterrupt)(run(block.filter(_ => !_.state.completed).map(_ => _.request)), block), {
discard: true
}) : requests.length === 1 ? run(requests[0].filter(_ => !_.state.completed).map(_ => _.request)) : core.unit);
const makeBatched = run => new core.RequestResolverImpl(requests => requests.length > 1 ? core.forEachDiscard(requests, block => (0, _fiberRuntime.invokeWithInterrupt)(run(block.filter(_ => !_.state.completed).map(_ => _.request)), block)) : requests.length === 1 ? run(requests[0].filter(_ => !_.state.completed).map(_ => _.request)) : core.unit);
/** @internal */
exports.makeBatched = makeBatched;
const around = /*#__PURE__*/(0, _Function.dual)(3, (self, before, after) => new core.RequestResolverImpl(requests => Effect.acquireUseRelease({
acquire: before,
use: () => self.runAll(requests),
release: after
}), Chunk.make("Around", self, before, after)));
const around = /*#__PURE__*/(0, _Function.dual)(3, (self, before, after) => new core.RequestResolverImpl(requests => core.acquireUseRelease(before, () => self.runAll(requests), after), Chunk.make("Around", self, before, after)));
/** @internal */
exports.around = around;
const batchN = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => new core.RequestResolverImpl(requests => {
return n < 1 ? Effect.die(Cause.IllegalArgumentException("RequestResolver.batchN: n must be at least 1")) : self.runAll(Array.from(Chunk.map(RA.reduce(requests, Chunk.empty(), (acc, chunk) => Chunk.appendAll(acc, Chunk.chunksOf(Chunk.unsafeFromArray(chunk), n))), chunk => Array.from(chunk))));
return n < 1 ? core.die(Cause.IllegalArgumentException("RequestResolver.batchN: n must be at least 1")) : self.runAll(Array.from(Chunk.map(RA.reduce(requests, Chunk.empty(), (acc, chunk) => Chunk.appendAll(acc, Chunk.chunksOf(Chunk.unsafeFromArray(chunk), n))), chunk => Array.from(chunk))));
}, Chunk.make("BatchN", self, n)));
/** @internal */
exports.batchN = batchN;
const contramapContext = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => new core.RequestResolverImpl(requests => Effect.contramapContext(self.runAll(requests), context => f(context)), Chunk.make("ContramapContext", self, f)));
const contramapContext = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => new core.RequestResolverImpl(requests => core.contramapContext(self.runAll(requests), context => f(context)), Chunk.make("ContramapContext", self, f)));
/** @internal */
exports.contramapContext = contramapContext;
const eitherWith = /*#__PURE__*/(0, _Function.dual)(3, (self, that, f) => new core.RequestResolverImpl(batch => Effect.forEach(batch, requests => {
const eitherWith = /*#__PURE__*/(0, _Function.dual)(3, (self, that, f) => new core.RequestResolverImpl(batch => core.forEach(batch, requests => {
const [as, bs] = RA.partitionMap(f)(requests);
return Effect.zipWith(self.runAll(Array.of(as)), that.runAll(Array.of(bs)), () => void 0, {
return (0, _fiberRuntime.zipWithOptions)(self.runAll(Array.of(as)), that.runAll(Array.of(bs)), () => void 0, {
parallel: true

@@ -53,5 +47,3 @@ });

exports.eitherWith = eitherWith;
const fromFunction = f => makeBatched(requests => Effect.forEach(requests, request => (0, _request.complete)(request, core.exitSucceed(f(request))), {
discard: true
})).identified("FromFunction", f);
const fromFunction = f => makeBatched(requests => core.forEachDiscard(requests, request => (0, _request.complete)(request, core.exitSucceed(f(request))))).identified("FromFunction", f);
/** @internal */

@@ -58,0 +50,0 @@ exports.fromFunction = fromFunction;

@@ -260,21 +260,12 @@ "use strict";

exports.filterMap = filterMap;
const filterOrDie = /*#__PURE__*/(0, _Function.dual)(2, (self, options) => filterOrElse(self, {
filter: options.filter,
orElse: () => core.dieSync(options.orDieWith)
}));
const filterOrDie = /*#__PURE__*/(0, _Function.dual)(3, (self, filter, orDieWith) => filterOrElse(self, filter, () => core.dieSync(orDieWith)));
/* @internal */
exports.filterOrDie = filterOrDie;
const filterOrDieMessage = /*#__PURE__*/(0, _Function.dual)(2, (self, options) => filterOrElse(self, {
filter: options.filter,
orElse: () => core.dieMessage(options.message)
}));
const filterOrDieMessage = /*#__PURE__*/(0, _Function.dual)(3, (self, filter, message) => filterOrElse(self, filter, () => core.dieMessage(message)));
/* @internal */
exports.filterOrDieMessage = filterOrDieMessage;
const filterOrElse = /*#__PURE__*/(0, _Function.dual)(2, (self, options) => core.flatMap(self, a => options.filter(a) ? core.succeed(a) : options.orElse(a)));
const filterOrElse = /*#__PURE__*/(0, _Function.dual)(3, (self, filter, orElse) => core.flatMap(self, a => filter(a) ? core.succeed(a) : orElse(a)));
/* @internal */
exports.filterOrElse = filterOrElse;
const filterOrFail = /*#__PURE__*/(0, _Function.dual)(2, (self, options) => filterOrElse(self, {
filter: options.filter,
orElse: a => core.failSync(() => options.orFailWith(a))
}));
const filterOrFail = /*#__PURE__*/(0, _Function.dual)(3, (self, filter, orFailWith) => filterOrElse(self, filter, a => core.failSync(() => orFailWith(a))));
/* @internal */

@@ -766,14 +757,10 @@ exports.filterOrFail = filterOrFail;

const evaluate = args[args.length - 1];
return core.acquireUseRelease({
acquire: tracerWith(tracer => core.flatMap(options?.parent ? core.succeed(Option.some(options.parent)) : options?.root ? core.succeed(Option.none()) : core.map(core.fiberRefGet(core.currentTracerSpan), List.head), parent => core.flatMap(core.fiberRefGet(core.currentTracerSpanAnnotations), annotations => core.flatMap(Clock.currentTimeNanos, startTime => core.sync(() => {
const span = tracer.span(name, parent, options?.context ?? Context.empty(), startTime);
HashMap.forEachWithIndex(annotations, (value, key) => span.attribute(key, value));
Object.entries(options?.attributes ?? {}).forEach(([k, v]) => {
span.attribute(k, v);
});
return span;
}))))),
use: evaluate,
release: (span, exit) => core.flatMap(Clock.clockWith(clock => clock.currentTimeNanos), endTime => core.sync(() => span.end(endTime, exit)))
});
return core.acquireUseRelease(tracerWith(tracer => core.flatMap(options?.parent ? core.succeed(Option.some(options.parent)) : options?.root ? core.succeed(Option.none()) : core.map(core.fiberRefGet(core.currentTracerSpan), List.head), parent => core.flatMap(core.fiberRefGet(core.currentTracerSpanAnnotations), annotations => core.flatMap(Clock.currentTimeNanos, startTime => core.sync(() => {
const span = tracer.span(name, parent, options?.context ?? Context.empty(), startTime);
HashMap.forEachWithIndex(annotations, (value, key) => span.attribute(key, value));
Object.entries(options?.attributes ?? {}).forEach(([k, v]) => {
span.attribute(k, v);
});
return span;
}))))), evaluate, (span, exit) => core.flatMap(Clock.clockWith(clock => clock.currentTimeNanos), endTime => core.sync(() => span.end(endTime, exit))));
};

@@ -780,0 +767,0 @@ /* @internal */

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

const acquire = core.tap(fiberRuntime.all(this.scope.fork(executionStrategy.sequential), makeSubscription(this.hub, this.subscribers, this.strategy)), tuple => tuple[0].addFinalizer(() => tuple[1].shutdown()));
return core.map(fiberRuntime.acquireRelease({
acquire,
release: (tuple, exit) => tuple[0].close(exit)
}), tuple => tuple[1]);
return core.map(fiberRuntime.acquireRelease(acquire, (tuple, exit) => tuple[0].close(exit)), tuple => tuple[1]);
}

@@ -822,0 +819,0 @@ offer(value) {

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

exports.scopedContext = scopedContext;
const scope = /*#__PURE__*/scopedContext( /*#__PURE__*/core.map( /*#__PURE__*/fiberRuntime.acquireRelease({
acquire: /*#__PURE__*/fiberRuntime.scopeMake(),
release: (scope, exit) => scope.close(exit)
}), scope => Context.make(Scope.Scope, scope)));
const scope = /*#__PURE__*/scopedContext( /*#__PURE__*/core.map( /*#__PURE__*/fiberRuntime.acquireRelease( /*#__PURE__*/fiberRuntime.scopeMake(), (scope, exit) => scope.close(exit)), scope => Context.make(Scope.Scope, scope)));
/** @internal */

@@ -513,7 +510,3 @@ exports.scope = scope;

exports.zipWithPar = zipWithPar;
const provideLayer = /*#__PURE__*/(0, _Function.dual)(2, (self, layer) => core.acquireUseRelease({
acquire: fiberRuntime.scopeMake(),
use: scope => core.flatMap(buildWithScope(layer, scope), context => core.provideContext(self, context)),
release: (scope, exit) => core.scopeClose(scope, exit)
}));
const provideLayer = /*#__PURE__*/(0, _Function.dual)(2, (self, layer) => core.acquireUseRelease(fiberRuntime.scopeMake(), scope => core.flatMap(buildWithScope(layer, scope), context => core.provideContext(self, context)), (scope, exit) => core.scopeClose(scope, exit)));
/** @internal */

@@ -520,0 +513,0 @@ exports.provideLayer = provideLayer;

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

});
return core.flatMap(([release, attempted]) => core.zipRight(toEffect(attempted))(effect.when(release, () => isFailure(attempted))))(fiberRuntime.disconnect(fiberRuntime.withEarlyRelease(fiberRuntime.acquireRelease({
acquire: acquire(),
release
}))));
return core.flatMap(([release, attempted]) => core.zipRight(toEffect(attempted))(effect.when(release, () => isFailure(attempted))))(fiberRuntime.disconnect(fiberRuntime.withEarlyRelease(fiberRuntime.acquireRelease(acquire(), release))));
}

@@ -141,0 +138,0 @@ invalidate(item) {

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

/** @internal */
const auto = (tag, options) => _layer.scoped(reloadableTag(tag), core.tap(reloadable => fiberRuntime.acquireRelease({
acquire: fiberRuntime.forkDaemon(_schedule.schedule_Effect(options.schedule)(effect.ignoreLogged(reloadable.reload()))),
release: core.interruptFiber
}))(core.map(Context.unsafeGet(reloadableTag(tag)))(_layer.build(manual(tag, {
const auto = (tag, options) => _layer.scoped(reloadableTag(tag), core.tap(reloadable => fiberRuntime.acquireRelease(fiberRuntime.forkDaemon(_schedule.schedule_Effect(options.schedule)(effect.ignoreLogged(reloadable.reload()))), core.interruptFiber))(core.map(Context.unsafeGet(reloadableTag(tag)))(_layer.build(manual(tag, {
layer: options.layer

@@ -33,0 +30,0 @@ })))));

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

/** @internal */
const auto = (acquire, policy) => core.tap(manual(acquire), manual => fiberRuntime.acquireRelease({
acquire: fiberRuntime.forkDaemon(core.interruptible(_schedule.schedule_Effect(policy)(refresh(manual)))),
release: core.interruptFiber
}));
const auto = (acquire, policy) => core.tap(manual(acquire), manual => fiberRuntime.acquireRelease(fiberRuntime.forkDaemon(core.interruptible(_schedule.schedule_Effect(policy)(refresh(manual)))), core.interruptFiber));
/** @internal */

@@ -31,0 +28,0 @@ exports.auto = auto;

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

onFailure: cause => core.failCause(cause),
onSuccess: ([value]) => fiberRuntime.acquireRelease({
acquire: core.as(core.sync(() => MutableRef.incrementAndGet(self.ownerCount)), value),
release: () => releaseOwner(self)
})
onSuccess: ([value]) => fiberRuntime.acquireRelease(core.as(core.sync(() => MutableRef.incrementAndGet(self.ownerCount)), value), () => releaseOwner(self))
});

@@ -391,6 +388,3 @@ /** @internal */

exports.makeWith = makeWith;
const buildWith = (capacity, scopedLookup, clock, timeToLive) => fiberRuntime.acquireRelease({
acquire: core.flatMap(core.context(), context => core.sync(() => new ScopedCacheImpl(capacity, scopedLookup, clock, timeToLive, context))),
release: cache => cache.invalidateAll()
});
const buildWith = (capacity, scopedLookup, clock, timeToLive) => fiberRuntime.acquireRelease(core.flatMap(core.context(), context => core.sync(() => new ScopedCacheImpl(capacity, scopedLookup, clock, timeToLive, context))), cache => cache.invalidateAll());
//# sourceMappingURL=scopedCache.js.map

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

awaitSuspended() {
return core.zipRight(this.suspendedWarningDone())(core.zipRight(effect.eventually(effect.filterOrFail({
filter: _Function.identity,
orFailWith: _Function.constVoid
})(core.zipWith(core.zipRight(this.suspended())(this.live.provide(effect.sleep(Duration.millis(10)))), Equal.equals)(this.suspended()))))(this.suspendedWarningStart()));
return core.zipRight(this.suspendedWarningDone())(core.zipRight(effect.eventually(effect.filterOrFail(_Function.identity, _Function.constVoid)(core.zipWith(core.zipRight(this.suspended())(this.live.provide(effect.sleep(Duration.millis(10)))), Equal.equals)(this.suspended()))))(this.suspendedWarningStart()));
}

@@ -201,0 +198,0 @@ /**

{
"name": "@effect/io",
"version": "0.31.1",
"version": "0.31.2",
"license": "MIT",

@@ -10,3 +10,3 @@ "repository": {

"dependencies": {
"@effect/data": "^0.13.0"
"@effect/data": "^0.13.4"
},

@@ -13,0 +13,0 @@ "publishConfig": {

@@ -5,3 +5,3 @@ /**

import type * as Data from "@effect/data/Data";
import type { Duration } from "@effect/data/Duration";
import type { DurationInput } from "@effect/data/Duration";
import type * as Option from "@effect/data/Option";

@@ -184,3 +184,3 @@ import type * as _Cache from "@effect/io/Cache";

readonly capacity: number;
readonly timeToLive: Duration;
readonly timeToLive: DurationInput;
}) => Effect.Effect<never, never, Cache>;

@@ -187,0 +187,0 @@ /**

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

import * as core from "@effect/io/internal/core"
import { invokeWithInterrupt } from "@effect/io/internal/fiberRuntime"
import { invokeWithInterrupt, zipWithOptions } from "@effect/io/internal/fiberRuntime"
import { complete } from "@effect/io/internal/request"

@@ -33,3 +33,3 @@ import type * as Request from "@effect/io/Request"

requests.length > 1 ?
Effect.forEach(requests, (block) =>
core.forEachDiscard(requests, (block) =>
invokeWithInterrupt(

@@ -42,3 +42,3 @@ run(

block
), { discard: true }) :
)) :
(requests.length === 1 ?

@@ -69,7 +69,7 @@ run(

(requests) =>
Effect.acquireUseRelease({
acquire: before,
use: () => self.runAll(requests),
release: after
}),
core.acquireUseRelease(
before,
() => self.runAll(requests),
after
),
Chunk.make("Around", self, before, after)

@@ -94,3 +94,3 @@ ))

return n < 1
? Effect.die(Cause.IllegalArgumentException("RequestResolver.batchN: n must be at least 1"))
? core.die(Cause.IllegalArgumentException("RequestResolver.batchN: n must be at least 1"))
: self.runAll(

@@ -127,3 +127,3 @@ Array.from(Chunk.map(

(requests) =>
Effect.contramapContext(
core.contramapContext(
self.runAll(requests),

@@ -173,3 +173,3 @@ (context: Context.Context<R0>) => f(context)

pipe(
Effect.forEach(batch, (requests) => {
core.forEach(batch, (requests) => {
const [as, bs] = pipe(

@@ -179,3 +179,3 @@ requests,

)
return Effect.zipWith(
return zipWithOptions(
self.runAll(Array.of(as)),

@@ -196,6 +196,5 @@ that.runAll(Array.of(bs)),

makeBatched((requests: Array<A>) =>
Effect.forEach(
core.forEachDiscard(
requests,
(request) => complete(request, core.exitSucceed(f(request)) as any),
{ discard: true }
(request) => complete(request, core.exitSucceed(f(request)) as any)
)

@@ -202,0 +201,0 @@ ).identified("FromFunction", f)

@@ -539,12 +539,8 @@ import * as Chunk from "@effect/data/Chunk"

<A, B extends A>(
options: {
readonly filter: Refinement<A, B>
readonly orDieWith: LazyArg<unknown>
}
filter: Refinement<A, B>,
orDieWith: LazyArg<unknown>
): <R, E>(self: Effect.Effect<R, E, A>) => Effect.Effect<R, E, B>
<A>(
options: {
readonly filter: Predicate<A>
readonly orDieWith: LazyArg<unknown>
}
filter: Predicate<A>,
orDieWith: LazyArg<unknown>
): <R, E>(self: Effect.Effect<R, E, A>) => Effect.Effect<R, E, A>

@@ -555,26 +551,16 @@ },

self: Effect.Effect<R, E, A>,
options: {
readonly filter: Refinement<A, B>
readonly orDieWith: LazyArg<unknown>
}
filter: Refinement<A, B>,
orDieWith: LazyArg<unknown>
): Effect.Effect<R, E, B>
<R, E, A>(
self: Effect.Effect<R, E, A>,
options: {
readonly filter: Predicate<A>
readonly orDieWith: LazyArg<unknown>
}
filter: Predicate<A>,
orDieWith: LazyArg<unknown>
): Effect.Effect<R, E, A>
}
>(2, <R, E, A>(
>(3, <R, E, A>(
self: Effect.Effect<R, E, A>,
options: {
readonly filter: Predicate<A>
readonly orDieWith: LazyArg<unknown>
}
): Effect.Effect<R, E, A> =>
filterOrElse(self, {
filter: options.filter,
orElse: () => core.dieSync(options.orDieWith)
}))
filter: Predicate<A>,
orDieWith: LazyArg<unknown>
): Effect.Effect<R, E, A> => filterOrElse(self, filter, () => core.dieSync(orDieWith)))

@@ -585,12 +571,8 @@ /* @internal */

<A, B extends A>(
options: {
readonly filter: Refinement<A, B>
readonly message: string
}
filter: Refinement<A, B>,
message: string
): <R, E>(self: Effect.Effect<R, E, A>) => Effect.Effect<R, E, B>
<A>(
options: {
readonly filter: Predicate<A>
readonly message: string
}
filter: Predicate<A>,
message: string
): <R, E>(self: Effect.Effect<R, E, A>) => Effect.Effect<R, E, A>

@@ -601,26 +583,16 @@ },

self: Effect.Effect<R, E, A>,
options: {
readonly filter: Refinement<A, B>
readonly message: string
}
filter: Refinement<A, B>,
message: string
): Effect.Effect<R, E, B>
<R, E, A>(
self: Effect.Effect<R, E, A>,
options: {
readonly filter: Predicate<A>
readonly message: string
}
filter: Predicate<A>,
message: string
): Effect.Effect<R, E, A>
}
>(2, <R, E, A>(
>(3, <R, E, A>(
self: Effect.Effect<R, E, A>,
options: {
readonly filter: Predicate<A>
readonly message: string
}
): Effect.Effect<R, E, A> =>
filterOrElse(self, {
filter: options.filter,
orElse: () => core.dieMessage(options.message)
}))
filter: Predicate<A>,
message: string
): Effect.Effect<R, E, A> => filterOrElse(self, filter, () => core.dieMessage(message)))

@@ -631,12 +603,8 @@ /* @internal */

<A, B extends A, R2, E2, C>(
options: {
readonly filter: Refinement<A, B>
readonly orElse: (a: A) => Effect.Effect<R2, E2, C>
}
filter: Refinement<A, B>,
orElse: (a: A) => Effect.Effect<R2, E2, C>
): <R, E>(self: Effect.Effect<R, E, A>) => Effect.Effect<R | R2, E | E2, B | C>
<A, R2, E2, B>(
options: {
readonly filter: Predicate<A>
readonly orElse: (a: A) => Effect.Effect<R2, E2, B>
}
filter: Predicate<A>,
orElse: (a: A) => Effect.Effect<R2, E2, B>
): <R, E>(self: Effect.Effect<R, E, A>) => Effect.Effect<R | R2, E | E2, A | B>

@@ -647,23 +615,20 @@ },

self: Effect.Effect<R, E, A>,
options: {
readonly filter: Refinement<A, B>
readonly orElse: (a: A) => Effect.Effect<R2, E2, C>
}
filter: Refinement<A, B>,
orElse: (a: A) => Effect.Effect<R2, E2, C>
): Effect.Effect<R | R2, E | E2, B | C>
<R, E, A, R2, E2, B>(
self: Effect.Effect<R, E, A>,
options: {
readonly filter: Predicate<A>
readonly orElse: (a: A) => Effect.Effect<R2, E2, B>
}
filter: Predicate<A>,
orElse: (a: A) => Effect.Effect<R2, E2, B>
): Effect.Effect<R | R2, E | E2, A | B>
}
>(2, <R, E, A, R2, E2, B>(
>(3, <R, E, A, R2, E2, B>(
self: Effect.Effect<R, E, A>,
options: {
readonly filter: Predicate<A>
readonly orElse: (a: A) => Effect.Effect<R2, E2, B>
}
filter: Predicate<A>,
orElse: (a: A) => Effect.Effect<R2, E2, B>
): Effect.Effect<R | R2, E | E2, A | B> =>
core.flatMap(self, (a) => options.filter(a) ? core.succeed<A | B>(a) : options.orElse(a)))
core.flatMap(
self,
(a) => filter(a) ? core.succeed<A | B>(a) : orElse(a)
))

@@ -674,12 +639,8 @@ /* @internal */

<A, B extends A, E2>(
options: {
readonly filter: Refinement<A, B>
readonly orFailWith: (a: A) => E2
}
filter: Refinement<A, B>,
orFailWith: (a: A) => E2
): <R, E>(self: Effect.Effect<R, E, A>) => Effect.Effect<R, E | E2, B>
<A, E2>(
options: {
readonly filter: Predicate<A>
readonly orFailWith: (a: A) => E2
}
filter: Predicate<A>,
orFailWith: (a: A) => E2
): <R, E>(self: Effect.Effect<R, E, A>) => Effect.Effect<R, E | E2, A>

@@ -690,26 +651,16 @@ },

self: Effect.Effect<R, E, A>,
options: {
readonly filter: Refinement<A, B>
readonly orFailWith: (a: A) => E2
}
filter: Refinement<A, B>,
orFailWith: (a: A) => E2
): Effect.Effect<R, E | E2, B>
<R, E, A, E2>(
self: Effect.Effect<R, E, A>,
options: {
readonly filter: Predicate<A>
readonly orFailWith: (a: A) => E2
}
filter: Predicate<A>,
orFailWith: (a: A) => E2
): Effect.Effect<R, E | E2, A>
}
>(2, <R, E, A, E2>(
>(3, <R, E, A, E2>(
self: Effect.Effect<R, E, A>,
options: {
readonly filter: Predicate<A>
readonly orFailWith: (a: A) => E2
}
): Effect.Effect<R, E | E2, A> =>
filterOrElse(self, {
filter: options.filter,
orElse: (a) => core.failSync(() => options.orFailWith(a))
}))
filter: Predicate<A>,
orFailWith: (a: A) => E2
): Effect.Effect<R, E | E2, A> => filterOrElse(self, filter, (a) => core.failSync(() => orFailWith(a))))

@@ -1822,4 +1773,4 @@ /* @internal */

const evaluate: (span: Tracer.Span) => Effect.Effect<R, E, A> = args[args.length - 1]
return core.acquireUseRelease({
acquire: tracerWith((tracer) =>
return core.acquireUseRelease(
tracerWith((tracer) =>
core.flatMap(

@@ -1853,4 +1804,4 @@ options?.parent ?

),
use: evaluate,
release: (span, exit) =>
evaluate,
(span, exit) =>
core.flatMap(

@@ -1860,3 +1811,3 @@ Clock.clockWith((clock) => clock.currentTimeNanos),

)
})
)
}

@@ -1863,0 +1814,0 @@

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

return core.map(
fiberRuntime.acquireRelease({
acquire,
release: (tuple, exit) => tuple[0].close(exit)
}),
fiberRuntime.acquireRelease(acquire, (tuple, exit) => tuple[0].close(exit)),
(tuple) => tuple[1]

@@ -1101,0 +1098,0 @@ )

@@ -903,6 +903,6 @@ import * as Context from "@effect/data/Context"

core.map(
fiberRuntime.acquireRelease({
acquire: fiberRuntime.scopeMake(),
release: (scope, exit) => scope.close(exit)
}),
fiberRuntime.acquireRelease(
fiberRuntime.scopeMake(),
(scope, exit) => scope.close(exit)
),
(scope) => Context.make(Scope.Scope, scope)

@@ -1111,5 +1111,5 @@ )

>(2, (self, layer) =>
core.acquireUseRelease({
acquire: fiberRuntime.scopeMake(),
use: (scope) =>
core.acquireUseRelease(
fiberRuntime.scopeMake(),
(scope) =>
core.flatMap(

@@ -1119,4 +1119,4 @@ buildWithScope(layer, scope),

),
release: (scope, exit) => core.scopeClose(scope, exit)
}))
(scope, exit) => core.scopeClose(scope, exit)
))

@@ -1123,0 +1123,0 @@ /** @internal */

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

return pipe(
fiberRuntime.acquireRelease({ acquire: acquire(), release }),
fiberRuntime.acquireRelease(acquire(), release),
fiberRuntime.withEarlyRelease,

@@ -234,0 +234,0 @@ fiberRuntime.disconnect,

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

core.tap((reloadable) =>
fiberRuntime.acquireRelease({
acquire: pipe(
fiberRuntime.acquireRelease(
pipe(
reloadable.reload(),

@@ -54,4 +54,4 @@ effect.ignoreLogged,

),
release: core.interruptFiber
})
core.interruptFiber
)
)

@@ -58,0 +58,0 @@ )

@@ -31,6 +31,11 @@ import { identity, pipe } from "@effect/data/Function"

core.tap(manual(acquire), (manual) =>
fiberRuntime.acquireRelease({
acquire: pipe(refresh(manual), _schedule.schedule_Effect(policy), core.interruptible, fiberRuntime.forkDaemon),
release: core.interruptFiber
}))
fiberRuntime.acquireRelease(
pipe(
refresh(manual),
_schedule.schedule_Effect(policy),
core.interruptible,
fiberRuntime.forkDaemon
),
core.interruptFiber
))

@@ -37,0 +42,0 @@ /** @internal */

@@ -151,6 +151,6 @@ import * as Context from "@effect/data/Context"

onSuccess: ([value]) =>
fiberRuntime.acquireRelease({
acquire: core.as(core.sync(() => MutableRef.incrementAndGet(self.ownerCount)), value),
release: () => releaseOwner(self)
})
fiberRuntime.acquireRelease(
core.as(core.sync(() => MutableRef.incrementAndGet(self.ownerCount)), value),
() => releaseOwner(self)
)
})

@@ -613,4 +613,4 @@

): Effect.Effect<Environment | Scope.Scope, never, ScopedCache.ScopedCache<Key, Error, Value>> =>
fiberRuntime.acquireRelease({
acquire: core.flatMap(
fiberRuntime.acquireRelease(
core.flatMap(
core.context<Environment>(),

@@ -628,3 +628,3 @@ (context) =>

),
release: (cache) => cache.invalidateAll()
})
(cache) => cache.invalidateAll()
)

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

),
effect.filterOrFail({ filter: identity, orFailWith: constVoid }),
effect.filterOrFail(identity, constVoid),
effect.eventually

@@ -315,0 +315,0 @@ )

@@ -5,3 +5,3 @@ /**

import type * as Data from "@effect/data/Data"
import type { Duration } from "@effect/data/Duration"
import type { DurationInput } from "@effect/data/Duration"
import type * as Option from "@effect/data/Option"

@@ -217,3 +217,3 @@ import type * as _Cache from "@effect/io/Cache"

readonly capacity: number
readonly timeToLive: Duration
readonly timeToLive: DurationInput
}

@@ -220,0 +220,0 @@ ): Effect.Effect<never, never, Cache> =>

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc