its-compiler-js
Version:
JavaScript/TypeScript implementation of the Instruction Template Specification (ITS) compiler
60 lines (59 loc) • 1.32 kB
TypeScript
/**
* Schema loading and caching for ITS Compiler
*/
import { SecurityConfig } from './types.js';
export declare class SchemaLoader {
private cache;
private cacheTTL;
private securityValidator;
private timeout;
constructor(cacheTTL: number | undefined, // 1 hour
securityConfig: SecurityConfig, timeout?: number);
/**
* Load a schema from URL or cache
*/
loadSchema(schemaUrl: string, baseUrl?: string): Promise<any>;
/**
* Resolve URL (handle relative URLs)
*/
private resolveUrl;
/**
* Check if URL is absolute
*/
private isAbsoluteUrl;
/**
* Load schema from URL
*/
private loadFromUrl;
/**
* Validate schema structure
*/
private validateSchemaStructure;
/**
* Validate individual instruction type definition
*/
private validateInstructionType;
/**
* Get schema from cache
*/
private getFromCache;
/**
* Save schema to cache
*/
private saveToCache;
/**
* Clear cache
*/
clearCache(): void;
/**
* Get cache statistics
*/
getCacheStats(): {
size: number;
urls: string[];
};
/**
* Load schema from file (for testing)
*/
loadSchemaFromFile(filePath: string): Promise<any>;
}