schemantic
Version:
A fully typed, extensible TypeScript type generator for FastAPI OpenAPI schemas
92 lines • 2.36 kB
TypeScript
/**
* Plugin loader for dynamic plugin loading
* Handles loading plugins from various sources (files, packages, etc.)
*/
import { SchemanticPlugin } from "../types/core";
/**
* Plugin loader class
*/
export declare class PluginLoader {
private loadedPlugins;
/**
* Load plugin from file path
*/
loadPluginFromFile(filePath: string): Promise<SchemanticPlugin>;
/**
* Load plugin from package
*/
loadPluginFromPackage(packageName: string): Promise<SchemanticPlugin>;
/**
* Load plugins from directory
*/
loadPluginsFromDirectory(directoryPath: string): Promise<SchemanticPlugin[]>;
/**
* Load plugin from object
*/
loadPluginFromObject(plugin: SchemanticPlugin): SchemanticPlugin;
/**
* Extract plugin from module
*/
private extractPluginFromModule;
/**
* Check if object is a valid plugin
*/
private isValidPlugin;
/**
* Validate plugin
*/
private validatePlugin;
/**
* Get loaded plugin
*/
getLoadedPlugin(name: string): SchemanticPlugin | undefined;
/**
* Get all loaded plugins
*/
getAllLoadedPlugins(): SchemanticPlugin[];
/**
* Clear loaded plugins
*/
clear(): void;
/**
* Get loading statistics
*/
getStatistics(): LoadingStatistics;
}
/**
* Loading statistics
*/
export interface LoadingStatistics {
loadedPlugins: number;
pluginNames: string[];
}
/**
* Plugin loading options
*/
export interface PluginLoadingOptions {
/**
* Whether to continue loading other plugins if one fails
*/
continueOnError?: boolean;
/**
* Whether to validate plugins after loading
*/
validate?: boolean;
/**
* Custom validation function
*/
customValidator?: (plugin: SchemanticPlugin) => boolean;
}
/**
* Convenience function to load plugin from file
*/
export declare function loadPluginFromFile(filePath: string): Promise<SchemanticPlugin>;
/**
* Convenience function to load plugin from package
*/
export declare function loadPluginFromPackage(packageName: string): Promise<SchemanticPlugin>;
/**
* Convenience function to load plugins from directory
*/
export declare function loadPluginsFromDirectory(directoryPath: string): Promise<SchemanticPlugin[]>;
//# sourceMappingURL=loader.d.ts.map