import { BautaJSInstance, Context, Pipeline } from '../types'; /** * Resolve the given predicate an execute the pipeline for that condition * * @export * @interface Match * @template TIn * @template TOut * @template TRequest * @template TResponse */ export interface Match { /** * Sets a condition step function that returns a boolean and a second statement step function. * If the result of the condition step function is true, the statement step function is executed. * * @param {(prev: TIn, ctx: Context, bautajs: BautaJSInstance) => boolean} pred * @param {Pipeline.StepFunction} pipeline * @returns {Match} * @memberof Match */ on(pred: (prev: TIn, ctx: Context, bautajs: BautaJSInstance) => boolean, pipeline: Pipeline.StepFunction): Match; /** * Set the pipeline that will be executed by default if any of the given conditions are not returning true. * * @param {Pipeline.StepFunction} pipeline * @memberof Match */ otherwise(pipeline: Pipeline.StepFunction): void; } /** * Allow to chose which pipeline execute depending on the given condition * @export * @template TIn * @template TOut * @param {(m: Match) => any} matchFn * @returns {Pipeline.StepFunction} * @example * const { match, pipe } = require('@batuajs/core'); * * const findCatsPipeline = pipe(...); * const logResultPipeline = pipe(...); * * bautajsInstance.operations.v1.findcats.setup(pipe( * () => 1, * match(m => * m.on((prev) => prev === 1, findCatsPipeline) * .otherwise(logResultPipeline) * ) ) */ export declare function match(matchFn: (m: Match) => any): Pipeline.StepFunction; export default match; //# sourceMappingURL=match.d.ts.map