Skip to content

Commit ad246eb

Browse files
authored
Remove legacy deprecation adapter (#76753) (#76835)
1 parent b4309d6 commit ad246eb

File tree

8 files changed

+8
-257
lines changed

8 files changed

+8
-257
lines changed

src/core/server/legacy/config/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@
1919

2020
export { ensureValidConfiguration } from './ensure_valid_configuration';
2121
export { LegacyObjectToConfigAdapter } from './legacy_object_to_config_adapter';
22-
export { convertLegacyDeprecationProvider } from './legacy_deprecation_adapters';

src/core/server/legacy/config/legacy_deprecation_adapters.test.ts

Lines changed: 0 additions & 106 deletions
This file was deleted.

src/core/server/legacy/config/legacy_deprecation_adapters.ts

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/core/server/legacy/legacy_service.test.ts

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
jest.mock('../../../legacy/server/kbn_server');
2121
jest.mock('../../../cli/cluster/cluster_manager');
22-
jest.mock('./config/legacy_deprecation_adapters', () => ({
23-
convertLegacyDeprecationProvider: (provider: any) => Promise.resolve(provider),
24-
}));
22+
2523
import {
2624
findLegacyPluginSpecsMock,
2725
logLegacyThirdPartyPluginDeprecationWarningMock,
@@ -446,46 +444,8 @@ describe('#discoverPlugins()', () => {
446444
expect(findLegacyPluginSpecs).toHaveBeenCalledWith(expect.any(Object), logger, env.packageInfo);
447445
});
448446

449-
it(`register legacy plugin's deprecation providers`, async () => {
450-
findLegacyPluginSpecsMock.mockImplementation(
451-
(settings) =>
452-
Promise.resolve({
453-
pluginSpecs: [
454-
{
455-
getDeprecationsProvider: () => undefined,
456-
},
457-
{
458-
getDeprecationsProvider: () => 'providerA',
459-
},
460-
{
461-
getDeprecationsProvider: () => 'providerB',
462-
},
463-
],
464-
pluginExtendedConfig: settings,
465-
disabledPluginSpecs: [],
466-
uiExports: {},
467-
navLinks: [],
468-
}) as any
469-
);
470-
471-
const legacyService = new LegacyService({
472-
coreId,
473-
env,
474-
logger,
475-
configService: configService as any,
476-
});
477-
478-
await legacyService.discoverPlugins();
479-
expect(configService.addDeprecationProvider).toHaveBeenCalledTimes(2);
480-
expect(configService.addDeprecationProvider).toHaveBeenCalledWith('', 'providerA');
481-
expect(configService.addDeprecationProvider).toHaveBeenCalledWith('', 'providerB');
482-
});
483-
484447
it(`logs deprecations for legacy third party plugins`, async () => {
485-
const pluginSpecs = [
486-
{ getId: () => 'pluginA', getDeprecationsProvider: () => undefined },
487-
{ getId: () => 'pluginB', getDeprecationsProvider: () => undefined },
488-
];
448+
const pluginSpecs = [{ getId: () => 'pluginA' }, { getId: () => 'pluginB' }];
489449
findLegacyPluginSpecsMock.mockImplementation(
490450
(settings) =>
491451
Promise.resolve({

src/core/server/legacy/legacy_service.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ import { combineLatest, ConnectableObservable, EMPTY, Observable, Subscription }
2121
import { first, map, publishReplay, tap } from 'rxjs/operators';
2222

2323
import { CoreService } from '../../types';
24-
import { Config, ConfigDeprecationProvider } from '../config';
24+
import { Config } from '../config';
2525
import { CoreContext } from '../core_context';
2626
import { CspConfigType, config as cspConfig } from '../csp';
2727
import { DevConfig, DevConfigType, config as devConfig } from '../dev';
2828
import { BasePathProxyServer, HttpConfig, HttpConfigType, config as httpConfig } from '../http';
2929
import { Logger } from '../logging';
3030
import { PathConfigType } from '../path';
3131
import { findLegacyPluginSpecs, logLegacyThirdPartyPluginDeprecationWarning } from './plugins';
32-
import { convertLegacyDeprecationProvider } from './config';
3332
import {
3433
ILegacyInternals,
3534
LegacyServiceSetupDeps,
@@ -145,18 +144,6 @@ export class LegacyService implements CoreService {
145144
navLinks,
146145
};
147146

148-
const deprecationProviders = await pluginSpecs
149-
.map((spec) => spec.getDeprecationsProvider())
150-
.reduce(async (providers, current) => {
151-
if (current) {
152-
return [...(await providers), await convertLegacyDeprecationProvider(current)];
153-
}
154-
return providers;
155-
}, Promise.resolve([] as ConfigDeprecationProvider[]));
156-
deprecationProviders.forEach((provider) =>
157-
this.coreContext.configService.addDeprecationProvider('', provider)
158-
);
159-
160147
this.legacyRawConfig = pluginExtendedConfig;
161148

162149
// check for unknown uiExport types

src/core/server/legacy/plugins/log_legacy_plugins_warning.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const createPluginSpec = ({ id, path }: { id: string; path: string }): LegacyPlu
2626
getId: () => id,
2727
getExpectedKibanaVersion: () => 'kibana',
2828
getConfigPrefix: () => 'plugin.config',
29-
getDeprecationsProvider: () => undefined,
3029
getPack: () => ({
3130
getPath: () => path,
3231
}),

src/core/server/legacy/types.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -51,36 +51,6 @@ export interface LegacyConfig {
5151
set(config: LegacyVars): void;
5252
}
5353

54-
/**
55-
* Representation of a legacy configuration deprecation factory used for
56-
* legacy plugin deprecations.
57-
*
58-
* @internal
59-
* @deprecated
60-
*/
61-
export interface LegacyConfigDeprecationFactory {
62-
rename(oldKey: string, newKey: string): LegacyConfigDeprecation;
63-
unused(unusedKey: string): LegacyConfigDeprecation;
64-
}
65-
66-
/**
67-
* Representation of a legacy configuration deprecation.
68-
*
69-
* @internal
70-
* @deprecated
71-
*/
72-
export type LegacyConfigDeprecation = (settings: LegacyVars, log: (msg: string) => void) => void;
73-
74-
/**
75-
* Representation of a legacy configuration deprecation provider.
76-
*
77-
* @internal
78-
* @deprecated
79-
*/
80-
export type LegacyConfigDeprecationProvider = (
81-
factory: LegacyConfigDeprecationFactory
82-
) => LegacyConfigDeprecation[] | Promise<LegacyConfigDeprecation[]>;
83-
8454
/**
8555
* @internal
8656
* @deprecated
@@ -97,7 +67,6 @@ export interface LegacyPluginSpec {
9767
getId: () => unknown;
9868
getExpectedKibanaVersion: () => string;
9969
getConfigPrefix: () => string;
100-
getDeprecationsProvider: () => LegacyConfigDeprecationProvider | undefined;
10170
getPack: () => LegacyPluginPack;
10271
}
10372

src/core/server/server.api.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,11 +2949,11 @@ export const validBodyOutput: readonly ["data", "stream"];
29492949
// Warnings were encountered during analysis:
29502950
//
29512951
// src/core/server/http/router/response.ts:316:3 - (ae-forgotten-export) The symbol "KibanaResponse" needs to be exported by the entry point index.d.ts
2952-
// src/core/server/legacy/types.ts:163:3 - (ae-forgotten-export) The symbol "VarsProvider" needs to be exported by the entry point index.d.ts
2953-
// src/core/server/legacy/types.ts:164:3 - (ae-forgotten-export) The symbol "VarsReplacer" needs to be exported by the entry point index.d.ts
2954-
// src/core/server/legacy/types.ts:165:3 - (ae-forgotten-export) The symbol "LegacyNavLinkSpec" needs to be exported by the entry point index.d.ts
2955-
// src/core/server/legacy/types.ts:166:3 - (ae-forgotten-export) The symbol "LegacyAppSpec" needs to be exported by the entry point index.d.ts
2956-
// src/core/server/legacy/types.ts:167:16 - (ae-forgotten-export) The symbol "LegacyPluginSpec" needs to be exported by the entry point index.d.ts
2952+
// src/core/server/legacy/types.ts:132:3 - (ae-forgotten-export) The symbol "VarsProvider" needs to be exported by the entry point index.d.ts
2953+
// src/core/server/legacy/types.ts:133:3 - (ae-forgotten-export) The symbol "VarsReplacer" needs to be exported by the entry point index.d.ts
2954+
// src/core/server/legacy/types.ts:134:3 - (ae-forgotten-export) The symbol "LegacyNavLinkSpec" needs to be exported by the entry point index.d.ts
2955+
// src/core/server/legacy/types.ts:135:3 - (ae-forgotten-export) The symbol "LegacyAppSpec" needs to be exported by the entry point index.d.ts
2956+
// src/core/server/legacy/types.ts:136:16 - (ae-forgotten-export) The symbol "LegacyPluginSpec" needs to be exported by the entry point index.d.ts
29572957
// src/core/server/plugins/types.ts:266:3 - (ae-forgotten-export) The symbol "KibanaConfigType" needs to be exported by the entry point index.d.ts
29582958
// src/core/server/plugins/types.ts:266:3 - (ae-forgotten-export) The symbol "SharedGlobalConfigKeys" needs to be exported by the entry point index.d.ts
29592959
// src/core/server/plugins/types.ts:268:3 - (ae-forgotten-export) The symbol "PathConfigType" needs to be exported by the entry point index.d.ts

0 commit comments

Comments
 (0)