mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Migrate server-side deprecation
service to packages (#139789)
* Move files to packages * start fixing usages * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * fix more usages * move mdx files * update READMEs * add author to package files * snake casing Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
a2dbc68e57
commit
980e80b902
44 changed files with 444 additions and 51 deletions
|
@ -176,6 +176,8 @@
|
|||
"@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-deprecations-server": "link:bazel-bin/packages/core/deprecations/core-deprecations-server",
|
||||
"@kbn/core-deprecations-server-internal": "link:bazel-bin/packages/core/deprecations/core-deprecations-server-internal",
|
||||
"@kbn/core-deprecations-server-mocks": "link:bazel-bin/packages/core/deprecations/core-deprecations-server-mocks",
|
||||
"@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",
|
||||
|
@ -851,6 +853,8 @@
|
|||
"@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-deprecations-server": "link:bazel-bin/packages/core/deprecations/core-deprecations-server/npm_module_types",
|
||||
"@types/kbn__core-deprecations-server-internal": "link:bazel-bin/packages/core/deprecations/core-deprecations-server-internal/npm_module_types",
|
||||
"@types/kbn__core-deprecations-server-mocks": "link:bazel-bin/packages/core/deprecations/core-deprecations-server-mocks/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",
|
||||
|
|
|
@ -42,6 +42,8 @@ filegroup(
|
|||
"//packages/core/deprecations/core-deprecations-browser-mocks:build",
|
||||
"//packages/core/deprecations/core-deprecations-common:build",
|
||||
"//packages/core/deprecations/core-deprecations-server:build",
|
||||
"//packages/core/deprecations/core-deprecations-server-internal:build",
|
||||
"//packages/core/deprecations/core-deprecations-server-mocks:build",
|
||||
"//packages/core/doc-links/core-doc-links-browser:build",
|
||||
"//packages/core/doc-links/core-doc-links-browser-internal:build",
|
||||
"//packages/core/doc-links/core-doc-links-browser-mocks:build",
|
||||
|
@ -335,6 +337,8 @@ filegroup(
|
|||
"//packages/core/deprecations/core-deprecations-browser-mocks:build_types",
|
||||
"//packages/core/deprecations/core-deprecations-common:build_types",
|
||||
"//packages/core/deprecations/core-deprecations-server:build_types",
|
||||
"//packages/core/deprecations/core-deprecations-server-internal:build_types",
|
||||
"//packages/core/deprecations/core-deprecations-server-mocks:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-browser:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-browser-internal:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-browser-mocks:build_types",
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
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-server-internal"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-deprecations-server-internal"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.config.js",
|
||||
"**/*.mock.*",
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
"**/__snapshots__/**",
|
||||
"**/integration_tests/**",
|
||||
"**/mocks/**",
|
||||
"**/scripts/**",
|
||||
"**/storybook/**",
|
||||
"**/test_fixtures/**",
|
||||
"**/test_helpers/**",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"@npm//rxjs",
|
||||
"//packages/kbn-i18n",
|
||||
"//packages/kbn-std",
|
||||
### test dependencies
|
||||
"//packages/kbn-logging-mocks",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"@npm//rxjs",
|
||||
"//packages/kbn-config-schema:npm_module_types",
|
||||
"//packages/kbn-utility-types:npm_module_types",
|
||||
"//packages/kbn-std:npm_module_types",
|
||||
"//packages/kbn-i18n:npm_module_types",
|
||||
"//packages/kbn-logging:npm_module_types",
|
||||
"//packages/kbn-config:npm_module_types",
|
||||
"//packages/core/base/core-base-server-internal:npm_module_types",
|
||||
"//packages/core/http/core-http-server-internal:npm_module_types",
|
||||
"//packages/core/elasticsearch/core-elasticsearch-server:npm_module_types",
|
||||
"//packages/core/elasticsearch/core-elasticsearch-server-internal:npm_module_types",
|
||||
"//packages/core/saved-objects/core-saved-objects-api-server:npm_module_types",
|
||||
"//packages/core/saved-objects/core-saved-objects-server-internal:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-common:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-server:npm_module_types",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
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",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
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-server-internal
|
||||
|
||||
This package contains the internal types and implementation of Core's server-side `deprecations` service.
|
|
@ -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 { DeprecationsService, config, CoreDeprecationsRouteHandlerContext } from './src';
|
||||
export type { InternalDeprecationsServiceSetup, InternalDeprecationsServiceStart } from './src';
|
|
@ -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/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/deprecations/core-deprecations-server-internal'],
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-deprecations-server-internal",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"author": "Kibana Core",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -8,15 +8,11 @@
|
|||
|
||||
import type { CoreElasticsearchRouteHandlerContext } from '@kbn/core-elasticsearch-server-internal';
|
||||
import type { CoreSavedObjectsRouteHandlerContext } from '@kbn/core-saved-objects-server-internal';
|
||||
import type { DeprecationsClient, InternalDeprecationsServiceStart } from './deprecations_service';
|
||||
|
||||
/**
|
||||
* Core's `deprecations` request handler context.
|
||||
* @public
|
||||
*/
|
||||
export interface DeprecationsRequestHandlerContext {
|
||||
client: DeprecationsClient;
|
||||
}
|
||||
import type {
|
||||
DeprecationsRequestHandlerContext,
|
||||
DeprecationsClient,
|
||||
} from '@kbn/core-deprecations-server';
|
||||
import type { InternalDeprecationsServiceStart } from './deprecations_service';
|
||||
|
||||
/**
|
||||
* The {@link DeprecationsRequestHandlerContext} implementation.
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { mockDeprecationsFactory } from './deprecations_factory.mock';
|
||||
import { mockDeprecationsFactory } from './mocks';
|
||||
|
||||
export const mockedDeprecationFactoryInstance = mockDeprecationsFactory.create();
|
||||
export const DeprecationsFactoryMock = jest
|
|
@ -10,12 +10,13 @@ import { DeprecationsFactoryMock } from './deprecations_service.test.mocks';
|
|||
|
||||
import { mockCoreContext } from '@kbn/core-base-server-mocks';
|
||||
import { httpServiceMock } from '@kbn/core-http-server-mocks';
|
||||
/* eslint-disable dot-notation */
|
||||
import { configServiceMock } from '@kbn/config-mocks';
|
||||
import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks';
|
||||
import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
|
||||
import { DeprecationsService, DeprecationsSetupDeps } from './deprecations_service';
|
||||
import { savedObjectsClientMock, elasticsearchServiceMock, configServiceMock } from '../mocks';
|
||||
import { mockDeprecationsFactory } from './deprecations_factory.mock';
|
||||
import { mockDeprecationsRegistry } from './deprecations_registry.mock';
|
||||
import { mockDeprecationsRegistry, mockDeprecationsFactory } from './mocks';
|
||||
|
||||
/* eslint-disable dot-notation */
|
||||
describe('DeprecationsService', () => {
|
||||
let coreContext: ReturnType<typeof mockCoreContext.create>;
|
||||
let http: ReturnType<typeof httpServiceMock.createInternalSetupContract>;
|
|
@ -10,27 +10,18 @@ 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 type { DomainDeprecationDetails } from '@kbn/core-deprecations-common';
|
||||
import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal';
|
||||
import type { IScopedClusterClient } from '@kbn/core-elasticsearch-server';
|
||||
import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server';
|
||||
import type {
|
||||
DeprecationsServiceSetup,
|
||||
DeprecationRegistryProvider,
|
||||
DeprecationsClient,
|
||||
} from '@kbn/core-deprecations-server';
|
||||
import { DeprecationsFactory } from './deprecations_factory';
|
||||
import { registerRoutes } from './routes';
|
||||
import { config as deprecationConfig, DeprecationConfigType } from './deprecation_config';
|
||||
|
||||
/**
|
||||
* Server-side client that provides access to fetch all Kibana deprecations
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface DeprecationsClient {
|
||||
getAllDeprecations: () => Promise<DomainDeprecationDetails[]>;
|
||||
}
|
||||
|
||||
export interface InternalDeprecationsServiceStart {
|
||||
/**
|
||||
* Creates a {@link DeprecationsClient} with provided SO client and ES client.
|
|
@ -6,19 +6,11 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export type {
|
||||
DeprecationsServiceSetup,
|
||||
GetDeprecationsContext,
|
||||
RegisterDeprecationsConfig,
|
||||
} from '@kbn/core-deprecations-server';
|
||||
|
||||
export type {
|
||||
InternalDeprecationsServiceSetup,
|
||||
InternalDeprecationsServiceStart,
|
||||
DeprecationsClient,
|
||||
} from './deprecations_service';
|
||||
|
||||
export { DeprecationsService } from './deprecations_service';
|
||||
export { config } from './deprecation_config';
|
||||
export { CoreDeprecationsRouteHandlerContext } from './deprecations_route_handler_context';
|
||||
export type { DeprecationsRequestHandlerContext } from './deprecations_route_handler_context';
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import type { IRouter, RequestHandlerContextBase } from '@kbn/core-http-server';
|
||||
import type { DeprecationsRequestHandlerContext } from './deprecations_route_handler_context';
|
||||
import type { DeprecationsRequestHandlerContext } from '@kbn/core-deprecations-server';
|
||||
|
||||
/**
|
||||
* Request handler context used by core's deprecations routes.
|
|
@ -7,7 +7,8 @@
|
|||
*/
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import type { DeprecationsFactory } from './deprecations_factory';
|
||||
import type { DeprecationsFactory } from '../deprecations_factory';
|
||||
|
||||
type DeprecationsFactoryContract = PublicMethodsOf<DeprecationsFactory>;
|
||||
|
||||
const createDeprecationsFactoryMock = () => {
|
|
@ -10,7 +10,7 @@ import type { PublicMethodsOf } from '@kbn/utility-types';
|
|||
import { elasticsearchClientMock } from '@kbn/core-elasticsearch-client-server-mocks';
|
||||
import type { GetDeprecationsContext } from '@kbn/core-deprecations-server';
|
||||
import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks';
|
||||
import type { DeprecationsRegistry } from './deprecations_registry';
|
||||
import type { DeprecationsRegistry } from '../deprecations_registry';
|
||||
|
||||
type DeprecationsRegistryContract = PublicMethodsOf<DeprecationsRegistry>;
|
||||
|
|
@ -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 { mockDeprecationsRegistry } from './deprecations_registry.mock';
|
||||
export { mockDeprecationsFactory } from './deprecations_factory.mock';
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
]
|
||||
}
|
|
@ -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-server-mocks"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-deprecations-server-mocks"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.config.js",
|
||||
"**/*.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",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/kbn-utility-types:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-server:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-server-internal:npm_module_types",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
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",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
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,5 @@
|
|||
# @kbn/core-deprecations-server-mocks
|
||||
|
||||
This package contains mocks fore Core's server-side `deprecations` service.
|
||||
|
||||
- `deprecationsServiceMock`
|
|
@ -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 './src';
|
|
@ -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/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/deprecations/core-deprecations-server-mocks'],
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-deprecations-server-mocks",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"author": "Kibana Core",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -7,13 +7,12 @@
|
|||
*/
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import type { DeprecationsServiceSetup } from '@kbn/core-deprecations-server';
|
||||
import {
|
||||
import type { DeprecationsServiceSetup, DeprecationsClient } from '@kbn/core-deprecations-server';
|
||||
import type {
|
||||
DeprecationsService,
|
||||
InternalDeprecationsServiceSetup,
|
||||
InternalDeprecationsServiceStart,
|
||||
DeprecationsClient,
|
||||
} from './deprecations_service';
|
||||
} from '@kbn/core-deprecations-server-internal';
|
||||
|
||||
type DeprecationsServiceContract = PublicMethodsOf<DeprecationsService>;
|
||||
|
|
@ -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,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
]
|
||||
}
|
|
@ -11,4 +11,6 @@ export type {
|
|||
GetDeprecationsContext,
|
||||
DeprecationsServiceSetup,
|
||||
DeprecationRegistryProvider,
|
||||
DeprecationsClient,
|
||||
DeprecationsRequestHandlerContext,
|
||||
} from './src';
|
||||
|
|
|
@ -12,3 +12,7 @@ export type {
|
|||
DeprecationsServiceSetup,
|
||||
DeprecationRegistryProvider,
|
||||
} from './contracts';
|
||||
export type {
|
||||
DeprecationsClient,
|
||||
DeprecationsRequestHandlerContext,
|
||||
} from './request_handler_context';
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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 { DomainDeprecationDetails } from '@kbn/core-deprecations-common';
|
||||
|
||||
/**
|
||||
* Server-side client that provides access to fetch all Kibana deprecations
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface DeprecationsClient {
|
||||
getAllDeprecations: () => Promise<DomainDeprecationDetails[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Core's `deprecations` request handler context.
|
||||
* @public
|
||||
*/
|
||||
export interface DeprecationsRequestHandlerContext {
|
||||
client: DeprecationsClient;
|
||||
}
|
|
@ -11,11 +11,9 @@ import type { ElasticsearchRequestHandlerContext } from '@kbn/core-elasticsearch
|
|||
import { CoreElasticsearchRouteHandlerContext } from '@kbn/core-elasticsearch-server-internal';
|
||||
import type { SavedObjectsRequestHandlerContext } from '@kbn/core-saved-objects-server';
|
||||
import { CoreSavedObjectsRouteHandlerContext } from '@kbn/core-saved-objects-server-internal';
|
||||
import type { DeprecationsRequestHandlerContext } from '@kbn/core-deprecations-server';
|
||||
import { CoreDeprecationsRouteHandlerContext } from '@kbn/core-deprecations-server-internal';
|
||||
import { CoreUiSettingsRouteHandlerContext, UiSettingsRequestHandlerContext } from './ui_settings';
|
||||
import {
|
||||
CoreDeprecationsRouteHandlerContext,
|
||||
DeprecationsRequestHandlerContext,
|
||||
} from './deprecations';
|
||||
import type { InternalCoreStart } from './internal_types';
|
||||
|
||||
/**
|
||||
|
|
|
@ -64,6 +64,7 @@ import type {
|
|||
SavedObjectsServiceSetup,
|
||||
SavedObjectsServiceStart,
|
||||
} from '@kbn/core-saved-objects-server';
|
||||
import { DeprecationsServiceSetup } from '@kbn/core-deprecations-server';
|
||||
|
||||
import { HttpResources } from './http_resources';
|
||||
import { PluginsServiceSetup, PluginsServiceStart, PluginOpaqueId } from './plugins';
|
||||
|
@ -71,7 +72,6 @@ import { UiSettingsServiceSetup, UiSettingsServiceStart } from './ui_settings';
|
|||
import { StatusServiceSetup } from './status';
|
||||
import { CoreUsageDataStart, CoreUsageDataSetup } from './core_usage_data';
|
||||
import { I18nServiceSetup } from './i18n';
|
||||
import { DeprecationsServiceSetup } from './deprecations';
|
||||
// Because of #79265 we need to explicitly import, then export these types for
|
||||
// scripts/telemetry_check.js to work as expected
|
||||
import {
|
||||
|
@ -432,7 +432,7 @@ export type {
|
|||
DeprecationsServiceSetup,
|
||||
DeprecationsClient,
|
||||
DeprecationsRequestHandlerContext,
|
||||
} from './deprecations';
|
||||
} from '@kbn/core-deprecations-server';
|
||||
export type { DeprecationsDetails } from '@kbn/core-deprecations-common';
|
||||
|
||||
export type { AppCategory } from '@kbn/core-application-common';
|
||||
|
|
|
@ -45,6 +45,10 @@ import {
|
|||
InternalSavedObjectsServiceSetup,
|
||||
InternalSavedObjectsServiceStart,
|
||||
} from '@kbn/core-saved-objects-server-internal';
|
||||
import {
|
||||
InternalDeprecationsServiceSetup,
|
||||
InternalDeprecationsServiceStart,
|
||||
} from '@kbn/core-deprecations-server-internal';
|
||||
import {
|
||||
InternalUiSettingsServicePreboot,
|
||||
InternalUiSettingsServiceSetup,
|
||||
|
@ -55,7 +59,6 @@ import { InternalHttpResourcesPreboot, InternalHttpResourcesSetup } from './http
|
|||
import { InternalStatusServiceSetup } from './status';
|
||||
import { CoreUsageDataStart, InternalCoreUsageDataSetup } from './core_usage_data';
|
||||
import { I18nServiceSetup } from './i18n';
|
||||
import { InternalDeprecationsServiceSetup, InternalDeprecationsServiceStart } from './deprecations';
|
||||
|
||||
/** @internal */
|
||||
export interface InternalCorePreboot {
|
||||
|
|
|
@ -26,6 +26,7 @@ import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
|
|||
import { typeRegistryMock as savedObjectsTypeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks';
|
||||
import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
|
||||
import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks';
|
||||
import { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';
|
||||
import type {
|
||||
PluginInitializerContext,
|
||||
CoreSetup,
|
||||
|
@ -41,7 +42,6 @@ import { SharedGlobalConfig } from './plugins';
|
|||
import { statusServiceMock } from './status/status_service.mock';
|
||||
import { coreUsageDataServiceMock } from './core_usage_data/core_usage_data_service.mock';
|
||||
import { i18nServiceMock } from './i18n/i18n_service.mock';
|
||||
import { deprecationsServiceMock } from './deprecations/deprecations_service.mock';
|
||||
|
||||
export { configServiceMock, configDeprecationsMock } from '@kbn/config-mocks';
|
||||
export { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
|
@ -61,9 +61,9 @@ export { renderingMock } from './rendering/rendering_service.mock';
|
|||
export { statusServiceMock } from './status/status_service.mock';
|
||||
export { contextServiceMock } from '@kbn/core-http-context-server-mocks';
|
||||
export { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
|
||||
export { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';
|
||||
export { coreUsageDataServiceMock } from './core_usage_data/core_usage_data_service.mock';
|
||||
export { i18nServiceMock } from './i18n/i18n_service.mock';
|
||||
export { deprecationsServiceMock } from './deprecations/deprecations_service.mock';
|
||||
export { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
|
||||
export { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
|
||||
export { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
|
||||
|
|
|
@ -117,10 +117,10 @@ jest.doMock('@kbn/core-preboot-server-internal', () => ({
|
|||
PrebootService: jest.fn(() => mockPrebootService),
|
||||
}));
|
||||
|
||||
import { deprecationsServiceMock } from './deprecations/deprecations_service.mock';
|
||||
import { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';
|
||||
|
||||
export const mockDeprecationService = deprecationsServiceMock.create();
|
||||
jest.doMock('./deprecations/deprecations_service', () => ({
|
||||
jest.doMock('@kbn/core-deprecations-server-internal', () => ({
|
||||
DeprecationsService: jest.fn(() => mockDeprecationService),
|
||||
}));
|
||||
|
||||
|
|
|
@ -50,6 +50,10 @@ import {
|
|||
savedObjectsMigrationConfig,
|
||||
} from '@kbn/core-saved-objects-base-server-internal';
|
||||
import { SavedObjectsService } from '@kbn/core-saved-objects-server-internal';
|
||||
import {
|
||||
DeprecationsService,
|
||||
config as deprecationConfig,
|
||||
} from '@kbn/core-deprecations-server-internal';
|
||||
import { CoreApp } from './core_app';
|
||||
import { I18nService } from './i18n';
|
||||
import { HttpResourcesService } from './http_resources';
|
||||
|
@ -64,7 +68,6 @@ import { config as statusConfig } from './status';
|
|||
import { config as i18nConfig } from './i18n';
|
||||
import { InternalCorePreboot, InternalCoreSetup, InternalCoreStart } from './internal_types';
|
||||
import { CoreUsageDataService } from './core_usage_data';
|
||||
import { DeprecationsService, config as deprecationConfig } from './deprecations';
|
||||
import { CoreRouteHandlerContext } from './core_route_handler_context';
|
||||
import { PrebootCoreRouteHandlerContext } from './preboot_core_route_handler_context';
|
||||
import { DiscoveredPlugins } from './plugins';
|
||||
|
|
16
yarn.lock
16
yarn.lock
|
@ -2839,6 +2839,14 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-deprecations-server-internal@link:bazel-bin/packages/core/deprecations/core-deprecations-server-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-deprecations-server-mocks@link:bazel-bin/packages/core/deprecations/core-deprecations-server-mocks":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-deprecations-server@link:bazel-bin/packages/core/deprecations/core-deprecations-server":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
@ -6885,6 +6893,14 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-deprecations-server-internal@link:bazel-bin/packages/core/deprecations/core-deprecations-server-internal/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-deprecations-server-mocks@link:bazel-bin/packages/core/deprecations/core-deprecations-server-mocks/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-deprecations-server@link:bazel-bin/packages/core/deprecations/core-deprecations-server/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue