/** * Smart REST API Analyzer - 83% Token Reduction * * Intelligent REST API analysis with: * - OpenAPI/Swagger spec parsing (2.0/3.0) * - Endpoint discovery and grouping * - Health scoring and pattern detection * - Authentication and rate limit analysis * - Token-optimized output with intelligent caching */ import { CacheEngine } from '../../core/cache-engine.js'; import type { TokenCounter } from '../../core/token-counter.js'; import type { MetricsCollector } from '../../core/metrics.js'; export interface SmartRESTOptions { specUrl?: string; specContent?: string; baseUrl?: string; analyzeEndpoints?: boolean; checkHealth?: boolean; generateDocs?: boolean; detectPatterns?: boolean; methods?: Array<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'>; resourceFilter?: string; force?: boolean; ttl?: number; } export interface EndpointInfo { path: string; method: string; summary?: string; description?: string; authenticated: boolean; parameters?: Array<{ name: string; in: 'query' | 'header' | 'path' | 'body'; required: boolean; type: string; }>; requestBody?: { required: boolean; contentType: string; schema?: any; }; responses: { [statusCode: string]: { description: string; schema?: any; }; }; tags?: string[]; } export interface ResourceGroup { name: string; path: string; endpoints: number; methods: string[]; authenticated: boolean; endpoints_list?: EndpointInfo[]; } export interface HealthIssue { severity: 'high' | 'medium' | 'low'; type: string; message: string; endpoint?: string; } export interface RateLimit { endpoint?: string; limit: number; period: string; scope: 'global' | 'endpoint' | 'user'; } export interface SmartRESTResult { api: { title: string; version: string; baseUrl: string; endpoints: number; resources: number; }; endpoints?: EndpointInfo[]; resources?: ResourceGroup[]; health?: { score: number; issues: HealthIssue[]; recommendations: string[]; }; patterns?: { authMethods: string[]; commonHeaders: string[]; rateLimits: RateLimit[]; versioning?: 'url' | 'header' | 'query' | 'none'; }; cached: boolean; metrics: { originalTokens: number; compactedTokens: number; reductionPercentage: number; }; } export declare class SmartREST { private cache; private tokenCounter; private metrics; constructor(cache: CacheEngine, tokenCounter: TokenCounter, metrics: MetricsCollector); run(options: SmartRESTOptions): Promise; private analyzeAPI; private parseSpec; private extractAPIInfo; private analyzeEndpoints; private extractResponses; private isAuthRequired; private groupByResource; private extractResourceName; private checkAPIHealth; private detectVersioning; private detectPatterns; private transformOutput; private generateCacheKey; private getCachedResult; private cacheResult; } /** * Factory Function - Use Constructor Injection */ export declare function getSmartRest(cache: CacheEngine, tokenCounter: TokenCounter, metrics: MetricsCollector): SmartREST; /** * CLI Function - Create Resources and Use Factory */ export declare function runSmartREST(options: SmartRESTOptions): Promise; export declare const SMART_REST_TOOL_DEFINITION: { name: string; description: string; inputSchema: { type: string; properties: { specUrl: { type: string; description: string; }; specContent: { type: string; description: string; }; baseUrl: { type: string; description: string; }; analyzeEndpoints: { type: string; description: string; }; checkHealth: { type: string; description: string; }; generateDocs: { type: string; description: string; }; detectPatterns: { type: string; description: string; }; methods: { type: string; items: { type: string; enum: string[]; }; description: string; }; resourceFilter: { type: string; description: string; }; force: { type: string; description: string; }; ttl: { type: string; description: string; }; }; }; }; //# sourceMappingURL=smart-rest.d.ts.map