Remove public contract for server-side context service (#135397)

This commit is contained in:
Pierre Gayvallet 2022-06-29 17:08:15 +02:00 committed by GitHub
parent adedf7bcde
commit 12ff015255
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 19 deletions

View file

@ -8,7 +8,7 @@
import type { PublicMethodsOf } from '@kbn/utility-types';
import { ContextService, ContextSetup, InternalContextPreboot } from './context_service';
import { ContextService, InternalContextSetup, InternalContextPreboot } from './context_service';
import { contextMock } from './container/context.mock';
const createPrebootContractMock = (mockContext = {}) => {
@ -19,7 +19,7 @@ const createPrebootContractMock = (mockContext = {}) => {
};
const createSetupContractMock = (mockContext = {}) => {
const setupContract: jest.Mocked<ContextSetup> = {
const setupContract: jest.Mocked<InternalContextSetup> = {
createContextContainer: jest.fn().mockImplementation(() => contextMock.create(mockContext)),
};
return setupContract;

View file

@ -24,7 +24,7 @@ export class ContextService {
return this.getContextContainerFactory(pluginDependencies);
}
public setup({ pluginDependencies }: SetupDeps): ContextSetup {
public setup({ pluginDependencies }: SetupDeps): InternalContextSetup {
return this.getContextContainerFactory(pluginDependencies);
}
@ -40,7 +40,7 @@ export class ContextService {
}
/** @internal */
export type InternalContextPreboot = ContextSetup;
export type InternalContextPreboot = InternalContextSetup;
/**
* {@inheritdoc IContextContainer}
@ -102,9 +102,9 @@ export type InternalContextPreboot = ContextSetup;
* }
* ```
*
* @public
* @internal
*/
export interface ContextSetup {
export interface InternalContextSetup {
/**
* Creates a new {@link IContextContainer} for a service owner.
*/

View file

@ -7,7 +7,7 @@
*/
export { ContextService } from './context_service';
export type { InternalContextPreboot, ContextSetup } from './context_service';
export type { InternalContextPreboot, InternalContextSetup } from './context_service';
export type {
IContextContainer,
IContextProvider,

View file

@ -17,7 +17,7 @@ import type { PluginOpaqueId } from '@kbn/core-base-common';
import type { InternalExecutionContextSetup } from '@kbn/core-execution-context-server-internal';
import type { RequestHandlerContext } from '..';
import { ContextSetup, InternalContextPreboot } from '../context';
import { InternalContextSetup, InternalContextPreboot } from '../context';
import { CspConfigType, config as cspConfig } from '../csp';
import { Router } from './router';
@ -45,7 +45,7 @@ export interface PrebootDeps {
}
export interface SetupDeps {
context: ContextSetup;
context: InternalContextSetup;
executionContext: InternalExecutionContextSetup;
}

View file

@ -53,7 +53,6 @@ import { HttpServicePreboot, HttpServiceSetup, HttpServiceStart } from './http';
import { HttpResources } from './http_resources';
import { PluginsServiceSetup, PluginsServiceStart, PluginOpaqueId } from './plugins';
import { ContextSetup } from './context';
import { IUiSettingsClient, UiSettingsServiceSetup, UiSettingsServiceStart } from './ui_settings';
import { SavedObjectsClientContract } from './saved_objects/types';
import {
@ -569,8 +568,6 @@ export interface CoreSetup<TPluginsStart extends object = object, TStart = unkno
analytics: AnalyticsServiceSetup;
/** {@link CapabilitiesSetup} */
capabilities: CapabilitiesSetup;
/** {@link ContextSetup} */
context: ContextSetup;
/** {@link DocLinksServiceSetup} */
docLinks: DocLinksServiceSetup;
/** {@link ElasticsearchServiceSetup} */
@ -646,7 +643,6 @@ export interface CoreStart {
export type {
CapabilitiesSetup,
CapabilitiesStart,
ContextSetup,
ExecutionContextSetup,
ExecutionContextStart,
HttpResources,

View file

@ -22,7 +22,7 @@ import type {
InternalExecutionContextStart,
} from '@kbn/core-execution-context-server-internal';
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
import { InternalContextPreboot, ContextSetup } from './context';
import { InternalContextPreboot, InternalContextSetup } from './context';
import {
InternalElasticsearchServicePreboot,
InternalElasticsearchServiceSetup,
@ -67,7 +67,7 @@ export interface InternalCorePreboot {
export interface InternalCoreSetup {
analytics: AnalyticsServiceSetup;
capabilities: CapabilitiesSetup;
context: ContextSetup;
context: InternalContextSetup;
docLinks: DocLinksServiceSetup;
http: InternalHttpServiceSetup;
elasticsearch: InternalElasticsearchServiceSetup;

View file

@ -170,7 +170,6 @@ function createCoreSetupMock({
const mock: CoreSetupMockType = {
analytics: analyticsServiceMock.createAnalyticsServiceSetup(),
capabilities: capabilitiesServiceMock.createSetupContract(),
context: contextServiceMock.createSetupContract(),
docLinks: docLinksServiceMock.createSetupContract(),
elasticsearch: elasticsearchServiceMock.createSetup(),
http: httpMock,

View file

@ -194,9 +194,6 @@ export function createPluginSetupContext<TPlugin, TPluginDependencies>(
registerProvider: deps.capabilities.registerProvider,
registerSwitcher: deps.capabilities.registerSwitcher,
},
context: {
createContextContainer: deps.context.createContextContainer,
},
docLinks: deps.docLinks,
elasticsearch: {
legacy: deps.elasticsearch.legacy,