@effect/stream
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -78,3 +78,3 @@ "use strict"; | ||
const add = yield* $(stream.distributedWithDynamic(bufferSize, ([key, value]) => Effect.flatMap(f => f(key, value))(Deferred.await(decider)), exit => Queue.offer(exit)(output))(stream.mapEffect(f)(self))); | ||
yield* $(Deferred.succeed((key, _) => Effect.flatMap(Option.match(() => Effect.flatMap(([index, queue]) => Effect.zipRight(Effect.as(n => n === index)(Queue.offer(Exit.succeed([key, mapDequeue(queue, exit => new take.TakeImpl(Exit.map(tuple => Chunk.singleton(tuple[1]))(exit)))]))(output)))(Ref.update(map => map.set(key, index))(ref)))(add), index => Effect.succeed(n => n === index)))(Effect.map(map => Option.fromNullable(map.get(key)))(Ref.get(ref))))(decider)); | ||
yield* $(Deferred.succeed((key, _) => Effect.flatMap(Option.match(() => Effect.flatMap(([index, queue]) => Effect.zipRight(Effect.as(n => n === index)(Queue.offer(Exit.succeed([key, mapDequeue(queue, exit => new take.TakeImpl(Exit.map(tuple => Chunk.of(tuple[1]))(exit)))]))(output)))(Ref.update(map => map.set(key, index))(ref)))(add), index => Effect.succeed(n => n === index)))(Effect.map(map => Option.fromNullable(map.get(key)))(Ref.get(ref))))(decider)); | ||
return stream.flattenExitOption(stream.fromQueueWithShutdown(output)); | ||
@@ -141,3 +141,3 @@ }))); | ||
if (innerQueue === undefined) { | ||
return Effect.flatMap(innerQueue => Effect.zipRight(Effect.catchSomeCause(cause => Cause.isInterruptedOnly(cause) ? Option.some(Effect.unit()) : Option.none)(Queue.offer(take.chunk(values))(innerQueue)))(Effect.zipRight(Queue.offer(take.singleton([key, innerQueue]))(outerQueue))(Effect.sync(() => { | ||
return Effect.flatMap(innerQueue => Effect.zipRight(Effect.catchSomeCause(cause => Cause.isInterruptedOnly(cause) ? Option.some(Effect.unit()) : Option.none)(Queue.offer(take.chunk(values))(innerQueue)))(Effect.zipRight(Queue.offer(take.of([key, innerQueue]))(outerQueue))(Effect.sync(() => { | ||
map.set(key, innerQueue); | ||
@@ -144,0 +144,0 @@ }))))(Queue.bounded(bufferSize)); |
@@ -428,3 +428,3 @@ "use strict"; | ||
exports.foldUntilEffect = foldUntilEffect; | ||
const foldWeighted = (s, max, costFn, f) => foldWeightedDecompose(s, max, costFn, Chunk.singleton, f); | ||
const foldWeighted = (s, max, costFn, f) => foldWeightedDecompose(s, max, costFn, Chunk.of, f); | ||
/** @internal */ | ||
@@ -476,3 +476,3 @@ exports.foldWeighted = foldWeighted; | ||
exports.foldWeightedDecomposeEffect = foldWeightedDecomposeEffect; | ||
const foldWeightedEffect = (s, max, costFn, f) => foldWeightedDecomposeEffect(s, max, costFn, input => Effect.succeed(Chunk.singleton(input)), f); | ||
const foldWeightedEffect = (s, max, costFn, f) => foldWeightedDecomposeEffect(s, max, costFn, input => Effect.succeed(Chunk.of(input)), f); | ||
/** @internal */ | ||
@@ -479,0 +479,0 @@ exports.foldWeightedEffect = foldWeightedEffect; |
@@ -28,3 +28,3 @@ "use strict"; | ||
done(exit) { | ||
return this(Effect.done(Exit.mapBoth(Option.some, Chunk.singleton)(exit))); | ||
return this(Effect.done(Exit.mapBoth(Option.some, Chunk.of)(exit))); | ||
}, | ||
@@ -38,3 +38,3 @@ end() { | ||
fromEffect(effect) { | ||
return this(Effect.mapBoth(Option.some, Chunk.singleton)(effect)); | ||
return this(Effect.mapBoth(Option.some, Chunk.of)(effect)); | ||
}, | ||
@@ -48,3 +48,3 @@ fromEffectChunk(effect) { | ||
single(value) { | ||
return this(Effect.succeed(Chunk.singleton(value))); | ||
return this(Effect.succeed(Chunk.of(value))); | ||
} | ||
@@ -51,0 +51,0 @@ }; |
@@ -22,3 +22,3 @@ "use strict"; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return Effect.succeed(Chunk.singleton(value)).traced(trace); | ||
return Effect.succeed(Chunk.of(value)).traced(trace); | ||
}; | ||
@@ -25,0 +25,0 @@ /** |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.tap = exports.singleton = exports.matchEffect = exports.match = exports.map = exports.make = exports.isSuccess = exports.isFailure = exports.isDone = exports.fromPull = exports.fromExit = exports.fromEffect = exports.failCause = exports.fail = exports.end = exports.done = exports.dieMessage = exports.die = exports.chunk = exports.TakeTypeId = exports.TakeImpl = void 0; | ||
exports.tap = exports.of = exports.matchEffect = exports.match = exports.map = exports.make = exports.isSuccess = exports.isFailure = exports.isDone = exports.fromPull = exports.fromExit = exports.fromEffect = exports.failCause = exports.fail = exports.end = exports.done = exports.dieMessage = exports.die = exports.chunk = exports.TakeTypeId = exports.TakeImpl = void 0; | ||
var Cause = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Cause")); | ||
@@ -66,7 +66,7 @@ var _Debug = /*#__PURE__*/require("@effect/io/Debug"); | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return Effect.matchCause(failCause, singleton)(effect).traced(trace); | ||
return Effect.matchCause(failCause, of)(effect).traced(trace); | ||
}; | ||
/** @internal */ | ||
exports.fromEffect = fromEffect; | ||
const fromExit = exit => new TakeImpl(Exit.mapBoth(Option.some, Chunk.singleton)(exit)); | ||
const fromExit = exit => new TakeImpl(Exit.mapBoth(Option.some, Chunk.of)(exit)); | ||
/** @internal */ | ||
@@ -108,5 +108,5 @@ exports.fromExit = fromExit; | ||
exports.map = map; | ||
const singleton = value => new TakeImpl(Exit.succeed(Chunk.singleton(value))); | ||
const of = value => new TakeImpl(Exit.succeed(Chunk.of(value))); | ||
/** @internal */ | ||
exports.singleton = singleton; | ||
exports.of = of; | ||
const tap = f => { | ||
@@ -113,0 +113,0 @@ const trace = (0, _Debug.getCallTrace)(); |
{ | ||
"name": "@effect/stream", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"license": "MIT", | ||
@@ -10,5 +10,5 @@ "repository": { | ||
"dependencies": { | ||
"@effect/io": "~0.0.50", | ||
"@effect/io": "~0.0.52", | ||
"@fp-ts/core": "~0.0.11", | ||
"@fp-ts/data": "~0.0.33" | ||
"@fp-ts/data": "~0.0.36" | ||
}, | ||
@@ -15,0 +15,0 @@ "publishConfig": { |
@@ -154,3 +154,3 @@ import * as Cause from "@effect/io/Cause" | ||
exit, | ||
Exit.map((tuple) => Chunk.singleton(tuple[1])) | ||
Exit.map((tuple) => Chunk.of(tuple[1])) | ||
))) | ||
@@ -271,3 +271,3 @@ ] as const | ||
outerQueue, | ||
Queue.offer(take.singleton([key, innerQueue] as const)) | ||
Queue.offer(take.of([key, innerQueue] as const)) | ||
) | ||
@@ -274,0 +274,0 @@ ), |
@@ -906,3 +906,3 @@ import * as Cause from "@effect/io/Cause" | ||
f: (s: S, input: In) => S | ||
): Sink.Sink<never, never, In, In, S> => foldWeightedDecompose(s, max, costFn, Chunk.singleton, f) | ||
): Sink.Sink<never, never, In, In, S> => foldWeightedDecompose(s, max, costFn, Chunk.of, f) | ||
@@ -1013,3 +1013,3 @@ /** @internal */ | ||
costFn, | ||
(input) => Effect.succeed(Chunk.singleton(input)), | ||
(input) => Effect.succeed(Chunk.of(input)), | ||
f | ||
@@ -1016,0 +1016,0 @@ ) |
@@ -24,3 +24,3 @@ import * as Cause from "@effect/io/Cause" | ||
done(this: Emit.Emit<R, E, A, B>, exit: Exit.Exit<E, A>) { | ||
return this(Effect.done(pipe(exit, Exit.mapBoth(Option.some, Chunk.singleton)))) | ||
return this(Effect.done(pipe(exit, Exit.mapBoth(Option.some, Chunk.of)))) | ||
}, | ||
@@ -34,3 +34,3 @@ end(this: Emit.Emit<R, E, A, B>) { | ||
fromEffect(this: Emit.Emit<R, E, A, B>, effect: Effect.Effect<R, E, A>) { | ||
return this(pipe(effect, Effect.mapBoth(Option.some, Chunk.singleton))) | ||
return this(pipe(effect, Effect.mapBoth(Option.some, Chunk.of))) | ||
}, | ||
@@ -44,3 +44,3 @@ fromEffectChunk(this: Emit.Emit<R, E, A, B>, effect: Effect.Effect<R, E, Chunk.Chunk<A>>) { | ||
single(this: Emit.Emit<R, E, A, B>, value: A) { | ||
return this(Effect.succeed(Chunk.singleton(value))) | ||
return this(Effect.succeed(Chunk.of(value))) | ||
} | ||
@@ -47,0 +47,0 @@ } |
@@ -20,3 +20,3 @@ import type * as Cause from "@effect/io/Cause" | ||
const trace = getCallTrace() | ||
return Effect.succeed(Chunk.singleton(value)).traced(trace) | ||
return Effect.succeed(Chunk.of(value)).traced(trace) | ||
} | ||
@@ -23,0 +23,0 @@ |
@@ -62,3 +62,3 @@ import * as Cause from "@effect/io/Cause" | ||
const trace = getCallTrace() | ||
return pipe(effect, Effect.matchCause(failCause, singleton)).traced(trace) | ||
return pipe(effect, Effect.matchCause(failCause, of)).traced(trace) | ||
} | ||
@@ -68,3 +68,3 @@ | ||
export const fromExit = <E, A>(exit: Exit.Exit<E, A>): Take.Take<E, A> => | ||
new TakeImpl(pipe(exit, Exit.mapBoth(Option.some, Chunk.singleton))) | ||
new TakeImpl(pipe(exit, Exit.mapBoth(Option.some, Chunk.of))) | ||
@@ -157,3 +157,3 @@ /** @internal */ | ||
/** @internal */ | ||
export const singleton = <A>(value: A): Take.Take<never, A> => new TakeImpl(Exit.succeed(Chunk.singleton(value))) | ||
export const of = <A>(value: A): Take.Take<never, A> => new TakeImpl(Exit.succeed(Chunk.of(value))) | ||
@@ -160,0 +160,0 @@ /** @internal */ |
@@ -112,3 +112,3 @@ /** | ||
* the `Take<E, A>`. Error from stream when pulling is converted to | ||
* `Take.failCause`. Creates a singleton chunk. | ||
* `Take.failCause`. Creates a single value chunk. | ||
* | ||
@@ -213,3 +213,3 @@ * @macro traced | ||
/** | ||
* Creates a `Take` with a singleton chunk. | ||
* Creates a `Take` with a single value chunk. | ||
* | ||
@@ -219,3 +219,3 @@ * @since 1.0.0 | ||
*/ | ||
export const singleton: <A>(value: A) => Take<never, A> = internal.singleton | ||
export const of: <A>(value: A) => Take<never, A> = internal.of | ||
@@ -222,0 +222,0 @@ /** |
@@ -97,3 +97,3 @@ /** | ||
* the `Take<E, A>`. Error from stream when pulling is converted to | ||
* `Take.failCause`. Creates a singleton chunk. | ||
* `Take.failCause`. Creates a single value chunk. | ||
* | ||
@@ -177,3 +177,3 @@ * @macro traced | ||
/** | ||
* Creates a `Take` with a singleton chunk. | ||
* Creates a `Take` with a single value chunk. | ||
* | ||
@@ -183,3 +183,3 @@ * @since 1.0.0 | ||
*/ | ||
export declare const singleton: <A>(value: A) => Take<never, A>; | ||
export declare const of: <A>(value: A) => Take<never, A>; | ||
/** | ||
@@ -186,0 +186,0 @@ * Returns an effect that effectfully "peeks" at the success of this take. |
10
Take.js
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.tap = exports.singleton = exports.matchEffect = exports.match = exports.map = exports.make = exports.isSuccess = exports.isFailure = exports.isDone = exports.fromPull = exports.fromExit = exports.fromEffect = exports.failCause = exports.fail = exports.end = exports.done = exports.dieMessage = exports.die = exports.chunk = exports.TakeTypeId = void 0; | ||
exports.tap = exports.of = exports.matchEffect = exports.match = exports.map = exports.make = exports.isSuccess = exports.isFailure = exports.isDone = exports.fromPull = exports.fromExit = exports.fromEffect = exports.failCause = exports.fail = exports.end = exports.done = exports.dieMessage = exports.die = exports.chunk = exports.TakeTypeId = void 0; | ||
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/stream/internal/take")); | ||
@@ -76,3 +76,3 @@ 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); } | ||
* the `Take<E, A>`. Error from stream when pulling is converted to | ||
* `Take.failCause`. Creates a singleton chunk. | ||
* `Take.failCause`. Creates a single value chunk. | ||
* | ||
@@ -166,3 +166,3 @@ * @macro traced | ||
/** | ||
* Creates a `Take` with a singleton chunk. | ||
* Creates a `Take` with a single value chunk. | ||
* | ||
@@ -173,3 +173,3 @@ * @since 1.0.0 | ||
exports.matchEffect = matchEffect; | ||
const singleton = internal.singleton; | ||
const of = internal.of; | ||
/** | ||
@@ -182,5 +182,5 @@ * Returns an effect that effectfully "peeks" at the success of this take. | ||
*/ | ||
exports.singleton = singleton; | ||
exports.of = of; | ||
const tap = internal.tap; | ||
exports.tap = tap; | ||
//# sourceMappingURL=Take.js.map |
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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3015567
Updated@effect/io@~0.0.52
Updated@fp-ts/data@~0.0.36