Class MiddlewareStack<Input, Output, Context>

Type Parameters

  • Input extends object = any
  • Output extends object = any
  • Context extends object = object

Constructors

Properties

names: Set<string> = ...
stack: Middleware<Input, Output, Context>[] = []

Accessors

  • get height(): number
  • Gives the number of entries of the stack.

    Returns number

    The height of the stack.

Methods

  • Adds middleware to the stack relative to the anchoring middleware. If the anchoring middleware does not exist, the middleware will be ignored during the sorting process.

    Parameters

    Returns this

    A reference to this instance.

  • Adds the middleware name to the local cache of middleware for quicker middleware validation.

    Parameters

    • name: string

      A middleware name to cache to check for name uniqueness on the stack.

    • silent: boolean = true

      An option to make this method go "BOOM!"

    Returns boolean

    An indicator that the name was successfully added to stack or that it already exists.

  • Verifies the existence of a particular middleware in the stack.

    Parameters

    Returns boolean

    An indicator that the middleware has or has not been added to the stack.

  • Remove deletes a middleware from the stack and cache.

    Parameters

    • name: string

      The name of the middleware to remove.

    Returns this

    The reference to this instance.

  • RemoveByRef deletes the middleware function(s) that have the same reference as the given function.

    Parameters

    Returns this

    The reference to this instance.

  • RemoveByTag deletes the middleware function(s) that have the given tag.

    Parameters

    • tag: string

      Indicates the middleware to remove by tag.

    Returns this

    The reference to this instance.

  • Resolve enchains the middleware by binding the next and context parameters and exposing a handler to begin the call chain.

    Type Parameters

    • I extends object
    • O extends object

    Parameters

    Returns InitializeHandler<I, O>

    The first middleware to be called on the middleware stack.

  • Provides a pluggable interface for manipulating this middleware stack instance. It should be used when performing multiple operations on a class instance in a transaction-like manner.

    Parameters

    Returns this

    The reference to this instance.