@tuanltntu/n8n-nodes-bitrix24
Version:
Comprehensive n8n community node for Bitrix24 API integration with CRM, Tasks, Chat, Telephony, and more
106 lines (105 loc) • 2.47 kB
TypeScript
/**
* Performance Optimizer for n8n-nodes-bitrix24
* This file provides utilities to monitor and improve performance
*/
export declare class PerformanceMonitor {
private static metrics;
private static cacheHits;
private static cacheMisses;
/**
* Start timing an operation
*/
static startTimer(operation: string): () => void;
/**
* Record performance metric
*/
private static recordMetric;
/**
* Record cache hit
*/
static recordCacheHit(): void;
/**
* Record cache miss
*/
static recordCacheMiss(): void;
/**
* Get performance statistics
*/
static getStats(): {
operations: Map<string, {
count: number;
totalTime: number;
avgTime: number;
}>;
cacheHitRate: number;
totalCacheHits: number;
totalCacheMisses: number;
};
/**
* Reset all metrics
*/
static reset(): void;
}
export declare class SmartCache<T> {
private cache;
private maxSize;
private ttl;
constructor(maxSize?: number, ttl?: number);
/**
* Get item from cache
*/
get(key: string): T | null;
/**
* Set item in cache
*/
set(key: string, data: T): void;
/**
* Evict least used items when cache is full
*/
private evictLeastUsed;
/**
* Clear expired items
*/
clearExpired(): void;
/**
* Get cache statistics
*/
getStats(): {
size: number;
maxSize: number;
ttl: number;
};
/**
* Clear all cache
*/
clear(): void;
}
export declare class Debouncer {
private timers;
/**
* Debounce a function call
*/
debounce<T extends (...args: any[]) => any>(key: string, func: T, delay: number): (...args: Parameters<T>) => void;
/**
* Cancel a debounced function
*/
cancel(key: string): void;
/**
* Clear all timers
*/
clear(): void;
}
export declare class PerformanceOptimizer {
/**
* Get optimization recommendations based on current metrics
*/
static getRecommendations(): string[];
/**
* Generate performance report
*/
static generateReport(): string;
}
export declare const performanceMonitor: PerformanceMonitor;
export declare const smartCache: SmartCache<unknown>;
export declare const debouncer: Debouncer;
export declare const performanceOptimizer: PerformanceOptimizer;