Template base para proyectos SaaS multi-tenant. Estructura inicial: - apps/backend (NestJS API) - apps/frontend (React/Vite) - apps/database (PostgreSQL DDL) - docs/ (Documentación) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
29 lines
1.7 KiB
TypeScript
29 lines
1.7 KiB
TypeScript
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
import { Reflector } from '@nestjs/core';
|
|
import { ThrottlerModuleOptions, ThrottlerOptions } from './throttler-module-options.interface';
|
|
import { ThrottlerStorage } from './throttler-storage.interface';
|
|
import { ThrottlerLimitDetail, ThrottlerRequest } from './throttler.guard.interface';
|
|
export declare class ThrottlerGuard implements CanActivate {
|
|
protected readonly options: ThrottlerModuleOptions;
|
|
protected readonly storageService: ThrottlerStorage;
|
|
protected readonly reflector: Reflector;
|
|
protected headerPrefix: string;
|
|
protected errorMessage: string;
|
|
protected throttlers: Array<ThrottlerOptions>;
|
|
protected commonOptions: Pick<ThrottlerOptions, 'skipIf' | 'ignoreUserAgents' | 'getTracker' | 'generateKey' | 'setHeaders'>;
|
|
constructor(options: ThrottlerModuleOptions, storageService: ThrottlerStorage, reflector: Reflector);
|
|
onModuleInit(): Promise<void>;
|
|
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
protected shouldSkip(_context: ExecutionContext): Promise<boolean>;
|
|
protected handleRequest(requestProps: ThrottlerRequest): Promise<boolean>;
|
|
protected getTracker(req: Record<string, any>): Promise<string>;
|
|
protected getRequestResponse(context: ExecutionContext): {
|
|
req: Record<string, any>;
|
|
res: Record<string, any>;
|
|
};
|
|
protected generateKey(context: ExecutionContext, suffix: string, name: string): string;
|
|
protected throwThrottlingException(context: ExecutionContext, throttlerLimitDetail: ThrottlerLimitDetail): Promise<void>;
|
|
protected getErrorMessage(context: ExecutionContext, throttlerLimitDetail: ThrottlerLimitDetail): Promise<string>;
|
|
private resolveValue;
|
|
}
|