mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Remove InjectedMetadata
browser-side public contract (#147840)
## Summary Fix https://github.com/elastic/kibana/issues/147721 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
b62a41e47f
commit
69272653b3
23 changed files with 3 additions and 264 deletions
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -779,7 +779,6 @@ packages/core/i18n/core-i18n-browser-mocks @elastic/kibana-core
|
|||
packages/core/i18n/core-i18n-server @elastic/kibana-core
|
||||
packages/core/i18n/core-i18n-server-internal @elastic/kibana-core
|
||||
packages/core/i18n/core-i18n-server-mocks @elastic/kibana-core
|
||||
packages/core/injected-metadata/core-injected-metadata-browser @elastic/kibana-core
|
||||
packages/core/injected-metadata/core-injected-metadata-browser-internal @elastic/kibana-core
|
||||
packages/core/injected-metadata/core-injected-metadata-browser-mocks @elastic/kibana-core
|
||||
packages/core/injected-metadata/core-injected-metadata-common-internal @elastic/kibana-core
|
||||
|
|
|
@ -232,7 +232,6 @@
|
|||
"@kbn/core-i18n-server": "link:bazel-bin/packages/core/i18n/core-i18n-server",
|
||||
"@kbn/core-i18n-server-internal": "link:bazel-bin/packages/core/i18n/core-i18n-server-internal",
|
||||
"@kbn/core-i18n-server-mocks": "link:bazel-bin/packages/core/i18n/core-i18n-server-mocks",
|
||||
"@kbn/core-injected-metadata-browser": "link:bazel-bin/packages/core/injected-metadata/core-injected-metadata-browser",
|
||||
"@kbn/core-injected-metadata-browser-internal": "link:bazel-bin/packages/core/injected-metadata/core-injected-metadata-browser-internal",
|
||||
"@kbn/core-injected-metadata-browser-mocks": "link:bazel-bin/packages/core/injected-metadata/core-injected-metadata-browser-mocks",
|
||||
"@kbn/core-injected-metadata-common-internal": "link:bazel-bin/packages/core/injected-metadata/core-injected-metadata-common-internal",
|
||||
|
|
|
@ -98,7 +98,6 @@ filegroup(
|
|||
"//packages/core/i18n/core-i18n-server:build",
|
||||
"//packages/core/i18n/core-i18n-server-internal:build",
|
||||
"//packages/core/i18n/core-i18n-server-mocks:build",
|
||||
"//packages/core/injected-metadata/core-injected-metadata-browser:build",
|
||||
"//packages/core/injected-metadata/core-injected-metadata-browser-internal:build",
|
||||
"//packages/core/injected-metadata/core-injected-metadata-browser-mocks:build",
|
||||
"//packages/core/injected-metadata/core-injected-metadata-common-internal:build",
|
||||
|
@ -476,7 +475,6 @@ filegroup(
|
|||
"//packages/core/i18n/core-i18n-server:build_types",
|
||||
"//packages/core/i18n/core-i18n-server-internal:build_types",
|
||||
"//packages/core/i18n/core-i18n-server-mocks:build_types",
|
||||
"//packages/core/injected-metadata/core-injected-metadata-browser:build_types",
|
||||
"//packages/core/injected-metadata/core-injected-metadata-browser-internal:build_types",
|
||||
"//packages/core/injected-metadata/core-injected-metadata-browser-mocks:build_types",
|
||||
"//packages/core/injected-metadata/core-injected-metadata-common-internal:build_types",
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_config")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
|
||||
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
|
||||
|
||||
PKG_DIRNAME = "core-injected-metadata-browser"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-injected-metadata-browser"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.config.js",
|
||||
"**/*.mock.*",
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
"**/__snapshots__/**",
|
||||
"**/integration_tests/**",
|
||||
"**/scripts/**",
|
||||
"**/storybook/**",
|
||||
"**/test_fixtures/**",
|
||||
"**/test_helpers/**",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
# In this array place runtime dependencies, including other packages and NPM packages
|
||||
# which must be available for this code to run.
|
||||
#
|
||||
# To reference other packages use:
|
||||
# "//repo/relative/path/to/package"
|
||||
# eg. "//packages/kbn-utils"
|
||||
#
|
||||
# To reference a NPM package use:
|
||||
# "@npm//name-of-package"
|
||||
# eg. "@npm//lodash"
|
||||
RUNTIME_DEPS = [
|
||||
"@npm//react"
|
||||
]
|
||||
|
||||
# In this array place dependencies necessary to build the types, which will include the
|
||||
# :npm_module_types target of other packages and packages from NPM, including @types/*
|
||||
# packages.
|
||||
#
|
||||
# To reference the types for another package use:
|
||||
# "//repo/relative/path/to/package:npm_module_types"
|
||||
# eg. "//packages/kbn-utils:npm_module_types"
|
||||
#
|
||||
# References to NPM packages work the same as RUNTIME_DEPS
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/react"
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_web",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
web = True,
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = "npm_module_types",
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "build_types",
|
||||
deps = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -1,3 +0,0 @@
|
|||
# @kbn/core-injected-metadata-browser
|
||||
|
||||
This package contains the browser public types for the injectedMedata core service.
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export type { InjectedMetadataStart, InjectedMetadataSetup } from './src/contract';
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/injected-metadata/core-injected-metadata-browser'],
|
||||
};
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/core-injected-metadata-browser",
|
||||
"owner": "@elastic/kibana-core",
|
||||
"runtimeDeps": [],
|
||||
"typeDeps": []
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"name": "@kbn/core-injected-metadata-browser",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"browser": "./target_web/index.js",
|
||||
"author": "Kibana Core",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"types": "./target_types/index.d.ts"
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
/**
|
||||
* exposed temporarily until https://github.com/elastic/kibana/issues/41990 done
|
||||
* use *only* to retrieve config values. There is no way to set injected values
|
||||
* in the new platform.
|
||||
* @public
|
||||
* @deprecated
|
||||
* @removeBy 8.8.0
|
||||
*/
|
||||
export interface InjectedMetadataSetup {
|
||||
getInjectedVar: (name: string, defaultValue?: any) => unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* exposed temporarily until https://github.com/elastic/kibana/issues/41990 done
|
||||
* use *only* to retrieve config values. There is no way to set injected values
|
||||
* in the new platform.
|
||||
* @public
|
||||
* @deprecated
|
||||
* @removeBy 8.8.0
|
||||
*/
|
||||
export interface InjectedMetadataStart {
|
||||
getInjectedVar: (name: string, defaultValue?: any) => unknown;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"types": [
|
||||
"jest",
|
||||
"node",
|
||||
"react"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts"
|
||||
]
|
||||
}
|
|
@ -36,7 +36,6 @@ NPM_MODULE_EXTRA_FILES = [
|
|||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/core/injected-metadata/core-injected-metadata-browser-mocks",
|
||||
"//packages/core/doc-links/core-doc-links-browser-mocks",
|
||||
"//packages/core/theme/core-theme-browser-mocks",
|
||||
"//packages/core/analytics/core-analytics-browser-mocks",
|
||||
|
@ -56,7 +55,6 @@ RUNTIME_DEPS = [
|
|||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/core/injected-metadata/core-injected-metadata-browser-mocks:npm_module_types",
|
||||
"//packages/core/doc-links/core-doc-links-browser-mocks:npm_module_types",
|
||||
"//packages/core/theme/core-theme-browser-mocks:npm_module_types",
|
||||
"//packages/core/analytics/core-analytics-browser-mocks:npm_module_types",
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { injectedMetadataServiceMock } from '@kbn/core-injected-metadata-browser-mocks';
|
||||
import { docLinksServiceMock } from '@kbn/core-doc-links-browser-mocks';
|
||||
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
|
||||
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
|
||||
|
@ -42,9 +41,6 @@ export function createCoreSetupMock({
|
|||
uiSettings: uiSettingsServiceMock.createSetupContract(),
|
||||
settings: settingsServiceMock.createSetupContract(),
|
||||
deprecations: deprecationsServiceMock.createSetupContract(),
|
||||
injectedMetadata: {
|
||||
getInjectedVar: injectedMetadataServiceMock.createSetupContract().getInjectedVar,
|
||||
},
|
||||
theme: themeServiceMock.createSetupContract(),
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { injectedMetadataServiceMock } from '@kbn/core-injected-metadata-browser-mocks';
|
||||
import { docLinksServiceMock } from '@kbn/core-doc-links-browser-mocks';
|
||||
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
|
||||
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
|
||||
|
@ -38,9 +37,6 @@ export function createCoreStartMock({ basePath = '' } = {}) {
|
|||
savedObjects: savedObjectsServiceMock.createStartContract(),
|
||||
deprecations: deprecationsServiceMock.createStartContract(),
|
||||
theme: themeServiceMock.createStartContract(),
|
||||
injectedMetadata: {
|
||||
getInjectedVar: injectedMetadataServiceMock.createStartContract().getInjectedVar,
|
||||
},
|
||||
fatalErrors: fatalErrorsServiceMock.createStartContract(),
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ RUNTIME_DEPS = [
|
|||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/core/injected-metadata/core-injected-metadata-browser:npm_module_types",
|
||||
"//packages/core/theme/core-theme-browser:npm_module_types",
|
||||
"//packages/core/analytics/core-analytics-browser:npm_module_types",
|
||||
"//packages/core/execution-context/core-execution-context-browser:npm_module_types",
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { InjectedMetadataSetup } from '@kbn/core-injected-metadata-browser';
|
||||
import type { ThemeServiceSetup } from '@kbn/core-theme-browser';
|
||||
import type { AnalyticsServiceSetup } from '@kbn/core-analytics-browser';
|
||||
import type { ExecutionContextSetup } from '@kbn/core-execution-context-browser';
|
||||
|
@ -49,8 +48,6 @@ export interface CoreSetup<TPluginsStart extends object = object, TStart = unkno
|
|||
settings: SettingsStart;
|
||||
/** {@link ExecutionContextSetup} */
|
||||
executionContext: ExecutionContextSetup;
|
||||
/** {@link InjectedMetadataSetup} */
|
||||
injectedMetadata: InjectedMetadataSetup;
|
||||
/** {@link ThemeServiceSetup} */
|
||||
theme: ThemeServiceSetup;
|
||||
/** {@link StartServicesAccessor} */
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { InjectedMetadataStart } from '@kbn/core-injected-metadata-browser';
|
||||
import type { DocLinksStart } from '@kbn/core-doc-links-browser';
|
||||
import type { ThemeServiceStart } from '@kbn/core-theme-browser';
|
||||
import type { AnalyticsServiceStart } from '@kbn/core-analytics-browser';
|
||||
|
@ -63,6 +62,4 @@ export interface CoreStart {
|
|||
deprecations: DeprecationsServiceStart;
|
||||
/** {@link ThemeServiceStart} */
|
||||
theme: ThemeServiceStart;
|
||||
/** {@link InjectedMetadataStart} */
|
||||
injectedMetadata: InjectedMetadataStart;
|
||||
}
|
||||
|
|
|
@ -80,9 +80,6 @@ export function createPluginSetupContext<
|
|||
notifications: deps.notifications,
|
||||
uiSettings: deps.uiSettings,
|
||||
settings: deps.settings,
|
||||
injectedMetadata: {
|
||||
getInjectedVar: deps.injectedMetadata.getInjectedVar,
|
||||
},
|
||||
theme: deps.theme,
|
||||
getStartServices: () => plugin.startDependencies,
|
||||
};
|
||||
|
@ -128,9 +125,6 @@ export function createPluginStartContext<
|
|||
uiSettings: deps.uiSettings,
|
||||
settings: deps.settings,
|
||||
savedObjects: deps.savedObjects,
|
||||
injectedMetadata: {
|
||||
getInjectedVar: deps.injectedMetadata.getInjectedVar,
|
||||
},
|
||||
fatalErrors: deps.fatalErrors,
|
||||
deprecations: deps.deprecations,
|
||||
theme: deps.theme,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { omit, pick } from 'lodash';
|
||||
import { omit } from 'lodash';
|
||||
|
||||
import {
|
||||
type MockedPluginInitializer,
|
||||
|
@ -98,10 +98,9 @@ describe('PluginsService', () => {
|
|||
theme: themeServiceMock.createSetupContract(),
|
||||
};
|
||||
mockSetupContext = {
|
||||
...mockSetupDeps,
|
||||
...omit(mockSetupDeps, 'injectedMetadata'),
|
||||
application: expect.any(Object),
|
||||
getStartServices: expect.any(Function),
|
||||
injectedMetadata: pick(mockSetupDeps.injectedMetadata, 'getInjectedVar'),
|
||||
};
|
||||
mockStartDeps = {
|
||||
analytics: analyticsServiceMock.createAnalyticsServiceStart(),
|
||||
|
@ -121,10 +120,9 @@ describe('PluginsService', () => {
|
|||
theme: themeServiceMock.createStartContract(),
|
||||
};
|
||||
mockStartContext = {
|
||||
...mockStartDeps,
|
||||
...omit(mockStartDeps, 'injectedMetadata'),
|
||||
application: expect.any(Object),
|
||||
chrome: omit(mockStartDeps.chrome, 'getComponent'),
|
||||
injectedMetadata: pick(mockStartDeps.injectedMetadata, 'getInjectedVar'),
|
||||
};
|
||||
|
||||
// Reset these for each test.
|
||||
|
|
|
@ -184,8 +184,6 @@
|
|||
"@kbn/core-i18n-server-internal/*": ["packages/core/i18n/core-i18n-server-internal/*"],
|
||||
"@kbn/core-i18n-server-mocks": ["packages/core/i18n/core-i18n-server-mocks"],
|
||||
"@kbn/core-i18n-server-mocks/*": ["packages/core/i18n/core-i18n-server-mocks/*"],
|
||||
"@kbn/core-injected-metadata-browser": ["packages/core/injected-metadata/core-injected-metadata-browser"],
|
||||
"@kbn/core-injected-metadata-browser/*": ["packages/core/injected-metadata/core-injected-metadata-browser/*"],
|
||||
"@kbn/core-injected-metadata-browser-internal": ["packages/core/injected-metadata/core-injected-metadata-browser-internal"],
|
||||
"@kbn/core-injected-metadata-browser-internal/*": ["packages/core/injected-metadata/core-injected-metadata-browser-internal/*"],
|
||||
"@kbn/core-injected-metadata-browser-mocks": ["packages/core/injected-metadata/core-injected-metadata-browser-mocks"],
|
||||
|
|
|
@ -82,9 +82,6 @@ export const StorybookContext: React.FC<{ storyContext?: Parameters<DecoratorFn>
|
|||
return <I18nProvider>{children}</I18nProvider>;
|
||||
},
|
||||
},
|
||||
injectedMetadata: {
|
||||
getInjectedVar: () => null,
|
||||
},
|
||||
notifications: getNotifications(),
|
||||
share: getShare(),
|
||||
uiSettings: getUiSettings(),
|
||||
|
|
|
@ -52,7 +52,6 @@ export interface IShims {
|
|||
toastNotifications: NotificationsStart['toasts'];
|
||||
capabilities: ApplicationStart['capabilities'];
|
||||
getBasePath: () => string;
|
||||
getInjected: (name: string, defaultValue?: unknown) => unknown;
|
||||
breadcrumbs: {
|
||||
set: (breadcrumbs: BreadcrumbItem[]) => void;
|
||||
update: (breadcrumbs?: BreadcrumbItem[]) => void;
|
||||
|
@ -91,8 +90,6 @@ export class Legacy {
|
|||
toastNotifications: core.notifications.toasts,
|
||||
capabilities: core.application.capabilities,
|
||||
getBasePath: (): string => core.http.basePath.get(),
|
||||
getInjected: (name: string, defaultValue?: unknown): string | unknown =>
|
||||
core.injectedMetadata.getInjectedVar(name, defaultValue),
|
||||
breadcrumbs: {
|
||||
set: (breadcrumbs: BreadcrumbItem[]) => this._shims.breadcrumbs.update(breadcrumbs),
|
||||
update: (breadcrumbs?: BreadcrumbItem[]) => {
|
||||
|
|
|
@ -3169,10 +3169,6 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-injected-metadata-browser@link:bazel-bin/packages/core/injected-metadata/core-injected-metadata-browser":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-injected-metadata-common-internal@link:bazel-bin/packages/core/injected-metadata/core-injected-metadata-common-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue