feat(planning): grille hebdomadaire complète avec API et filtres
- Connexion API via proxy Angular (résolution CORS, base path /api) - Import CSS ng-zorro global pour les modales et composants - Filtres Camion/Show câblés sur l'affichage de la grille - Camions affichés via TrucksService (linkés au show du même créneau) - Panneau de détails : spectacles + camions du jour sélectionné - Modale de création de spectacle stylisée avec fond et centrage - Positionnement précis des events à la minute dans leur créneau - Auto-scroll vers l'heure courante au chargement - Ligne "maintenant" sur la colonne du jour actuel - Régénération des services OpenAPI (nouveaux noms de types) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+421
-614
File diff suppressed because it is too large
Load Diff
+21
-105
@@ -1,28 +1,7 @@
|
||||
// Generated by dts-bundle-generator v8.1.2
|
||||
// Generated by dts-bundle-generator v8.0.1
|
||||
|
||||
import { NextFunction, Request, RequestHandler, Response } from 'express';
|
||||
|
||||
/**
|
||||
* Returns the IP address itself for IPv4, or a CIDR-notation subnet for IPv6.
|
||||
*
|
||||
* If you write a custom keyGenerator that allows a fallback to IP address for
|
||||
* unauthenticated users, return ipKeyGenerator(req.ip) rather than just req.ip.
|
||||
*
|
||||
* For more information, {@see Options.ipv6Subnet}.
|
||||
*
|
||||
* @param ip {string} - The IP address to process, usually request.ip.
|
||||
* @param ipv6Subnet {number | false} - The subnet mask for IPv6 addresses.
|
||||
*
|
||||
* @returns {string} - The key generated from the IP address
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function ipKeyGenerator(ip: string, ipv6Subnet?: number | false): string;
|
||||
declare const SUPPORTED_DRAFT_VERSIONS: readonly [
|
||||
"draft-6",
|
||||
"draft-7",
|
||||
"draft-8"
|
||||
];
|
||||
declare const validations: {
|
||||
enabled: {
|
||||
[key: string]: boolean;
|
||||
@@ -60,14 +39,6 @@ declare const validations: {
|
||||
* @returns {void}
|
||||
*/
|
||||
xForwardedForHeader(request: Request): void;
|
||||
/**
|
||||
* Alert the user if the Forwarded header is set (standardized version of X-Forwarded-For - not supported by express as of version 5.1.0)
|
||||
*
|
||||
* @param request {Request} - The Express request object.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
forwardedHeader(request: Request): void;
|
||||
/**
|
||||
* Ensures totalHits value from store is a positive integer.
|
||||
*
|
||||
@@ -132,13 +103,12 @@ declare const validations: {
|
||||
* @returns {void}
|
||||
*/
|
||||
headersResetTime(resetTime?: Date): void;
|
||||
knownOptions(passedOptions?: Partial<Options>): void;
|
||||
/**
|
||||
* Checks the options.validate setting to ensure that only recognized
|
||||
* validations are enabled or disabled.
|
||||
*
|
||||
* If any unrecognized values are found, an error is logged that
|
||||
* includes the list of supported validations.
|
||||
* includes the list of supported vaidations.
|
||||
*/
|
||||
validationsConfig(): void;
|
||||
/**
|
||||
@@ -147,38 +117,13 @@ declare const validations: {
|
||||
* store (or any other store with localKeys.)
|
||||
*/
|
||||
creationStack(store: Store): void;
|
||||
ipv6Subnet(ipv6Subnet?: any): void;
|
||||
ipv6SubnetOrKeyGenerator(options: Partial<Options>): void;
|
||||
keyGeneratorIpFallback(keyGenerator?: ValueDeterminingMiddleware<string>): void;
|
||||
/**
|
||||
* Checks to see if the window duration is greater than 2^32 - 1. This is only
|
||||
* called by the default MemoryStore, since it uses Node's setInterval method.
|
||||
*
|
||||
* See https://nodejs.org/api/timers.html#setintervalcallback-delay-args.
|
||||
*/
|
||||
windowMs(windowMs: number): void;
|
||||
};
|
||||
export type Validations = typeof validations;
|
||||
/**
|
||||
* Basic logging function
|
||||
*
|
||||
* @param error {unknown} - The error to log
|
||||
* @param message {string | undefined} - Additional details about the error
|
||||
*/
|
||||
export type LoggerFn = (error: unknown, message?: string) => void;
|
||||
/**
|
||||
* Minimal interface for logging warnings and errors
|
||||
*/
|
||||
export type Logger = {
|
||||
/**
|
||||
* Function to log an error
|
||||
*/
|
||||
error: LoggerFn;
|
||||
/**
|
||||
* Function to log a warning
|
||||
*/
|
||||
warn: LoggerFn;
|
||||
};
|
||||
declare const SUPPORTED_DRAFT_VERSIONS: readonly [
|
||||
"draft-6",
|
||||
"draft-7",
|
||||
"draft-8"
|
||||
];
|
||||
/**
|
||||
* Callback that fires when a client's hit counter is incremented.
|
||||
*
|
||||
@@ -285,15 +230,9 @@ export type Store = {
|
||||
* Method that initializes the store, and has access to the options passed to
|
||||
* the middleware too.
|
||||
*
|
||||
* Called once during initialization.
|
||||
*
|
||||
* Errors / promise rejections will be caught and logged.
|
||||
*
|
||||
* Note that the result is not awaited - other store methods (such as increment) may be called before init returns and/or after it throws/rejects.
|
||||
*
|
||||
* @param options {Options} - The options used to setup the middleware.
|
||||
*/
|
||||
init?: (options: Options) => void | Promise<void>;
|
||||
init?: (options: Options) => void;
|
||||
/**
|
||||
* Method to fetch a client's hit count and reset time.
|
||||
*
|
||||
@@ -341,8 +280,7 @@ export type Store = {
|
||||
/**
|
||||
* 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.
|
||||
* Used by the double-count check to avoid false-positives when a key is counted twice, but with different prefixes
|
||||
*/
|
||||
prefix?: string;
|
||||
};
|
||||
@@ -434,21 +372,6 @@ export type Options = {
|
||||
* By default, the client's IP address is used.
|
||||
*/
|
||||
keyGenerator: ValueDeterminingMiddleware<string>;
|
||||
/**
|
||||
* IPv6 subnet mask applied to IPv6 addresses in the default keyGenerator.
|
||||
*
|
||||
* Default is 56. The valid range is technically 1-128 but the value should
|
||||
* generally be in the 32-64 range.
|
||||
*
|
||||
* Smaller numbers are more aggressive, larger numbers are more lenient. Try
|
||||
* bumping to 60 or 64 if you see evidence of users being blocked incorrectly.
|
||||
*
|
||||
* May also be set to a function that returns a number based on the request.
|
||||
*
|
||||
* See the documentation for more info:
|
||||
* https://express-rate-limit.mintlify.app/reference/configuration#ipv6subnet.
|
||||
*/
|
||||
ipv6Subnet: 64 | 60 | 56 | 52 | 50 | 48 | 32 | number | ValueDeterminingMiddleware<number> | false;
|
||||
/**
|
||||
* Express request handler that sends back a response when a client is
|
||||
* rate-limited.
|
||||
@@ -464,7 +387,7 @@ export type Options = {
|
||||
*/
|
||||
skip: ValueDeterminingMiddleware<boolean>;
|
||||
/**
|
||||
* Method to determine whether or not the request counts as 'successful'. Used
|
||||
* Method to determine whether or not the request counts as 'succesful'. Used
|
||||
* when either `skipSuccessfulRequests` or `skipFailedRequests` is set to true.
|
||||
*
|
||||
* By default, requests with a response status code less than 400 are considered
|
||||
@@ -503,10 +426,6 @@ export type Options = {
|
||||
* If the Store generates an error, allow the request to pass.
|
||||
*/
|
||||
passOnStoreError: boolean;
|
||||
/**
|
||||
* The logger to use to log errors. If absent, logs to the console.
|
||||
*/
|
||||
logger: Logger;
|
||||
};
|
||||
/**
|
||||
* The extended request object that includes information about the client's
|
||||
@@ -524,8 +443,18 @@ export type RateLimitInfo = {
|
||||
used: number;
|
||||
remaining: number;
|
||||
resetTime: Date | undefined;
|
||||
key: string;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* Create an instance of IP rate-limiting middleware for Express.
|
||||
*
|
||||
* @param passedOptions {Options} - Options to configure the rate limiter.
|
||||
*
|
||||
* @returns {RateLimitRequestHandler} - The middleware that rate-limits clients based on your configuration.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const rateLimit: (passedOptions?: Partial<Options>) => RateLimitRequestHandler;
|
||||
/**
|
||||
* The record that stores information about a client - namely, how many times
|
||||
* they have hit the endpoint, and when their hit count resets.
|
||||
@@ -542,7 +471,6 @@ export type Client = {
|
||||
* @public
|
||||
*/
|
||||
export declare class MemoryStore implements Store {
|
||||
private validations?;
|
||||
/**
|
||||
* The duration of time before which all hit counts are reset (in milliseconds).
|
||||
*/
|
||||
@@ -568,7 +496,6 @@ export declare class MemoryStore implements Store {
|
||||
* cannot affect other instances.
|
||||
*/
|
||||
localKeys: boolean;
|
||||
constructor(validations?: Validations | undefined);
|
||||
/**
|
||||
* Method that initializes the store.
|
||||
*
|
||||
@@ -653,17 +580,6 @@ export declare class MemoryStore implements Store {
|
||||
*/
|
||||
private clearExpired;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Create an instance of IP rate-limiting middleware for Express.
|
||||
*
|
||||
* @param passedOptions {Options} - Options to configure the rate limiter.
|
||||
*
|
||||
* @returns {RateLimitRequestHandler} - The middleware that rate-limits clients based on your configuration.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const rateLimit: (passedOptions?: Partial<Options>) => RateLimitRequestHandler;
|
||||
|
||||
export {
|
||||
rateLimit as default,
|
||||
|
||||
+21
-105
@@ -1,28 +1,7 @@
|
||||
// Generated by dts-bundle-generator v8.1.2
|
||||
// Generated by dts-bundle-generator v8.0.1
|
||||
|
||||
import { NextFunction, Request, RequestHandler, Response } from 'express';
|
||||
|
||||
/**
|
||||
* Returns the IP address itself for IPv4, or a CIDR-notation subnet for IPv6.
|
||||
*
|
||||
* If you write a custom keyGenerator that allows a fallback to IP address for
|
||||
* unauthenticated users, return ipKeyGenerator(req.ip) rather than just req.ip.
|
||||
*
|
||||
* For more information, {@see Options.ipv6Subnet}.
|
||||
*
|
||||
* @param ip {string} - The IP address to process, usually request.ip.
|
||||
* @param ipv6Subnet {number | false} - The subnet mask for IPv6 addresses.
|
||||
*
|
||||
* @returns {string} - The key generated from the IP address
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function ipKeyGenerator(ip: string, ipv6Subnet?: number | false): string;
|
||||
declare const SUPPORTED_DRAFT_VERSIONS: readonly [
|
||||
"draft-6",
|
||||
"draft-7",
|
||||
"draft-8"
|
||||
];
|
||||
declare const validations: {
|
||||
enabled: {
|
||||
[key: string]: boolean;
|
||||
@@ -60,14 +39,6 @@ declare const validations: {
|
||||
* @returns {void}
|
||||
*/
|
||||
xForwardedForHeader(request: Request): void;
|
||||
/**
|
||||
* Alert the user if the Forwarded header is set (standardized version of X-Forwarded-For - not supported by express as of version 5.1.0)
|
||||
*
|
||||
* @param request {Request} - The Express request object.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
forwardedHeader(request: Request): void;
|
||||
/**
|
||||
* Ensures totalHits value from store is a positive integer.
|
||||
*
|
||||
@@ -132,13 +103,12 @@ declare const validations: {
|
||||
* @returns {void}
|
||||
*/
|
||||
headersResetTime(resetTime?: Date): void;
|
||||
knownOptions(passedOptions?: Partial<Options>): void;
|
||||
/**
|
||||
* Checks the options.validate setting to ensure that only recognized
|
||||
* validations are enabled or disabled.
|
||||
*
|
||||
* If any unrecognized values are found, an error is logged that
|
||||
* includes the list of supported validations.
|
||||
* includes the list of supported vaidations.
|
||||
*/
|
||||
validationsConfig(): void;
|
||||
/**
|
||||
@@ -147,38 +117,13 @@ declare const validations: {
|
||||
* store (or any other store with localKeys.)
|
||||
*/
|
||||
creationStack(store: Store): void;
|
||||
ipv6Subnet(ipv6Subnet?: any): void;
|
||||
ipv6SubnetOrKeyGenerator(options: Partial<Options>): void;
|
||||
keyGeneratorIpFallback(keyGenerator?: ValueDeterminingMiddleware<string>): void;
|
||||
/**
|
||||
* Checks to see if the window duration is greater than 2^32 - 1. This is only
|
||||
* called by the default MemoryStore, since it uses Node's setInterval method.
|
||||
*
|
||||
* See https://nodejs.org/api/timers.html#setintervalcallback-delay-args.
|
||||
*/
|
||||
windowMs(windowMs: number): void;
|
||||
};
|
||||
export type Validations = typeof validations;
|
||||
/**
|
||||
* Basic logging function
|
||||
*
|
||||
* @param error {unknown} - The error to log
|
||||
* @param message {string | undefined} - Additional details about the error
|
||||
*/
|
||||
export type LoggerFn = (error: unknown, message?: string) => void;
|
||||
/**
|
||||
* Minimal interface for logging warnings and errors
|
||||
*/
|
||||
export type Logger = {
|
||||
/**
|
||||
* Function to log an error
|
||||
*/
|
||||
error: LoggerFn;
|
||||
/**
|
||||
* Function to log a warning
|
||||
*/
|
||||
warn: LoggerFn;
|
||||
};
|
||||
declare const SUPPORTED_DRAFT_VERSIONS: readonly [
|
||||
"draft-6",
|
||||
"draft-7",
|
||||
"draft-8"
|
||||
];
|
||||
/**
|
||||
* Callback that fires when a client's hit counter is incremented.
|
||||
*
|
||||
@@ -285,15 +230,9 @@ export type Store = {
|
||||
* Method that initializes the store, and has access to the options passed to
|
||||
* the middleware too.
|
||||
*
|
||||
* Called once during initialization.
|
||||
*
|
||||
* Errors / promise rejections will be caught and logged.
|
||||
*
|
||||
* Note that the result is not awaited - other store methods (such as increment) may be called before init returns and/or after it throws/rejects.
|
||||
*
|
||||
* @param options {Options} - The options used to setup the middleware.
|
||||
*/
|
||||
init?: (options: Options) => void | Promise<void>;
|
||||
init?: (options: Options) => void;
|
||||
/**
|
||||
* Method to fetch a client's hit count and reset time.
|
||||
*
|
||||
@@ -341,8 +280,7 @@ export type Store = {
|
||||
/**
|
||||
* 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.
|
||||
* Used by the double-count check to avoid false-positives when a key is counted twice, but with different prefixes
|
||||
*/
|
||||
prefix?: string;
|
||||
};
|
||||
@@ -434,21 +372,6 @@ export type Options = {
|
||||
* By default, the client's IP address is used.
|
||||
*/
|
||||
keyGenerator: ValueDeterminingMiddleware<string>;
|
||||
/**
|
||||
* IPv6 subnet mask applied to IPv6 addresses in the default keyGenerator.
|
||||
*
|
||||
* Default is 56. The valid range is technically 1-128 but the value should
|
||||
* generally be in the 32-64 range.
|
||||
*
|
||||
* Smaller numbers are more aggressive, larger numbers are more lenient. Try
|
||||
* bumping to 60 or 64 if you see evidence of users being blocked incorrectly.
|
||||
*
|
||||
* May also be set to a function that returns a number based on the request.
|
||||
*
|
||||
* See the documentation for more info:
|
||||
* https://express-rate-limit.mintlify.app/reference/configuration#ipv6subnet.
|
||||
*/
|
||||
ipv6Subnet: 64 | 60 | 56 | 52 | 50 | 48 | 32 | number | ValueDeterminingMiddleware<number> | false;
|
||||
/**
|
||||
* Express request handler that sends back a response when a client is
|
||||
* rate-limited.
|
||||
@@ -464,7 +387,7 @@ export type Options = {
|
||||
*/
|
||||
skip: ValueDeterminingMiddleware<boolean>;
|
||||
/**
|
||||
* Method to determine whether or not the request counts as 'successful'. Used
|
||||
* Method to determine whether or not the request counts as 'succesful'. Used
|
||||
* when either `skipSuccessfulRequests` or `skipFailedRequests` is set to true.
|
||||
*
|
||||
* By default, requests with a response status code less than 400 are considered
|
||||
@@ -503,10 +426,6 @@ export type Options = {
|
||||
* If the Store generates an error, allow the request to pass.
|
||||
*/
|
||||
passOnStoreError: boolean;
|
||||
/**
|
||||
* The logger to use to log errors. If absent, logs to the console.
|
||||
*/
|
||||
logger: Logger;
|
||||
};
|
||||
/**
|
||||
* The extended request object that includes information about the client's
|
||||
@@ -524,8 +443,18 @@ export type RateLimitInfo = {
|
||||
used: number;
|
||||
remaining: number;
|
||||
resetTime: Date | undefined;
|
||||
key: string;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* Create an instance of IP rate-limiting middleware for Express.
|
||||
*
|
||||
* @param passedOptions {Options} - Options to configure the rate limiter.
|
||||
*
|
||||
* @returns {RateLimitRequestHandler} - The middleware that rate-limits clients based on your configuration.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const rateLimit: (passedOptions?: Partial<Options>) => RateLimitRequestHandler;
|
||||
/**
|
||||
* The record that stores information about a client - namely, how many times
|
||||
* they have hit the endpoint, and when their hit count resets.
|
||||
@@ -542,7 +471,6 @@ export type Client = {
|
||||
* @public
|
||||
*/
|
||||
export declare class MemoryStore implements Store {
|
||||
private validations?;
|
||||
/**
|
||||
* The duration of time before which all hit counts are reset (in milliseconds).
|
||||
*/
|
||||
@@ -568,7 +496,6 @@ export declare class MemoryStore implements Store {
|
||||
* cannot affect other instances.
|
||||
*/
|
||||
localKeys: boolean;
|
||||
constructor(validations?: Validations | undefined);
|
||||
/**
|
||||
* Method that initializes the store.
|
||||
*
|
||||
@@ -653,17 +580,6 @@ export declare class MemoryStore implements Store {
|
||||
*/
|
||||
private clearExpired;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Create an instance of IP rate-limiting middleware for Express.
|
||||
*
|
||||
* @param passedOptions {Options} - Options to configure the rate limiter.
|
||||
*
|
||||
* @returns {RateLimitRequestHandler} - The middleware that rate-limits clients based on your configuration.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const rateLimit: (passedOptions?: Partial<Options>) => RateLimitRequestHandler;
|
||||
|
||||
export {
|
||||
rateLimit as default,
|
||||
|
||||
+21
-105
@@ -1,28 +1,7 @@
|
||||
// Generated by dts-bundle-generator v8.1.2
|
||||
// Generated by dts-bundle-generator v8.0.1
|
||||
|
||||
import { NextFunction, Request, RequestHandler, Response } from 'express';
|
||||
|
||||
/**
|
||||
* Returns the IP address itself for IPv4, or a CIDR-notation subnet for IPv6.
|
||||
*
|
||||
* If you write a custom keyGenerator that allows a fallback to IP address for
|
||||
* unauthenticated users, return ipKeyGenerator(req.ip) rather than just req.ip.
|
||||
*
|
||||
* For more information, {@see Options.ipv6Subnet}.
|
||||
*
|
||||
* @param ip {string} - The IP address to process, usually request.ip.
|
||||
* @param ipv6Subnet {number | false} - The subnet mask for IPv6 addresses.
|
||||
*
|
||||
* @returns {string} - The key generated from the IP address
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function ipKeyGenerator(ip: string, ipv6Subnet?: number | false): string;
|
||||
declare const SUPPORTED_DRAFT_VERSIONS: readonly [
|
||||
"draft-6",
|
||||
"draft-7",
|
||||
"draft-8"
|
||||
];
|
||||
declare const validations: {
|
||||
enabled: {
|
||||
[key: string]: boolean;
|
||||
@@ -60,14 +39,6 @@ declare const validations: {
|
||||
* @returns {void}
|
||||
*/
|
||||
xForwardedForHeader(request: Request): void;
|
||||
/**
|
||||
* Alert the user if the Forwarded header is set (standardized version of X-Forwarded-For - not supported by express as of version 5.1.0)
|
||||
*
|
||||
* @param request {Request} - The Express request object.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
forwardedHeader(request: Request): void;
|
||||
/**
|
||||
* Ensures totalHits value from store is a positive integer.
|
||||
*
|
||||
@@ -132,13 +103,12 @@ declare const validations: {
|
||||
* @returns {void}
|
||||
*/
|
||||
headersResetTime(resetTime?: Date): void;
|
||||
knownOptions(passedOptions?: Partial<Options>): void;
|
||||
/**
|
||||
* Checks the options.validate setting to ensure that only recognized
|
||||
* validations are enabled or disabled.
|
||||
*
|
||||
* If any unrecognized values are found, an error is logged that
|
||||
* includes the list of supported validations.
|
||||
* includes the list of supported vaidations.
|
||||
*/
|
||||
validationsConfig(): void;
|
||||
/**
|
||||
@@ -147,38 +117,13 @@ declare const validations: {
|
||||
* store (or any other store with localKeys.)
|
||||
*/
|
||||
creationStack(store: Store): void;
|
||||
ipv6Subnet(ipv6Subnet?: any): void;
|
||||
ipv6SubnetOrKeyGenerator(options: Partial<Options>): void;
|
||||
keyGeneratorIpFallback(keyGenerator?: ValueDeterminingMiddleware<string>): void;
|
||||
/**
|
||||
* Checks to see if the window duration is greater than 2^32 - 1. This is only
|
||||
* called by the default MemoryStore, since it uses Node's setInterval method.
|
||||
*
|
||||
* See https://nodejs.org/api/timers.html#setintervalcallback-delay-args.
|
||||
*/
|
||||
windowMs(windowMs: number): void;
|
||||
};
|
||||
export type Validations = typeof validations;
|
||||
/**
|
||||
* Basic logging function
|
||||
*
|
||||
* @param error {unknown} - The error to log
|
||||
* @param message {string | undefined} - Additional details about the error
|
||||
*/
|
||||
export type LoggerFn = (error: unknown, message?: string) => void;
|
||||
/**
|
||||
* Minimal interface for logging warnings and errors
|
||||
*/
|
||||
export type Logger = {
|
||||
/**
|
||||
* Function to log an error
|
||||
*/
|
||||
error: LoggerFn;
|
||||
/**
|
||||
* Function to log a warning
|
||||
*/
|
||||
warn: LoggerFn;
|
||||
};
|
||||
declare const SUPPORTED_DRAFT_VERSIONS: readonly [
|
||||
"draft-6",
|
||||
"draft-7",
|
||||
"draft-8"
|
||||
];
|
||||
/**
|
||||
* Callback that fires when a client's hit counter is incremented.
|
||||
*
|
||||
@@ -285,15 +230,9 @@ export type Store = {
|
||||
* Method that initializes the store, and has access to the options passed to
|
||||
* the middleware too.
|
||||
*
|
||||
* Called once during initialization.
|
||||
*
|
||||
* Errors / promise rejections will be caught and logged.
|
||||
*
|
||||
* Note that the result is not awaited - other store methods (such as increment) may be called before init returns and/or after it throws/rejects.
|
||||
*
|
||||
* @param options {Options} - The options used to setup the middleware.
|
||||
*/
|
||||
init?: (options: Options) => void | Promise<void>;
|
||||
init?: (options: Options) => void;
|
||||
/**
|
||||
* Method to fetch a client's hit count and reset time.
|
||||
*
|
||||
@@ -341,8 +280,7 @@ export type Store = {
|
||||
/**
|
||||
* 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.
|
||||
* Used by the double-count check to avoid false-positives when a key is counted twice, but with different prefixes
|
||||
*/
|
||||
prefix?: string;
|
||||
};
|
||||
@@ -434,21 +372,6 @@ export type Options = {
|
||||
* By default, the client's IP address is used.
|
||||
*/
|
||||
keyGenerator: ValueDeterminingMiddleware<string>;
|
||||
/**
|
||||
* IPv6 subnet mask applied to IPv6 addresses in the default keyGenerator.
|
||||
*
|
||||
* Default is 56. The valid range is technically 1-128 but the value should
|
||||
* generally be in the 32-64 range.
|
||||
*
|
||||
* Smaller numbers are more aggressive, larger numbers are more lenient. Try
|
||||
* bumping to 60 or 64 if you see evidence of users being blocked incorrectly.
|
||||
*
|
||||
* May also be set to a function that returns a number based on the request.
|
||||
*
|
||||
* See the documentation for more info:
|
||||
* https://express-rate-limit.mintlify.app/reference/configuration#ipv6subnet.
|
||||
*/
|
||||
ipv6Subnet: 64 | 60 | 56 | 52 | 50 | 48 | 32 | number | ValueDeterminingMiddleware<number> | false;
|
||||
/**
|
||||
* Express request handler that sends back a response when a client is
|
||||
* rate-limited.
|
||||
@@ -464,7 +387,7 @@ export type Options = {
|
||||
*/
|
||||
skip: ValueDeterminingMiddleware<boolean>;
|
||||
/**
|
||||
* Method to determine whether or not the request counts as 'successful'. Used
|
||||
* Method to determine whether or not the request counts as 'succesful'. Used
|
||||
* when either `skipSuccessfulRequests` or `skipFailedRequests` is set to true.
|
||||
*
|
||||
* By default, requests with a response status code less than 400 are considered
|
||||
@@ -503,10 +426,6 @@ export type Options = {
|
||||
* If the Store generates an error, allow the request to pass.
|
||||
*/
|
||||
passOnStoreError: boolean;
|
||||
/**
|
||||
* The logger to use to log errors. If absent, logs to the console.
|
||||
*/
|
||||
logger: Logger;
|
||||
};
|
||||
/**
|
||||
* The extended request object that includes information about the client's
|
||||
@@ -524,8 +443,18 @@ export type RateLimitInfo = {
|
||||
used: number;
|
||||
remaining: number;
|
||||
resetTime: Date | undefined;
|
||||
key: string;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* Create an instance of IP rate-limiting middleware for Express.
|
||||
*
|
||||
* @param passedOptions {Options} - Options to configure the rate limiter.
|
||||
*
|
||||
* @returns {RateLimitRequestHandler} - The middleware that rate-limits clients based on your configuration.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const rateLimit: (passedOptions?: Partial<Options>) => RateLimitRequestHandler;
|
||||
/**
|
||||
* The record that stores information about a client - namely, how many times
|
||||
* they have hit the endpoint, and when their hit count resets.
|
||||
@@ -542,7 +471,6 @@ export type Client = {
|
||||
* @public
|
||||
*/
|
||||
export declare class MemoryStore implements Store {
|
||||
private validations?;
|
||||
/**
|
||||
* The duration of time before which all hit counts are reset (in milliseconds).
|
||||
*/
|
||||
@@ -568,7 +496,6 @@ export declare class MemoryStore implements Store {
|
||||
* cannot affect other instances.
|
||||
*/
|
||||
localKeys: boolean;
|
||||
constructor(validations?: Validations | undefined);
|
||||
/**
|
||||
* Method that initializes the store.
|
||||
*
|
||||
@@ -653,17 +580,6 @@ export declare class MemoryStore implements Store {
|
||||
*/
|
||||
private clearExpired;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Create an instance of IP rate-limiting middleware for Express.
|
||||
*
|
||||
* @param passedOptions {Options} - Options to configure the rate limiter.
|
||||
*
|
||||
* @returns {RateLimitRequestHandler} - The middleware that rate-limits clients based on your configuration.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const rateLimit: (passedOptions?: Partial<Options>) => RateLimitRequestHandler;
|
||||
|
||||
export {
|
||||
rateLimit as default,
|
||||
|
||||
+421
-613
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user