UNPKG

@kitstack/nest-powertools

Version:

A comprehensive collection of NestJS powertools, decorators, and utilities to supercharge your backend development

42 lines (41 loc) 1.46 kB
import type { PaginationConfig, CacheConfig, ValidationConfig, LoggingConfig, RateLimitConfig, AuditConfig, ResilientHttpConfig, AuthConfig } from '../types/generics'; import { Environment } from '../types/enums'; export interface AuditStorageConfig { type: 'mongodb' | 'file'; mongoUrl?: string; filePath?: string; } export interface PowertoolsConfig { global?: { enabled?: boolean; environment?: Environment; debug?: boolean; requestIdHeader?: string; enableMetrics?: boolean; }; pagination?: PaginationConfig; cache?: CacheConfig; validation?: ValidationConfig; logging?: LoggingConfig; rateLimit?: RateLimitConfig; audit?: AuditConfig & { storage?: AuditStorageConfig; }; resilientHttp?: ResilientHttpConfig; auth?: AuthConfig; custom?: Record<string, any>; } export declare const DEFAULT_POWERTOOLS_CONFIG: PowertoolsConfig; export declare class PowertoolsConfigService { private static instance; private config; private constructor(); static getInstance(config?: PowertoolsConfig): PowertoolsConfigService; getConfig(): PowertoolsConfig; updateConfig(updates: Partial<PowertoolsConfig>): void; getFeatureConfig<T extends keyof PowertoolsConfig>(feature: T): PowertoolsConfig[T]; isFeatureEnabled(feature: keyof PowertoolsConfig): boolean; private mergeConfig; reset(): void; validateConfig(): boolean; }