import type { Profile } from '@remixproject/plugin-utils'; import { Plugin } from "./abstract"; export declare type BasePluginManager = { getProfile(name: string): Promise; updateProfile(profile: Partial): Promise; activatePlugin(name: string): Promise; deactivatePlugin(name: string): Promise; isActive(name: string): Promise; canCall(from: Profile, to: Profile, method: string): Promise; toggleActive(name: string): any; addProfile(profiles: Partial | Partial[]): any; canActivatePlugin(from: Profile, to: Profile, method?: string): Promise; canDeactivatePlugin(from: Profile, to: Profile): Promise; } & Plugin; interface ManagerProfile extends Profile { name: 'manager'; } export declare class PluginManager extends Plugin implements BasePluginManager { protected profiles: Record; protected actives: string[]; protected onPluginActivated?(profile: Profile): any; protected onPluginDeactivated?(profile: Profile): any; protected onProfileAdded?(profile: Profile): any; constructor(profile?: ManagerProfile); /** Return the name of the caller. If no request provided, this mean that the method has been called from the IDE so we use "manager" */ get requestFrom(): string; /** Run engine activation. Implemented by Engine */ private engineActivatePlugin; /** Run engine deactivation. Implemented by Engine */ private engineDeactivatePlugin; /** * Get the profile if it's registered. * @param name The name of the plugin * @note This method can be overrided */ getProfile(name: string): Promise>; /** Get all the profiles of the manager */ getProfiles(): Profile[]; /** Get all active profiles of the manager */ getActiveProfiles(): Profile[]; /** * Update the profile of the plugin * @param profile The Updated version of the plugin * @note Only the caller plugin should be able to update its profile */ updateProfile(to: Partial): Promise; /** * Add a profile to the list of profile * @param profile The profile to add * @note This method should only be used by the engine */ addProfile(profiles: Profile | Profile[]): void | void[]; /** * Verify if a plugin is currently active * @param name Name of the plugin */ isActive(name: string): Promise; /** * Check if caller can activate plugin and activate it if authorized * @param name The name of the plugin to activate */ activatePlugin(names: string | string[]): Promise; /** * Check if caller can deactivate plugin and deactivate it if authorized * @param name The name of the plugin to activate */ deactivatePlugin(names: string | string[]): Promise; /** * Activate or deactivate by bypassing permission * @param name The name of the plugin to activate * @note This method should ONLY be used by the IDE */ toggleActive(names: string | string[]): Promise; /** * Check if a plugin can activate another * @param from Profile of the caller plugin * @param to Profile of the target plugin * @note This method should be overrided */ canActivatePlugin(from: Profile, to: Profile): Promise; /** * Check if a plugin can deactivate another * @param from Profile of the caller plugin * @param to Profile of the target plugin * @note This method should be overrided */ canDeactivatePlugin(from: Profile, to: Profile): Promise; /** * Check if a plugin can call a method of another * @param from Profile of the caller plugin * @param to Profile of the target plugin * @param method Method targetted by the caller * @param message Method provided by the targetted method plugin */ canCall(from: Profile, to: Profile, method: string, message?: string): Promise; /** * Check if a plugin can update profile of another one * @param from Profile of the caller plugin * @param to Updates on the profile of the target plugin * @note This method can be overrided */ canUpdateProfile(from: Profile, to: Partial): Promise; } export {};