UNPKG

autosnippet

Version:

Extract code patterns into a knowledge base for AI coding assistants

29 lines (28 loc) 778 B
/** * RateLimiter — 简易内存限流器 * 防止短时间内批量提交导致资源耗尽 */ /** * 检查是否允许提交 * @param projectRoot 项目根路径作为命名空间 * @param clientId 客户端标识 * @param [opts] { windowMs: 60000, maxRequests: 10 } * @returns } */ export declare function checkRecipeSave(projectRoot: string, clientId: string, opts?: { windowMs?: number; maxRequests?: number; }): { allowed: boolean; retryAfter: number; } | { allowed: boolean; retryAfter?: undefined; }; /** 重置限流器(测试用) */ export declare function resetRateLimiter(): void; declare const _default: { checkRecipeSave: typeof checkRecipeSave; resetRateLimiter: typeof resetRateLimiter; }; export default _default;