/** * Limitem rate limiting instance */ declare class LimitemInstance { /** * Check rate limit for the given identifier * @param identifier - Unique identifier (e.g., user ID, IP address) * @returns Promise that resolves to rate limit check result */ limit(identifier: string): Promise<{ allowed: boolean; namespace: string; limit: number; remaining: number; reset_time: number; count: number; algorithm: string; failover?: boolean; _request?: { success: boolean; processing_time_ms: number; }; }>; } export const limit: { /** * Create a new Limitem rate limiting instance * * @example * ```typescript * // Basic usage * const rateLimiter = new limit.em({ * namespace: 'my-app', * limit: 100, * duration: '1h' * }); * * // With all options * const advancedLimiter = new limit.em({ * token: 'your-api-token', // Optional: API token (or use LIMITEM_TOKEN env var) * namespace: 'my-app', // Required: Your app identifier * limit: 100, // Required: Max requests allowed * duration: 3600, // Required: Time window (seconds or "30s", "5m", "1h") * product: 'premium', // Optional: Product tier/type * algorithm: 'token-bucket', // Optional: "sliding-window" | "fixed-window" | "token-bucket" | "leaky-bucket" * timeout: 1000 // Optional: Request timeout in ms (default: 800) * }); * * const result = await rateLimiter.limit('user-123'); * ``` */ em: new (config: { token?: string; namespace: string; limit: number; duration: string | number; product?: string; algorithm?: "sliding-window" | "fixed-window" | "token-bucket" | "leaky-bucket"; timeout?: number; }) => LimitemInstance; }; export default limit;