/** * @since 1.0.0 */ import type * as Context from "@effect/data/Context"; import type { Inspectable } from "@effect/data/Inspectable"; import type { Pipeable } from "@effect/data/Pipeable"; import type { Cause } from "@effect/io/Cause"; import type * as Effect from "@effect/io/Effect"; import type * as Exit from "@effect/io/Exit"; import type * as Fiber from "@effect/io/Fiber"; import type * as FiberId from "@effect/io/FiberId"; import type * as FiberRefs from "@effect/io/FiberRefs"; import type * as RuntimeFlags from "@effect/io/RuntimeFlags"; import type { Scheduler } from "@effect/io/Scheduler"; /** * @since 1.0.0 * @category models */ export interface AsyncFiberException { readonly _tag: "AsyncFiberException"; readonly fiber: Fiber.RuntimeFiber; } /** * @since 1.0.0 * @category models */ export interface Cancel { (fiberId?: FiberId.FiberId, onExit?: (exit: Exit.Exit) => void): void; } /** * @since 1.0.0 * @category models */ export interface Runtime extends Pipeable { /** * The context used as initial for forks */ readonly context: Context.Context; /** * The runtime flags used as initial for forks */ readonly runtimeFlags: RuntimeFlags.RuntimeFlags; /** * The fiber references used as initial for forks */ readonly fiberRefs: FiberRefs.FiberRefs; } /** * @since 1.0.0 * @category models */ export interface RunForkOptions { scheduler?: Scheduler; updateRefs?: (refs: FiberRefs.FiberRefs, fiberId: FiberId.Runtime) => FiberRefs.FiberRefs; } /** * Executes the effect using the provided Scheduler or using the global * Scheduler if not provided * * @since 1.0.0 * @category execution */ export declare const runFork: (runtime: Runtime) => (self: Effect.Effect, options?: RunForkOptions | undefined) => Fiber.RuntimeFiber; /** * Executes the effect synchronously returning the exit. * * This method is effectful and should only be invoked at the edges of your * program. * * @since 1.0.0 * @category execution */ export declare const runSyncExit: (runtime: Runtime) => (effect: Effect.Effect) => Exit.Exit; /** * Executes the effect synchronously throwing in case of errors or async boundaries. * * This method is effectful and should only be invoked at the edges of your * program. * * @since 1.0.0 * @category execution */ export declare const runSync: (runtime: Runtime) => (effect: Effect.Effect) => A; /** * Executes the effect asynchronously, eventually passing the exit value to * the specified callback. * * This method is effectful and should only be invoked at the edges of your * program. * * @since 1.0.0 * @category execution */ export declare const runCallback: (runtime: Runtime) => (effect: Effect.Effect, onExit?: ((exit: Exit.Exit) => void) | undefined) => (fiberId?: FiberId.FiberId | undefined, onExit?: ((exit: Exit.Exit) => void) | undefined) => void; /** * Runs the `Effect`, returning a JavaScript `Promise` that will be resolved * with the value of the effect once the effect has been executed, or will be * rejected with the first error or exception throw by the effect. * * This method is effectful and should only be used at the edges of your * program. * * @since 1.0.0 * @category execution */ export declare const runPromise: (runtime: Runtime) => (effect: Effect.Effect) => Promise; /** * Runs the `Effect`, returning a JavaScript `Promise` that will be resolved * with the `Exit` state of the effect once the effect has been executed. * * This method is effectful and should only be used at the edges of your * program. * * @since 1.0.0 * @category execution */ export declare const runPromiseExit: (runtime: Runtime) => (effect: Effect.Effect) => Promise>; /** * @since 1.0.0 * @category constructors */ export declare const defaultRuntime: Runtime; /** * @since 1.0.0 * @category constructors */ export declare const defaultRuntimeFlags: RuntimeFlags.RuntimeFlags; /** * @since 1.0.0 * @category constructors */ export declare const make: (options: { readonly context: Context.Context; readonly runtimeFlags: RuntimeFlags.RuntimeFlags; readonly fiberRefs: FiberRefs.FiberRefs; }) => Runtime; /** * @since 1.0.0 * @category symbols */ export declare const FiberFailureId: unique symbol; /** * @since 1.0.0 * @category symbols */ export type FiberFailureId = typeof FiberFailureId; /** * @since 1.0.0 * @category symbols */ export declare const FiberFailureCauseId: unique symbol; /** * @since 1.0.0 * @category exports */ export type FiberFailureCauseId = typeof FiberFailureCauseId; /** * @since 1.0.0 * @category models */ export interface FiberFailure extends Error, Inspectable { readonly [FiberFailureId]: FiberFailureId; readonly [FiberFailureCauseId]: Cause; } /** * @since 1.0.0 * @category guards */ export declare const isAsyncFiberException: (u: unknown) => u is AsyncFiberException; /** * @since 1.0.0 * @category guards */ export declare const isFiberFailure: (u: unknown) => u is FiberFailure; /** * @since 1.0.0 * @category constructors */ export declare const makeFiberFailure: (cause: Cause) => FiberFailure; //# sourceMappingURL=Runtime.d.ts.map