@imgly/plugin-ai-generation-web
Version:
AI generation plugin for the CE.SDK editor
41 lines (40 loc) • 1.65 kB
TypeScript
import { ProviderInitializationResult } from '../providers/initializeProvider';
import { OutputKind } from './provider';
/**
* Global registry for managing AI generation providers across all plugins.
* Uses singleton pattern to ensure cross-plugin provider discovery.
*/
export declare class ProviderRegistry {
/** Map storing all registered providers by their ID */
private providers;
private constructor();
/**
* Gets the singleton instance of the ProviderRegistry.
* Uses global object storage to ensure singleton across different bundle contexts.
* @returns The ProviderRegistry instance
*/
static get(): ProviderRegistry;
/**
* Registers a provider in the registry.
* @param providerInitializationResult The provider to register
* @returns A disposer function that unregisters the provider when called
*/
register(providerInitializationResult: ProviderInitializationResult<any, any, any>): () => void;
/**
* Gets all registered providers.
* @returns Array of all provider instances
*/
getAll(): ProviderInitializationResult<any, any, any>[];
/**
* Gets a provider by its ID.
* @param id The provider ID to look up
* @returns The provider instance or undefined if not found
*/
getById(id: string): ProviderInitializationResult<any, any, any> | undefined;
/**
* Gets all providers of a specific kind.
* @param kind The output kind to filter by
* @returns Array of providers matching the specified kind
*/
getByKind<K extends OutputKind>(kind: K): ProviderInitializationResult<K, any, any>[];
}