import { type Context } from './context.types.js'; /** * The next function caller in a Koa Middleware chain. * Always returns a promise and allows for fine grained middleware control flow. */ export type Next = () => Promise; /** * Composeable middleware. * * @param context - The Koa extended context object * @param next - The next function to be call the next next middleware in the middleware chain. */ export type Middleware = ( /** * The Koa extended context object */ context: C, /** * The next function to be call the next next middleware in the middleware chain. * Always returns a promise and allows for fine grained middleware control flow. * */ next: Next) => Promise; /** * Expose compositor * * Compose `middleware` returning * a fully valid middleware comprised * of all those which are passed. */ declare function compose(middleware: Middleware[]): (context: Context, next?: Next) => Promise; export default compose;