@metricinsights/concierge
Version:
Metric Insights Concierge Component
62 lines • 2.37 kB
TypeScript
import { ParserResult, ParserConfig, BaseParser } from './types';
export declare class ContentParser {
private parsers;
constructor();
/**
* Check if a parser is already registered
* @param parser The parser to check
* @returns True if the parser is registered
*/
isRegistered(parser: BaseParser): boolean;
/**
* Check if a parser can be overridden by another parser
* @param existingParser The existing parser
* @param newParser The new parser to check
* @returns True if the new parser can override the existing one
*/
private canOverrideParser;
/**
* Get parser by ID
* @param id The parser ID
* @returns The parser if found, undefined otherwise
*/
getParserById(id: string): BaseParser | undefined;
/**
* Register a new parser with optional configuration
* @param parser The parser to register
* @param config Optional configuration for the parser
* @param allowOverride Whether to allow overriding an existing parser with an extended version
* @throws ParserRegistrationError if parser is already registered and override is not allowed
*/
register(parser: BaseParser, config?: ParserConfig, allowOverride?: boolean): void;
/**
* Disable a parser instead of removing it
* @param parser The parser to disable
* @throws ParserRegistrationError if parser is not registered
*/
unregister(parser: BaseParser): void;
/**
* Enable or disable a parser
* @param parser The parser to enable/disable
* @param enabled Whether to enable or disable the parser
* @throws ParserRegistrationError if parser is not registered
*/
setParserEnabled(parser: BaseParser, enabled: boolean): void;
/**
* Get all registered parsers in priority order
*/
private getOrderedParsers;
/**
* Get all registered parsers including disabled ones
*/
getAllParsers(): BaseParser[];
/**
* Get parser configuration
* @param parser The parser to get configuration for
* @throws ParserRegistrationError if parser is not registered
*/
getParserConfig(parser: BaseParser): ParserConfig;
setParserConfig(parser: BaseParser, config: ParserConfig): void;
parse(chunk: string): ParserResult[];
}
//# sourceMappingURL=content-parser.d.ts.map