mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Migrate server-side environment service to packages (#135075)
* create the empty packages * move src/core/server/environment into the new packages * adapt some imports * fix more imports * export dep type * restore delete packages or idk * update READMEs * address review comments
This commit is contained in:
parent
66196769a7
commit
e08e4b4c0c
40 changed files with 391 additions and 25 deletions
|
@ -164,6 +164,8 @@
|
|||
"@kbn/core-doc-links-server": "link:bazel-bin/packages/core/doc-links/core-doc-links-server",
|
||||
"@kbn/core-doc-links-server-internal": "link:bazel-bin/packages/core/doc-links/core-doc-links-server-internal",
|
||||
"@kbn/core-doc-links-server-mocks": "link:bazel-bin/packages/core/doc-links/core-doc-links-server-mocks",
|
||||
"@kbn/core-environment-server-internal": "link:bazel-bin/packages/core/environment/core-environment-server-internal",
|
||||
"@kbn/core-environment-server-mocks": "link:bazel-bin/packages/core/environment/core-environment-server-mocks",
|
||||
"@kbn/core-execution-context-browser": "link:bazel-bin/packages/core/execution-context/core-execution-context-browser",
|
||||
"@kbn/core-execution-context-browser-internal": "link:bazel-bin/packages/core/execution-context/core-execution-context-browser-internal",
|
||||
"@kbn/core-execution-context-browser-mocks": "link:bazel-bin/packages/core/execution-context/core-execution-context-browser-mocks",
|
||||
|
@ -701,6 +703,8 @@
|
|||
"@types/kbn__core-doc-links-server": "link:bazel-bin/packages/core/doc-links/core-doc-links-server/npm_module_types",
|
||||
"@types/kbn__core-doc-links-server-internal": "link:bazel-bin/packages/core/doc-links/core-doc-links-server-internal/npm_module_types",
|
||||
"@types/kbn__core-doc-links-server-mocks": "link:bazel-bin/packages/core/doc-links/core-doc-links-server-mocks/npm_module_types",
|
||||
"@types/kbn__core-environment-server-internal": "link:bazel-bin/packages/core/environment/core-environment-server-internal/npm_module_types",
|
||||
"@types/kbn__core-environment-server-mocks": "link:bazel-bin/packages/core/environment/core-environment-server-mocks/npm_module_types",
|
||||
"@types/kbn__core-execution-context-browser": "link:bazel-bin/packages/core/execution-context/core-execution-context-browser/npm_module_types",
|
||||
"@types/kbn__core-execution-context-browser-internal": "link:bazel-bin/packages/core/execution-context/core-execution-context-browser-internal/npm_module_types",
|
||||
"@types/kbn__core-execution-context-browser-mocks": "link:bazel-bin/packages/core/execution-context/core-execution-context-browser-mocks/npm_module_types",
|
||||
|
|
|
@ -33,6 +33,8 @@ filegroup(
|
|||
"//packages/core/doc-links/core-doc-links-server-internal:build",
|
||||
"//packages/core/doc-links/core-doc-links-server-mocks:build",
|
||||
"//packages/core/doc-links/core-doc-links-server:build",
|
||||
"//packages/core/environment/core-environment-server-internal:build",
|
||||
"//packages/core/environment/core-environment-server-mocks:build",
|
||||
"//packages/core/execution-context/core-execution-context-browser-internal:build",
|
||||
"//packages/core/execution-context/core-execution-context-browser-mocks:build",
|
||||
"//packages/core/execution-context/core-execution-context-browser:build",
|
||||
|
@ -203,6 +205,8 @@ filegroup(
|
|||
"//packages/core/doc-links/core-doc-links-server-internal:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-server-mocks:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-server:build_types",
|
||||
"//packages/core/environment/core-environment-server-internal:build_types",
|
||||
"//packages/core/environment/core-environment-server-mocks:build_types",
|
||||
"//packages/core/execution-context/core-execution-context-browser-internal:build_types",
|
||||
"//packages/core/execution-context/core-execution-context-browser-mocks:build_types",
|
||||
"//packages/core/execution-context/core-execution-context-browser:build_types",
|
||||
|
|
19
packages/core/base/core-base-server-internal/src/config.ts
Normal file
19
packages/core/base/core-base-server-internal/src/config.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constants for Core config paths that are used from multiple service.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const coreConfigPaths = {
|
||||
/**
|
||||
* Config path of the http service's config.
|
||||
*/
|
||||
http: 'server',
|
||||
};
|
|
@ -9,3 +9,5 @@
|
|||
export type { CoreContext } from './core_context';
|
||||
export type { CoreService, ServiceConfigDescriptor } from './services';
|
||||
export { CriticalError } from './errors';
|
||||
export { uuidRegexp } from './regexp';
|
||||
export { coreConfigPaths } from './config';
|
||||
|
|
10
packages/core/base/core-base-server-internal/src/regexp.ts
Normal file
10
packages/core/base/core-base-server-internal/src/regexp.ts
Normal file
|
@ -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 const uuidRegexp =
|
||||
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
@ -0,0 +1,109 @@
|
|||
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-environment-server-internal"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-environment-server-internal"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"@npm//rxjs",
|
||||
"@npm//lodash",
|
||||
"@npm//uuid",
|
||||
"//packages/core/base/core-base-server-internal",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/uuid",
|
||||
"@npm//rxjs",
|
||||
"@npm//lodash",
|
||||
"//packages/kbn-utility-types:npm_module_types",
|
||||
"//packages/kbn-utils: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/analytics/core-analytics-server:npm_module_types",
|
||||
"//packages/core/logging/core-logging-server-mocks: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,
|
||||
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"],
|
||||
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-environment-server-internal
|
||||
|
||||
This package contains the internal types and implementation for Core's server-side environment 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/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/environment/core-environment-server-internal'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@kbn/core-environment-server-internal",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -10,10 +10,10 @@ import { firstValueFrom, of } from 'rxjs';
|
|||
import { PathConfigType, config as pathConfigDef } from '@kbn/utils';
|
||||
import type { Logger } from '@kbn/logging';
|
||||
import type { IConfigService } from '@kbn/config';
|
||||
import type { CoreContext } from '@kbn/core-base-server-internal';
|
||||
import { CoreContext, coreConfigPaths } from '@kbn/core-base-server-internal';
|
||||
import type { AnalyticsServicePreboot } from '@kbn/core-analytics-server';
|
||||
import { HttpConfigType, config as httpConfigDef } from '../http';
|
||||
import { PidConfigType, config as pidConfigDef } from './pid_config';
|
||||
import { HttpConfigType } from './types';
|
||||
import { PidConfigType, pidConfig as pidConfigDef } from './pid_config';
|
||||
import { resolveInstanceUuid } from './resolve_uuid';
|
||||
import { createDataFolder } from './create_data_folder';
|
||||
import { writePidFile } from './write_pid_file';
|
||||
|
@ -21,7 +21,7 @@ import { writePidFile } from './write_pid_file';
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface PrebootDeps {
|
||||
export interface EnvironmentServicePrebootDeps {
|
||||
/**
|
||||
* {@link AnalyticsServicePreboot}
|
||||
*/
|
||||
|
@ -56,12 +56,12 @@ export class EnvironmentService {
|
|||
this.configService = core.configService;
|
||||
}
|
||||
|
||||
public async preboot({ analytics }: PrebootDeps) {
|
||||
public async preboot({ analytics }: EnvironmentServicePrebootDeps) {
|
||||
// IMPORTANT: This code is based on the assumption that none of the configuration values used
|
||||
// here is supposed to change during preboot phase and it's safe to read them only once.
|
||||
const [pathConfig, serverConfig, pidConfig] = await Promise.all([
|
||||
firstValueFrom(this.configService.atPath<PathConfigType>(pathConfigDef.path)),
|
||||
firstValueFrom(this.configService.atPath<HttpConfigType>(httpConfigDef.path)),
|
||||
firstValueFrom(this.configService.atPath<HttpConfigType>(coreConfigPaths.http)),
|
||||
firstValueFrom(this.configService.atPath<PidConfigType>(pidConfigDef.path)),
|
||||
]);
|
||||
|
|
@ -10,6 +10,7 @@ export { EnvironmentService } from './environment_service';
|
|||
export type {
|
||||
InternalEnvironmentServicePreboot,
|
||||
InternalEnvironmentServiceSetup,
|
||||
EnvironmentServicePrebootDeps,
|
||||
} from './environment_service';
|
||||
export { config } from './pid_config';
|
||||
export { pidConfig } from './pid_config';
|
||||
export type { PidConfigType } from './pid_config';
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { TypeOf, schema } from '@kbn/config-schema';
|
||||
|
||||
export const config = {
|
||||
export const pidConfig = {
|
||||
path: 'pid',
|
||||
schema: schema.object({
|
||||
file: schema.maybe(schema.string()),
|
||||
|
@ -16,4 +16,4 @@ export const config = {
|
|||
}),
|
||||
};
|
||||
|
||||
export type PidConfigType = TypeOf<typeof config.schema>;
|
||||
export type PidConfigType = TypeOf<typeof pidConfig.schema>;
|
|
@ -11,7 +11,7 @@ import { PathConfigType } from '@kbn/utils';
|
|||
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
import { readFile, writeFile } from './fs';
|
||||
import { resolveInstanceUuid, UUID_7_6_0_BUG } from './resolve_uuid';
|
||||
import { HttpConfigType } from '../http';
|
||||
import { HttpConfigType } from './types';
|
||||
|
||||
jest.mock('uuid', () => ({
|
||||
v4: () => 'NEW_UUID',
|
|
@ -10,9 +10,9 @@ import uuid from 'uuid';
|
|||
import { join } from 'path';
|
||||
import { PathConfigType } from '@kbn/utils';
|
||||
import type { Logger } from '@kbn/logging';
|
||||
import { uuidRegexp } from '@kbn/core-base-server-internal';
|
||||
import { readFile, writeFile } from './fs';
|
||||
import { HttpConfigType } from '../http';
|
||||
import { uuidRegexp } from '../http/http_config';
|
||||
import { HttpConfigType } from './types';
|
||||
|
||||
const FILE_ENCODING = 'utf8';
|
||||
const FILE_NAME = 'uuid';
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Subset of the `HttpConfig` type that is used by the environment service
|
||||
*/
|
||||
export interface HttpConfigType {
|
||||
uuid: string;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
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-environment-server-mocks"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-environment-server-mocks"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
],
|
||||
)
|
||||
|
||||
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/environment/core-environment-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,
|
||||
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"],
|
||||
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-environment-server-mocks
|
||||
|
||||
This package contains the mocks for Core's server-side environment 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/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/environment/core-environment-server-mocks'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@kbn/core-environment-server-mocks",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -11,7 +11,7 @@ import type {
|
|||
EnvironmentService,
|
||||
InternalEnvironmentServicePreboot,
|
||||
InternalEnvironmentServiceSetup,
|
||||
} from './environment_service';
|
||||
} from '@kbn/core-environment-server-internal';
|
||||
|
||||
const createPrebootContractMock = () => {
|
||||
const prebootContract: jest.Mocked<InternalEnvironmentServicePreboot> = {
|
|
@ -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 { environmentServiceMock } from './environment_service.mock';
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -9,6 +9,8 @@
|
|||
import { ByteSizeValue, schema, TypeOf } from '@kbn/config-schema';
|
||||
import { IHttpConfig, SslConfig, sslSchema } from '@kbn/server-http-tools';
|
||||
import type { ServiceConfigDescriptor } from '@kbn/core-base-server-internal';
|
||||
import { uuidRegexp } from '@kbn/core-base-server-internal';
|
||||
|
||||
import { hostname } from 'os';
|
||||
import url from 'url';
|
||||
|
||||
|
@ -21,8 +23,7 @@ import {
|
|||
} from './security_response_headers_config';
|
||||
|
||||
const validBasePathRegex = /^\/.*[^\/]$/;
|
||||
export const uuidRegexp =
|
||||
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
||||
|
||||
const hostURISchema = schema.uri({ scheme: ['http', 'https'] });
|
||||
const match = (regex: RegExp, errorMsg: string) => (str: string) =>
|
||||
regex.test(str) ? undefined : errorMsg;
|
||||
|
|
|
@ -16,6 +16,7 @@ import type {
|
|||
AnalyticsServiceSetup,
|
||||
AnalyticsServiceStart,
|
||||
} from '@kbn/core-analytics-server';
|
||||
import type { InternalEnvironmentServiceSetup } from '@kbn/core-environment-server-internal';
|
||||
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
|
||||
import { InternalContextPreboot, ContextSetup } from './context';
|
||||
import {
|
||||
|
@ -37,7 +38,6 @@ import {
|
|||
InternalUiSettingsServiceSetup,
|
||||
InternalUiSettingsServiceStart,
|
||||
} from './ui_settings';
|
||||
import { InternalEnvironmentServiceSetup } from './environment';
|
||||
import { InternalMetricsServiceSetup, InternalMetricsServiceStart } from './metrics';
|
||||
import { InternalRenderingServiceSetup } from './rendering';
|
||||
import { InternalHttpResourcesPreboot, InternalHttpResourcesSetup } from './http_resources';
|
||||
|
|
|
@ -14,6 +14,7 @@ import type { MockedKeys } from '@kbn/utility-types-jest';
|
|||
import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
|
||||
import { loggingSystemMock, loggingServiceMock } from '@kbn/core-logging-server-mocks';
|
||||
import { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
|
||||
import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
|
||||
import { nodeServiceMock } from '@kbn/core-node-server-mocks';
|
||||
import type {
|
||||
PluginInitializerContext,
|
||||
|
@ -34,7 +35,6 @@ import { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock';
|
|||
import { SharedGlobalConfig } from './plugins';
|
||||
import { capabilitiesServiceMock } from './capabilities/capabilities_service.mock';
|
||||
import { metricsServiceMock } from './metrics/metrics_service.mock';
|
||||
import { environmentServiceMock } from './environment/environment_service.mock';
|
||||
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';
|
||||
|
|
|
@ -15,11 +15,11 @@ import { join } from 'path';
|
|||
import { ConfigPath, ConfigService, Env } from '@kbn/config';
|
||||
import { getEnvOptions, rawConfigServiceMock } from '@kbn/config-mocks';
|
||||
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
|
||||
import { nodeServiceMock } from '@kbn/core-node-server-mocks';
|
||||
import { PluginsService } from '../plugins_service';
|
||||
import { BehaviorSubject, from } from 'rxjs';
|
||||
import { config } from '../plugins_config';
|
||||
import { environmentServiceMock } from '../../environment/environment_service.mock';
|
||||
import { coreMock } from '../../mocks';
|
||||
import { AsyncPlugin, PluginType } from '../types';
|
||||
import { PluginWrapper } from '../plugin';
|
||||
|
|
|
@ -17,9 +17,9 @@ import { ConfigPath, ConfigService, Env } from '@kbn/config';
|
|||
|
||||
import { rawConfigServiceMock, getEnvOptions } from '@kbn/config-mocks';
|
||||
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
|
||||
import { nodeServiceMock } from '@kbn/core-node-server-mocks';
|
||||
import { coreMock } from '../mocks';
|
||||
import { environmentServiceMock } from '../environment/environment_service.mock';
|
||||
import { PluginDiscoveryError } from './discovery';
|
||||
import { PluginWrapper } from './plugin';
|
||||
import { PluginsService } from './plugins_service';
|
||||
|
|
|
@ -15,6 +15,7 @@ import { Logger } from '@kbn/logging';
|
|||
import type { IConfigService } from '@kbn/config';
|
||||
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
|
||||
import type { PluginName } from '@kbn/core-base-common';
|
||||
import type { InternalEnvironmentServicePreboot } from '@kbn/core-environment-server-internal';
|
||||
import type { InternalNodeServicePreboot } from '@kbn/core-node-server-internal';
|
||||
import { discover, PluginDiscoveryError, PluginDiscoveryErrorType } from './discovery';
|
||||
import { PluginWrapper } from './plugin';
|
||||
|
@ -29,7 +30,6 @@ import { PluginsConfig, PluginsConfigType } from './plugins_config';
|
|||
import { PluginsSystem } from './plugins_system';
|
||||
import { createBrowserConfig } from './create_browser_config';
|
||||
import { InternalCorePreboot, InternalCoreSetup, InternalCoreStart } from '../internal_types';
|
||||
import { InternalEnvironmentServicePreboot } from '../environment';
|
||||
|
||||
/** @internal */
|
||||
export type DiscoveredPlugins = {
|
||||
|
|
|
@ -68,10 +68,10 @@ import { RenderingService, mockRenderingService } from './rendering/__mocks__/re
|
|||
export { mockRenderingService };
|
||||
jest.doMock('./rendering/rendering_service', () => ({ RenderingService }));
|
||||
|
||||
import { environmentServiceMock } from './environment/environment_service.mock';
|
||||
import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
|
||||
|
||||
export const mockEnvironmentService = environmentServiceMock.create();
|
||||
jest.doMock('./environment/environment_service', () => ({
|
||||
jest.doMock('@kbn/core-environment-server-internal', () => ({
|
||||
EnvironmentService: jest.fn(() => mockEnvironmentService),
|
||||
}));
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import {
|
|||
import { NodeService, nodeConfig } from '@kbn/core-node-server-internal';
|
||||
import { AnalyticsService } from '@kbn/core-analytics-server-internal';
|
||||
import type { AnalyticsServiceSetup } from '@kbn/core-analytics-server';
|
||||
import { EnvironmentService, pidConfig } from '@kbn/core-environment-server-internal';
|
||||
import { CoreApp } from './core_app';
|
||||
import { I18nService } from './i18n';
|
||||
import { ElasticsearchService } from './elasticsearch';
|
||||
|
@ -35,7 +36,6 @@ import { PluginsService, config as pluginsConfig } from './plugins';
|
|||
import { SavedObjectsService, SavedObjectsServiceStart } from './saved_objects';
|
||||
import { MetricsService, opsConfig } from './metrics';
|
||||
import { CapabilitiesService } from './capabilities';
|
||||
import { EnvironmentService, config as pidConfig } from './environment';
|
||||
// do not try to shorten the import to `./status`, it will break server test mocking
|
||||
import { StatusService } from './status/status_service';
|
||||
import { ExecutionContextService } from './execution_context';
|
||||
|
|
|
@ -17,8 +17,8 @@ import {
|
|||
import { StatusService } from './status_service';
|
||||
import { first, take, toArray } from 'rxjs/operators';
|
||||
import { mockCoreContext } from '@kbn/core-base-server-mocks';
|
||||
import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
|
||||
import { ServiceStatusLevelSnapshotSerializer } from './test_utils';
|
||||
import { environmentServiceMock } from '../environment/environment_service.mock';
|
||||
import { httpServiceMock } from '../http/http_service.mock';
|
||||
import { mockRouter, RouterMock } from '../http/router/router.mock';
|
||||
import { metricsServiceMock } from '../metrics/metrics_service.mock';
|
||||
|
|
|
@ -23,12 +23,12 @@ import { Logger, LogMeta } from '@kbn/logging';
|
|||
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
|
||||
import type { PluginName } from '@kbn/core-base-common';
|
||||
import type { AnalyticsServiceSetup } from '@kbn/core-analytics-server';
|
||||
import type { InternalEnvironmentServiceSetup } from '@kbn/core-environment-server-internal';
|
||||
import { InternalElasticsearchServiceSetup } from '../elasticsearch';
|
||||
import { InternalHttpServiceSetup } from '../http';
|
||||
import { InternalSavedObjectsServiceSetup } from '../saved_objects';
|
||||
import { InternalMetricsServiceSetup } from '../metrics';
|
||||
import { registerStatusRoute } from './routes';
|
||||
import { InternalEnvironmentServiceSetup } from '../environment';
|
||||
import type { InternalCoreUsageDataSetup } from '../core_usage_data';
|
||||
|
||||
import { config, StatusConfigType } from './status_config';
|
||||
|
|
16
yarn.lock
16
yarn.lock
|
@ -3127,6 +3127,14 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-environment-server-internal@link:bazel-bin/packages/core/environment/core-environment-server-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-environment-server-mocks@link:bazel-bin/packages/core/environment/core-environment-server-mocks":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-i18n-browser-internal@link:bazel-bin/packages/core/i18n/core-i18n-browser-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
@ -6578,6 +6586,14 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-environment-server-internal@link:bazel-bin/packages/core/environment/core-environment-server-internal/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-environment-server-mocks@link:bazel-bin/packages/core/environment/core-environment-server-mocks/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-execution-context-browser-internal@link:bazel-bin/packages/core/execution-context/core-execution-context-browser-internal/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue