(request: LegacyRequest | KibanaRequest<unknown, unknown, unknown>) => string
| returns basePath
value, specific for an incoming request. |
+| [get](./kibana-plugin-server.basepath.get.md) | | (request: KibanaRequest<unknown, unknown, unknown> | LegacyRequest) => string
| returns basePath
value, specific for an incoming request. |
| [prepend](./kibana-plugin-server.basepath.prepend.md) | | (path: string) => string
| Prepends path
with the basePath. |
| [remove](./kibana-plugin-server.basepath.remove.md) | | (path: string) => string
| Removes the prepended basePath from the path
. |
| [serverBasePath](./kibana-plugin-server.basepath.serverbasepath.md) | | string
| returns the server's basePathSee [BasePath.get](./kibana-plugin-server.basepath.get.md) for getting the basePath value for a specific request |
-| [set](./kibana-plugin-server.basepath.set.md) | | (request: LegacyRequest | KibanaRequest<unknown, unknown, unknown>, requestSpecificBasePath: string) => void
| sets basePath
value, specific for an incoming request. |
+| [set](./kibana-plugin-server.basepath.set.md) | | (request: KibanaRequest<unknown, unknown, unknown> | LegacyRequest, requestSpecificBasePath: string) => void
| sets basePath
value, specific for an incoming request. |
## Remarks
diff --git a/docs/development/core/server/kibana-plugin-server.basepath.set.md b/docs/development/core/server/kibana-plugin-server.basepath.set.md
index cec70ee853bfa..1272a134ef5c4 100644
--- a/docs/development/core/server/kibana-plugin-server.basepath.set.md
+++ b/docs/development/core/server/kibana-plugin-server.basepath.set.md
@@ -9,5 +9,5 @@ sets `basePath` value, specific for an incoming request.
Signature:
```typescript
-set: (request: LegacyRequest | KibanaRequest(route: RouteConfig
, handler: RequestHandler
) => void;
@@ -839,7 +809,7 @@ export interface LegacyRequest extends Request {
// @public @deprecated (undocumented)
export interface LegacyServiceSetupDeps {
- // Warning: (ae-incompatible-release-tags) The symbol "core" is marked as @public, but its signature references "InternalCoreSetup" which is marked as @internal
+ // Warning: (ae-forgotten-export) The symbol "InternalCoreSetup" needs to be exported by the entry point index.d.ts
//
// (undocumented)
core: InternalCoreSetup & {
@@ -851,7 +821,7 @@ export interface LegacyServiceSetupDeps {
// @public @deprecated (undocumented)
export interface LegacyServiceStartDeps {
- // Warning: (ae-incompatible-release-tags) The symbol "core" is marked as @public, but its signature references "InternalCoreStart" which is marked as @internal
+ // Warning: (ae-forgotten-export) The symbol "InternalCoreStart" needs to be exported by the entry point index.d.ts
//
// (undocumented)
core: InternalCoreStart & {
diff --git a/src/core/server/server.ts b/src/core/server/server.ts
index 46974e204c7a4..6c38de03f0f2d 100644
--- a/src/core/server/server.ts
+++ b/src/core/server/server.ts
@@ -39,7 +39,8 @@ import { config as uiSettingsConfig } from './ui_settings';
import { mapToObject } from '../utils/';
import { ContextService } from './context';
import { SavedObjectsServiceSetup } from './saved_objects/saved_objects_service';
-import { RequestHandlerContext, InternalCoreSetup } from '.';
+import { RequestHandlerContext } from '.';
+import { InternalCoreSetup } from './internal_types';
const coreId = Symbol('core');
diff --git a/x-pack/legacy/plugins/apm/index.ts b/x-pack/legacy/plugins/apm/index.ts
index 556bce9d37bb5..fe8cc43d7f55d 100644
--- a/x-pack/legacy/plugins/apm/index.ts
+++ b/x-pack/legacy/plugins/apm/index.ts
@@ -7,13 +7,10 @@
import { i18n } from '@kbn/i18n';
import { Server } from 'hapi';
import { resolve } from 'path';
-import {
- InternalCoreSetup,
- PluginInitializerContext
-} from '../../../../src/core/server';
+import { PluginInitializerContext } from '../../../../src/core/server';
import { LegacyPluginInitializer } from '../../../../src/legacy/types';
import mappings from './mappings.json';
-import { plugin } from './server/new-platform/index';
+import { plugin } from './server/new-platform';
export const apm: LegacyPluginInitializer = kibana => {
return new kibana.Plugin({
@@ -111,12 +108,13 @@ export const apm: LegacyPluginInitializer = kibana => {
});
const initializerContext = {} as PluginInitializerContext;
- const core = {
- http: {
- server
- }
- } as InternalCoreSetup;
- plugin(initializerContext).setup(core);
+ const legacySetup = {
+ server
+ };
+ plugin(initializerContext).setup(
+ server.newPlatform.setup.core,
+ legacySetup
+ );
}
});
};
diff --git a/x-pack/legacy/plugins/apm/server/lib/apm_telemetry/make_apm_usage_collector.ts b/x-pack/legacy/plugins/apm/server/lib/apm_telemetry/make_apm_usage_collector.ts
index 8a91bd8781fe7..886c3890f1a9a 100644
--- a/x-pack/legacy/plugins/apm/server/lib/apm_telemetry/make_apm_usage_collector.ts
+++ b/x-pack/legacy/plugins/apm/server/lib/apm_telemetry/make_apm_usage_collector.ts
@@ -4,26 +4,26 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { InternalCoreSetup } from 'src/core/server';
+import { CoreSetup } from 'src/core/server';
import { getSavedObjectsClient } from '../helpers/saved_objects_client';
import { APM_TELEMETRY_DOC_ID, createApmTelementry } from './apm_telemetry';
+import { LegacySetup } from '../../new-platform/plugin';
-export interface CoreSetupWithUsageCollector extends InternalCoreSetup {
- http: InternalCoreSetup['http'] & {
- server: {
- usage: {
- collectorSet: {
- makeUsageCollector: (options: unknown) => unknown;
- register: (options: unknown) => unknown;
- };
+export interface LegacySetupWithUsageCollector extends LegacySetup {
+ server: LegacySetup['server'] & {
+ usage: {
+ collectorSet: {
+ makeUsageCollector: (options: unknown) => unknown;
+ register: (options: unknown) => unknown;
};
};
};
}
-export function makeApmUsageCollector(core: CoreSetupWithUsageCollector) {
- const { server } = core.http;
-
+export function makeApmUsageCollector(
+ core: CoreSetup,
+ { server }: LegacySetupWithUsageCollector
+) {
const apmUsageCollector = server.usage.collectorSet.makeUsageCollector({
type: 'apm',
fetch: async () => {
diff --git a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts b/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts
index 861732ee03923..18f6aea610a68 100644
--- a/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts
+++ b/x-pack/legacy/plugins/apm/server/lib/settings/agent_configuration/create_agent_config_index.ts
@@ -4,15 +4,16 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { InternalCoreSetup } from 'src/core/server';
+import { CoreSetup } from 'src/core/server';
import { CallCluster } from '../../../../../../../../src/legacy/core_plugins/elasticsearch';
import { getApmIndices } from '../apm_indices/get_apm_indices';
+import { LegacySetup } from '../../../new-platform/plugin';
export async function createApmAgentConfigurationIndex(
- core: InternalCoreSetup
+ core: CoreSetup,
+ { server }: LegacySetup
) {
try {
- const { server } = core.http;
const indices = await getApmIndices(server);
const index = indices['apm_oss.apmAgentConfigurationIndex'];
const { callWithInternalUser } = server.plugins.elasticsearch.getCluster(
diff --git a/x-pack/legacy/plugins/apm/server/new-platform/plugin.ts b/x-pack/legacy/plugins/apm/server/new-platform/plugin.ts
index 0458c8e4fedf0..351afe618901e 100644
--- a/x-pack/legacy/plugins/apm/server/new-platform/plugin.ts
+++ b/x-pack/legacy/plugins/apm/server/new-platform/plugin.ts
@@ -4,16 +4,21 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { InternalCoreSetup } from 'src/core/server';
+import { Server } from 'hapi';
+import { CoreSetup } from 'src/core/server';
import { makeApmUsageCollector } from '../lib/apm_telemetry';
-import { CoreSetupWithUsageCollector } from '../lib/apm_telemetry/make_apm_usage_collector';
+import { LegacySetupWithUsageCollector } from '../lib/apm_telemetry/make_apm_usage_collector';
import { createApmAgentConfigurationIndex } from '../lib/settings/agent_configuration/create_agent_config_index';
import { createApmApi } from '../routes/create_apm_api';
+export interface LegacySetup {
+ server: Server;
+}
+
export class Plugin {
- public setup(core: InternalCoreSetup) {
- createApmApi().init(core);
- createApmAgentConfigurationIndex(core);
- makeApmUsageCollector(core as CoreSetupWithUsageCollector);
+ public setup(core: CoreSetup, __LEGACY: LegacySetup) {
+ createApmApi().init(core, __LEGACY);
+ createApmAgentConfigurationIndex(core, __LEGACY);
+ makeApmUsageCollector(core, __LEGACY as LegacySetupWithUsageCollector);
}
}
diff --git a/x-pack/legacy/plugins/apm/server/routes/create_api/index.test.ts b/x-pack/legacy/plugins/apm/server/routes/create_api/index.test.ts
index b0461f5cb3b68..98eae3196eaac 100644
--- a/x-pack/legacy/plugins/apm/server/routes/create_api/index.test.ts
+++ b/x-pack/legacy/plugins/apm/server/routes/create_api/index.test.ts
@@ -5,23 +5,25 @@
*/
import * as t from 'io-ts';
import { createApi } from './index';
-import { InternalCoreSetup } from 'src/core/server';
+import { CoreSetup } from 'src/core/server';
import { Params } from '../typings';
+import { LegacySetup } from '../../new-platform/plugin';
-const getCoreMock = () =>
+const getCoreMock = () => (({} as unknown) as CoreSetup);
+
+const getLegacyMock = () =>
(({
- http: {
- server: {
- route: jest.fn()
- }
+ server: {
+ route: jest.fn()
}
- } as unknown) as InternalCoreSetup & {
- http: { server: { route: ReturnType