/**
 * @module @arcis/node/middleware/rate-limit-token
 * Token bucket rate limiting middleware.
 *
 * Allows burst traffic while enforcing an average rate.
 * Tokens refill at a steady rate. Each request costs 1 token.
 *
 * Algorithm:
 *   tokens = min(capacity, tokens + elapsed * refillRate)
 *   if tokens >= cost: allow, subtract cost
 *   else: deny
 *
 * @example
 * app.use(createTokenBucketLimiter({ capacity: 50, refillRate: 10 }));
 */
import type { Request, RequestHandler } from 'express';
export interface TokenBucketOptions {
    /** Maximum tokens (burst size). Default: 100 */
    capacity?: number;
    /** Tokens added per second. Default: 10 */
    refillRate?: number;
    /** Tokens consumed per request. Default: 1 */
    cost?: number;
    /** Error message when limit exceeded */
    message?: string;
    /** HTTP status code for rate limited responses. Default: 429 */
    statusCode?: number;
    /** Function to generate rate limit key from request */
    keyGenerator?: (req: Request) => string;
    /** Function to skip rate limiting for certain requests */
    skip?: (req: Request) => boolean;
}
export interface TokenBucketMiddleware extends RequestHandler {
    close: () => void;
}
/**
 * Create token bucket rate limiter middleware.
 *
 * @example
 * // Allow bursts of 50, sustained rate of 10/sec
 * app.use(createTokenBucketLimiter({ capacity: 50, refillRate: 10 }));
 *
 * @example
 * // Strict API: 5 requests burst, 1/sec sustained
 * app.use('/api/expensive', createTokenBucketLimiter({
 *   capacity: 5,
 *   refillRate: 1,
 * }));
 */
export declare function createTokenBucketLimiter(options?: TokenBucketOptions): TokenBucketMiddleware;
//# sourceMappingURL=rate-limit-token.d.ts.map