diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts index c0a0ef0f88c7b..cd8e4243e5edf 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts @@ -25,10 +25,14 @@ import { registerRoutes } from './routes'; import { config as deprecationConfig, DeprecationConfigType } from './deprecation_config'; import { registerApiDeprecationsInfo, registerConfigDeprecationsInfo } from './deprecations'; +/** + * Deprecation Service: Internal Start contract + */ export interface InternalDeprecationsServiceStart { /** * Creates a {@link DeprecationsClient} with provided SO client and ES client. - * + * @param esClient Scoped Elasticsearch client + * @param savedObjectsClient Scoped SO Client */ asScopedToClient( esClient: IScopedClusterClient, diff --git a/packages/core/deprecations/core-deprecations-server/src/contracts.ts b/packages/core/deprecations/core-deprecations-server/src/contracts.ts index eecd0a8c7e1ac..097e9f6aa0522 100644 --- a/packages/core/deprecations/core-deprecations-server/src/contracts.ts +++ b/packages/core/deprecations/core-deprecations-server/src/contracts.ts @@ -87,27 +87,50 @@ import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-ser * @public */ export interface DeprecationsServiceSetup { + /** + * Registers deprecation messages or notices for a specific feature or functionality + * within the application. This allows developers to flag certain behaviors or APIs + * as deprecated, providing guidance and warnings for future deprecation plans. + * + * @param {RegisterDeprecationsConfig} deprecationContext - The configuration object containing + * information about the deprecated features, including messages, corrective actions, + * and any relevant metadata to inform users or developers about the deprecation. + */ registerDeprecations: (deprecationContext: RegisterDeprecationsConfig) => void; } /** + * Options to provide when registering deprecations via {@link DeprecationsServiceSetup.registerDeprecations}. * @public */ export interface RegisterDeprecationsConfig { + /** + * Method called when the user wants to list any existing deprecations. + * Returns the list of deprecation messages to warn about. + * @param {GetDeprecationsContext} context Scoped clients and helpers to ease fetching the deprecations. + */ getDeprecations: (context: GetDeprecationsContext) => MaybePromise; } /** + * Scoped clients and helpers to ease fetching the deprecations. * @public */ export interface GetDeprecationsContext { + /** Elasticsearch client scoped to the current user */ esClient: IScopedClusterClient; + /** Saved Objects client scoped to the current user and space */ savedObjectsClient: SavedObjectsClientContract; } /** + * Provides a method to scope the {@link DeprecationsServiceSetup | Deprecations Service} to a specific domain. * @public */ export interface DeprecationRegistryProvider { + /** + * Returns the {@link DeprecationsServiceSetup | Deprecations Service} scoped to a specific domain. + * @param domainId Domain ID to categorize the deprecations reported under it. + */ getRegistry: (domainId: string) => DeprecationsServiceSetup; } diff --git a/packages/core/deprecations/core-deprecations-server/src/request_handler_context.ts b/packages/core/deprecations/core-deprecations-server/src/request_handler_context.ts index e75df37aa2c6e..fc5990cd65028 100644 --- a/packages/core/deprecations/core-deprecations-server/src/request_handler_context.ts +++ b/packages/core/deprecations/core-deprecations-server/src/request_handler_context.ts @@ -15,6 +15,9 @@ import type { DomainDeprecationDetails } from '@kbn/core-deprecations-common'; * @public */ export interface DeprecationsClient { + /** + * Fetch all Kibana deprecations. + */ getAllDeprecations: () => Promise; } @@ -23,5 +26,8 @@ export interface DeprecationsClient { * @public */ export interface DeprecationsRequestHandlerContext { + /** + * {@link DeprecationsClient | Deprecations client} exposed in the request handler context. + */ client: DeprecationsClient; }