From 833ef864e5eb4b65089f033ce54c10bb3e0c7afc Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 8 Jan 2025 04:32:59 +1100 Subject: [PATCH] [8.x] More strict plugin type definitions (#205232) (#205778) # Backport This will backport the following commits from `main` to `8.x`: - [More strict plugin type definitions (#205232)](https://github.com/elastic/kibana/pull/205232) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Dario Gieselaar --- .../server/plugin.ts | 5 +++- .../lifecycle/browser/src/core_setup.ts | 2 +- .../lifecycle/server/src/core_setup.ts | 2 +- .../packages/plugins/browser/src/plugin.ts | 4 +-- .../plugins/browser/src/plugin_initializer.ts | 8 ++--- .../plugins/server-internal/src/plugin.ts | 4 +-- src/core/packages/plugins/server/src/types.ts | 14 ++++----- .../plugins/private/maps_ems/server/plugin.ts | 4 ++- .../plugins/shared/dashboard/server/plugin.ts | 4 +-- .../data/server/search/search_service.ts | 3 +- src/plugins/unified_search/server/plugin.ts | 10 ++++++- .../vis_types/timeseries/server/plugin.ts | 10 ++++++- .../server/plugin.ts | 4 ++- .../screenshotting_example/server/plugin.ts | 2 +- .../plugins/private/canvas/server/plugin.ts | 2 +- .../private/data_visualizer/server/plugin.ts | 2 +- .../plugins/shared/actions/server/plugin.ts | 7 +++-- .../integration_assistant/server/plugin.ts | 21 ++++++++----- .../integration_assistant/server/types.ts | 6 ++++ .../plugins/shared/maps/server/plugin.ts | 2 +- .../dataset_quality/server/plugin.ts | 11 ++++++- .../shared/stack_connectors/server/plugin.ts | 4 ++- .../delete_inactive_nodes_task.ts | 5 ++-- .../shared/task_manager/server/plugin.ts | 30 ++++++++++++++----- .../mark_removed_tasks_as_unrecognized.ts | 5 ++-- .../triggers_actions_ui/server/plugin.ts | 5 +++- x-pack/plugins/lens/server/plugin.tsx | 4 ++- .../metrics_data_access/server/plugin.ts | 4 ++- .../plugins/observability/server/plugin.ts | 6 ++-- .../enterprise_search/server/plugin.ts | 2 +- 30 files changed, 133 insertions(+), 59 deletions(-) diff --git a/examples/eso_model_version_example/server/plugin.ts b/examples/eso_model_version_example/server/plugin.ts index 76a0a22d6dcef..a5109acafaf9e 100644 --- a/examples/eso_model_version_example/server/plugin.ts +++ b/examples/eso_model_version_example/server/plugin.ts @@ -61,7 +61,10 @@ export interface EsoModelVersionExamplePluginsStart { encryptedSavedObjects: EncryptedSavedObjectsPluginStart; } -export class EsoModelVersionExample implements Plugin { +export class EsoModelVersionExample + implements + Plugin +{ public setup( core: CoreSetup, plugins: EsoModelVersionExamplePluginSetup diff --git a/src/core/packages/lifecycle/browser/src/core_setup.ts b/src/core/packages/lifecycle/browser/src/core_setup.ts index bef46aa4b84c1..84dbbf5e6efdb 100644 --- a/src/core/packages/lifecycle/browser/src/core_setup.ts +++ b/src/core/packages/lifecycle/browser/src/core_setup.ts @@ -36,7 +36,7 @@ import type { CoreStart } from './core_start'; * navigation in the generated docs until there's a fix for * https://github.com/Microsoft/web-build-tools/issues/1237 */ -export interface CoreSetup { +export interface CoreSetup = {}, TStart = unknown> { /** {@link AnalyticsServiceSetup} */ analytics: AnalyticsServiceSetup; /** {@link ApplicationSetup} */ diff --git a/src/core/packages/lifecycle/server/src/core_setup.ts b/src/core/packages/lifecycle/server/src/core_setup.ts index 59616a5d65ecd..f3419187b183a 100644 --- a/src/core/packages/lifecycle/server/src/core_setup.ts +++ b/src/core/packages/lifecycle/server/src/core_setup.ts @@ -40,7 +40,7 @@ import type { CoreStart } from './core_start'; * consuming {@link Plugin}'s `TStart` type. Used by `getStartServices`. * @public */ -export interface CoreSetup { +export interface CoreSetup = {}, TStart = unknown> { /** {@link AnalyticsServiceSetup} */ analytics: AnalyticsServiceSetup; /** {@link CapabilitiesSetup} */ diff --git a/src/core/packages/plugins/browser/src/plugin.ts b/src/core/packages/plugins/browser/src/plugin.ts index c3e5d9c42cf0b..974776533f285 100644 --- a/src/core/packages/plugins/browser/src/plugin.ts +++ b/src/core/packages/plugins/browser/src/plugin.ts @@ -18,8 +18,8 @@ import type { CoreStart, CoreSetup } from '@kbn/core-lifecycle-browser'; export interface Plugin< TSetup = void, TStart = void, - TPluginsSetup extends object = object, - TPluginsStart extends object = object + TPluginsSetup extends Record = never, + TPluginsStart extends Record = never > { setup(core: CoreSetup, plugins: TPluginsSetup): TSetup; diff --git a/src/core/packages/plugins/browser/src/plugin_initializer.ts b/src/core/packages/plugins/browser/src/plugin_initializer.ts index 97bb3748dbe42..e8ffa887087fe 100644 --- a/src/core/packages/plugins/browser/src/plugin_initializer.ts +++ b/src/core/packages/plugins/browser/src/plugin_initializer.ts @@ -19,10 +19,10 @@ import type { Plugin } from './plugin'; * @public */ export type PluginInitializer< - TSetup, - TStart, - TPluginsSetup extends object = object, - TPluginsStart extends object = object + TSetup = void, + TStart = void, + TPluginsSetup extends Record = never, + TPluginsStart extends Record = never > = (core: PluginInitializerContext) => Plugin; /** diff --git a/src/core/packages/plugins/server-internal/src/plugin.ts b/src/core/packages/plugins/server-internal/src/plugin.ts index cd330a647da66..7d37c2b46943f 100644 --- a/src/core/packages/plugins/server-internal/src/plugin.ts +++ b/src/core/packages/plugins/server-internal/src/plugin.ts @@ -98,7 +98,7 @@ export class PluginWrapper< * is the contract returned by the dependency's `setup` function. */ public setup( - setupContext: CoreSetup | CorePreboot, + setupContext: CoreSetup | CorePreboot, plugins: TPluginsSetup ): TSetup | Promise { if (!this.instance) { @@ -109,7 +109,7 @@ export class PluginWrapper< return this.instance.setup(setupContext as CorePreboot, plugins); } - return this.instance.setup(setupContext as CoreSetup, plugins); + return this.instance.setup(setupContext as CoreSetup, plugins); } /** diff --git a/src/core/packages/plugins/server/src/types.ts b/src/core/packages/plugins/server/src/types.ts index 7be2647ba48d2..39c8ef4cb8392 100644 --- a/src/core/packages/plugins/server/src/types.ts +++ b/src/core/packages/plugins/server/src/types.ts @@ -291,10 +291,10 @@ export interface PrebootPlugin = {}, + TPluginsStart extends Record = {} > { - setup(core: CoreSetup, plugins: TPluginsSetup): TSetup; + setup(core: CoreSetup, plugins: TPluginsSetup): TSetup; start(core: CoreStart, plugins: TPluginsStart): TStart; @@ -451,10 +451,10 @@ export interface PluginInitializerContext { * @public */ export type PluginInitializer< - TSetup, - TStart, - TPluginsSetup extends object = object, - TPluginsStart extends object = object + TSetup = void, + TStart = void, + TPluginsSetup extends Record = never, + TPluginsStart extends Record = never > = ( core: PluginInitializerContext ) => Promise< diff --git a/src/platform/plugins/private/maps_ems/server/plugin.ts b/src/platform/plugins/private/maps_ems/server/plugin.ts index b30ee5fa9ec72..98bbb2c3e913d 100644 --- a/src/platform/plugins/private/maps_ems/server/plugin.ts +++ b/src/platform/plugins/private/maps_ems/server/plugin.ts @@ -54,5 +54,7 @@ export class MapsEmsPlugin implements Plugin { }; } - public start() {} + public start() { + return {}; + } } diff --git a/src/platform/plugins/shared/dashboard/server/plugin.ts b/src/platform/plugins/shared/dashboard/server/plugin.ts index 7762e7da0da96..6ca274635f6d4 100644 --- a/src/platform/plugins/shared/dashboard/server/plugin.ts +++ b/src/platform/plugins/shared/dashboard/server/plugin.ts @@ -45,7 +45,7 @@ interface StartDeps { } export class DashboardPlugin - implements Plugin + implements Plugin { private readonly logger: Logger; @@ -53,7 +53,7 @@ export class DashboardPlugin this.logger = initializerContext.logger.get(); } - public setup(core: CoreSetup, plugins: SetupDeps) { + public setup(core: CoreSetup, plugins: SetupDeps) { this.logger.debug('dashboard: Setup'); core.savedObjects.registerType( diff --git a/src/plugins/data/server/search/search_service.ts b/src/plugins/data/server/search/search_service.ts index 3a2158a17773a..d3ab7ae8a6359 100644 --- a/src/plugins/data/server/search/search_service.ts +++ b/src/plugins/data/server/search/search_service.ts @@ -15,7 +15,6 @@ import { CoreStart, KibanaRequest, Logger, - Plugin, PluginInitializerContext, SharedGlobalConfig, StartServicesAccessor, @@ -124,7 +123,7 @@ export interface SearchRouteDependencies { globalConfig$: Observable; } -export class SearchService implements Plugin { +export class SearchService { private readonly aggsService = new AggsService(); private readonly searchSourceService = new SearchSourceService(); private searchStrategies: StrategyMap = {}; diff --git a/src/plugins/unified_search/server/plugin.ts b/src/plugins/unified_search/server/plugin.ts index c9182374b0f35..0361827a04487 100644 --- a/src/plugins/unified_search/server/plugin.ts +++ b/src/plugins/unified_search/server/plugin.ts @@ -25,7 +25,15 @@ export interface UnifiedSearchServerPluginSetupDependencies {} // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface UnifiedSearchServerPluginStartDependencies {} -export class UnifiedSearchServerPlugin implements Plugin { +export class UnifiedSearchServerPlugin + implements + Plugin< + UnifiedSearchServerPluginSetup, + UnifiedSearchServerPluginStart, + UnifiedSearchServerPluginSetupDependencies, + UnifiedSearchServerPluginStartDependencies + > +{ private readonly autocompleteService: AutocompleteService; constructor(initializerContext: PluginInitializerContext) { diff --git a/src/plugins/vis_types/timeseries/server/plugin.ts b/src/plugins/vis_types/timeseries/server/plugin.ts index ff2e5ca1a7c69..1b1b330c1c18a 100644 --- a/src/plugins/vis_types/timeseries/server/plugin.ts +++ b/src/plugins/vis_types/timeseries/server/plugin.ts @@ -82,7 +82,15 @@ export interface Framework { getEsShardTimeout: () => Promise; } -export class VisTypeTimeseriesPlugin implements Plugin { +export class VisTypeTimeseriesPlugin + implements + Plugin< + VisTypeTimeseriesSetup, + void, + VisTypeTimeseriesPluginSetupDependencies, + VisTypeTimeseriesPluginStartDependencies + > +{ constructor(private readonly initializerContext: PluginInitializerContext) { this.initializerContext = initializerContext; } diff --git a/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts b/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts index 02be370d08e25..9dcb8c1873efb 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts +++ b/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts @@ -26,7 +26,9 @@ interface MessageBody { messages: Message[]; } -export class GenAiStreamingResponseExamplePlugin implements Plugin { +export class GenAiStreamingResponseExamplePlugin + implements Plugin +{ public setup({ http, getStartServices }: CoreSetup) { const router = http.createRouter(); diff --git a/x-pack/examples/screenshotting_example/server/plugin.ts b/x-pack/examples/screenshotting_example/server/plugin.ts index ff21ce947140b..32c9ccd606eac 100644 --- a/x-pack/examples/screenshotting_example/server/plugin.ts +++ b/x-pack/examples/screenshotting_example/server/plugin.ts @@ -15,7 +15,7 @@ interface StartDeps { screenshotting: ScreenshottingStart; } -export class ScreenshottingExamplePlugin implements Plugin { +export class ScreenshottingExamplePlugin implements Plugin { setup({ http, getStartServices }: CoreSetup) { const router = http.createRouter(); diff --git a/x-pack/platform/plugins/private/canvas/server/plugin.ts b/x-pack/platform/plugins/private/canvas/server/plugin.ts index 074d29ec977f9..be68ebe8fae3a 100644 --- a/x-pack/platform/plugins/private/canvas/server/plugin.ts +++ b/x-pack/platform/plugins/private/canvas/server/plugin.ts @@ -41,7 +41,7 @@ interface PluginsStart { data: DataPluginStart; } -export class CanvasPlugin implements Plugin { +export class CanvasPlugin implements Plugin { private readonly logger: Logger; constructor(public readonly initializerContext: PluginInitializerContext) { diff --git a/x-pack/platform/plugins/private/data_visualizer/server/plugin.ts b/x-pack/platform/plugins/private/data_visualizer/server/plugin.ts index 7a279d6c01ef8..721c805ec5f16 100644 --- a/x-pack/platform/plugins/private/data_visualizer/server/plugin.ts +++ b/x-pack/platform/plugins/private/data_visualizer/server/plugin.ts @@ -17,7 +17,7 @@ import { registerWithCustomIntegrations } from './register_custom_integration'; import { routes } from './routes'; import type { ConfigSchema } from '../common/app'; -export class DataVisualizerPlugin implements Plugin { +export class DataVisualizerPlugin implements Plugin { private readonly _logger: Logger; constructor(initializerContext: PluginInitializerContext) { diff --git a/x-pack/platform/plugins/shared/actions/server/plugin.ts b/x-pack/platform/plugins/shared/actions/server/plugin.ts index eb9dab938e9fc..62ed7b3822910 100644 --- a/x-pack/platform/plugins/shared/actions/server/plugin.ts +++ b/x-pack/platform/plugins/shared/actions/server/plugin.ts @@ -208,7 +208,10 @@ const includedHiddenTypes = [ CONNECTOR_TOKEN_SAVED_OBJECT_TYPE, ]; -export class ActionsPlugin implements Plugin { +export class ActionsPlugin + implements + Plugin +{ private readonly logger: Logger; private readonly actionsConfig: ActionsConfig; private taskRunnerFactory?: TaskRunnerFactory; @@ -237,7 +240,7 @@ export class ActionsPlugin implements Plugin, + core: CoreSetup, plugins: ActionsPluginsSetup ): PluginSetupContract { this.licenseState = new LicenseState(plugins.licensing.license$); diff --git a/x-pack/platform/plugins/shared/integration_assistant/server/plugin.ts b/x-pack/platform/plugins/shared/integration_assistant/server/plugin.ts index bf972f04a61a5..6361e916f9c44 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/server/plugin.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/server/plugin.ts @@ -13,29 +13,36 @@ import type { Logger, CustomRequestHandlerContext, } from '@kbn/core/server'; -import type { PluginStartContract as ActionsPluginsStart } from '@kbn/actions-plugin/server/plugin'; import { MINIMUM_LICENSE_TYPE } from '../common/constants'; import { registerRoutes } from './routes'; import type { IntegrationAssistantPluginSetup, IntegrationAssistantPluginStart, IntegrationAssistantPluginStartDependencies, + IntegrationAssistantPluginSetupDependencies, } from './types'; import { parseExperimentalConfigValue } from '../common/experimental_features'; import { IntegrationAssistantConfigType } from './config'; export type IntegrationAssistantRouteHandlerContext = CustomRequestHandlerContext<{ integrationAssistant: { - getStartServices: CoreSetup<{ - actions: ActionsPluginsStart; - }>['getStartServices']; + getStartServices: CoreSetup< + IntegrationAssistantPluginStartDependencies, + IntegrationAssistantPluginStart + >['getStartServices']; isAvailable: () => boolean; logger: Logger; }; }>; export class IntegrationAssistantPlugin - implements Plugin + implements + Plugin< + IntegrationAssistantPluginSetup, + IntegrationAssistantPluginStart, + IntegrationAssistantPluginSetupDependencies, + IntegrationAssistantPluginStartDependencies + > { private readonly logger: Logger; private readonly config: IntegrationAssistantConfigType; @@ -50,9 +57,7 @@ export class IntegrationAssistantPlugin } public setup( - core: CoreSetup<{ - actions: ActionsPluginsStart; - }> + core: CoreSetup ): IntegrationAssistantPluginSetup { core.http.registerRouteHandlerContext< IntegrationAssistantRouteHandlerContext, diff --git a/x-pack/platform/plugins/shared/integration_assistant/server/types.ts b/x-pack/platform/plugins/shared/integration_assistant/server/types.ts index df054c40a9ef3..8e9c707176c03 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/server/types.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/server/types.ts @@ -12,6 +12,10 @@ import { ActionsClientSimpleChatModel, } from '@kbn/langchain/server'; import type { LicensingPluginSetup, LicensingPluginStart } from '@kbn/licensing-plugin/server'; +import type { + PluginStartContract as ActionsPluginStart, + PluginSetupContract as ActionsPluginSetup, +} from '@kbn/actions-plugin/server/plugin'; import { ESProcessorItem, SamplesFormat } from '../common'; export interface IntegrationAssistantPluginSetup { @@ -22,9 +26,11 @@ export interface IntegrationAssistantPluginStart {} export interface IntegrationAssistantPluginSetupDependencies { licensing: LicensingPluginSetup; + actions: ActionsPluginSetup; } export interface IntegrationAssistantPluginStartDependencies { licensing: LicensingPluginStart; + actions: ActionsPluginStart; } export interface SimplifiedProcessor { diff --git a/x-pack/platform/plugins/shared/maps/server/plugin.ts b/x-pack/platform/plugins/shared/maps/server/plugin.ts index 9d82aa0cc931e..097b59715cb76 100644 --- a/x-pack/platform/plugins/shared/maps/server/plugin.ts +++ b/x-pack/platform/plugins/shared/maps/server/plugin.ts @@ -35,7 +35,7 @@ import { registerIntegrations } from './register_integrations'; import { StartDeps, SetupDeps } from './types'; import { MapsStorage } from './content_management'; -export class MapsPlugin implements Plugin { +export class MapsPlugin implements Plugin { readonly _initializerContext: PluginInitializerContext; private readonly _logger: Logger; diff --git a/x-pack/platform/plugins/shared/observability_solution/dataset_quality/server/plugin.ts b/x-pack/platform/plugins/shared/observability_solution/dataset_quality/server/plugin.ts index 86f89d3c0d146..209be46cba29c 100644 --- a/x-pack/platform/plugins/shared/observability_solution/dataset_quality/server/plugin.ts +++ b/x-pack/platform/plugins/shared/observability_solution/dataset_quality/server/plugin.ts @@ -12,12 +12,21 @@ import { getDatasetQualityServerRouteRepository } from './routes'; import { registerRoutes } from './routes/register_routes'; import { DatasetQualityRouteHandlerResources } from './routes/types'; import { + DatasetQualityPluginSetup, DatasetQualityPluginSetupDependencies, DatasetQualityPluginStart, DatasetQualityPluginStartDependencies, } from './types'; -export class DatasetQualityServerPlugin implements Plugin { +export class DatasetQualityServerPlugin + implements + Plugin< + DatasetQualityPluginSetup, + DatasetQualityPluginStart, + DatasetQualityPluginSetupDependencies, + DatasetQualityPluginStartDependencies + > +{ private readonly logger: Logger; private readonly dataTelemetryService: DataTelemetryService; diff --git a/x-pack/platform/plugins/shared/stack_connectors/server/plugin.ts b/x-pack/platform/plugins/shared/stack_connectors/server/plugin.ts index b20892938735b..604cd935b6a85 100644 --- a/x-pack/platform/plugins/shared/stack_connectors/server/plugin.ts +++ b/x-pack/platform/plugins/shared/stack_connectors/server/plugin.ts @@ -26,7 +26,9 @@ export interface ConnectorsPluginsStart { actions: ActionsPluginSetupContract; } -export class StackConnectorsPlugin implements Plugin { +export class StackConnectorsPlugin + implements Plugin +{ private readonly logger: Logger; private config: StackConnectorsConfigType; readonly experimentalFeatures: ExperimentalFeatures; diff --git a/x-pack/platform/plugins/shared/task_manager/server/kibana_discovery_service/delete_inactive_nodes_task.ts b/x-pack/platform/plugins/shared/task_manager/server/kibana_discovery_service/delete_inactive_nodes_task.ts index f5d7204d739da..b343c15976072 100644 --- a/x-pack/platform/plugins/shared/task_manager/server/kibana_discovery_service/delete_inactive_nodes_task.ts +++ b/x-pack/platform/plugins/shared/task_manager/server/kibana_discovery_service/delete_inactive_nodes_task.ts @@ -12,6 +12,7 @@ import { TaskTypeDictionary } from '../task_type_dictionary'; import { BackgroundTaskNode } from '../saved_objects/schemas/background_task_node'; import { BACKGROUND_TASK_NODE_SO_NAME } from '../saved_objects'; import { TaskManagerStartContract } from '..'; +import { TaskManagerPluginsStart } from '../plugin'; export const TASK_ID = 'delete_inactive_background_task_nodes'; const TASK_TYPE = `task_manager:${TASK_ID}`; @@ -40,7 +41,7 @@ export async function scheduleDeleteInactiveNodesTaskDefinition( export function registerDeleteInactiveNodesTaskDefinition( logger: Logger, - coreStartServices: () => Promise<[CoreStart, TaskManagerStartContract, unknown]>, + coreStartServices: () => Promise<[CoreStart, TaskManagerPluginsStart, TaskManagerStartContract]>, taskTypeDictionary: TaskTypeDictionary ) { taskTypeDictionary.registerTaskDefinitions({ @@ -53,7 +54,7 @@ export function registerDeleteInactiveNodesTaskDefinition( export function taskRunner( logger: Logger, - coreStartServices: () => Promise<[CoreStart, TaskManagerStartContract, unknown]> + coreStartServices: () => Promise<[CoreStart, TaskManagerPluginsStart, TaskManagerStartContract]> ) { return () => { return { diff --git a/x-pack/platform/plugins/shared/task_manager/server/plugin.ts b/x-pack/platform/plugins/shared/task_manager/server/plugin.ts index cd820d1e70780..ae6a7ac8fd72d 100644 --- a/x-pack/platform/plugins/shared/task_manager/server/plugin.ts +++ b/x-pack/platform/plugins/shared/task_manager/server/plugin.ts @@ -8,7 +8,11 @@ import { combineLatest, Observable, Subject, BehaviorSubject } from 'rxjs'; import { map, distinctUntilChanged } from 'rxjs'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { UsageCollectionSetup, UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { + UsageCollectionSetup, + UsageCollectionStart, + UsageCounter, +} from '@kbn/usage-collection-plugin/server'; import { PluginInitializerContext, Plugin, @@ -18,7 +22,7 @@ import { ServiceStatusLevels, CoreStatus, } from '@kbn/core/server'; -import type { CloudStart } from '@kbn/cloud-plugin/server'; +import type { CloudSetup, CloudStart } from '@kbn/cloud-plugin/server'; import { registerDeleteInactiveNodesTaskDefinition, scheduleDeleteInactiveNodesTaskDefinition, @@ -82,14 +86,26 @@ export type TaskManagerStartContract = Pick< getRegisteredTypes: () => string[]; }; -export interface TaskManagerPluginStart { +export interface TaskManagerPluginsStart { cloud?: CloudStart; + usageCollection?: UsageCollectionStart; +} + +export interface TaskManagerPluginsSetup { + cloud?: CloudSetup; + usageCollection?: UsageCollectionSetup; } const LogHealthForBackgroundTasksOnlyMinutes = 60; export class TaskManagerPlugin - implements Plugin + implements + Plugin< + TaskManagerSetupContract, + TaskManagerStartContract, + TaskManagerPluginsSetup, + TaskManagerPluginsStart + > { private taskPollingLifecycle?: TaskPollingLifecycle; private ephemeralTaskLifecycle?: EphemeralTaskLifecycle; @@ -129,8 +145,8 @@ export class TaskManagerPlugin } public setup( - core: CoreSetup, - plugins: { usageCollection?: UsageCollectionSetup } + core: CoreSetup, + plugins: TaskManagerPluginsSetup ): TaskManagerSetupContract { this.elasticsearchAndSOAvailability$ = getElasticsearchAndSOAvailability(core.status.core$); @@ -259,7 +275,7 @@ export class TaskManagerPlugin public start( { savedObjects, elasticsearch, executionContext, docLinks }: CoreStart, - { cloud }: TaskManagerPluginStart + { cloud }: TaskManagerPluginsStart ): TaskManagerStartContract { const savedObjectsRepository = savedObjects.createInternalRepository([ TASK_SO_NAME, diff --git a/x-pack/platform/plugins/shared/task_manager/server/removed_tasks/mark_removed_tasks_as_unrecognized.ts b/x-pack/platform/plugins/shared/task_manager/server/removed_tasks/mark_removed_tasks_as_unrecognized.ts index e28d5221e72d5..a0b518849d909 100644 --- a/x-pack/platform/plugins/shared/task_manager/server/removed_tasks/mark_removed_tasks_as_unrecognized.ts +++ b/x-pack/platform/plugins/shared/task_manager/server/removed_tasks/mark_removed_tasks_as_unrecognized.ts @@ -15,6 +15,7 @@ import { ConcreteTaskInstance, TaskManagerStartContract } from '..'; import { TaskStatus } from '../task'; import { REMOVED_TYPES } from '../task_type_dictionary'; import { TASK_MANAGER_INDEX } from '../constants'; +import { TaskManagerPluginsStart } from '../plugin'; export const TASK_ID = 'mark_removed_tasks_as_unrecognized'; const TASK_TYPE = `task_manager:${TASK_ID}`; @@ -40,7 +41,7 @@ export async function scheduleMarkRemovedTasksAsUnrecognizedDefinition( export function registerMarkRemovedTasksAsUnrecognizedDefinition( logger: Logger, - coreStartServices: () => Promise<[CoreStart, TaskManagerStartContract, unknown]>, + coreStartServices: () => Promise<[CoreStart, TaskManagerPluginsStart, TaskManagerStartContract]>, taskTypeDictionary: TaskTypeDictionary ) { taskTypeDictionary.registerTaskDefinitions({ @@ -53,7 +54,7 @@ export function registerMarkRemovedTasksAsUnrecognizedDefinition( export function taskRunner( logger: Logger, - coreStartServices: () => Promise<[CoreStart, TaskManagerStartContract, unknown]> + coreStartServices: () => Promise<[CoreStart, TaskManagerPluginsStart, TaskManagerStartContract]> ) { return () => { return { diff --git a/x-pack/platform/plugins/shared/triggers_actions_ui/server/plugin.ts b/x-pack/platform/plugins/shared/triggers_actions_ui/server/plugin.ts index 2263af73dbdc7..3b5cf481bf588 100644 --- a/x-pack/platform/plugins/shared/triggers_actions_ui/server/plugin.ts +++ b/x-pack/platform/plugins/shared/triggers_actions_ui/server/plugin.ts @@ -34,7 +34,10 @@ export class TriggersActionsPlugin implements Plugin this.data = getService(); } - public setup(core: CoreSetup, plugins: PluginsSetup): void { + public setup( + core: CoreSetup, + plugins: PluginsSetup + ): void { const router = core.http.createRouter(); registerDataService({ logger: this.logger, diff --git a/x-pack/plugins/lens/server/plugin.tsx b/x-pack/plugins/lens/server/plugin.tsx index c7584474dfc2b..ab683555d70c2 100644 --- a/x-pack/plugins/lens/server/plugin.tsx +++ b/x-pack/plugins/lens/server/plugin.tsx @@ -61,7 +61,9 @@ export interface LensServerPluginSetup { ) => void; } -export class LensServerPlugin implements Plugin { +export class LensServerPlugin + implements Plugin +{ private customVisualizationMigrations: CustomVisualizationMigrations = {}; constructor(private initializerContext: PluginInitializerContext) {} diff --git a/x-pack/solutions/observability/plugins/metrics_data_access/server/plugin.ts b/x-pack/solutions/observability/plugins/metrics_data_access/server/plugin.ts index 597c63c2d8ebb..b64b96a4716c2 100644 --- a/x-pack/solutions/observability/plugins/metrics_data_access/server/plugin.ts +++ b/x-pack/solutions/observability/plugins/metrics_data_access/server/plugin.ts @@ -18,7 +18,9 @@ import { KibanaFramework } from './lib/adapters/framework/kibana_framework_adapt import { initMetricExplorerRoute } from './routes/metrics_explorer'; import { initMetricIndicesRoute } from './routes/metric_indices'; -export class MetricsDataPlugin implements Plugin { +export class MetricsDataPlugin + implements Plugin +{ private metricsClient: MetricsDataClient | null = null; constructor(context: PluginInitializerContext) {} diff --git a/x-pack/solutions/observability/plugins/observability/server/plugin.ts b/x-pack/solutions/observability/plugins/observability/server/plugin.ts index 53c91feb3b842..88e5ac667ee97 100644 --- a/x-pack/solutions/observability/plugins/observability/server/plugin.ts +++ b/x-pack/solutions/observability/plugins/observability/server/plugin.ts @@ -78,7 +78,9 @@ const alertingFeatures = OBSERVABILITY_RULE_TYPE_IDS_WITH_SUPPORTED_STACK_RULE_T }) ); -export class ObservabilityPlugin implements Plugin { +export class ObservabilityPlugin + implements Plugin +{ private logger: Logger; constructor(private readonly initContext: PluginInitializerContext) { @@ -86,7 +88,7 @@ export class ObservabilityPlugin implements Plugin { this.logger = initContext.logger.get(); } - public setup(core: CoreSetup, plugins: PluginSetup) { + public setup(core: CoreSetup, plugins: PluginSetup) { const casesCapabilities = createCasesUICapabilities(); const casesApiTags = getCasesApiTags(observabilityFeatureId); diff --git a/x-pack/solutions/search/plugins/enterprise_search/server/plugin.ts b/x-pack/solutions/search/plugins/enterprise_search/server/plugin.ts index 7cc9d281dedbb..9c1f8625fe8d3 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/server/plugin.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/server/plugin.ts @@ -134,7 +134,7 @@ export interface RouteDependencies { router: IRouter; } -export class EnterpriseSearchPlugin implements Plugin { +export class EnterpriseSearchPlugin implements Plugin { private readonly config: ConfigType; private readonly logger: Logger; private readonly globalConfigService: GlobalConfigService;