UNPKG

@aikidosec/firewall

Version:

Zen by Aikido is an embedded Application Firewall that autonomously protects Node.js apps against common and critical attacks, provides rate limiting, detects malicious traffic (including bots), and more.

44 lines (43 loc) 1.34 kB
import { type APISpec } from "./api-discovery/getApiInfo"; import { Endpoint } from "./Config"; import type { Context } from "./Context"; export type Route = { method: string; path: string; hits: number; rateLimitedCount: number; graphql?: { type: "query" | "mutation"; name: string; }; apispec: APISpec; }; export declare class Routes { private readonly maxEntries; private readonly maxGraphQLSchemas; private graphQLSchemas; private routes; constructor(maxEntries?: number, maxGraphQLSchemas?: number); addRoute(context: Context): void; private evictLeastUsedRouteIfNecessary; private getKey; hasGraphQLSchema(method: string, path: string): boolean; setGraphQLSchema(method: string, path: string, schema: string): void; private getGraphQLKey; addGraphQLField(method: string, path: string, type: "query" | "mutation", name: string): void; private evictLeastUsedRoute; countRouteRateLimited(route: Endpoint): void; clear(): void; asArray(): { method: string; path: string; hits: number; rateLimitedCount: number; graphql: { type: "query" | "mutation"; name: string; } | undefined; apispec: APISpec; graphQLSchema: string | undefined; }[]; }