UNPKG

@bonginkan/maria

Version:

MARIA OS v5.9.5 – Self-Evolving Organizational Intelligence OS | Speed Improvement Phase 3: LLM Optimization + Command Refactoring | Performance Measurement + Run Evidence System | Zero ESLint/TypeScript Errors | 人とAIが役割を持ち、学び、進化し続けるための仕事のOS | GraphRAG ×

109 lines (108 loc) 2.99 kB
/** * Format Handler Registry * * Central registry for all format handlers with factory pattern */ import { EventEmitter } from "node:events"; import type { IFormatHandler, SupportedFormat } from "../types/porter-types"; export interface FormatHandlerFactory { create(): IFormatHandler; supports: ("read" | "write" | "stream")[]; description: string; defaultOptions?: unknown; } export declare class FormatHandlerRegistry extends EventEmitter { private readonly handlers; private readonly instances; constructor(); /** * Register built-in format handlers */ private registerBuiltInHandlers; /** * Register a format handler factory */ register(format: SupportedFormat, factory: FormatHandlerFactory): void; /** * Get format handler instance */ get(format: SupportedFormat, options?: unknown): IFormatHandler; /** * Check if format is supported */ isSupported(format: SupportedFormat): boolean; /** * Check if format supports specific operation */ supportsOperation(format: SupportedFormat, operation: "read" | "write" | "stream"): boolean; /** * List all supported formats */ listFormats(): Array<{ format: SupportedFormat; supports: ("read" | "write" | "stream")[]; description: string; defaultOptions?: unknown; }>; /** * List formats that support specific operation */ listFormatsByOperation(operation: "read" | "write" | "stream"): SupportedFormat[]; /** * Get format information */ getFormatInfo(format: SupportedFormat): { format: SupportedFormat; supports: ("read" | "write" | "stream")[]; description: string; defaultOptions?: unknown; } | null; /** * Validate format with data */ validate(format: SupportedFormat, data: unknown, schema?: unknown): Promise<unknown>; /** * Clear handler instance cache */ clearCache(): void; /** * Clear cache for specific format */ clearFormatCache(format: SupportedFormat): void; /** * Get registry statistics */ getStats(): { registeredFormats: number; cachedInstances: number; formatsByOperation: { read: number; write: number; stream: number; }; }; /** * Unregister format handler */ unregister(format: SupportedFormat): boolean; /** * Get registry health status */ getHealthStatus(): { status: "healthy" | "degraded" | "unhealthy"; details: unknown; }; /** * Test format handler creation */ testFormat(format: SupportedFormat, testData?: unknown): Promise<{ success: boolean; error?: string; operations: { create: boolean; validate: boolean; serialize?: boolean; deserialize?: boolean; }; }>; }