import { type InternalAction, type MiddlewareFn } from '../types.js'; export type CompiledChain = Map) => Promise>; /** Generic handler function signature used in middleware chains. */ type ChainFn = (ctx: TContext, args: Record) => Promise; /** * Wrap a handler with a middleware stack (right-to-left composition). * * This is the single canonical implementation of the middleware * wrapping pattern. No other file should duplicate this loop. * * @param handler - The innermost function to wrap * @param middlewares - Middleware stack (outermost first, applied right-to-left) * @returns The compiled chain function */ export declare function wrapChain(handler: ChainFn, middlewares: readonly MiddlewareFn[]): ChainFn; /** * Pre-compile middleware chains for all actions in a builder. * * For each action: * 1. Wraps generator handlers in a GeneratorResultEnvelope * 2. Applies per-action middlewares (innermost) * 3. Applies global middlewares (outermost) * * @param actions - Registered actions with their handlers and local middleware * @param middlewares - Global middleware stack * @returns Map from action key to compiled chain */ export declare function compileMiddlewareChains(actions: readonly InternalAction[], middlewares: readonly MiddlewareFn[]): CompiledChain; export {}; //# sourceMappingURL=MiddlewareCompiler.d.ts.map