import "../../Operator/index.js"; import * as C from "../../Cause/index.js"; import type { HasClock } from "../../Clock/index.js"; import * as A from "../../Collections/Immutable/Chunk/index.js"; import * as List from "../../Collections/Immutable/List/index.js"; import type * as MP from "../../Collections/Immutable/Map/index.js"; import * as Tp from "../../Collections/Immutable/Tuple/index.js"; import * as E from "../../Either/index.js"; import * as H from "../../Hub/index.js"; import * as L from "../../Layer/index.js"; import * as O from "../../Option/index.js"; import * as Q from "../../Queue/index.js"; import * as T from "../_internal/effect.js"; import * as M from "../_internal/managed.js"; import * as Push from "../Push/index.js"; import type { Transducer } from "../Transducer/index.js"; export declare class Sink { readonly push: M.Managed>; constructor(push: M.Managed>); } /** * Replaces this sink's result with the provided value. */ export declare function as_(self: Sink, z: Z1): Sink; /** * Replaces this sink's result with the provided value. */ export declare function as(z: Z1): (self: Sink) => Sink; /** * Repeatedly runs the sink for as long as its results satisfy * the predicate `p`. The sink's results will be accumulated * using the stepping function `f`. */ export declare function collectAllWhileWith(z: S): (p: (z: Z) => boolean) => (f: (s: S, z: Z) => S) => (self: Sink) => Sink; /** * Transforms this sink's input elements. */ export declare function contramap_(self: Sink, f: (i2: I2) => I): Sink; /** * Transforms this sink's input elements. */ export declare function contramap(f: (i2: I2) => I): (self: Sink) => Sink; /** * Effectfully transforms this sink's input elements. */ export declare function contramapM_(self: Sink, f: (i2: I2) => T.Effect): Sink; /** * Effectfully transforms this sink's input elements. */ export declare function contramapM(f: (i2: I2) => T.Effect): (self: Sink) => Sink; /** * Transforms this sink's input chunks. * `f` must preserve chunking-invariance */ export declare function contramapChunks_(self: Sink, f: (a: A.Chunk) => A.Chunk): Sink; /** * Transforms this sink's input chunks. * `f` must preserve chunking-invariance */ export declare function contramapChunks(f: (a: A.Chunk) => A.Chunk): (self: Sink) => Sink; /** * Effectfully transforms this sink's input chunks. * `f` must preserve chunking-invariance */ export declare function contramapChunksM_(self: Sink, f: (a: A.Chunk) => T.Effect>): Sink; /** * Effectfully transforms this sink's input chunks. * `f` must preserve chunking-invariance */ export declare function contramapChunksM(f: (a: A.Chunk) => T.Effect>): (self: Sink) => Sink; /** * Transforms both inputs and result of this sink using the provided functions. */ export declare function dimap_(self: Sink, f: (i2: I2) => I, g: (z: Z) => Z2): Sink; /** * Transforms both inputs and result of this sink using the provided functions. */ export declare function dimap(f: (i2: I2) => I, g: (z: Z) => Z2): (self: Sink) => Sink; /** * Effectfully transforms both inputs and result of this sink using the provided functions. */ export declare function dimapM_(self: Sink, f: (i2: I2) => T.Effect, g: (z: Z) => T.Effect): Sink; /** * Effectfully transforms both inputs and result of this sink using the provided functions. */ export declare function dimapM(f: (i2: I2) => T.Effect, g: (z: Z) => T.Effect): (self: Sink) => Sink; /** * Transforms both input chunks and result of this sink using the provided functions. */ export declare function dimapChunks_(self: Sink, f: (i2: A.Chunk) => A.Chunk, g: (z: Z) => Z2): Sink; /** * Transforms both input chunks and result of this sink using the provided functions. */ export declare function dimapChunks(f: (i2: A.Chunk) => A.Chunk, g: (z: Z) => Z2): (self: Sink) => Sink; /** * Effectfully transforms both input chunks and result of this sink using the provided functions. * `f` and `g` must preserve chunking-invariance */ export declare function dimapChunksM_(self: Sink, f: (i2: A.Chunk) => T.Effect>, g: (z: Z) => T.Effect): Sink; /** * Effectfully transforms both input chunks and result of this sink using the provided functions. * `f` and `g` must preserve chunking-invariance */ export declare function dimapChunksM(f: (i2: A.Chunk) => T.Effect>, g: (z: Z) => T.Effect): (self: Sink) => Sink; /** * Runs this sink until it yields a result, then uses that result to create another * sink from the provided function which will continue to run until it yields a result. * * This function essentially runs sinks in sequence. */ export declare function chain_(self: Sink, f: (z: Z) => Sink): Sink; /** * Runs this sink until it yields a result, then uses that result to create another * sink from the provided function which will continue to run until it yields a result. * * This function essentially runs sinks in sequence. */ export declare function chain(f: (z: Z) => Sink): (self: Sink) => Sink; /** * Recovers from errors by accepting one effect to execute for the case of an * error, and one effect to execute for the case of success. * * This method has better performance than `either` since no intermediate * value is allocated and does not require subsequent calls to `flatMap` to * define the next effect. * * The error parameter of the returned `IO` may be chosen arbitrarily, since * it will depend on the `IO`s returned by the given continuations. */ export declare function foldM_(self: Sink, failure: (e: E) => Sink, success: (z: Z) => Sink): Sink; /** * Recovers from errors by accepting one effect to execute for the case of an * error, and one effect to execute for the case of success. * * This method has better performance than `either` since no intermediate * value is allocated and does not require subsequent calls to `flatMap` to * define the next effect. * * The error parameter of the returned `IO` may be chosen arbitrarily, since * it will depend on the `IO`s returned by the given continuations. */ export declare function foldM(failure: (e: E) => Sink, success: (z: Z) => Sink): (self: Sink) => Sink; /** * Transforms this sink's result. */ export declare function map_(self: Sink, f: (z: Z) => Z2): Sink; /** * Transforms this sink's result. */ export declare function map(f: (z: Z) => Z2): (self: Sink) => Sink; /** * Transforms the errors emitted by this sink using `f`. */ export declare function mapError_(self: Sink, f: (e: E) => E2): Sink; /** * Transforms the errors emitted by this sink using `f`. */ export declare function mapError(f: (e: E) => E2): (self: Sink) => Sink; /** * Effectfully transforms this sink's result. */ export declare function mapM_(self: Sink, f: (z: Z) => T.Effect): Sink; /** * Effectfully transforms this sink's result. */ export declare function mapM(f: (z: Z) => T.Effect): (self: Sink) => Sink; /** * Runs both sinks in parallel on the input, , returning the result or the error from the * one that finishes first. */ export declare function race_(self: Sink, that: Sink): Sink; /** * Runs both sinks in parallel on the input, , returning the result or the error from the * one that finishes first. */ export declare function race(that: Sink): (self: Sink) => Sink; /** * Runs both sinks in parallel on the input, returning the result or the error from the * one that finishes first. */ export declare function raceBoth_(self: Sink, that: Sink): Sink>; /** * Runs both sinks in parallel on the input, returning the result or the error from the * one that finishes first. */ export declare function raceBoth(that: Sink): (self: Sink) => Sink>; /** * Returns the sink that executes this one and times its execution. */ export declare function timed(self: Sink): Sink>; /** * Converts this sink to a transducer that feeds incoming elements to the sink * and emits the sink's results as outputs. The sink will be restarted when * it ends. */ export declare function toTransducer(self: Sink): Transducer; /** * Feeds inputs to this sink until it yields a result, then switches over to the * provided sink until it yields a result, combining the two results in a tuple. */ export declare function zip_(self: Sink, that: Sink): Sink>; /** * Feeds inputs to this sink until it yields a result, then switches over to the * provided sink until it yields a result, combining the two results in a tuple. */ export declare function zip(that: Sink): (self: Sink) => Sink>; /** * Like `zip`, but keeps only the result from the `that` sink. */ export declare function zipLeft_(self: Sink, that: Sink): Sink; /** * Like `zip`, but keeps only the result from the `that` sink. */ export declare function zipLeft(that: Sink): (self: Sink) => Sink; /** * Runs both sinks in parallel on the input and combines the results in a tuple. */ export declare function zipPar_(self: Sink, that: Sink): Sink>; /** * Runs both sinks in parallel on the input and combines the results in a tuple. */ export declare function zipPar(that: Sink): (self: Sink) => Sink>; /** * Like `zipPar`, but keeps only the result from this sink. */ export declare function zipParLeft_(self: Sink, that: Sink): Sink; /** * Like `zipPar`, but keeps only the result from this sink. */ export declare function zipParLeft(that: Sink): (self: Sink) => Sink; /** * Like `zipPar`, but keeps only the result from the `that` sink. */ export declare function zipParRight_(self: Sink, that: Sink): Sink; /** * Like `zipPar`, but keeps only the result from the `that` sink. */ export declare function zipParRight(that: Sink): (self: Sink) => Sink; /** * Like `zip`, but keeps only the result from this sink. */ export declare function zipRight_(self: Sink, that: Sink): Sink; /** * Like `zip`, but keeps only the result from this sink. */ export declare function zipRight(that: Sink): (self: Sink) => Sink; /** * Feeds inputs to this sink until it yields a result, then switches over to the * provided sink until it yields a result, finally combining the two results with `f`. */ export declare function zipWith_(self: Sink, that: Sink, f: (z: Z, z1: Z1) => Z2): Sink; /** * Feeds inputs to this sink until it yields a result, then switches over to the * provided sink until it yields a result, finally combining the two results with `f`. */ export declare function zipWith(that: Sink, f: (z: Z, z1: Z1) => Z2): (self: Sink) => Sink; /** * Runs both sinks in parallel on the input and combines the results * using the provided function. */ export declare function zipWithPar_(self: Sink, that: Sink, f: (z: Z, z1: Z1) => Z2): Sink; /** * Runs both sinks in parallel on the input and combines the results * using the provided function. */ export declare function zipWithPar(that: Sink, f: (z: Z, z1: Z1) => Z2): (self: Sink) => Sink; /** * Exposes leftover */ export declare function exposeLeftover(self: Sink): Sink]>>; /** * Drops any leftover */ export declare function dropLeftover(self: Sink): Sink; /** * Creates a sink that produces values until one verifies * the predicate `f`. */ export declare function untilOutputM_(self: Sink, f: (z: Z) => T.Effect): Sink>; /** * Creates a sink that produces values until one verifies * the predicate `f`. */ export declare function untilOutputM(f: (z: Z) => T.Effect): (self: Sink) => Sink>; /** * Provides the sink with its required environment, which eliminates * its dependency on `R`. */ export declare function provideAll_(self: Sink, r: R): Sink; /** * Provides the sink with its required environment, which eliminates * its dependency on `R`. */ export declare function provideAll(r: R): (self: Sink) => Sink; /** * Provides some of the environment required to run this effect, * leaving the remainder `R0`. */ export declare function provideSome_(self: Sink, f: (r0: R0) => R): Sink; /** * Provides some of the environment required to run this effect, * leaving the remainder `R0`. */ export declare function provideSome(f: (r0: R0) => R): (self: Sink) => Sink; /** * Provides a layer to the `Managed`, which translates it to another level. */ export declare function provideLayer(layer: L.Layer): (self: Sink) => Sink; /** * Provides a layer to the `Managed`, which translates it to another level. */ export declare function provideLayer_(self: Sink, layer: L.Layer): Sink; /** * Splits the environment into two parts, providing one part using the * specified layer and leaving the remainder `R0`. */ export declare function provideSomeLayer(layer: L.Layer): (self: Sink) => Sink; /** * Creates a Sink from a managed `Push` */ export declare function managedPush(push: M.Managed>): Sink; /** * Accesses the environment of the sink in the context of a sink. */ export declare function accessM(f: (r: R) => Sink): Sink; /** * A sink that collects all of its inputs into an array. */ export declare function collectAll(): Sink>; /** * A sink that collects all of its inputs into an list. */ export declare function collectAllToList(): Sink>; /** * A sink that collects all of its inputs into a map. The keys are extracted from inputs * using the keying function `key`; if multiple inputs use the same key, they are merged * using the `f` function. */ export declare function collectAllToMap(key: (a: A) => K): (f: (a: A, a1: A) => A) => Sink>; /** * A sink that collects all of its inputs into a set. */ export declare function collectAllToSet(): Sink>; /** * A sink that counts the number of elements fed to it. */ export declare const count: Sink; /** * Creates a sink halting with the specified `Throwable`. */ export declare function die(e: unknown): Sink; /** * Creates a sink halting with the specified message, wrapped in a * `RuntimeException`. */ export declare function dieMessage(m: string): Sink; /** * A sink that ignores its inputs. */ export declare const drain: Sink; /** * A sink that always fails with the specified error. */ export declare function fail(e: E): () => Sink; /** * A sink that folds its inputs with the provided function, termination predicate and initial state. */ export declare function reduce(z: S, contFn: (s: S) => boolean, f: (s: S, i: I) => S): Sink; /** * A sink that folds its input chunks with the provided function, termination predicate and initial state. * `contFn` condition is checked only for the initial value and at the end of processing of each chunk. * `f` and `contFn` must preserve chunking-invariance. */ export declare function reduceChunks(z: Z): (contFn: (s: Z) => boolean) => (f: (s: Z, i: A.Chunk) => Z) => Sink; /** * A sink that effectfully folds its input chunks with the provided function, termination predicate and initial state. * `contFn` condition is checked only for the initial value and at the end of processing of each chunk. * `f` and `contFn` must preserve chunking-invariance. */ export declare function reduceChunksM(z: S): (contFn: (s: S) => boolean) => (f: (a: S, i: A.Chunk) => T.Effect) => Sink; /** * A sink that effectfully folds its inputs with the provided function, termination predicate and initial state. * * This sink may terminate in the middle of a chunk and discard the rest of it. See the discussion on the * ZSink class scaladoc on sinks vs. transducers. */ export declare function reduceM(z: S, contFn: (s: S) => boolean, f: (s: S, i: I) => T.Effect): Sink; /** * A sink that folds its inputs with the provided function and initial state. */ export declare function reduceLeft(z: S): (f: (s: S, i: I) => S) => Sink; /** * A sink that folds its input chunks with the provided function and initial state. * `f` must preserve chunking-invariance. */ export declare function reduceLeftChunks(z: S): (f: (s: S, i: A.Chunk) => S) => Sink; /** * A sink that effectfully folds its input chunks with the provided function and initial state. * `f` must preserve chunking-invariance. */ export declare function reduceLeftChunksM(z: S): (f: (s: S, i: A.Chunk) => T.Effect) => Sink; /** * A sink that effectfully folds its inputs with the provided function and initial state. */ export declare function reduceLeftM(z: S): (f: (s: S, i: I) => T.Effect) => Sink; /** * A sink that executes the provided effectful function for every element fed to it. */ export declare function forEach(f: (i: I) => T.Effect): Sink; /** * A sink that executes the provided effectful function for every chunk fed to it. */ export declare function forEachChunk(f: (a: A.Chunk) => T.Effect): Sink; /** * A sink that executes the provided effectful function for every element fed to it * until `f` evaluates to `false`. */ export declare function forEachWhile(f: (i: I) => T.Effect): Sink; /** * Creates a single-value sink produced from an effect */ export declare function fromEffect(b: T.Effect): () => Sink; /** * Creates a sink from a Push */ export declare function fromPush(push: Push.Push): Sink; /** * Creates a sink halting with a specified cause. */ export declare function halt(e: C.Cause): Sink; /** * Creates a sink containing the first value. */ export declare function head(): Sink>; /** * Creates a sink containing the last value. */ export declare function last(): Sink>; /** * A sink that depends on another managed value * `resource` will be finalized after the processing. * * @deprecated Use unwrapManaged */ export declare function managed_(resource: M.Managed, fn: (a: A) => Sink): M.Managed>; /** * A sink that depends on another managed value * `resource` will be finalized after the processing. * * @deprecated Use unwrapManaged */ export declare function managed(resource: M.Managed): (fn: (a: A) => Sink) => M.Managed>; /** * A sink that immediately ends with the specified value. */ export declare function succeed(z: Z): Sink; /** * A sink that sums incoming numeric values. */ export declare const sum: Sink; /** * A sink that takes the specified number of values. */ export declare function take(n: number): Sink>; /** * A sink with timed execution. */ export declare const timedDrain: Sink; /** * A sink that executes the provided effectful function for every chunk fed to it. */ export declare function foreachChunk(f: (c: A.Chunk) => T.Effect): Sink; /** * Create a sink which enqueues each element into the specified queue. */ export declare function fromQueue(queue: Q.XQueue): Sink; /** * Create a sink which enqueues each element into the specified queue. * The queue will be shutdown once the stream is closed. */ export declare function fromQueueWithShutdown(queue: Q.XQueue): Sink; /** * Create a sink which publishes each element to the specified hub. */ export declare function fromHub(hub: H.XHub): Sink; /** * Create a sink which publishes each element to the specified hub. * The hub will be shutdown once the stream is closed. */ export declare function fromHubWithShutdown(hub: H.XHub): Sink; /** * Creates a sink produced from an effect. */ export declare function unwrap(effect: T.Effect>): Sink; /** * Creates a sink produced from a managed effect. */ export declare function unwrapManaged(managed: M.Managed>): Sink; //# sourceMappingURL=index.d.ts.map