/** * `Op` — `Effect.Effect` wrapper with named factories. * * @module */ import type { Scope, Result } from 'effect'; import { Effect } from 'effect'; import { IoError } from '@czap/error'; import type { Millis } from './brands.js'; interface OpShape { readonly _tag: 'Op'; readonly effect: Effect.Effect; run(): Effect.Effect; map(f: (a: A) => B): OpShape; flatMap(f: (a: A) => OpShape): OpShape; } type OpValue> = T extends OpShape ? A : never; type OpError> = T extends OpShape ? E : never; type OpRequirement> = T extends OpShape ? R : never; type OpValues[]> = { [K in keyof T]: OpValue; }; type SettledOpValues[]> = { [K in keyof T]: Result.Result, OpError>; }; /** * Op -- Effect.Effect wrapper providing named factories and combinators * for async operations with retry, timeout, race, and parallel execution. * * @example * ```ts * const op = Op.succeed(42).map(n => n * 2); * const result = Effect.runSync(op.run()); // 84 * * const tasks = Op.all([Op.succeed(1), Op.succeed(2)] as const); * const [a, b] = Effect.runSync(tasks.run()); // [1, 2] * ``` */ export declare const Op: { make: (effect: Effect.Effect) => OpShape; fromPromise: (f: () => Promise) => OpShape; succeed: (value: A) => OpShape; fail: (error: E) => OpShape; all: []>(tasks: T) => OpShape, OpError, OpRequirement>; allSettled: []>(tasks: T) => OpShape, never, OpRequirement>; race: (tasks: ReadonlyArray>) => OpShape; retry: (task: OpShape, options: { times: number; delay?: Millis; factor?: number; }) => OpShape; timeout: (task: OpShape, ms: Millis) => OpShape; }; export declare namespace Op { /** Structural shape of an {@link Op}: a thin alias over `Effect.Effect` produced by the `Op.*` factories. */ type Shape = OpShape; } export {}; //# sourceMappingURL=op.d.ts.map