import { Resolver, ResolverOptions, Constructor, ClassOrFunctionReturning, FunctionReturning } from 'awilix'; import { MethodName } from 'awilix-router-core'; /** * Creates either a function invoker or a class invoker, based on whether * the argument can be classified as a class or not. Uses Awilix' `isClass` utility. * * @param functionOrClass * The function or class to invoke. * * @param opts * Resolver options for the class/function. */ export declare function makeInvoker(functionOrClass: ClassOrFunctionReturning, opts?: ResolverOptions): (methodToInvoke: MethodName) => (req: any, ...rest: any[]) => any; /** * Returns a function that when called with a name, * returns another function to be used as Express middleware. * That function will run `fn` with the container cradle as the * only parameter, and then call the `methodToInvoke` on * the result. * * @param, {Function} fn * @return {(methodToInvoke: string) => (req) => void} */ export declare function makeFunctionInvoker(fn: FunctionReturning, opts?: ResolverOptions): (methodToInvoke: MethodName) => (req: any, ...rest: any[]) => any; /** * Same as `makeInvoker` but for classes. * * @param {Class} Class * @return {(methodToInvoke: string) => (req) => void} */ export declare function makeClassInvoker(Class: Constructor, opts?: ResolverOptions): (methodToInvoke: MethodName) => (req: any, ...rest: any[]) => any; /** * Returns a function that when called with a method name, * returns another function to be used as Express middleware. * That function will run `container.build(resolver)`, and * then call the method on the result, passing in the Express request * and rest of the parameters. * * @param, {Resolver} resolver * @return {(methodToInvoke: string) => (req) => void} */ export declare function makeResolverInvoker(resolver: Resolver): (methodToInvoke: MethodName) => (req: any, ...rest: any[]) => any; /** * Injects dependencies into the middleware factory when the middleware is invoked. * * @param factory */ export declare function inject(factory: ClassOrFunctionReturning | Resolver): (req: any, ...rest: any[]) => any;