Describes how requests of one API are grouped into categories, and the default limit of each category.

interface ConcurrencyPolicy<C> {
    defaults: Readonly<Record<C, number>>;
    fallback?: ((normalizedPath: string) => undefined | C);
    name: string;
    normalizePath?: ((pathname: string) => string);
    rules: readonly ConcurrencyRule<C>[];
}

Type Parameters

  • C extends string

Properties

defaults: Readonly<Record<C, number>>
fallback?: ((normalizedPath: string) => undefined | C)

Category for paths no rule matches. Return undefined to leave them unlimited.

name: string

Used in validation errors

normalizePath?: ((pathname: string) => string)

Maps a request pathname to the form the rules are written against.

rules: readonly ConcurrencyRule<C>[]

First match wins, so order matters when rules overlap.