import { tagged, type Logger, } from '@monochromatic-dev/module-logger/ts'; import { runPipeAsync, } from './run.ts'; import type { AsyncStep, NoStepsAfter1, NoStepsAfter2, NoStepsAfter3, NoStepsAfter4, NoStepsAfter5, NoStepsAfter6, NoStepsAfter7, NoStepsAfter8, NoStepsAfter9, RunArgs, } from './types.ts'; export function pipedAsync( args: { readonly value: TInput; readonly fn1: AsyncStep; readonly l?: Logger; } & NoStepsAfter1, ): Promise>; export function pipedAsync( args: { readonly value: TInput; readonly fn1: AsyncStep; readonly fn2: AsyncStep; readonly l?: Logger; } & NoStepsAfter2, ): Promise>; export function pipedAsync( args: { readonly value: TInput; readonly fn1: AsyncStep; readonly fn2: AsyncStep; readonly fn3: AsyncStep; readonly l?: Logger; } & NoStepsAfter3, ): Promise>; export function pipedAsync( args: { readonly value: TInput; readonly fn1: AsyncStep; readonly fn2: AsyncStep; readonly fn3: AsyncStep; readonly fn4: AsyncStep; readonly l?: Logger; } & NoStepsAfter4, ): Promise>; export function pipedAsync( args: { readonly value: TInput; readonly fn1: AsyncStep; readonly fn2: AsyncStep; readonly fn3: AsyncStep; readonly fn4: AsyncStep; readonly fn5: AsyncStep; readonly l?: Logger; } & NoStepsAfter5, ): Promise>; export function pipedAsync( args: { readonly value: TInput; readonly fn1: AsyncStep; readonly fn2: AsyncStep; readonly fn3: AsyncStep; readonly fn4: AsyncStep; readonly fn5: AsyncStep; readonly fn6: AsyncStep; readonly l?: Logger; } & NoStepsAfter6, ): Promise>; export function pipedAsync( args: { readonly value: TInput; readonly fn1: AsyncStep; readonly fn2: AsyncStep; readonly fn3: AsyncStep; readonly fn4: AsyncStep; readonly fn5: AsyncStep; readonly fn6: AsyncStep; readonly fn7: AsyncStep; readonly l?: Logger; } & NoStepsAfter7, ): Promise>; export function pipedAsync( args: { readonly value: TInput; readonly fn1: AsyncStep; readonly fn2: AsyncStep; readonly fn3: AsyncStep; readonly fn4: AsyncStep; readonly fn5: AsyncStep; readonly fn6: AsyncStep; readonly fn7: AsyncStep; readonly fn8: AsyncStep; readonly l?: Logger; } & NoStepsAfter8, ): Promise>; export function pipedAsync< const TInput, TStep1, TStep2, TStep3, TStep4, TStep5, TStep6, TStep7, TStep8, TStep9, >( args: { readonly value: TInput; readonly fn1: AsyncStep; readonly fn2: AsyncStep; readonly fn3: AsyncStep; readonly fn4: AsyncStep; readonly fn5: AsyncStep; readonly fn6: AsyncStep; readonly fn7: AsyncStep; readonly fn8: AsyncStep; readonly fn9: AsyncStep; readonly l?: Logger; } & NoStepsAfter9, ): Promise>; /** Runs a possibly promised value through asynchronous left-to-right pipeline steps, delegating to {@link runPipeAsync}. @param args - possibly promised input value, contiguous step functions, and optional logger @returns promise resolving to final pipeline output @throws {@link PipeStepGapError} or {@link PipeStepOverflowError} when runtime step keys are invalid @throws whatever pipeline step throws or rejects with; the failure propagates unchanged @example ```ts import { pipedAsync } from '\@monochromatic-dev/module-pipe'; const result = await pipedAsync({ value: Promise.resolve(1), fn1: (input: number) => input + 1, fn2: async (input) => String(input), }); ``` */ export function pipedAsync(args: RunArgs,): Promise { /** Logger tagged at the eager async public API boundary. */ const l = tagged(args.l === undefined ? { tag: pipedAsync.name, } : { tag: pipedAsync.name, l: args.l, },); return runPipeAsync({ ...args, l, },); }