UNPKG

@the_cfdude/productboard-mcp

Version:

Model Context Protocol server for Productboard REST API with dynamic tool loading

141 lines (140 loc) 3.73 kB
/** * Lightweight query engine for high-performance operations * Optimized for status checks, existence validation, and progress tracking */ import { IntelligentCache } from './performance-monitor.js'; export interface LightweightEntity { id: string; status?: string; updatedAt?: string; exists?: boolean; name?: string; [key: string]: unknown; } export interface StatusSummary { total: number; byStatus: Record<string, number>; lastUpdated: string; summary: string; entities?: LightweightEntity[]; } export interface ExistenceResult { missing: string[]; existing: string[]; total: number; existingCount: number; missingCount: number; } export interface ProgressResult { completed: number; pending: number; total: number; details?: Array<{ id: string; status: string; progress: boolean; marker?: string; }>; summary: string; } export interface BatchQueryOptions { batchSize?: number; concurrency?: number; cache?: boolean; cacheTtl?: number; fields?: string[]; timeout?: number; } export interface HealthCheckResult { status: 'healthy' | 'degraded' | 'unhealthy'; responseTime: number; timestamp: number; checks: { api: boolean; cache: boolean; memory: boolean; }; details: { memoryUsage: NodeJS.MemoryUsage; cacheStats: unknown; apiLatency: number; }; } /** * Lightweight query engine optimized for performance-critical operations */ export declare class LightweightQueryEngine { private cache; private defaultBatchSize; private defaultConcurrency; private maxBatchSize; constructor(cache?: IntelligentCache); /** * Check status for multiple entities with minimal data transfer */ checkMultipleStatus(entityType: string, ids: string[], options?: BatchQueryOptions): Promise<StatusSummary>; /** * Validate existence of multiple entities */ validateExistence(entityType: string, ids: string[], options?: BatchQueryOptions): Promise<ExistenceResult>; /** * Track progress for multiple entities with custom markers */ trackBatchProgress(entityType: string, ids: string[], progressMarker: string, options?: BatchQueryOptions): Promise<ProgressResult>; /** * Perform health check on the system */ healthCheck(): Promise<HealthCheckResult>; /** * Get count of entities without fetching full data */ getEntityCount(entityType: string, filters?: Record<string, unknown>, options?: BatchQueryOptions): Promise<{ count: number; timestamp: number; }>; /** * Fetch entity batch with minimal fields */ private fetchEntityBatch; /** * Test API connectivity with minimal request */ private testApiConnectivity; /** * Fetch entity count */ private fetchEntityCount; /** * Get appropriate handler for entity type */ private getEntityHandler; /** * Parse response from tool handlers */ private parseResponse; /** * Map API response to lightweight entity */ private mapToLightweightEntity; /** * Create status summary from entities */ private createStatusSummary; /** * Check if entity has progress marker */ private checkProgressMarker; /** * Create batches from array of IDs */ private createBatches; /** * Hash array of IDs for cache keys */ private hashIds; /** * Simple string hash for cache keys */ private hashString; } export declare const lightweightQueryEngine: LightweightQueryEngine;