Stone.js API
    Preparing search index...

    Holds the configured limiters and hands one out by name.

    The same shape every driver-based module in the framework uses: named limiters, a default, and factories so an application can register a driver this package has never heard of. That last part matters more here than elsewhere: a limiter has to live where the application's other state lives, and for a serverless deployment that is often the table it already runs on.

    Index
    • Count one hit against the named limiter.

      Parameters

      • key: string

        What the budget belongs to.

      • limit: number

        How many hits the window allows.

      • windowMs: number

        How long the window lasts.

      • Optionalname: string

        Which limiter counts it.

      Returns Promise<RateLimitHit>

      The verdict.

    • The limiter a rule named, or the default.

      Parameters

      • name: string = ...

        The limiter's name.

      Returns RateLimiter

      The limiter.

      When nothing is registered under that name.

    • Register a built limiter.

      Parameters

      • name: string

        The name rules refer to it by.

      • limiter: RateLimiter

        The limiter.

      Returns this

      This manager.

    • Register a limiter to be built on first use.

      Parameters

      • name: string

        The name rules refer to it by.

      • factory: () => RateLimiter

        How to build it.

      Returns this

      This manager.

    • Parameters

      • defaultLimiter: string = 'memory'

        The limiter used when a rule names none.

      Returns RateLimitManager

      A manager.

    • Publish the manager, so code outside the container can reach it.

      Parameters

      Returns void