import { t as HKT } from "./hkt-C84w3kEn.mjs"; import { Err, Result, UnhandledException } from "better-result"; //#region src/tagged.d.ts interface Tagged { readonly _tag: Tag; } type AbstractCtor = abstract new (...args: readonly never[]) => object; type TaggedConstructor = Base extends undefined ? new () => Tagged : Base extends AbstractCtor ? new (...args: ConstructorParameters) => InstanceType & Tagged : never; declare function Tagged(tag: Tag): TaggedConstructor; declare function Tagged(tag: Tag, Base: Base): TaggedConstructor; //#endregion //#region src/errors.d.ts declare const TimeoutError_base: import("better-result").TaggedErrorClass<"TimeoutError">; /** * Built-in typed error emitted when an operation exceeds a timeout budget */ declare class TimeoutError extends TimeoutError_base<{ message: string; timeoutMs: number; }> { constructor({ timeoutMs }: { timeoutMs: number; }); } declare const ErrorGroup_base: new (errors: Iterable, message?: string | undefined, options?: ErrorOptions | undefined) => AggregateError & Tagged<"ErrorGroup">; /** A typed aggregate error used when an operation must preserve multiple failures. */ declare class ErrorGroup extends ErrorGroup_base { readonly errors: E[]; constructor(errors: Iterable, message: string); [Symbol.iterator](): Generator, never, unknown>; static is(value: unknown): value is ErrorGroup; } //#endregion //#region src/execution/abort-settlement.d.ts /** * Driver-level abort mechanics for suspended work and nested plan execution. * * Contributor call sites declare intent through `Settlement` in `settlement.ts`. * Suspend work wrapped with {@link withAbortDrain} maps to * {@link AbortSettlement.interruptAndDrainOnAbort} when the enclosing suspend uses * {@link AbortSettlement.interruptOnAbort} (see {@link settlementForSuspendedWork}). */ type AbortSettlement = { readonly kind: "passThrough"; } | { readonly kind: "rejectOnAbort"; readonly getAbortReason: () => unknown; } | { readonly kind: "interruptOnAbort"; readonly getAbortReason: () => unknown; } | { readonly kind: "interruptAndDrainOnAbort"; readonly getAbortReason: () => unknown; }; declare const AbortSettlement: { passThrough: { readonly kind: "passThrough"; }; rejectOnAbort(getAbortReason: () => unknown): AbortSettlement; interruptOnAbort(getAbortReason: () => unknown): AbortSettlement; interruptAndDrainOnAbort(getAbortReason: () => unknown): AbortSettlement; }; declare const ABORT_DRAINED_WORK: unique symbol; declare const ABORT_OWNED_WORK: unique symbol; type AbortDrainedWork = { readonly [ABORT_DRAINED_WORK]: true; readonly promise: PromiseLike; }; type AbortOwnedWork = { readonly [ABORT_OWNED_WORK]: true; readonly promise: PromiseLike; }; /** Suspend callback return type: plain, drain-on-abort, or abort-owned work. */ type SuspendWork = PromiseLike | AbortDrainedWork | AbortOwnedWork; //#endregion //#region src/core/metadata.d.ts declare const EMPTY_META: unique symbol; declare const BLOCKING: unique symbol; /** * Metadata merge algebra for composed operations. * * Operations carry extension metadata on `M`. When they compose (`flatMap`, combinators, * yielded custom instructions), {@link MergeMeta} accumulates requirements from both sides. * * {@link EmptyMeta} is the identity element: merging with empty metadata leaves the other * operand unchanged. * * Per-key merge outcomes: * - Keys present on only one side are kept as-is. * - Plain values at the same key union (requirements accumulate). * - When either side at a key is {@link Blocking}, the merged value is `Blocking` with * payloads unioned. `Blocking` takes precedence over plain values at that key. * * {@link MergeMetaObjects} merges two object shapes key-by-key. {@link MergeUnionMeta} applies * the same rules when a generator yields multiple custom instructions. {@link CollectBlockingPayload} * extracts `Blocking` payload types during union merges so blocking requirements stay branded. */ type MergeBlockingValue = VA extends Blocking ? VB extends Blocking ? Blocking : Blocking : VB extends Blocking ? Blocking : VA | VB; type MergeMetaValue = K extends keyof StripEmpty & keyof StripEmpty ? MergeBlockingValue[K], StripEmpty[K]> : K extends keyof StripEmpty ? StripEmpty[K] : K extends keyof StripEmpty ? StripEmpty[K] : never; type MergeMetaObjects = NormalizeMeta<{ [K in keyof StripEmpty | keyof StripEmpty]: MergeMetaValue }>; type UnionMetaValueAt = U extends Record ? V : never; type CollectBlockingPayload = U extends Record> ? R : never; type MergeUnionMetaValue = [CollectBlockingPayload] extends [never] ? UnionMetaValueAt : Blocking>; type MergeUnionMeta = NormalizeMeta<[U] extends [never] ? EmptyMeta : { [K in AllMetaKeys]: MergeUnionMetaValue }>; /** Merges metadata accumulated across two composed operations. See merge algebra above. */ type MergeMeta = IsAny extends true ? any : IsAny extends true ? any : [A] extends [EmptyMeta] ? NormalizeMeta : [B] extends [EmptyMeta] ? NormalizeMeta : MergeMetaObjects>; type SetBlockingMeta = NormalizeMeta & { [P in K]: Blocking }>>; /** An operation that is not ready for top-level `.run()`. */ type BlockingOp = Op>; /** * Marks an operation as needing extension-specific preconditions before * top-level `.run()` by placing `Blocking

` on a metadata key. */ declare function withBlocking(op: Op, _key: K): BlockingOp; /** * Runnable gating from metadata. * * Top-level {@link BaseOp.run} is available only when every metadata key is satisfied. * {@link HasBlocking} is true when any key still carries {@link Blocking} with a non-empty * payload. {@link IsRunnable} is false in that case, so `.run()` is not on the operation type. * * Extension packages block `.run()` by attaching `Blocking` to metadata keys (or via * `withBlocking(...)`). Callers satisfy those requirements through extension-specific runners * first; clearing or replacing blocking metadata is what makes `.run()` type-check again. */ type IsRunnable = IsAny extends true ? true : [HasBlocking] extends [true] ? false : true; /** True when metadata still carries an unsatisfied {@link Blocking} requirement on any key. */ type HasBlocking = keyof StripEmpty extends never ? false : { [K in keyof StripEmpty]: StripEmpty[K] extends Blocking ? [R] extends [never] ? false : true : false }[keyof StripEmpty] extends true ? true : false; /** * Empty metadata; the merge identity element. * * Operations with no extension requirements use `EmptyMeta`. Merging with `EmptyMeta` leaves * the other operand unchanged in both directions. */ type EmptyMeta = { readonly [EMPTY_META]: true; }; /** * Branded metadata value that blocks top-level `.run()` until its payload is satisfied. * * During metadata merge, `Blocking` at a key takes precedence over plain values and unions * payloads with other `Blocking` values at the same key. */ type Blocking = { readonly [BLOCKING]: T; }; type IsAny = 0 extends 1 & T ? true : false; type NormalizeMeta = [M] extends [never] ? EmptyMeta : M extends EmptyMeta ? EmptyMeta : M extends object ? keyof M extends never ? EmptyMeta : Simplify : M; type StripEmpty = [M] extends [never] ? {} : M extends EmptyMeta ? {} : M; type Simplify = T extends object ? { [K in keyof T]: T[K] } : T; type WithoutEmptyMeta = M extends EmptyMeta ? never : M; type MergeMetaRight = [WithoutEmptyMeta] extends [never] ? EmptyMeta : WithoutEmptyMeta; type AllMetaKeys = U extends unknown ? keyof U : never; //#endregion //#region src/execution/instructions.d.ts declare const CUSTOM_INSTRUCTION_META: unique symbol; /** * Extension protocol for custom generator yield instructions. * * Implementations are detected at runtime via {@link CUSTOM_INSTRUCTION_META} * and executed through {@link CustomInstruction.resolve}. * * Typed failures should be surfaced by yielding {@link Err} values from * `[Symbol.iterator]` or from the enclosing generator; throws from `resolve` * surface as {@link UnhandledException}. */ interface CustomInstruction { readonly [CUSTOM_INSTRUCTION_META]: M; resolve(context: RunContext): T | PromiseLike; [Symbol.iterator](): Generator; } type ExtractInstructionMeta = Y extends CustomInstruction ? M : never; type NonEmptyInstructionMeta = Exclude, EmptyMeta>; type InferInstructionMeta = [NonEmptyInstructionMeta] extends [never] ? EmptyMeta : MergeUnionMeta>; type DropUnknown = unknown extends E ? never : E; type ExtractResultErr = Y extends Err ? DropUnknown : never; type InferInstructionErr = ExtractResultErr; type SuspendFn = (ctx: RunContext) => SuspendWork; declare const SuspendInstruction_base: new () => Tagged<"SuspendInstruction">; declare class SuspendInstruction extends SuspendInstruction_base { readonly suspend: SuspendFn; constructor(suspend: SuspendFn); [Symbol.iterator](): Generator, any, unknown>; } type FinalizeFn = (ctx: ExitContext) => PromiseLike; declare const RegisterExitFinalizerInstruction_base: new () => Tagged<"RegisterExitFinalizerInstruction">; declare class RegisterExitFinalizerInstruction extends RegisterExitFinalizerInstruction_base { readonly finalize: FinalizeFn; readonly args: readonly unknown[] | undefined; constructor(finalize: FinalizeFn, args: readonly unknown[] | undefined); } declare const NestedOpInstruction_base: new () => Tagged<"NestedOpInstruction">; /** Internal driver instruction for direct Op-to-Op generator delegation. */ declare class NestedOpInstruction extends NestedOpInstruction_base { readonly iterate: () => Generator, T, unknown>; readonly finalizerArgs: readonly unknown[] | undefined; constructor(iterate: () => Generator, T, unknown>, finalizerArgs?: readonly unknown[]); } type Instruction = Err | SuspendInstruction | RegisterExitFinalizerInstruction | CustomInstruction; /** Driver instruction set. Kept separate so NestedOpInstruction is not part of the extension API. */ type RuntimeInstruction = Instruction | NestedOpInstruction; //#endregion //#region src/policy/retry-policy.d.ts /** * Retry delay configuration for `RetryPolicy.delay`: fixed milliseconds or * `(retry, cause) => ms` before an upcoming retry (`retry` is 0-based). For built-in delay * functions, use the `Delay` helper namespace (`Delay.fixed`, `Delay.exponential`, and so on). */ type Delay = number | ((retry: number, cause: unknown) => number); /** Configuration for `Policy.retry(policy)`. `retries` is the post-failure budget; `delay(retry, cause)` uses a 0-based retry index. */ interface RetryPolicy { /** How many times to retry after the first failure. */ retries?: number; /** Whether to retry after a failure. Receives the root cause. */ when?: (cause: unknown) => boolean; /** Delay before the next retry: fixed milliseconds or `(retry, cause) => ms`. */ delay?: Delay; } /** Options for `Delay.exponential(options)`. */ interface ExponentialDelayOptions { /** Initial delay in milliseconds. */ baseMs?: number; /** Maximum delay in milliseconds. */ maxMs?: number; /** Fraction of the computed delay to randomize, from `0` to `1`. */ jitter?: number; } declare const DELAY_VALIDATE: unique symbol; type ValidatedDelay = ((retry: number, cause: unknown) => number) & { readonly [DELAY_VALIDATE]: () => void; }; /** Built-in retry delay helpers for `RetryPolicy.delay`. See also the `Delay` type alias. */ declare const Delay: Readonly<{ /** Constant delay in milliseconds before each retry attempt. */fixed: (ms: number) => ValidatedDelay; /** Exponential backoff: `baseMs * 2 ** retry`, capped at `maxMs`. */ exponential: (options?: ExponentialDelayOptions) => ValidatedDelay; /** Zero delay between retries. */ immediate: ValidatedDelay; /** Default exponential backoff used by `Policy.retry()` with no policy argument. */ defaultRetry: ValidatedDelay; }>; //#endregion //#region src/policy/types.d.ts declare const OP_POLICY: unique symbol; declare const OP_POLICY_INPUT: unique symbol; interface OpPolicyType extends HKT { readonly [HKT.TYPE]: Op, HKT.Param, HKT.Param, HKT.Param>; } interface OpPolicyInput { readonly ok: T; readonly err: E; readonly args: A; readonly meta: M; } interface OpPolicySource { wrap(transform: (plan: Plan) => Plan): Op; rewrite(rewriter: PlanRewriter): Op; around(run: (next: (context: RunContext) => Promise>, context: RunContext) => PromiseLike>): Op; } interface OpPolicy { readonly [OP_POLICY]: F; readonly [OP_POLICY_INPUT]?: (input: Input) => void; apply(source: OpPolicySource): HKT.Apply; } /** * Builds a custom policy value for `.with(Policy.define(...))`. * Use `source.wrap`, `source.rewrite`, or `source.around` inside `apply` to transform the wrapped op. */ declare function define>(definition: Extras & { apply(source: OpPolicySource): HKT.Apply; }): OpPolicy & Extras; interface TimeoutPolicyType extends HKT { readonly [HKT.TYPE]: Op, HKT.Param | TimeoutError, HKT.Param, HKT.Param>; } type RetryPolicyAttachment = OpPolicy & { readonly policy: RetryPolicy | undefined; }; type TimeoutPolicyAttachment = OpPolicy & { readonly timeoutMs: number; }; type CancelPolicyAttachment = OpPolicy & { readonly abortSignal: AbortSignal; }; type ReleasePolicyAttachment = OpPolicy, OpPolicyType> & { readonly release: ReleaseFn; }; type BuiltInPolicy = RetryPolicyAttachment | TimeoutPolicyAttachment | CancelPolicyAttachment | ReleasePolicyAttachment; //#endregion //#region src/core/surface.d.ts type TrackedErr = E extends UnhandledException ? never : E extends TimeoutError ? never : E extends Excluded ? never : E; type BypassedErr = E extends TimeoutError ? E : never; type InferOpOk = R extends Op ? T : Awaited; type InferOpErr = R extends Op ? E : never; type InferOpMeta = R extends Op ? NormalizeMeta : EmptyMeta; type AnyNullaryOp = Op; interface BaseOp { /** Type discriminant for an `Op` instance. */ readonly _tag: "Op"; /** Provides the operation with runtime arguments. */ (...args: AsArgs): Op; /** * Executes the operation with runtime arguments and returns a `Result`. * * @example * const result = await Op.of(1).run(); */ run: [IsRunnable] extends [false] ? never : (...args: AsArgs) => Promise>; } interface FluentOp { /** * Attaches an execution policy to the operation. * * @example * import { Policy } from "@prodkit/op/policy"; * const resilient = Op.try(() => fetch("/ping")).with(Policy.retry()); */ with(policy: OpPolicy, M>, F>): HKT.Apply, M]>; /** * Register a handler that runs before the operation body starts. * * @example * const withEnter = Op.of(1).on("enter", () => console.log("start")); */ on(event: "enter", initialize: EnterFn): Op; /** * Register a handler that runs after the operation settles. * * @example * const withExit = Op.of(1).on("exit", () => console.log("done")); */ on(event: "exit", finalize: ExitFn): Op; /** * Transforms the success value while preserving args and error channel. * * @example * const mapped = Op.of(2).map((n) => n * 2); */ map(transform: (value: T) => U): Op, E, A, M>; /** * Transforms the tracked typed error channel while preserving success values. * * @example * const mappedError = Op.fail("x" as const).mapErr((e) => ({ code: e })); */ mapErr(transform: (error: TrackedErr) => E2): Op, A, M>; /** * Binds the success value into the next operation. * * @example * const chained = Op.of(1).flatMap((n) => Op.of(n + 1)); */ flatMap(bind: (value: T) => R): Op, E | InferOpErr, A, MergeMeta>>; /** * Observes successful values without changing the success payload. * * @example * const observed = Op.of(1).tap((n) => console.log(n)); */ tap(observe: (value: T) => R): Op; /** * Observes tracked errors without changing the original success payload. * * @example * const observedError = Op.fail("x" as const).tapErr((e) => console.error(e)); */ tapErr(observe: (error: TrackedErr) => R): Op | BypassedErr, A, M>; /** * Recovers selected typed failures into a fallback value. * Wrap methods such as `MyError.is` so the tagged-error guard keeps its class receiver. * * @example * class NotFoundError extends TaggedError("NotFoundError") {} * const isNotFoundError = (error: unknown) => NotFoundError.is(error); * const recovered = Op.fail(new NotFoundError()).recover( * isNotFoundError, * () => ({ id: "fallback" }), * ); */ recover, R>(predicate: (error: TrackedErr) => error is ECaught, handler: (error: ECaught) => R): Op, TrackedErr | BypassedErr, A, M>; } interface OpIterable { [Symbol.iterator](): Generator, T, unknown>; } type OpInterface = BaseOp & FluentOp & (Yieldable extends true ? OpIterable : {}); type AsArgs = T extends readonly unknown[] ? T : never; //#endregion //#region src/plan/model.d.ts declare const PLAN_UNARY_REWRITE: unique symbol; type PlanInstruction<_E, M> = RuntimeInstruction; type PlanIterator = Generator, T, unknown>; type ErasedPlan = Plan; type UnaryPlanRewrite = { readonly source: ErasedPlan; readonly rebuild: (rewrittenSource: ErasedPlan) => ErasedPlan; }; interface Plan { readonly execute: (context: RunContext, settlement?: AbortSettlement) => Promise>; readonly [PLAN_UNARY_REWRITE]?: UnaryPlanRewrite; readonly iterate: () => PlanIterator; readonly rewrite: (rewriter: PlanRewriter) => Plan; } /** * Internal rewrite protocol for policy attachment. Built-in policies supply `apply` to wrap leaf * plans; wrapper nodes rebuild themselves via `source.rewrite(rewriter)` (see `rewriteUnaryPlan`). * * When adding a new fluent transform, see "Adding a fluent plan transform" in * `docs/contributor/runtime-architecture.md`. */ interface PlanRewriter { readonly apply: (source: Plan) => Plan; } //#endregion //#region src/execution/runtime.d.ts /** Runtime execution context threaded through internal driver/suspend boundaries. */ interface RunContext { readonly signal: AbortSignal; readonly args: A; readonly extensions: ReadonlyMap; } /** * Passed to {@link ExitFn} when the run unwinds. * * - `args` are the runtime inputs for this run * - `result` is the operation's pre-finalizer settlement result * (including {@link UnhandledException} on the error channel when relevant). * If a finalizer throws, `.run()` returns a new cleanup-failure result instead. */ interface ExitContext { readonly signal: AbortSignal; readonly args: A; readonly result: Result; } //#endregion //#region src/core/lifecycle.d.ts /** Passed to {@link EnterFn} when a run starts, before the wrapped operation body begins. */ interface EnterContext { readonly signal: AbortSignal; readonly args: A; } type EnterFn = (ctx: EnterContext) => unknown; type ExitFn = (ctx: ExitContext) => unknown; /** Widened hook for {@link builders.defer} where enclosing `Op` `T`/`E` are not inferred. */ type AnyExitFn = ExitFn; type ReleaseFn = (value: T) => unknown; /** Lifecycle channels exposed by {@link Op}. */ type OpLifecycleHook = "enter" | "exit"; //#endregion //#region src/core/builders.d.ts declare function succeed(value: T | PromiseLike): Op, never, [], EmptyMeta>; declare function fail(value: E): Op; declare function defer(finalize: AnyExitFn): Op; declare function sleep(ms: number): Op; declare function _try(f: (signal: AbortSignal) => T, onError?: (e: unknown) => E | PromiseLike): Op, TrackedErr>, [], EmptyMeta>; /** * Turns a generator function into an {@link Op} */ declare function fromGenFn, T, A>(f: (...args: AsArgs) => Generator): Op, A, InferInstructionMeta>; //#endregion //#region src/core/combinators.d.ts type MergeOpsMeta = Ops extends readonly [infer Head extends AnyNullaryOp, ...infer Tail extends readonly AnyNullaryOp[]] ? MergeMeta, MergeOpsMeta> : EmptyMeta; type AllOpOk = { [K in keyof Ops]: InferOpOk }; type AllOpErr = InferOpErr; declare function allOp(ops: Ops, concurrency?: number): Op, AllOpErr, [], MergeOpsMeta>; type AllSettledOpOk = { [K in keyof Ops]: Result, InferOpErr | UnhandledException> }; declare function allSettledOp(ops: Ops, concurrency?: number): Op, never, [], MergeOpsMeta>; declare function settleOp(op: Op): Op, never, [], M>; /** * helper to check if any op in the list has an infallible error type */ type HasInfallibleOp = Ops extends readonly [infer Head extends AnyNullaryOp, ...infer Tail extends readonly AnyNullaryOp[]] ? [InferOpErr] extends [never] ? true : HasInfallibleOp : false; type AnyOpOk = InferOpOk; type AnyOpErr = HasInfallibleOp extends true ? never : ErrorGroup>; declare function anyOp(ops: Ops): Op, AnyOpErr, [], MergeOpsMeta>; type RaceOpOk = InferOpOk; type RaceOpErr = InferOpErr; declare function raceOp(ops: Ops): Op, RaceOpErr, [], MergeOpsMeta>; //#endregion //#region src/index.d.ts /** * An operation that can be run and composed with other operations. * * - Runtime factory and namespace for building and composing operations. * - Call `Op(function* (...) { ... })` to build generator-based operations. * - Use static helpers (`Op.of`, `Op.fail`, `Op.try`, `Op.all`, `Op.any`, etc.) * for common patterns. * * Use `Op.run(op)` to execute an operation directly. For external cancellation, * compose with `.with(Policy.cancel(signal))` first and then run. * * @example * const op = Op(function* () { * if (Math.random() > 0.5) { * return yield* Op.fail("error"); * } * return yield* Op.of(69); * }); * const result = await op.run(); * console.log(result); */ declare const Op: typeof fromGenFn & { /** Type discriminant for the `Op` factory namespace value. */_tag: "OpFactory"; /** * Executes an operation with its runtime arguments and resolves to its `Result`. * * @example * const value = await Op.run(Op.of(1)); */ run: (op: [IsRunnable] extends [false] ? never : Op, ...args: AsArgs) => Promise>; /** * Creates an operation that always succeeds with the provided value. * * Promise inputs are awaited before producing the success value. * * @example * const value = Op.of(69); */ of: typeof succeed; /** * Creates an operation that always fails with the provided typed error value. * * @example * const failed = Op.fail("bad-input" as const); */ fail: typeof fail; /** * Registers an exit finalizer for the current run via `yield* Op.defer(...)`. * * If any callback throws during unwind, `run` fails with {@link UnhandledException} whose `cause` * is an {@link ErrorGroup} (message `Operation cleanup failed`). Cleanup failures are exact * thrown values in LIFO execution order. When the body already failed, its error is the first * group entry. * * **Important**: Op.defer *must* be `yield*`ed or it will do nothing * * @note Should always be used inside an `Op(function* () { ... })` body. * * @example * const program = Op(function* () { * yield* Op.defer(() => console.log("cleanup")); * return 1; * }); */ defer: typeof defer; /** * Suspends the current operation for `ms` milliseconds. * * Negative durations are normalized to `0`. Non-finite durations fail at run time * with `UnhandledException`. * The sleep observes surrounding cancellation from `.with(Policy.cancel(...))`, * `.with(Policy.timeout(...))`, and combinators. * * @example * const delayed = Op(function* () { * yield* Op.sleep(100); * return "ready"; * }); */ sleep: typeof sleep; /** * Lifts a sync or async callback into an operation. * * - Fulfillment returns `Ok`. * - Throw/reject is normalized to `UnhandledException` when `onError` is omitted. * - With `onError`, failures are mapped to your typed error. * * @example * const fetched = Op.try(() => fetch("/health")); * * @example * const fetched = Op.try( * () => fetch("/health"), * (cause) => new FetchError({ cause }), * ); */ try: typeof _try; /** * Runs nullary operations concurrently and preserves input order on success. * * `Op.all` fails fast on the first observed error, aborts remaining siblings, * and still waits for active losers to settle so cleanup/finalizers complete. * * @example * const pair = Op.all([Op.of(1), Op.of("ok")]); */ all: typeof allOp; /** * Runs all branches and returns per-branch `Result` values in input order. * * Branch failures do not abort siblings. Invalid `concurrency` (non-integer or * less than 1) returns `Err(UnhandledException)` at run time. * * @example * const settled = Op.allSettled([Op.of(1), Op.fail("nope" as const)]); */ allSettled: typeof allSettledOp; /** * Converts one operation into an infallible wrapper that returns `Result` as data. * * @example * const settled = Op.settle(Op.try(() => JSON.parse("{}"))); */ settle: typeof settleOp; /** * Resolves with the first successful branch and aborts the rest. * * If every branch fails, returns `Err(ErrorGroup<...>)` with errors retained * in input order. * * @example * const fastestSuccess = Op.any([Op.fail("x"), Op.of(2)]); */ any: typeof anyOp; /** * Returns the first branch to settle (`Ok` or `Err`) and aborts the rest. * * @example * const firstSettler = Op.race([Op.of(1), Op.try(() => Promise.resolve(2))]); */ race: typeof raceOp; /** * Shared no-op operation that succeeds with `undefined`. * * @example * const noop = Op.empty; */ empty: Op; }; type Op = OpInterface & Tagged<"Op">; //#endregion export { EmptyMeta as A, CUSTOM_INSTRUCTION_META as C, Instruction as D, InferInstructionMeta as E, Simplify as F, StripEmpty as I, withBlocking as L, MergeMeta as M, NormalizeMeta as N, Blocking as O, SetBlockingMeta as P, ErrorGroup as R, RetryPolicy as S, InferInstructionErr as T, TimeoutPolicyAttachment as _, ExitContext as a, Delay as b, InferOpMeta as c, OpPolicy as d, OpPolicyInput as f, RetryPolicyAttachment as g, ReleasePolicyAttachment as h, ReleaseFn as i, IsRunnable as j, BlockingOp as k, BuiltInPolicy as l, OpPolicyType as m, EnterContext as n, RunContext as o, OpPolicySource as p, OpLifecycleHook as r, AnyNullaryOp as s, Op as t, CancelPolicyAttachment as u, TimeoutPolicyType as v, CustomInstruction as w, ExponentialDelayOptions as x, define as y, TimeoutError as z }; //# sourceMappingURL=index-BeplSvsa.d.mts.map