mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Migrates core's client-side deprecations service to packages (#136164)
* Creates packages for shared types: core-deprecations-common and core-deprecations-common-internal, moves types accordingly, updates src/core/public|server imports * Moves more internal types to package * Changes widely used internal deprecations-related types to public types, moves these to publically accessible packages * Updates import, updates bazel build file * Creates package core-deprecations-browser-internal and moves implementation and tests into package * Updates imports of public deprecations implementations * Creates package core-deprecations-browser-mocks, moves mock and deletes core-deprecations-common-internal * Updates types in src/core * Updates README's and build bazel files for core's client-side deprecations service * Updates imports * exports shared DeprecationsDetails from core/server * Adds deprecations to i18n rc * replace targetted core packages with top level packages for core in i18nrc file, cleans up tsconfig and bazel build files, addresses prefered style in core
This commit is contained in:
parent
f074c397c5
commit
318530ef54
49 changed files with 874 additions and 171 deletions
|
@ -9,8 +9,7 @@
|
|||
"console": "src/plugins/console",
|
||||
"core": [
|
||||
"src/core",
|
||||
"packages/core/i18n/core-i18n-browser-internal",
|
||||
"packages/core/fatal-errors/core-fatal-errors-browser-internal"
|
||||
"packages/core"
|
||||
],
|
||||
"customIntegrations": "src/plugins/custom_integrations",
|
||||
"dashboard": "src/plugins/dashboard",
|
||||
|
|
|
@ -158,6 +158,10 @@
|
|||
"@kbn/core-base-server-mocks": "link:bazel-bin/packages/core/base/core-base-server-mocks",
|
||||
"@kbn/core-config-server-internal": "link:bazel-bin/packages/core/config/core-config-server-internal",
|
||||
"@kbn/core-config-server-mocks": "link:bazel-bin/packages/core/config/core-config-server-mocks",
|
||||
"@kbn/core-deprecations-browser": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser",
|
||||
"@kbn/core-deprecations-browser-internal": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser-internal",
|
||||
"@kbn/core-deprecations-browser-mocks": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser-mocks",
|
||||
"@kbn/core-deprecations-common": "link:bazel-bin/packages/core/deprecations/core-deprecations-common",
|
||||
"@kbn/core-doc-links-browser": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser",
|
||||
"@kbn/core-doc-links-browser-internal": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal",
|
||||
"@kbn/core-doc-links-browser-mocks": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-mocks",
|
||||
|
@ -730,6 +734,10 @@
|
|||
"@types/kbn__core-common-internal-base": "link:bazel-bin/packages/core/common/internal-base/npm_module_types",
|
||||
"@types/kbn__core-config-server-internal": "link:bazel-bin/packages/core/config/core-config-server-internal/npm_module_types",
|
||||
"@types/kbn__core-config-server-mocks": "link:bazel-bin/packages/core/config/core-config-server-mocks/npm_module_types",
|
||||
"@types/kbn__core-deprecations-browser": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser/npm_module_types",
|
||||
"@types/kbn__core-deprecations-browser-internal": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser-internal/npm_module_types",
|
||||
"@types/kbn__core-deprecations-browser-mocks": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser-mocks/npm_module_types",
|
||||
"@types/kbn__core-deprecations-common": "link:bazel-bin/packages/core/deprecations/core-deprecations-common/npm_module_types",
|
||||
"@types/kbn__core-doc-links-browser": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser/npm_module_types",
|
||||
"@types/kbn__core-doc-links-browser-internal": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal/npm_module_types",
|
||||
"@types/kbn__core-doc-links-browser-mocks": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-mocks/npm_module_types",
|
||||
|
|
|
@ -27,6 +27,10 @@ filegroup(
|
|||
"//packages/core/base/core-base-server-internal:build",
|
||||
"//packages/core/base/core-base-server-mocks:build",
|
||||
"//packages/core/config/core-config-server-internal:build",
|
||||
"//packages/core/deprecations/core-deprecations-browser-internal:build",
|
||||
"//packages/core/deprecations/core-deprecations-browser-mocks:build",
|
||||
"//packages/core/deprecations/core-deprecations-browser:build",
|
||||
"//packages/core/deprecations/core-deprecations-common:build",
|
||||
"//packages/core/doc-links/core-doc-links-browser-internal:build",
|
||||
"//packages/core/doc-links/core-doc-links-browser-mocks:build",
|
||||
"//packages/core/doc-links/core-doc-links-browser:build",
|
||||
|
@ -224,6 +228,10 @@ filegroup(
|
|||
"//packages/core/base/core-base-server-internal:build_types",
|
||||
"//packages/core/base/core-base-server-mocks:build_types",
|
||||
"//packages/core/config/core-config-server-internal:build_types",
|
||||
"//packages/core/deprecations/core-deprecations-browser-internal:build_types",
|
||||
"//packages/core/deprecations/core-deprecations-browser-mocks:build_types",
|
||||
"//packages/core/deprecations/core-deprecations-browser:build_types",
|
||||
"//packages/core/deprecations/core-deprecations-common:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-browser-internal:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-browser-mocks:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-browser:build_types",
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
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-deprecations-browser-internal"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-deprecations-browser-internal"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/kbn-i18n",
|
||||
"//packages/core/http/core-http-browser-mocks",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/react",
|
||||
"//packages/kbn-i18n:npm_module_types",
|
||||
"//packages/core/base/core-base-browser-internal:npm_module_types",
|
||||
"//packages/core/http/core-http-browser:npm_module_types",
|
||||
"//packages/core/http/core-http-browser-mocks:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-common:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-browser:npm_module_types"
|
||||
]
|
||||
|
||||
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,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
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"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-deprecations-browser-internal
|
||||
|
||||
Contains implementation and internal types for Core's client-side `deprecations` service
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* 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/deprecations/core-deprecations-browser-internal'],
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-deprecations-browser-internal",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"browser": "./target_web/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { httpServiceMock } from '@kbn/core-http-browser-mocks';
|
||||
import { DeprecationsClient } from './deprecations_client';
|
||||
import type { DomainDeprecationDetails } from '../../server/types';
|
||||
import type { DomainDeprecationDetails } from '@kbn/core-deprecations-common';
|
||||
|
||||
describe('DeprecationsClient', () => {
|
||||
const http = httpServiceMock.createSetupContract();
|
|
@ -8,16 +8,17 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import type { HttpStart } from '@kbn/core-http-browser';
|
||||
import type { DomainDeprecationDetails, DeprecationsGetResponse } from '../../server/types';
|
||||
import type {
|
||||
DomainDeprecationDetails,
|
||||
DeprecationsGetResponse,
|
||||
} from '@kbn/core-deprecations-common';
|
||||
import type { ResolveDeprecationResponse } from '@kbn/core-deprecations-browser';
|
||||
|
||||
/* @internal */
|
||||
export interface DeprecationsClientDeps {
|
||||
http: Pick<HttpStart, 'fetch'>;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export type ResolveDeprecationResponse = { status: 'ok' } | { status: 'fail'; reason: string };
|
||||
|
||||
export class DeprecationsClient {
|
||||
private readonly http: Pick<HttpStart, 'fetch'>;
|
||||
constructor({ http }: DeprecationsClientDeps) {
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import type { CoreService } from '@kbn/core-base-browser-internal';
|
||||
import type { DeprecationsServiceStart } from '@kbn/core-deprecations-browser';
|
||||
import type { HttpStart } from '@kbn/core-http-browser';
|
||||
import { DeprecationsClient } from './deprecations_client';
|
||||
|
||||
export class DeprecationsService implements CoreService<void, DeprecationsServiceStart> {
|
||||
public setup(): void {}
|
||||
|
||||
public start({ http }: { http: HttpStart }): DeprecationsServiceStart {
|
||||
const deprecationsClient = new DeprecationsClient({ http });
|
||||
|
||||
return {
|
||||
getAllDeprecations: deprecationsClient.getAllDeprecations,
|
||||
getDeprecations: deprecationsClient.getDeprecations,
|
||||
isDeprecationResolvable: deprecationsClient.isDeprecationResolvable,
|
||||
resolveDeprecation: deprecationsClient.resolveDeprecation,
|
||||
};
|
||||
}
|
||||
|
||||
public stop(): void {}
|
||||
}
|
|
@ -7,5 +7,3 @@
|
|||
*/
|
||||
|
||||
export { DeprecationsService } from './deprecations_service';
|
||||
export type { DeprecationsServiceStart } from './deprecations_service';
|
||||
export type { ResolveDeprecationResponse } from './deprecations_client';
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
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-deprecations-browser-mocks"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-deprecations-browser-mocks"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/core/deprecations/core-deprecations-browser-internal"
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/react",
|
||||
"//packages/kbn-utility-types:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-browser:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-browser-internal:npm_module_types"
|
||||
]
|
||||
|
||||
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,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
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"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-deprecations-browser-mocks
|
||||
|
||||
Contains mocks for Core's client-side `deprecations` service
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* 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/deprecations/core-deprecations-browser-mocks'],
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-deprecations-browser-mocks",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"browser": "./target_web/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -7,8 +7,8 @@
|
|||
*/
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import { DeprecationsService } from './deprecations_service';
|
||||
import type { DeprecationsServiceStart } from './deprecations_service';
|
||||
import { DeprecationsService } from '@kbn/core-deprecations-browser-internal';
|
||||
import type { DeprecationsServiceStart } from '@kbn/core-deprecations-browser';
|
||||
|
||||
const createServiceMock = (): jest.Mocked<DeprecationsServiceStart> => ({
|
||||
getAllDeprecations: jest.fn().mockResolvedValue([]),
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* 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 { deprecationsServiceMock } from './deprecations_service.mock';
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
107
packages/core/deprecations/core-deprecations-browser/BUILD.bazel
Normal file
107
packages/core/deprecations/core-deprecations-browser/BUILD.bazel
Normal file
|
@ -0,0 +1,107 @@
|
|||
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-deprecations-browser"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-deprecations-browser"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/react",
|
||||
"//packages/core/deprecations/core-deprecations-common:npm_module_types"
|
||||
]
|
||||
|
||||
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,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
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"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-deprecations-browser
|
||||
|
||||
Contains public types for Core's client-side `deprecations` service
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* 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/deprecations/core-deprecations-browser'],
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-deprecations-browser",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"browser": "./target_web/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -5,11 +5,8 @@
|
|||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { CoreService } from '@kbn/core-base-browser-internal';
|
||||
import type { HttpStart } from '@kbn/core-http-browser';
|
||||
import { DeprecationsClient, ResolveDeprecationResponse } from './deprecations_client';
|
||||
import type { DomainDeprecationDetails } from '../../server/types';
|
||||
import type { DomainDeprecationDetails } from '@kbn/core-deprecations-common';
|
||||
import type { ResolveDeprecationResponse } from './types';
|
||||
|
||||
/**
|
||||
* DeprecationsService provides methods to fetch domain deprecation details from
|
||||
|
@ -41,20 +38,3 @@ export interface DeprecationsServiceStart {
|
|||
*/
|
||||
resolveDeprecation: (details: DomainDeprecationDetails) => Promise<ResolveDeprecationResponse>;
|
||||
}
|
||||
|
||||
export class DeprecationsService implements CoreService<void, DeprecationsServiceStart> {
|
||||
public setup(): void {}
|
||||
|
||||
public start({ http }: { http: HttpStart }): DeprecationsServiceStart {
|
||||
const deprecationsClient = new DeprecationsClient({ http });
|
||||
|
||||
return {
|
||||
getAllDeprecations: deprecationsClient.getAllDeprecations,
|
||||
getDeprecations: deprecationsClient.getDeprecations,
|
||||
isDeprecationResolvable: deprecationsClient.isDeprecationResolvable,
|
||||
resolveDeprecation: deprecationsClient.resolveDeprecation,
|
||||
};
|
||||
}
|
||||
|
||||
public stop(): void {}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* 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 { DeprecationsServiceStart } from './contracts';
|
||||
export type { ResolveDeprecationResponse } from './types';
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Response from correctiveActions.api call from automatically resolving the deprecation
|
||||
* @public
|
||||
*/
|
||||
export type ResolveDeprecationResponse = { status: 'ok' } | { status: 'fail'; reason: string };
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
106
packages/core/deprecations/core-deprecations-common/BUILD.bazel
Normal file
106
packages/core/deprecations/core-deprecations-common/BUILD.bazel
Normal file
|
@ -0,0 +1,106 @@
|
|||
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-deprecations-common"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-deprecations-common"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
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,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
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"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-deprecations-common
|
||||
|
||||
Contains public shared types for Core's `deprecations` service
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* 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/deprecations/core-deprecations-common'],
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-deprecations-common",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"browser": "./target_web/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* 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 {
|
||||
BaseDeprecationDetails,
|
||||
ConfigDeprecationDetails,
|
||||
FeatureDeprecationDetails,
|
||||
DeprecationsDetails,
|
||||
DomainDeprecationDetails,
|
||||
DeprecationsGetResponse,
|
||||
} from './types';
|
107
packages/core/deprecations/core-deprecations-common/src/types.ts
Normal file
107
packages/core/deprecations/core-deprecations-common/src/types.ts
Normal file
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base properties shared by all types of deprecations
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface BaseDeprecationDetails {
|
||||
/**
|
||||
* The title of the deprecation.
|
||||
* Check the README for writing deprecations in `src/core/server/deprecations/README.mdx`
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* The description message to be displayed for the deprecation.
|
||||
* Check the README for writing deprecations in `src/core/server/deprecations/README.mdx`
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* levels:
|
||||
* - warning: will not break deployment upon upgrade
|
||||
* - critical: needs to be addressed before upgrade.
|
||||
* - fetch_error: Deprecations service failed to grab the deprecation details for the domain.
|
||||
*/
|
||||
level: 'warning' | 'critical' | 'fetch_error';
|
||||
/**
|
||||
* (optional) Used to identify between different deprecation types.
|
||||
* Example use case: in Upgrade Assistant, we may want to allow the user to sort by
|
||||
* deprecation type or show each type in a separate tab.
|
||||
*
|
||||
* Feel free to add new types if necessary.
|
||||
* Predefined types are necessary to reduce having similar definitions with different keywords
|
||||
* across kibana deprecations.
|
||||
*/
|
||||
deprecationType?: 'config' | 'feature';
|
||||
/** (optional) link to the documentation for more details on the deprecation. */
|
||||
documentationUrl?: string;
|
||||
/** (optional) specify the fix for this deprecation requires a full kibana restart. */
|
||||
requireRestart?: boolean;
|
||||
/** corrective action needed to fix this deprecation. */
|
||||
correctiveActions: {
|
||||
/**
|
||||
* (optional) The api to be called to automatically fix the deprecation
|
||||
* Each domain should implement a POST/PUT route for their plugin to
|
||||
* handle their deprecations.
|
||||
*/
|
||||
api?: {
|
||||
/** Kibana route path. Passing a query string is allowed */
|
||||
path: string;
|
||||
/** Kibana route method: 'POST' or 'PUT'. */
|
||||
method: 'POST' | 'PUT';
|
||||
/** Additional details to be passed to the route. */
|
||||
body?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/* Allow to omit context in the request of the body */
|
||||
omitContextFromBody?: boolean;
|
||||
};
|
||||
/**
|
||||
* Specify a list of manual steps users need to follow to
|
||||
* fix the deprecation before upgrade. Required even if an API
|
||||
* corrective action is set in case the API fails.
|
||||
* Check the README for writing deprecations in `src/core/server/deprecations/README.mdx`
|
||||
*/
|
||||
manualSteps: string[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface ConfigDeprecationDetails extends BaseDeprecationDetails {
|
||||
configPath: string;
|
||||
deprecationType: 'config';
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface FeatureDeprecationDetails extends BaseDeprecationDetails {
|
||||
deprecationType?: 'feature' | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type DeprecationsDetails = ConfigDeprecationDetails | FeatureDeprecationDetails;
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type DomainDeprecationDetails = DeprecationsDetails & {
|
||||
domainId: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface DeprecationsGetResponse {
|
||||
deprecations: DomainDeprecationDetails[];
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -23,6 +23,7 @@ import { ExecutionContextService } from '@kbn/core-execution-context-browser-int
|
|||
import type { FatalErrorsSetup } from '@kbn/core-fatal-errors-browser';
|
||||
import { FatalErrorsService } from '@kbn/core-fatal-errors-browser-internal';
|
||||
import { HttpService } from '@kbn/core-http-browser-internal';
|
||||
import { DeprecationsService } from '@kbn/core-deprecations-browser-internal';
|
||||
import { CoreSetup, CoreStart } from '.';
|
||||
import { ChromeService } from './chrome';
|
||||
import { NotificationsService } from './notifications';
|
||||
|
@ -33,7 +34,6 @@ import { ApplicationService } from './application';
|
|||
import { RenderingService } from './rendering';
|
||||
import { SavedObjectsService } from './saved_objects';
|
||||
import { IntegrationsService } from './integrations';
|
||||
import { DeprecationsService } from './deprecations';
|
||||
import { CoreApp } from './core_app';
|
||||
import type { InternalApplicationSetup, InternalApplicationStart } from './application/types';
|
||||
import { fetchOptionalMemoryInfo } from './fetch_optional_memory_info';
|
||||
|
|
|
@ -42,6 +42,7 @@ import type {
|
|||
FatalErrorsStart,
|
||||
FatalErrorInfo,
|
||||
} from '@kbn/core-fatal-errors-browser';
|
||||
import type { DeprecationsServiceStart } from '@kbn/core-deprecations-browser';
|
||||
import type {
|
||||
ChromeBadge,
|
||||
ChromeBreadcrumb,
|
||||
|
@ -75,10 +76,9 @@ import type {
|
|||
import type { UiSettingsState, IUiSettingsClient } from './ui_settings';
|
||||
import type { ApplicationSetup, Capabilities, ApplicationStart } from './application';
|
||||
import type { SavedObjectsStart } from './saved_objects';
|
||||
import type { DeprecationsServiceStart } from './deprecations';
|
||||
|
||||
export type { PackageInfo, EnvironmentMode } from '@kbn/config';
|
||||
export type { DomainDeprecationDetails } from '../server/types';
|
||||
export type { DomainDeprecationDetails } from '@kbn/core-deprecations-common';
|
||||
export type { CoreContext } from '@kbn/core-base-browser-internal';
|
||||
export type { CoreSystem } from './core_system';
|
||||
export { DEFAULT_APP_CATEGORIES, APP_WRAPPER_CLASS } from '../utils';
|
||||
|
@ -210,7 +210,10 @@ export type {
|
|||
|
||||
export type { ThemeServiceSetup, ThemeServiceStart, CoreTheme } from '@kbn/core-theme-browser';
|
||||
|
||||
export type { DeprecationsServiceStart, ResolveDeprecationResponse } from './deprecations';
|
||||
export type {
|
||||
DeprecationsServiceStart,
|
||||
ResolveDeprecationResponse,
|
||||
} from '@kbn/core-deprecations-browser';
|
||||
|
||||
export type { MountPoint, UnmountCallback, PublicUiSettingsParams } from './types';
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import { executionContextServiceMock } from '@kbn/core-execution-context-browser
|
|||
import { i18nServiceMock } from '@kbn/core-i18n-browser-mocks';
|
||||
import { fatalErrorsServiceMock } from '@kbn/core-fatal-errors-browser-mocks';
|
||||
import { httpServiceMock } from '@kbn/core-http-browser-mocks';
|
||||
import { deprecationsServiceMock } from '@kbn/core-deprecations-browser-mocks';
|
||||
import type { PluginInitializerContext, AppMountParameters } from '.';
|
||||
// Import values from their individual modules instead.
|
||||
import { ScopedHistory } from './application';
|
||||
|
@ -26,7 +27,6 @@ import { notificationServiceMock } from './notifications/notifications_service.m
|
|||
import { overlayServiceMock } from './overlays/overlay_service.mock';
|
||||
import { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock';
|
||||
import { savedObjectsServiceMock } from './saved_objects/saved_objects_service.mock';
|
||||
import { deprecationsServiceMock } from './deprecations/deprecations_service.mock';
|
||||
|
||||
export { injectedMetadataServiceMock } from '@kbn/core-injected-metadata-browser-mocks';
|
||||
export { docLinksServiceMock } from '@kbn/core-doc-links-browser-mocks';
|
||||
|
@ -43,7 +43,7 @@ export { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock';
|
|||
export { savedObjectsServiceMock } from './saved_objects/saved_objects_service.mock';
|
||||
export { scopedHistoryMock } from './application/scoped_history.mock';
|
||||
export { applicationServiceMock } from './application/application_service.mock';
|
||||
export { deprecationsServiceMock } from './deprecations/deprecations_service.mock';
|
||||
export { deprecationsServiceMock } from '@kbn/core-deprecations-browser-mocks';
|
||||
|
||||
function createCoreSetupMock({
|
||||
basePath = '',
|
||||
|
|
|
@ -38,7 +38,7 @@ import { uiSettingsServiceMock } from '../ui_settings/ui_settings_service.mock';
|
|||
import { httpServiceMock } from '@kbn/core-http-browser-mocks';
|
||||
import type { CoreSetup, CoreStart, PluginInitializerContext } from '..';
|
||||
import { savedObjectsServiceMock } from '../saved_objects/saved_objects_service.mock';
|
||||
import { deprecationsServiceMock } from '../deprecations/deprecations_service.mock';
|
||||
import { deprecationsServiceMock } from '@kbn/core-deprecations-browser-mocks';
|
||||
|
||||
export let mockPluginInitializers: Map<PluginName, MockedPluginInitializer>;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import type { GetDeprecationsContext } from './types';
|
||||
import { DeprecationsFactory, DeprecationsFactoryConfig } from './deprecations_factory';
|
||||
import { loggerMock } from '@kbn/logging-mocks';
|
||||
import { DeprecationsDetails } from './types';
|
||||
import type { DeprecationsDetails } from '@kbn/core-deprecations-common';
|
||||
|
||||
describe('DeprecationsFactory', () => {
|
||||
let logger: ReturnType<typeof loggerMock.create>;
|
||||
|
|
|
@ -8,12 +8,9 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import type { Logger } from '@kbn/logging';
|
||||
import type { DomainDeprecationDetails, DeprecationsDetails } from '@kbn/core-deprecations-common';
|
||||
import { DeprecationsRegistry } from './deprecations_registry';
|
||||
import type {
|
||||
DomainDeprecationDetails,
|
||||
DeprecationsDetails,
|
||||
GetDeprecationsContext,
|
||||
} from './types';
|
||||
import type { GetDeprecationsContext } from './types';
|
||||
|
||||
export interface DeprecationsFactoryDeps {
|
||||
logger: Logger;
|
||||
|
|
|
@ -7,12 +7,8 @@
|
|||
*/
|
||||
|
||||
import { withTimeout, isPromise } from '@kbn/std';
|
||||
import type {
|
||||
DeprecationsDetails,
|
||||
RegisterDeprecationsConfig,
|
||||
GetDeprecationsContext,
|
||||
} from './types';
|
||||
|
||||
import type { DeprecationsDetails } from '@kbn/core-deprecations-common';
|
||||
import type { RegisterDeprecationsConfig, GetDeprecationsContext } from './types';
|
||||
const MsInSec = 1000;
|
||||
|
||||
export class DeprecationsRegistry {
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
*/
|
||||
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
|
||||
import type { Logger } from '@kbn/logging';
|
||||
import type { IConfigService } from '@kbn/config';
|
||||
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
|
||||
import { DomainDeprecationDetails } from '@kbn/core-deprecations-common';
|
||||
import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal';
|
||||
import { DeprecationsFactory } from './deprecations_factory';
|
||||
import { DomainDeprecationDetails, RegisterDeprecationsConfig } from './types';
|
||||
import { RegisterDeprecationsConfig } from './types';
|
||||
import { registerRoutes } from './routes';
|
||||
import { config as deprecationConfig, DeprecationConfigType } from './deprecation_config';
|
||||
import { IScopedClusterClient } from '../elasticsearch/client';
|
||||
|
|
|
@ -6,15 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export type {
|
||||
BaseDeprecationDetails,
|
||||
DeprecationsDetails,
|
||||
ConfigDeprecationDetails,
|
||||
FeatureDeprecationDetails,
|
||||
GetDeprecationsContext,
|
||||
RegisterDeprecationsConfig,
|
||||
DeprecationsGetResponse,
|
||||
} from './types';
|
||||
export type { GetDeprecationsContext, RegisterDeprecationsConfig } from './types';
|
||||
|
||||
export type {
|
||||
DeprecationsServiceSetup,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { DeprecationsGetResponse } from '../types';
|
||||
import type { DeprecationsGetResponse } from '@kbn/core-deprecations-common';
|
||||
import type { InternalDeprecationRouter } from '../internal_types';
|
||||
|
||||
export const registerGetRoute = (router: InternalDeprecationRouter) => {
|
||||
|
|
|
@ -7,102 +7,10 @@
|
|||
*/
|
||||
|
||||
import type { MaybePromise } from '@kbn/utility-types';
|
||||
import type { DeprecationsDetails } from '@kbn/core-deprecations-common';
|
||||
import type { SavedObjectsClientContract } from '../saved_objects/types';
|
||||
import type { IScopedClusterClient } from '../elasticsearch';
|
||||
|
||||
/**
|
||||
* Base properties shared by all types of deprecations
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface BaseDeprecationDetails {
|
||||
/**
|
||||
* The title of the deprecation.
|
||||
* Check the README for writing deprecations in `src/core/server/deprecations/README.mdx`
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* The description message to be displayed for the deprecation.
|
||||
* Check the README for writing deprecations in `src/core/server/deprecations/README.mdx`
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* levels:
|
||||
* - warning: will not break deployment upon upgrade
|
||||
* - critical: needs to be addressed before upgrade.
|
||||
* - fetch_error: Deprecations service failed to grab the deprecation details for the domain.
|
||||
*/
|
||||
level: 'warning' | 'critical' | 'fetch_error';
|
||||
/**
|
||||
* (optional) Used to identify between different deprecation types.
|
||||
* Example use case: in Upgrade Assistant, we may want to allow the user to sort by
|
||||
* deprecation type or show each type in a separate tab.
|
||||
*
|
||||
* Feel free to add new types if necessary.
|
||||
* Predefined types are necessary to reduce having similar definitions with different keywords
|
||||
* across kibana deprecations.
|
||||
*/
|
||||
deprecationType?: 'config' | 'feature';
|
||||
/** (optional) link to the documentation for more details on the deprecation. */
|
||||
documentationUrl?: string;
|
||||
/** (optional) specify the fix for this deprecation requires a full kibana restart. */
|
||||
requireRestart?: boolean;
|
||||
/** corrective action needed to fix this deprecation. */
|
||||
correctiveActions: {
|
||||
/**
|
||||
* (optional) The api to be called to automatically fix the deprecation
|
||||
* Each domain should implement a POST/PUT route for their plugin to
|
||||
* handle their deprecations.
|
||||
*/
|
||||
api?: {
|
||||
/** Kibana route path. Passing a query string is allowed */
|
||||
path: string;
|
||||
/** Kibana route method: 'POST' or 'PUT'. */
|
||||
method: 'POST' | 'PUT';
|
||||
/** Additional details to be passed to the route. */
|
||||
body?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/* Allow to omit context in the request of the body */
|
||||
omitContextFromBody?: boolean;
|
||||
};
|
||||
/**
|
||||
* Specify a list of manual steps users need to follow to
|
||||
* fix the deprecation before upgrade. Required even if an API
|
||||
* corrective action is set in case the API fails.
|
||||
* Check the README for writing deprecations in `src/core/server/deprecations/README.mdx`
|
||||
*/
|
||||
manualSteps: string[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface ConfigDeprecationDetails extends BaseDeprecationDetails {
|
||||
configPath: string;
|
||||
deprecationType: 'config';
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface FeatureDeprecationDetails extends BaseDeprecationDetails {
|
||||
deprecationType?: 'feature' | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type DeprecationsDetails = ConfigDeprecationDetails | FeatureDeprecationDetails;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type DomainDeprecationDetails = DeprecationsDetails & {
|
||||
domainId: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
|
@ -117,10 +25,3 @@ export interface GetDeprecationsContext {
|
|||
esClient: IScopedClusterClient;
|
||||
savedObjectsClient: SavedObjectsClientContract;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface DeprecationsGetResponse {
|
||||
deprecations: DomainDeprecationDetails[];
|
||||
}
|
||||
|
|
|
@ -405,17 +405,13 @@ export { EventLoopDelaysMonitor } from './metrics';
|
|||
|
||||
export type { I18nServiceSetup } from './i18n';
|
||||
export type {
|
||||
BaseDeprecationDetails,
|
||||
DeprecationsDetails,
|
||||
ConfigDeprecationDetails,
|
||||
FeatureDeprecationDetails,
|
||||
RegisterDeprecationsConfig,
|
||||
GetDeprecationsContext,
|
||||
DeprecationsServiceSetup,
|
||||
DeprecationsClient,
|
||||
DeprecationsRequestHandlerContext,
|
||||
} from './deprecations';
|
||||
|
||||
export type { DeprecationsDetails } from '@kbn/core-deprecations-common';
|
||||
export type { AppCategory } from '../types';
|
||||
export { DEFAULT_APP_CATEGORIES, APP_WRAPPER_CLASS } from '../utils';
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import type { DeprecationsDetails } from '../../deprecations';
|
||||
import type { DeprecationsDetails } from '@kbn/core-deprecations-common';
|
||||
import { IScopedClusterClient } from '../../elasticsearch';
|
||||
import { getAggregatedTypesDocuments } from '../migrations/actions/check_for_unknown_docs';
|
||||
import { addExcludedTypesToBoolQuery } from '../migrations/model/helpers';
|
||||
|
|
|
@ -42,6 +42,9 @@ export type {
|
|||
SavedObjectReferenceWithContext,
|
||||
SavedObjectsCollectMultiNamespaceReferencesResponse,
|
||||
} from './saved_objects/service';
|
||||
export type { DomainDeprecationDetails, DeprecationsGetResponse } from './deprecations/types';
|
||||
export type {
|
||||
DomainDeprecationDetails,
|
||||
DeprecationsGetResponse,
|
||||
} from '@kbn/core-deprecations-common';
|
||||
export * from './ui_settings/types';
|
||||
export type { ExternalUrlConfig } from '@kbn/core-http-server-internal';
|
||||
|
|
32
yarn.lock
32
yarn.lock
|
@ -3104,6 +3104,22 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-deprecations-browser-internal@link:bazel-bin/packages/core/deprecations/core-deprecations-browser-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-deprecations-browser-mocks@link:bazel-bin/packages/core/deprecations/core-deprecations-browser-mocks":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-deprecations-browser@link:bazel-bin/packages/core/deprecations/core-deprecations-browser":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-deprecations-common@link:bazel-bin/packages/core/deprecations/core-deprecations-common":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-doc-links-browser-internal@link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
@ -6723,6 +6739,22 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-deprecations-browser-internal@link:bazel-bin/packages/core/deprecations/core-deprecations-browser-internal/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-deprecations-browser-mocks@link:bazel-bin/packages/core/deprecations/core-deprecations-browser-mocks/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-deprecations-browser@link:bazel-bin/packages/core/deprecations/core-deprecations-browser/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-deprecations-common@link:bazel-bin/packages/core/deprecations/core-deprecations-common/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-doc-links-browser-internal@link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue