Skip to content
1 min read · 142 words

Function: runInputPipeline()

ts
function runInputPipeline<C>(
  mw: Middleware<MiddlewareFn<C>>,
  ctx: C,
  label: string,
): Promise<string | undefined>;

Defined in: batteries/tools/_shared/index.ts:211

Run an input pipeline over ctx. Returns the short-circuit string when a stage short-circuited, or undefined when the pipeline reached its terminal handler. A non-terminal pipeline (a stage that neither called next() nor short-circuited) throws — the caller converts it to an Error: string.

Type Parameters

Type Parameter
C

Parameters

ParameterTypeDescription
mwMiddleware<MiddlewareFn<C>>The Middleware instance holding the stages (a fresh .runner() is minted here).
ctxCThe mutable input context handed to each stage.
labelstringBattery name, used in the non-terminal error message.

Returns

Promise<string | undefined>

The short-circuit result string, or undefined if the pipeline ran to completion.