/** * @since 2.0.0 */ import type * as Cause from "./Cause.js" import type * as Chunk from "./Chunk.js" import type * as Effect from "./Effect.js" import type * as Exit from "./Exit.js" import type * as Option from "./Option.js" /** * An `Emit` represents an asynchronous callback that can be * called multiple times. The callback can be called with a value of type * `Effect, Option, R>`, where succeeding with a `Chunk` * indicates to emit those elements, failing with `Some` indicates to * terminate with that error, and failing with `None` indicates to terminate * with an end of stream signal. * * @since 2.0.0 * @category models */ export interface Emit extends EmitOps { (f: Effect.Effect, Option.Option, R>): Promise } /** * @since 2.0.0 * @category models */ export interface EmitOps { /** * Emits a chunk containing the specified values. */ chunk(chunk: Chunk.Chunk): Promise /** * Terminates with a cause that dies with the specified defect. */ die(defect: Err): Promise /** * Terminates with a cause that dies with a `Throwable` with the specified * message. */ dieMessage(message: string): Promise /** * Either emits the specified value if this `Exit` is a `Success` or else * terminates with the specified cause if this `Exit` is a `Failure`. */ done(exit: Exit.Exit): Promise /** * Terminates with an end of stream signal. */ end(): Promise /** * Terminates with the specified error. */ fail(error: E): Promise /** * Either emits the success value of this effect or terminates the stream * with the failure value of this effect. */ fromEffect(effect: Effect.Effect): Promise /** * Either emits the success value of this effect or terminates the stream * with the failure value of this effect. */ fromEffectChunk(effect: Effect.Effect, E, R>): Promise /** * Terminates the stream with the specified cause. */ halt(cause: Cause.Cause): Promise /** * Emits a chunk containing the specified value. */ single(value: A): Promise } /** * @since 3.6.0 * @category models */ export interface EmitOpsPush { /** * Emits a chunk containing the specified values. */ chunk(chunk: Chunk.Chunk): boolean /** * Emits a chunk containing the specified values. */ array(chunk: ReadonlyArray): boolean /** * Terminates with a cause that dies with the specified defect. */ die(defect: Err): void /** * Terminates with a cause that dies with a `Throwable` with the specified * message. */ dieMessage(message: string): void /** * Either emits the specified value if this `Exit` is a `Success` or else * terminates with the specified cause if this `Exit` is a `Failure`. */ done(exit: Exit.Exit): void /** * Terminates with an end of stream signal. */ end(): void /** * Terminates with the specified error. */ fail(error: E): void /** * Terminates the stream with the specified cause. */ halt(cause: Cause.Cause): void /** * Emits a chunk containing the specified value. */ single(value: A): boolean }