UNPKG

fortify2-js

Version:

MOST POWERFUL JavaScript Security Library! Military-grade cryptography + 19 enhanced object methods + quantum-resistant algorithms + perfect TypeScript support. More powerful than Lodash with built-in security.

74 lines (71 loc) 1.96 kB
'use strict'; // Bitwise flags for ultra-fast classification const CLASSIFICATION_FLAGS = { ULTRA_FAST: 1, FAST: 2, STANDARD: 4, HAS_PARAMS: 8, HAS_QUERY: 16, HAS_BODY: 32, IS_GET: 64, IS_POST: 128, IS_STATIC: 256, IS_HEALTH: 512, }; // Pre-compiled regexes for static content (compiled once) const STATIC_FILE_REGEX = /\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf)$/; const PING_REGEX = /ping/; const STATUS_REGEX = /status/; const CONFIG_REGEX = /config/; // Static lookup tables for O(1) access const HEALTH_ROUTES = new Set([ "/health", "/fortify/health", "/status", "/ping", ]); const STATIC_ROUTES = new Set([ "/", "/favicon.ico", "/static/config", "/api/config", ]); // Reusable result objects to avoid allocation const ULTRA_FAST_RESULT = { type: "ultra-fast", confidence: 0.95, executionPath: "direct-cache", cacheStrategy: "direct", skipMiddleware: ["security", "validation", "logging"], reason: "Static rule match", overhead: 0, }; const FAST_RESULT = { type: "fast", confidence: 0.85, executionPath: "optimized-cache", cacheStrategy: "optimized", skipMiddleware: ["heavy-validation"], reason: "Fast rule match", overhead: 0, }; const STANDARD_RESULT = { type: "standard", confidence: 0.5, executionPath: "full-pipeline", cacheStrategy: "standard", skipMiddleware: [], reason: "Default classification", overhead: 0, }; exports.CLASSIFICATION_FLAGS = CLASSIFICATION_FLAGS; exports.CONFIG_REGEX = CONFIG_REGEX; exports.FAST_RESULT = FAST_RESULT; exports.HEALTH_ROUTES = HEALTH_ROUTES; exports.PING_REGEX = PING_REGEX; exports.STANDARD_RESULT = STANDARD_RESULT; exports.STATIC_FILE_REGEX = STATIC_FILE_REGEX; exports.STATIC_ROUTES = STATIC_ROUTES; exports.STATUS_REGEX = STATUS_REGEX; exports.ULTRA_FAST_RESULT = ULTRA_FAST_RESULT; //# sourceMappingURL=ExecutionPredictor_EP.const.js.map