/** * @since 2.0.0 */ import type { NonEmptyReadonlyArray } from "./Array.ts"; import * as Arr from "./Array.ts"; import * as Cause from "./Cause.ts"; import * as Channel from "./Channel.ts"; import type * as Context from "./Context.ts"; import * as Duration from "./Duration.ts"; import * as Effect from "./Effect.ts"; import * as Exit from "./Exit.ts"; import type * as Filter from "./Filter.ts"; import type { LazyArg } from "./Function.ts"; import * as Option from "./Option.ts"; import { type Pipeable } from "./Pipeable.ts"; import type { Predicate, Refinement } from "./Predicate.ts"; import * as PubSub from "./PubSub.ts"; import * as Pull from "./Pull.ts"; import * as Queue from "./Queue.ts"; import * as Scope from "./Scope.ts"; import type { Stream } from "./Stream.ts"; import type * as Types from "./Types.ts"; import type * as Unify from "./Unify.ts"; declare const TypeId = "~effect/Sink"; /** * A `Sink` is used to consume elements produced by a `Stream`. * You can think of a sink as a function that will consume a variable amount of * `In` elements (could be 0, 1, or many), might fail with an error of type `E`, * and will eventually yield a value of type `A` together with a remainder of * type `L` (i.e. any leftovers). * * @example * ```ts * import { Effect } from "effect" * import * as Sink from "effect/Sink" * import * as Stream from "effect/Stream" * * // Create a simple sink that always succeeds with a value * const sink: Sink.Sink = Sink.succeed(42) * * // Use the sink to consume a stream * const stream = Stream.make(1, 2, 3) * const program = Stream.run(stream, sink) * * Effect.runPromise(program).then(console.log) * // Output: 42 * ``` * * @since 2.0.0 * @category models */ export interface Sink extends Sink.Variance, Pipeable { readonly transform: (upstream: Pull.Pull, never, void>, scope: Scope.Scope) => Effect.Effect, E, R>; [Unify.typeSymbol]?: unknown; [Unify.unifySymbol]?: SinkUnify; [Unify.ignoreSymbol]?: SinkUnifyIgnore; } /** * @since 2.0.0 * @category models */ export type End = readonly [value: A, leftover?: NonEmptyReadonlyArray | undefined]; /** * Interface for Sink unification, used internally by the Effect type system * to provide proper type inference when using Sink with other Effect types. * * @example * ```ts * import type { Effect } from "effect" * import type * as Sink from "effect/Sink" * import type * as Unify from "effect/Unify" * * // SinkUnify helps unify Sink and Effect types * declare const sink: Sink.Sink * declare const effect: Effect.Effect * * // The unification system handles mixed operations * type Combined = Sink.SinkUnify<{ [Unify.typeSymbol]?: any }> * ``` * * @since 2.0.0 * @category models */ export interface SinkUnify extends Effect.EffectUnify { Sink?: () => A[Unify.typeSymbol] extends Sink | infer _ ? Sink : never; } /** * Interface used to ignore certain types during Sink unification. * Part of the internal type system machinery. * * @example * ```ts * import type * as Sink from "effect/Sink" * * // Used internally by the type system * type IgnoreConfig = Sink.SinkUnifyIgnore * ``` * * @category models * @since 2.0.0 */ export interface SinkUnifyIgnore { Effect?: true; } /** * Namespace containing types and interfaces for Sink variance and type relationships. * * @example * ```ts * import type * as Sink from "effect/Sink" * * // The Sink namespace contains internal type definitions * // These are used internally for type safety and variance * type SinkType = Sink.Sink * ``` * * @since 2.0.0 * @category models */ export declare namespace Sink { /** * Represents the variance annotations for a Sink type. * Used internally to track how type parameters flow through the Sink. * * @example * ```ts * import type * as Sink from "effect/Sink" * * // The variance interface is used internally * // It defines how type parameters behave in Sink * type SinkWithVariance = Sink.Sink & { variance: "internal" } * ``` * * @since 2.0.0 * @category models */ interface Variance { readonly [TypeId]: VarianceStruct; } /** * The internal structure representing Sink variance annotations. * Contains the actual variance markers for each type parameter. * * @example * ```ts * import type * as Sink from "effect/Sink" * * // The variance structure is used internally by the type system * // It ensures proper type safety for Sink operations * type SinkInstance = Sink.Sink * ``` * * @since 2.0.0 * @category models */ interface VarianceStruct { _A: Types.Covariant; _In: Types.Contravariant; _L: Types.Covariant; _E: Types.Covariant; _R: Types.Covariant; } } /** * Checks if a value is a Sink. * * @example * ```ts * import { Sink } from "effect" * * const sink = Sink.never * const notStream = { data: [1, 2, 3] } * * console.log(Sink.isSink(sink)) // true * console.log(Sink.isSink(notStream)) // false * ``` * * @since 2.0.0 * @category guards */ export declare const isSink: (u: unknown) => u is Sink; /** * Creates a sink from a `Channel`. * * @since 2.0.0 * @category constructors */ export declare const fromChannel: (channel: Channel.Channel, NonEmptyReadonlyArray, never, void, R>) => Sink; /** * @since 4.0.0 * @category constructors */ export declare const fromTransform: (transform: (upstream: Pull.Pull, never, void>, scope: Scope.Scope) => Effect.Effect, E, R>) => Sink; /** * Creates a `Channel` from a Sink. * * @example * ```ts * import { Sink } from "effect" * * // Create a sink and extract its channel * const sink = Sink.succeed(42) * const channel = Sink.toChannel(sink) * ``` * * @since 2.0.0 * @category constructors */ export declare const toChannel: (self: Sink) => Channel.Channel, NonEmptyReadonlyArray, never, void, R>; /** * @since 4.0.0 * @category constructors */ export declare const make: () => make.Constructor; /** * @since 4.0.0 */ export declare namespace make { /** * @since 4.0.0 */ interface Constructor { (ab: (_: Stream) => Effect.Effect): Sink>; (ab: (_: Stream) => B, bc: (_: B) => Effect.Effect): Sink>; (ab: (_: Stream) => B, bc: (_: B) => C, cd: (_: C) => Effect.Effect): Sink>; (ab: (_: Stream) => B, bc: (_: B) => C, cd: (_: C) => D, df: (_: D) => Effect.Effect): Sink>; (ab: (_: Stream) => B, bc: (_: B) => C, cd: (_: C) => D, df: (_: D) => F, fg: (_: F) => Effect.Effect): Sink>; (ab: (_: Stream) => B, bc: (_: B) => C, cd: (_: C) => D, df: (_: D) => F, fg: (_: F) => G, gh: (_: G) => Effect.Effect): Sink>; (ab: (_: Stream) => B, bc: (_: B) => C, cd: (_: C) => D, df: (_: D) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => Effect.Effect): Sink>; (ab: (_: Stream) => B, bc: (_: B) => C, cd: (_: C) => D, df: (_: D) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => Effect.Effect): Sink>; (ab: (_: Stream) => B, bc: (_: B) => C, cd: (_: C) => D, df: (_: D) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => Effect.Effect): Sink>; (ab: (_: Stream) => B, bc: (_: B) => C, cd: (_: C) => D, df: (_: D) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => Effect.Effect): Sink>; } } /** * @since 4.0.0 * @category constructors */ export declare const fromEffectEnd: (effect: Effect.Effect, E, R>) => Sink; /** * @since 4.0.0 * @category constructors */ export declare const fromEffect: (effect: Effect.Effect) => Sink; /** * @since 2.0.0 * @category constructors */ export declare const fromQueue: (queue: Queue.Queue) => Sink; /** * @since 2.0.0 * @category constructors */ export declare const fromPubSub: (pubsub: PubSub.PubSub) => Sink; /** * A sink that immediately ends with the specified value. * * @example * ```ts * import { Effect, Sink, Stream } from "effect" * * // Create a sink that always yields the same value * const sink = Sink.succeed(42) * * // Use it with a stream * const stream = Stream.make(1, 2, 3) * const program = Stream.run(stream, sink) * * Effect.runPromise(program).then(console.log) * // Output: 42 * ``` * * @since 2.0.0 * @category constructors */ export declare const succeed: (a: A, leftovers?: NonEmptyReadonlyArray | undefined) => Sink; /** * A sink that immediately ends with the specified lazily evaluated value. * * @since 2.0.0 * @category constructors */ export declare const sync: (a: LazyArg) => Sink; /** * A sink that is created from a lazily evaluated sink. * * @since 2.0.0 * @category constructors */ export declare const suspend: (evaluate: LazyArg>) => Sink; /** * A sink that always fails with the specified error. * * @example * ```ts * import { Effect, Sink, Stream } from "effect" * * // Create a sink that always fails * const sink = Sink.fail(new Error("Sink failed")) * * // Use it with a stream * const stream = Stream.make(1, 2, 3) * const program = Stream.run(stream, sink) * * Effect.runPromise(program).catch(console.log) * // Output: Error: Sink failed * ``` * * @since 2.0.0 * @category constructors */ export declare const fail: (e: E) => Sink; /** * A sink that always fails with the specified lazily evaluated error. * * @example * ```ts * import { Effect, Sink, Stream } from "effect" * * // Create a sink that fails with a lazy error * const sink = Sink.failSync(() => new Error("Lazy error")) * * // Use it with a stream * const stream = Stream.make(1, 2, 3) * const program = Stream.run(stream, sink) * * Effect.runPromise(program).catch(console.log) * // Output: Error: Lazy error * ``` * * @since 2.0.0 * @category constructors */ export declare const failSync: (evaluate: LazyArg) => Sink; /** * Creates a sink halting with a specified `Cause`. * * @example * ```ts * import { Cause, Effect, Sink, Stream } from "effect" * * // Create a sink that fails with a specific cause * const sink = Sink.failCause(Cause.fail(new Error("Custom cause"))) * * // Use it with a stream * const stream = Stream.make(1, 2, 3) * const program = Stream.run(stream, sink) * * Effect.runPromise(program).catch(console.log) * // Output: Error: Custom cause * ``` * * @since 2.0.0 * @category constructors */ export declare const failCause: (cause: Cause.Cause) => Sink; /** * Creates a sink halting with a specified lazily evaluated `Cause`. * * @example * ```ts * import { Cause, Effect, Sink, Stream } from "effect" * * // Create a sink that fails with a lazy cause * const sink = Sink.failCauseSync(() => Cause.fail(new Error("Lazy cause"))) * * // Use it with a stream * const stream = Stream.make(1, 2, 3) * const program = Stream.run(stream, sink) * * Effect.runPromise(program).catch(console.log) * // Output: Error: Lazy cause * ``` * * @since 2.0.0 * @category constructors */ export declare const failCauseSync: (evaluate: LazyArg>) => Sink; /** * Creates a sink halting with a specified defect. * * @example * ```ts * import { Effect, Sink, Stream } from "effect" * * // Create a sink that dies with a defect * const sink = Sink.die(new Error("Defect error")) * * // Use it with a stream * const stream = Stream.make(1, 2, 3) * const program = Stream.run(stream, sink) * * Effect.runPromise(program).catch(console.log) * // Output: Error: Defect error * ``` * * @since 2.0.0 * @category constructors */ export declare const die: (defect: unknown) => Sink; /** * A sink that never completes. * * @since 2.0.0 * @category constructors */ export declare const never: Sink; /** * Drains the remaining elements from the stream after the sink finishes * * @since 2.0.0 * @category utils */ export declare const ignoreLeftover: (self: Sink) => Sink; /** * Drains elements from the stream by ignoring all inputs. * * @since 2.0.0 * @category constructors */ export declare const drain: Sink; /** * A sink that folds its inputs with the provided function, termination * predicate and initial state. * * @since 2.0.0 * @category folding */ export declare const fold: (s: LazyArg, contFn: Predicate, f: (s: S, input: In) => Effect.Effect) => Sink; /** * @since 2.0.0 * @category folding */ export declare const foldArray: (s: LazyArg, contFn: Predicate, f: (s: S, input: Arr.NonEmptyReadonlyArray) => Effect.Effect) => Sink; /** * @since 2.0.0 * @category folding */ export declare const foldUntil: (s: LazyArg, max: number, f: (s: S, input: In) => Effect.Effect) => Sink; /** * A sink that returns whether all elements satisfy the specified predicate. * * @since 2.0.0 * @category constructors */ export declare const every: (predicate: Predicate) => Sink; /** * A sink that returns whether an element satisfies the specified predicate. * * @since 2.0.0 * @category constructors */ export declare const some: (predicate: Predicate) => Sink; /** * Transforms this sink's result. * * @since 2.0.0 * @category mapping */ export declare const map: { /** * Transforms this sink's result. * * @since 2.0.0 * @category mapping */ (f: (a: A) => A2): (self: Sink) => Sink; /** * Transforms this sink's result. * * @since 2.0.0 * @category mapping */ (self: Sink, f: (a: A) => A2): Sink; }; /** * Set the sink's result to a constant value. * * @since 2.0.0 * @category mapping */ export declare const as: { /** * Set the sink's result to a constant value. * * @since 2.0.0 * @category mapping */ (a2: A2): (self: Sink) => Sink; /** * Set the sink's result to a constant value. * * @since 2.0.0 * @category mapping */ (self: Sink, a2: A2): Sink; }; /** * Transforms this sink's input elements. * * @since 2.0.0 * @category mapping */ export declare const mapInput: { /** * Transforms this sink's input elements. * * @since 2.0.0 * @category mapping */ (f: (input: In0) => In): (self: Sink) => Sink; /** * Transforms this sink's input elements. * * @since 2.0.0 * @category mapping */ (self: Sink, f: (input: In0) => In): Sink; }; /** * Effectfully transforms this sink's input elements. * * @since 2.0.0 * @category mapping */ export declare const mapInputEffect: { /** * Effectfully transforms this sink's input elements. * * @since 2.0.0 * @category mapping */ (f: (input: In0) => Effect.Effect): (self: Sink) => Sink; /** * Effectfully transforms this sink's input elements. * * @since 2.0.0 * @category mapping */ (self: Sink, f: (input: In0) => Effect.Effect): Sink; }; /** * Transforms this sink's input elements. * * @since 4.0.0 * @category mapping */ export declare const mapInputArray: { /** * Transforms this sink's input elements. * * @since 4.0.0 * @category mapping */ (f: (input: Arr.NonEmptyReadonlyArray) => Arr.NonEmptyReadonlyArray): (self: Sink) => Sink; /** * Transforms this sink's input elements. * * @since 4.0.0 * @category mapping */ (self: Sink, f: (input: Arr.NonEmptyReadonlyArray) => Arr.NonEmptyReadonlyArray): Sink; }; /** * Effectfully transforms this sink's input elements. * * @since 4.0.0 * @category mapping */ export declare const mapInputArrayEffect: { /** * Effectfully transforms this sink's input elements. * * @since 4.0.0 * @category mapping */ (f: (input: Arr.NonEmptyReadonlyArray) => Effect.Effect, E2, R2>): (self: Sink) => Sink; /** * Effectfully transforms this sink's input elements. * * @since 4.0.0 * @category mapping */ (self: Sink, f: (input: Arr.NonEmptyReadonlyArray) => Effect.Effect, E2, R2>): Sink; }; /** * Transforms this sink's result. * * @since 4.0.0 * @category mapping */ export declare const mapEnd: { /** * Transforms this sink's result. * * @since 4.0.0 * @category mapping */ (f: (a: End) => End): (self: Sink) => Sink; /** * Transforms this sink's result. * * @since 4.0.0 * @category mapping */ (self: Sink, f: (a: End) => End): Sink; }; /** * Effectfully transforms this sink's result. * * @since 4.0.0 * @category mapping */ export declare const mapEffectEnd: { /** * Effectfully transforms this sink's result. * * @since 4.0.0 * @category mapping */ (f: (end: End) => Effect.Effect, E2, R2>): (self: Sink) => Sink; /** * Effectfully transforms this sink's result. * * @since 4.0.0 * @category mapping */ (self: Sink, f: (end: End) => Effect.Effect, E2, R2>): Sink; }; /** * Effectfully transforms this sink's result. * * @since 2.0.0 * @category mapping */ export declare const mapEffect: { /** * Effectfully transforms this sink's result. * * @since 2.0.0 * @category mapping */ (f: (a: A) => Effect.Effect): (self: Sink) => Sink; /** * Effectfully transforms this sink's result. * * @since 2.0.0 * @category mapping */ (self: Sink, f: (a: A) => Effect.Effect): Sink; }; /** * Transforms the errors emitted by this sink using `f`. * * @since 2.0.0 * @category mapping */ export declare const mapError: { /** * Transforms the errors emitted by this sink using `f`. * * @since 2.0.0 * @category mapping */ (f: (error: E) => E2): (self: Sink) => Sink; /** * Transforms the errors emitted by this sink using `f`. * * @since 2.0.0 * @category mapping */ (self: Sink, f: (error: E) => E2): Sink; }; /** * Transforms the leftovers emitted by this sink using `f`. * * @since 2.0.0 * @category mapping */ export declare const mapLeftover: { /** * Transforms the leftovers emitted by this sink using `f`. * * @since 2.0.0 * @category mapping */ (f: (leftover: L) => L2): (self: Sink) => Sink; /** * Transforms the leftovers emitted by this sink using `f`. * * @since 2.0.0 * @category mapping */ (self: Sink, f: (leftover: L) => L2): Sink; }; /** * @since 2.0.0 * @category collecting */ export declare const take: (n: number) => Sink, In, In>; /** * 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. * * @since 2.0.0 * @category sequencing */ export declare const flatMap: { /** * 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. * * @since 2.0.0 * @category sequencing */ (f: (a: A) => Sink): (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. * * @since 2.0.0 * @category sequencing */ (self: Sink, f: (a: A) => Sink): Sink; }; /** * A sink that reduces its inputs using the provided function `f` starting from * the provided `initial` state while the specified `predicate` returns `true`. * * @since 2.0.0 * @category reducing */ export declare const reduceWhile: (initial: LazyArg, predicate: Predicate, f: (s: S, input: In) => S) => Sink; /** * A sink that reduces its inputs using the provided effectful function `f` * starting from the provided `initial` state while the specified `predicate` * returns `true`. * * @since 2.0.0 * @category reducing */ export declare const reduceWhileEffect: (initial: LazyArg, predicate: Predicate, f: (s: S, input: In) => Effect.Effect) => Sink; /** * A sink that reduces its inputs using the provided function `f` starting from * the provided `initial` state while the specified `predicate` returns `true`. * * @since 4.0.0 * @category reducing */ export declare const reduceWhileArray: (initial: LazyArg, contFn: Predicate, f: (s: S, input: NonEmptyReadonlyArray) => S) => Sink; /** * A sink that reduces its inputs using the provided effectful function `f` * starting from the provided `initial` state while the specified `predicate` * returns `true`. * * @since 4.0.0 * @category reducing */ export declare const reduceWhileArrayEffect: (initial: LazyArg, predicate: Predicate, f: (s: S, input: NonEmptyReadonlyArray) => Effect.Effect) => Sink; /** * A sink that reduces its inputs using the provided function `f` starting from * the provided `initial` state. * * @since 2.0.0 * @category reducing */ export declare const reduce: (initial: LazyArg, f: (s: S, input: In) => S) => Sink; /** * A sink that reduces its inputs using the provided function `f` starting from * the specified `initial` state. * * @since 2.0.0 * @category reducing */ export declare const reduceArray: (initial: LazyArg, f: (s: S, input: NonEmptyReadonlyArray) => S) => Sink; /** * A sink that reduces its inputs using the provided effectful function `f` * starting from the specified `initial` state. * * @since 2.0.0 * @category reducing */ export declare const reduceEffect: (initial: LazyArg, f: (s: S, input: In) => Effect.Effect) => Sink; /** * Creates a sink containing the first value. * * @since 2.0.0 * @category constructors */ export declare const head: () => Sink, In, In>; /** * Creates a sink containing the last value. * * @since 2.0.0 * @category constructors */ export declare const last: () => Sink, In>; /** * Creates a sink containing the first matching value. * * @since 4.0.0 * @category constructors */ export declare const find: { /** * Creates a sink containing the first matching value. * * @since 4.0.0 * @category constructors */ (refinement: Refinement): Sink, In, In>; /** * Creates a sink containing the first matching value. * * @since 4.0.0 * @category constructors */ (predicate: Predicate): Sink, In, In>; }; /** * Creates a sink containing the first matching value. * * @since 4.0.0 * @category constructors */ export declare const findEffect: (predicate: (input: In) => Effect.Effect) => Sink, In, In, E, R>; /** * Creates a sink which sums up its inputs. * * @since 2.0.0 * @category constructors */ export declare const sum: Sink; /** * A sink that counts the number of elements fed to it. * * @since 2.0.0 * @category constructors */ export declare const count: Sink; /** * Accumulates incoming elements into an array. * * @since 2.0.0 * @category constructors */ export declare const collect: () => Sink, In>; /** * @since 4.0.0 * @category constructors */ export declare const takeWhile: { /** * @since 4.0.0 * @category constructors */ (refinement: Refinement): Sink, In, In>; /** * @since 4.0.0 * @category constructors */ (predicate: Predicate): Sink, In, In>; }; /** * @since 4.0.0 * @category constructors */ export declare const takeWhileFilter: (filter: Filter.Filter) => Sink, In, In>; /** * @since 4.0.0 * @category constructors */ export declare const takeWhileEffect: { /** * @since 4.0.0 * @category constructors */ (predicate: (input: In) => Effect.Effect): Sink, In, In, E, R>; }; /** * @since 4.0.0 * @category constructors */ export declare const takeWhileFilterEffect: (filter: Filter.FilterEffect) => Sink, In, In, E, R>; /** * @since 4.0.0 * @category constructors */ export declare const takeUntil: (predicate: Predicate) => Sink, In, In>; /** * @since 4.0.0 * @category constructors */ export declare const takeUntilEffect: (predicate: (input: In) => Effect.Effect) => Sink, In, In, E, R>; /** * A sink that executes the provided effectful function for every item fed * to it. * * @example * ```ts * import { Console, Effect, Sink, Stream } from "effect" * * // Create a sink that logs each item * const sink = Sink.forEach((item: number) => Console.log(`Processing: ${item}`)) * * // Use it with a stream * const stream = Stream.make(1, 2, 3) * const program = Stream.run(stream, sink) * * Effect.runPromise(program) * // Output: * // Processing: 1 * // Processing: 2 * // Processing: 3 * ``` * * @since 2.0.0 * @category constructors */ export declare const forEach: (f: (input: In) => Effect.Effect) => Sink; /** * A sink that executes the provided effectful function for every Chunk fed * to it. * * @example * ```ts * import { Console, Effect, Sink, Stream } from "effect" * * // Create a sink that processes chunks * const sink = Sink.forEachArray((chunk: ReadonlyArray) => * Console.log( * `Processing chunk of ${chunk.length} items: [${chunk.join(", ")}]` * ) * ) * * // Use it with a stream * const stream = Stream.make(1, 2, 3, 4, 5) * const program = Stream.run(stream, sink) * * Effect.runPromise(program) * // Output: Processing chunk of 5 items: [1, 2, 3, 4, 5] * ``` * * @since 4.0.0 * @category constructors */ export declare const forEachArray: (f: (input: NonEmptyReadonlyArray) => Effect.Effect) => Sink; /** * @since 2.0.0 * @category constructors */ export declare const forEachWhile: (f: (input: In) => Effect.Effect) => Sink; /** * @since 2.0.0 * @category constructors */ export declare const forEachWhileArray: (f: (input: NonEmptyReadonlyArray) => Effect.Effect) => Sink; /** * Creates a sink produced from a scoped effect. * * @example * ```ts * import { Console, Effect, Sink, Stream } from "effect" * * // Create a sink from an effect that produces a sink * const sinkEffect = Effect.succeed( * Sink.forEach((item: number) => Console.log(`Item: ${item}`)) * ) * const sink = Sink.unwrap(sinkEffect) * * // Use it with a stream * const stream = Stream.make(1, 2, 3) * const program = Stream.run(stream, sink) * * Effect.runPromise(program) * // Output: * // Item: 1 * // Item: 2 * // Item: 3 * ``` * * @since 2.0.0 * @category constructors */ export declare const unwrap: (effect: Effect.Effect, E, R>) => Sink | R2>; /** * Summarize a sink by running an effect when the sink starts and again when * it completes. * * @since 2.0.0 * @category utils */ export declare const summarized: { /** * Summarize a sink by running an effect when the sink starts and again when * it completes. * * @since 2.0.0 * @category utils */ (summary: Effect.Effect, f: (start: A2, end: A2) => A3): (self: Sink) => Sink<[A, A3], In, L, E2 | E, R2 | R>; /** * Summarize a sink by running an effect when the sink starts and again when * it completes. * * @since 2.0.0 * @category utils */ (self: Sink, summary: Effect.Effect, f: (start: A2, end: A2) => A3): Sink<[A, A3], In, L, E | E2, R | R2>; }; /** * Returns the sink that executes this one and times its execution. * * @since 2.0.0 * @category utils */ export declare const withDuration: (self: Sink) => Sink<[A, Duration.Duration], In, L, E, R>; /** * @since 2.0.0 * @category constructors */ export declare const timed: Sink; /** * @since 4.0.0 * @category Services */ export declare const provideContext: { /** * @since 4.0.0 * @category Services */ (context: Context.Context): (self: Sink) => Sink>; /** * @since 4.0.0 * @category Services */ (self: Sink, context: Context.Context): Sink>; }; /** * @since 4.0.0 * @category Services */ export declare const provideService: { /** * @since 4.0.0 * @category Services */ (key: Context.Key, value: Types.NoInfer): (self: Sink) => Sink>; /** * @since 4.0.0 * @category Services */ (self: Sink, key: Context.Key, value: Types.NoInfer): Sink>; }; /** * @since 2.0.0 * @category Error handling */ export declare const orElse: { /** * @since 2.0.0 * @category Error handling */ (f: (error: Types.NoInfer) => Sink): (self: Sink) => Sink; /** * @since 2.0.0 * @category Error handling */ (self: Sink, f: (error: E) => Sink): Sink; }; /** * @since 4.0.0 * @category Error handling */ export declare const catchCause: { /** * @since 4.0.0 * @category Error handling */ (f: (error: Cause.Cause>) => Effect.Effect): (self: Sink) => Sink; /** * @since 4.0.0 * @category Error handling */ (self: Sink, f: (error: Cause.Cause) => Effect.Effect): Sink; }; declare const catch_: { (f: (error: Types.NoInfer) => Effect.Effect): (self: Sink) => Sink; (self: Sink, f: (error: E) => Effect.Effect): Sink; }; export { /** * @since 4.0.0 * @category Error handling */ catch_ as catch }; /** * @since 4.0.0 * @category Finalization */ export declare const onExit: { /** * @since 4.0.0 * @category Finalization */ (f: (exit: Exit.Exit) => Effect.Effect): (self: Sink) => Sink; /** * @since 4.0.0 * @category Finalization */ (self: Sink, f: (exit: Exit.Exit) => Effect.Effect): Sink; }; /** * @since 4.0.0 * @category Finalization */ export declare const ensuring: { /** * @since 4.0.0 * @category Finalization */ (effect: Effect.Effect): (self: Sink) => Sink; /** * @since 4.0.0 * @category Finalization */ (self: Sink, effect: Effect.Effect): Sink; }; //# sourceMappingURL=Sink.d.ts.map