import { omit } from 'lodash' ; import { DiscoveredPlugin } from '../../server' ; import { PluginOpaqueId , PackageInfo , EnvironmentMode } from '../../server/types' ; import { CoreContext } from '../core_system' ; import { PluginWrapper } from './plugin' ; import { PluginsServiceSetupDeps , PluginsServiceStartDeps } from './plugins_service' ; import { CoreSetup , CoreStart } from '../' ; public export interface PluginInitializerContext < ConfigSchema extends object = object > { /**
     * A symbol used to identify this plugin in the system. Needed when registering handlers or context providers.
     */ readonly opaqueId : PluginOpaqueId ; readonly env : { mode : Readonly < EnvironmentMode > ; packageInfo : Readonly < PackageInfo > ; } ; readonly config : { get : < T extends object = ConfigSchema > ( ) => T ; } ; } param coreContext param opaqueId param pluginManifest param pluginConfig internal export function createPluginInitializerContext ( coreContext , opaqueId , pluginManifest , pluginConfig ) { return { opaqueId , env : coreContext . env , config : { get < T > ( ) { return ( pluginConfig as unknown ) as T ; } , } , } ; } param coreContext param deps param plugin internal export function createPluginSetupContext < TSetup , TStart , TPluginsSetup extends object , TPluginsStart extends object > ( coreContext , deps , plugin ) { return { application : { register : ( app ) => deps . application . register ( plugin . opaqueId , app ) , registerAppUpdater : ( statusUpdater$ ) => deps . application . registerAppUpdater ( statusUpdater$ ) , registerMountContext : ( contextName , provider ) => deps . application . registerMountContext ( plugin . opaqueId , contextName , provider ) , } , context : deps . context , fatalErrors : deps . fatalErrors , http : deps . http , notifications : deps . notifications , uiSettings : deps . uiSettings , injectedMetadata : { getInjectedVar : deps . injectedMetadata . getInjectedVar , getBranding : deps . injectedMetadata . getBranding , } , getStartServices : ( ) => plugin . startDependencies , } ; } param coreContext param deps param plugin internal export function createPluginStartContext < TSetup , TStart , TPluginsSetup extends object , TPluginsStart extends object > ( coreContext , deps , plugin ) { return { application : { applications$ : deps . application . applications$ , currentAppId$ : deps . application . currentAppId$ , capabilities : deps . application . capabilities , navigateToApp : deps . application . navigateToApp , navigateToUrl : deps . application . navigateToUrl , getUrlForApp : deps . application . getUrlForApp , registerMountContext : ( contextName , provider ) => deps . application . registerMountContext ( plugin . opaqueId , contextName , provider ) , } , docLinks : deps . docLinks , http : deps . http , chrome : omit ( deps . chrome , 'getComponent' ) , i18n : deps . i18n , notifications : deps . notifications , overlays : deps . overlays , uiSettings : deps . uiSettings , savedObjects : deps . savedObjects , injectedMetadata : { getInjectedVar : deps . injectedMetadata . getInjectedVar , getBranding : deps . injectedMetadata . getBranding , } , fatalErrors : deps . fatalErrors , } ; }