@obarlik/streaming-pipeline-core
Version:
🔄 Memory-efficient circular buffer streaming pipeline with universal processing - by Codechu
53 lines (52 loc) • 1.75 kB
TypeScript
import { IASTProcessor, IASTRenderer, ASTNode, ParseResult } from '../framework/ast';
import { ILogger, IMetrics, IContainer } from '../framework/services';
import { TraceContext, FeatureFlags } from '../framework/observability';
export interface ASTProcessingOptions {
astOptional?: boolean;
preserveAST?: boolean;
enableValidation?: boolean;
transformers?: any[];
}
export declare class ASTOrchestrator {
private processors;
private renderers;
private logger;
private metrics;
private container?;
private featureFlags;
constructor(logger?: ILogger, metrics?: IMetrics, container?: IContainer, featureFlags?: Partial<FeatureFlags>);
registerProcessor(processor: IASTProcessor): void;
registerRenderer(renderer: IASTRenderer): void;
/**
* Parse content to AST only (no rendering)
*/
parseToAST(content: string, traceContext?: TraceContext, options?: ASTProcessingOptions): Promise<ParseResult>;
/**
* Render from pre-built AST
*/
renderFromAST(ast: ASTNode, targetFormat: string, traceContext?: TraceContext): Promise<string>;
/**
* Complete pipeline: parse to AST then render
*/
processWithAST(content: string, targetFormat: string, traceContext?: TraceContext, options?: ASTProcessingOptions): Promise<{
result: string;
ast?: ASTNode;
parseResult: ParseResult;
}>;
/**
* Get AST statistics
*/
getASTStats(ast: ASTNode): {
nodeCount: number;
maxDepth: number;
typeDistribution: Record<string, number>;
};
/**
* Validate AST structure
*/
validateAST(ast: ASTNode): {
valid: boolean;
errors: string[];
};
private findProcessor;
}