@re-shell/cli
Version:
Full-stack development platform uniting microservices and microfrontends. Build complete applications with .NET (ASP.NET Core Web API, Minimal API), Java (Spring Boot, Quarkus, Micronaut, Vert.x), Rust (Actix-Web, Warp, Rocket, Axum), Python (FastAPI, Dja
101 lines (100 loc) • 2.92 kB
TypeScript
import { EventEmitter } from 'events';
export interface DebouncedEvent {
id: string;
type: 'add' | 'change' | 'unlink' | 'addDir' | 'unlinkDir';
path: string;
timestamp: number;
stats?: any;
}
export interface BatchedEvents {
id: string;
events: DebouncedEvent[];
startTime: number;
endTime: number;
totalEvents: number;
deduplicated: boolean;
}
export interface DebounceOptions {
delay: number;
maxDelay: number;
maxBatchSize: number;
enableDeduplication: boolean;
enableBatching: boolean;
groupByType: boolean;
includeStats: boolean;
}
export interface EventFilter {
patterns: RegExp[];
types: string[];
minFileSize?: number;
maxFileSize?: number;
extensions?: string[];
excludePatterns?: RegExp[];
}
export declare class EventDebouncer extends EventEmitter {
private pendingEvents;
private timers;
private batchTimers;
private eventBatches;
private options;
private filters;
private eventCounter;
constructor(options?: Partial<DebounceOptions>);
addEvent(type: string, path: string, stats?: any): void;
private processEvent;
private forceProcessEvent;
private addToBatch;
private processBatch;
private deduplicateEvents;
private getEventKey;
private getBatchKey;
private getDeduplicationKey;
private generateEventId;
private generateBatchId;
private passesFilters;
private eventMatchesFilter;
private getFileExtension;
addFilter(filter: EventFilter): void;
removeFilter(index: number): void;
clearFilters(): void;
getFilterCount(): number;
getPendingEventsCount(): number;
getActiveTimersCount(): number;
getBatchCount(): number;
flush(): void;
clear(): void;
getStatistics(): {
pendingEvents: number;
activeTimers: number;
activeBatches: number;
totalFilters: number;
options: DebounceOptions;
};
updateOptions(newOptions: Partial<DebounceOptions>): void;
}
export declare class EventBatcher extends EventEmitter {
private batches;
private batchTimers;
private options;
constructor(options?: Partial<{
batchInterval: number;
maxBatchSize: number;
groupByDirectory: boolean;
}>);
addEvent(event: DebouncedEvent): void;
private getBatchKey;
private startBatchTimer;
private emitBatch;
flush(): void;
clear(): void;
getBatchCount(): number;
getPendingEventCount(): number;
}
export declare function createEventDebouncer(options?: Partial<DebounceOptions>): EventDebouncer;
export declare function createEventBatcher(options?: Partial<{
batchInterval: number;
maxBatchSize: number;
groupByDirectory: boolean;
}>): EventBatcher;
export declare function createWebpackDebouncer(): EventDebouncer;
export declare function createTestDebouncer(): EventDebouncer;