middleware.d.ts 764 B

12345678910
  1. import { YargsInstance, Arguments } from './yargs';
  2. export declare function globalMiddlewareFactory<T>(globalMiddleware: Middleware[], context: T): (callback: MiddlewareCallback | MiddlewareCallback[], applyBeforeValidation?: boolean) => T;
  3. export declare function commandMiddlewareFactory(commandMiddleware?: MiddlewareCallback[]): Middleware[];
  4. export declare function applyMiddleware(argv: Arguments | Promise<Arguments>, yargs: YargsInstance, middlewares: Middleware[], beforeValidation: boolean): Arguments | Promise<Arguments>;
  5. export interface MiddlewareCallback {
  6. (argv: Arguments, yargs: YargsInstance): Partial<Arguments> | Promise<Partial<Arguments>>;
  7. }
  8. export interface Middleware extends MiddlewareCallback {
  9. applyBeforeValidation: boolean;
  10. }