UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

118 lines 3.49 kB
/** * Data Flow Tracer - Follow a single request through all system layers * * Purpose: Systematic debugging by tracing data transformations at each boundary * Usage: Attach to any request to see exactly how data changes through the pipeline * * @author Optimizely MCP Server - Chief Software Scientist Debugging Framework * @version 1.0.0 */ export interface TracePoint { layer: string; component: string; operation: string; timestamp: number; input: any; output: any; transformations?: Array<{ field: string; before: any; after: any; reason: string; }>; errors?: string[]; metadata?: Record<string, any>; } export interface TraceSession { traceId: string; requestType: string; startTime: number; endTime?: number; points: TracePoint[]; summary: { totalTransformations: number; layersTraversed: string[]; errorCount: number; durationMs?: number; }; } /** * Main DataFlowTracer class */ export declare class DataFlowTracer { private static logger; /** * Start tracing a request */ static startTrace(requestType: string, initialData?: any): string; /** * Add a trace point at any system boundary */ static trace(traceId: string, layer: string, component: string, operation: string, input: any, output: any, options?: { transformations?: Array<{ field: string; before: any; after: any; reason: string; }>; errors?: string[]; metadata?: Record<string, any>; }): void; /** * Compare input vs output at a boundary */ static compareAtBoundary(traceId: string, layer: string, component: string, input: any, output: any): Array<{ field: string; before: any; after: any; reason: string; }>; /** * End tracing and get full session */ static endTrace(traceId: string, finalData?: any): TraceSession | null; /** * Get trace session for analysis */ static getTrace(traceId: string): TraceSession | null; /** * Get recent traces for debugging */ static getRecentTraces(limit?: number): TraceSession[]; /** * Generate a human-readable trace report */ static generateTraceReport(traceId: string): string; /** * Helper: Deep compare two objects to find changes */ private static deepCompare; /** * Helper: Sanitize data for logging (remove sensitive info, limit size) */ private static sanitizeForLogging; /** * Helper: Generate transformation summary */ private static generateTransformationSummary; /** * Utility: Create a traced wrapper for any function */ static traceFunction<T extends (...args: any[]) => any>(fn: T, layer: string, component: string, operation: string): T; } /** * Decorator for automatic tracing */ export declare function traced(layer: string, component: string, operation?: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor; /** * Context object that carries trace ID through the system */ export interface TraceContext { traceId: string; [key: string]: any; } /** * Helper to extract or create trace context */ export declare function getOrCreateTraceContext(args: any[], requestType?: string): TraceContext; //# sourceMappingURL=DataFlowTracer.d.ts.map