import { PluginInitializerContext , CoreSetup , CoreStart , Plugin , Logger } from 'kibana/server' ; import { CustomIntegrationsPluginSetup , CustomIntegrationsPluginStart } from './types' ; import { CustomIntegration } from '../common' ; import { CustomIntegrationRegistry } from './custom_integration_registry' ; import { defineRoutes } from './routes/define_routes' ; import { registerLanguageClients } from './language_clients' ; export class CustomIntegrationsPlugin implements Plugin < CustomIntegrationsPluginSetup , CustomIntegrationsPluginStart > { private readonly logger : Logger ; private readonly customIngegrationRegistry : CustomIntegrationRegistry ; private readonly branch : string ; constructor ( initializerContext ) { this . logger = initializerContext . logger . get ( ) ; this . customIngegrationRegistry = new CustomIntegrationRegistry ( this . logger , initializerContext . env . mode . dev ) ; this . branch = initializerContext . env . packageInfo . branch ; } public setup ( core ) { this . logger . debug ( 'customIntegrations: Setup' ) ; const router = core . http . createRouter ( ) ; defineRoutes ( router , this . customIngegrationRegistry ) ; registerLanguageClients ( core , this . customIngegrationRegistry , this . branch ) ; return { registerCustomIntegration : ( integration ) => { this . customIngegrationRegistry . registerCustomIntegration ( { type : 'ui_link' , ... integration , } ) ; } , getAppendCustomIntegrations : ( ) => { return this . customIngegrationRegistry . getAppendCustomIntegrations ( ) ; } , } as CustomIntegrationsPluginSetup ; } public start ( core ) { this . logger . debug ( 'customIntegrations: Started' ) ; return { } ; } public stop ( ) { } }