import { ProviderRef } from '../dependency-injection/provider-refs/provider-ref'; import { Type } from '../common/cli-types'; import { ConfiguredModule } from '../module/module-models'; import { ModuleRef } from '../module/module-ref'; import { CommandRef } from '../command/command-ref'; import { Command } from '../command/command-models'; import { OptionsLink } from '../options/options-link'; /** * A registery for application components including global dependency injection scope, used for validation and the implementation * of singleton shared modules. */ export declare class GlobalComponentsRegistry { /** * Global provider scope */ readonly providers: ProviderRef[]; /** * List of modules imported into other modules in the applciation graph */ private sharedModules; /** * List of modules utilized within command routes in the application grapgh */ private commandModules; /** * List of commands utilized in the application graph */ private commands; /** * List of options registered in the application graph */ private optionLinks; /** * Creates a new registery */ constructor(); /** * Registers a module instance of a command module and returns this instance. If the module already exists * it will through an error. Throws an error where the module already exists as a shared module * @param mod Module contructor or configured module */ registerCommandModule(mod: Type | ConfiguredModule, parent: ModuleRef): ModuleRef; /** * Registers a module instance of a command module and returns this instance. If the module already exists * it return the existing instance. When a configured module it will always create a new module instance. Throws an error where * the module already exists as a command module * @param mod Module constructor or configured module */ registerSharedModule(mod: Type | ConfiguredModule): ModuleRef; /** * Registers a provider in the global scope and throws an error if a provider already exists with the same token * @param provider provider to include in the global scope */ registerProvider(provider: ProviderRef): void; /** * Registers a provider in the global scope and replaces it if it already exists * @param provider provider to include in the global scope */ registerOrReplaceProvider(provider: ProviderRef): void; /** * Registeres a command instance and returns the instance. Throws an error where the command has already been instantiated * @param constructorRef Constructor of the command * @param parent parent module of the command */ registerCommand(constructorRef: Type, parent: ModuleRef): CommandRef; /** * Registers an options container and returns a loink which allows the dependency injection scope of the options to be determined at * a later stage * @param constructorRef Contrcutor of the options container * @param moduleRef the closest parent module of the options container reference */ registerOptions(constructorRef: Type, moduleRef: ModuleRef): OptionsLink; /** * Creates the option provider reference for option links by find the lowest command parent injector to determine the providers * dependency injection scope */ resolveOptions(): void; /** * Ensures that two or more option links for the same container share a common dependency injection scope else it will throw an error * @param links Option links that have the same constructor reference * @param constructorRef Constructor of the option links */ private validateOptionsForSingleScope; }