import { Store, Options, ClientRateLimitInfo } from 'express-rate-limit'; /** * A `Store` for the `express-rate-limit` package that stores individual hits in * PostgreSQL. Each hit is stored as a separate entry and can be used for advanced analytics. * * @public */ declare class PostgresStoreIndividualIP implements Store { /** * The database configuration as specified in https://node-postgres.com/apis/client. */ config: any; /** * The database connection pool. */ pool: any; /** * Optional value that the store prepends to keys * * Used by the double-count check to avoid false-positives when a key is counted twice, but with different prefixes */ prefix: string; /** * The duration of time before which all hit counts are reset (in milliseconds). */ windowMs: number; /** * @constructor for `PostgresStoreIndividualIP`. * * @param config {any} - The database configuration as specified in https://node-postgres.com/apis/client. * @param prefix {string} - The unique name of the session. This is useful when applying multiple rate limiters with multiple stores. */ constructor(config: any, prefix: string); /** * Method that actually initializes the store. Must be synchronous. * * This method is optional, it will be called only if it exists. * * @param options {Options} - The options used to setup express-rate-limit. * * @public */ init(options: Options): void; /** * Method to increment a client's hit counter. * * @param key {string} - The identifier for a client. * * @returns {ClientRateLimitInfo} - The number of hits and reset time for that client. * * @public */ increment(key: string): Promise; /** * Method to decrement a client's hit counter. * * @param key {string} - The identifier for a client. * * @public */ decrement(key: string): Promise; /** * Method to reset a client's hit counter. * * @param key {string} - The identifier for a client. * * @public */ resetKey(key: string): Promise; /** * Method to reset everyone's hit counter. * * This method is optional, it is never called by express-rate-limit. * * @public */ resetAll(): Promise; } /** * A `Store` for the `express-rate-limit` package that stores hit counts in * PostgreSQL. * * @public */ declare class PostgresStoreAggregatedIP implements Store { /** * The database configuration as specified in https://node-postgres.com/apis/client. */ config: any; /** * Optional value that the store prepends to keys * * Used by the double-count check to avoid false-positives when a key is counted twice, but with different prefixes */ prefix: string; /** * The database connection pool. */ pool: any; /** * The duration of time before which all hit counts are reset (in milliseconds). */ windowMs: number; /** * @constructor for `PostgresStoreAggregatedIP`. * * @param config {any} - The database configuration as specified in https://node-postgres.com/apis/client. * @param prefix {string} - The unique name of the session. This is useful when applying multiple rate limiters with multiple stores. */ constructor(config: any, prefix: string); /** * Method that actually initializes the store. Must be synchronous. * * This method is optional, it will be called only if it exists. * * @param options {Options} - The options used to setup express-rate-limit. * * @public */ init(options: Options): void; /** * Method to increment a client's hit counter. * * @param key {string} - The identifier for a client. * * @returns {ClientRateLimitInfo} - The number of hits and reset time for that client. * * @public */ increment(key: string): Promise; /** * Method to decrement a client's hit counter. * * @param key {string} - The identifier for a client. * * @public */ decrement(key: string): Promise; /** * Method to reset a client's hit counter. * * @param key {string} - The identifier for a client. * * @public */ resetKey(key: string): Promise; /** * Method to reset everyone's hit counter. * * This method is optional, it is never called by express-rate-limit. * * @public */ resetAll(): Promise; } export { PostgresStoreAggregatedIP as PostgresStore, PostgresStoreIndividualIP };