datapilot-cli
Version:
Enterprise-grade streaming multi-format data analysis with comprehensive statistical insights and intelligent relationship detection - supports CSV, JSON, Excel, TSV, Parquet - memory-efficient, cross-platform
90 lines • 2.56 kB
TypeScript
/**
* Parser Registry - Universal format detection and parser management
*/
import type { DataParser, FormatDetector, FormatDetectionResult, ParseOptions } from './data-parser';
export interface ParserRegistration {
format: string;
parserFactory: (options?: ParseOptions) => DataParser;
detector: FormatDetector;
priority: number;
extensions: string[];
}
export interface DetectionResult {
parser: DataParser;
format: string;
detection: FormatDetectionResult;
registration: ParserRegistration;
}
/**
* Central registry for all data parsers
* Handles format detection and parser instantiation
*/
export declare class ParserRegistry {
private registrations;
private extensionMap;
/**
* Register a parser for a specific format
*/
register(registration: ParserRegistration): void;
/**
* Auto-detect format and return appropriate parser
*/
getParser(filePath: string, options?: ParseOptions): Promise<DetectionResult>;
/**
* Get parser by specific format
*/
getParserByFormat(filePath: string, format: string, options?: ParseOptions): Promise<DetectionResult>;
/**
* Get candidate formats based on file extension
*/
private getCandidatesByExtension;
/**
* Run content detection on candidate parsers
*/
private runContentDetection;
/**
* Build comprehensive error message for unsupported formats
*/
private buildUnsupportedFormatError;
/**
* Get all supported format names
*/
getSupportedFormats(): string[];
/**
* Get all supported file extensions
*/
getSupportedExtensions(): string[];
/**
* Get format information
*/
getFormatInfo(format: string): ParserRegistration | undefined;
/**
* Check if format is supported
*/
isFormatSupported(format: string): boolean;
/**
* Get statistics about registered parsers
*/
getRegistryStats(): {
formatCount: number;
extensionCount: number;
formats: Array<{
name: string;
extensions: string[];
priority: number;
}>;
};
/**
* Validate file can be parsed by any registered parser
*/
validateFile(filePath: string): Promise<{
supported: boolean;
bestMatch?: DetectionResult;
allResults: DetectionResult[];
}>;
}
/**
* Global parser registry instance
*/
export declare const globalParserRegistry: ParserRegistry;
//# sourceMappingURL=parser-registry.d.ts.map