mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Migrate server-side preboot service to packages (#136060)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
8a1c7f3e72
commit
6ed1d88678
32 changed files with 549 additions and 52 deletions
|
@ -189,6 +189,9 @@
|
|||
"@kbn/core-node-server": "link:bazel-bin/packages/core/node/core-node-server",
|
||||
"@kbn/core-node-server-internal": "link:bazel-bin/packages/core/node/core-node-server-internal",
|
||||
"@kbn/core-node-server-mocks": "link:bazel-bin/packages/core/node/core-node-server-mocks",
|
||||
"@kbn/core-preboot-server": "link:bazel-bin/packages/core/preboot/core-preboot-server",
|
||||
"@kbn/core-preboot-server-internal": "link:bazel-bin/packages/core/preboot/core-preboot-server-internal",
|
||||
"@kbn/core-preboot-server-mocks": "link:bazel-bin/packages/core/preboot/core-preboot-server-mocks",
|
||||
"@kbn/core-theme-browser": "link:bazel-bin/packages/core/theme/core-theme-browser",
|
||||
"@kbn/core-theme-browser-internal": "link:bazel-bin/packages/core/theme/core-theme-browser-internal",
|
||||
"@kbn/core-theme-browser-mocks": "link:bazel-bin/packages/core/theme/core-theme-browser-mocks",
|
||||
|
@ -744,6 +747,9 @@
|
|||
"@types/kbn__core-node-server": "link:bazel-bin/packages/core/node/core-node-server/npm_module_types",
|
||||
"@types/kbn__core-node-server-internal": "link:bazel-bin/packages/core/node/core-node-server-internal/npm_module_types",
|
||||
"@types/kbn__core-node-server-mocks": "link:bazel-bin/packages/core/node/core-node-server-mocks/npm_module_types",
|
||||
"@types/kbn__core-preboot-server": "link:bazel-bin/packages/core/preboot/core-preboot-server/npm_module_types",
|
||||
"@types/kbn__core-preboot-server-internal": "link:bazel-bin/packages/core/preboot/core-preboot-server-internal/npm_module_types",
|
||||
"@types/kbn__core-preboot-server-mocks": "link:bazel-bin/packages/core/preboot/core-preboot-server-mocks/npm_module_types",
|
||||
"@types/kbn__core-public-internal-base": "link:bazel-bin/packages/core/public/internal-base/npm_module_types",
|
||||
"@types/kbn__core-server-internal-base": "link:bazel-bin/packages/core/server/internal-base/npm_module_types",
|
||||
"@types/kbn__core-theme-browser": "link:bazel-bin/packages/core/theme/core-theme-browser/npm_module_types",
|
||||
|
|
|
@ -58,6 +58,9 @@ filegroup(
|
|||
"//packages/core/node/core-node-server-internal:build",
|
||||
"//packages/core/node/core-node-server-mocks:build",
|
||||
"//packages/core/node/core-node-server:build",
|
||||
"//packages/core/preboot/core-preboot-server-internal:build",
|
||||
"//packages/core/preboot/core-preboot-server-mocks:build",
|
||||
"//packages/core/preboot/core-preboot-server:build",
|
||||
"//packages/core/theme/core-theme-browser-internal:build",
|
||||
"//packages/core/theme/core-theme-browser-mocks:build",
|
||||
"//packages/core/theme/core-theme-browser:build",
|
||||
|
@ -238,6 +241,9 @@ filegroup(
|
|||
"//packages/core/node/core-node-server-internal:build_types",
|
||||
"//packages/core/node/core-node-server-mocks:build_types",
|
||||
"//packages/core/node/core-node-server:build_types",
|
||||
"//packages/core/preboot/core-preboot-server-internal:build_types",
|
||||
"//packages/core/preboot/core-preboot-server-mocks:build_types",
|
||||
"//packages/core/preboot/core-preboot-server:build_types",
|
||||
"//packages/core/theme/core-theme-browser-internal:build_types",
|
||||
"//packages/core/theme/core-theme-browser-mocks:build_types",
|
||||
"//packages/core/theme/core-theme-browser:build_types",
|
||||
|
|
111
packages/core/preboot/core-preboot-server-internal/BUILD.bazel
Normal file
111
packages/core/preboot/core-preboot-server-internal/BUILD.bazel
Normal file
|
@ -0,0 +1,111 @@
|
|||
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-preboot-server-internal"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-preboot-server-internal"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/kbn-logging",
|
||||
"//packages/core/base/core-base-server-internal",
|
||||
"//packages/core/base/core-base-common",
|
||||
"//packages/kbn-utils",
|
||||
"//packages/kbn-config",
|
||||
"//packages/kbn-config-mocks",
|
||||
"//packages/core/logging/core-logging-server-mocks",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/kbn-logging:npm_module_types",
|
||||
"//packages/core/base/core-base-server-internal:npm_module_types",
|
||||
"//packages/core/base/core-base-common:npm_module_types",
|
||||
"//packages/kbn-utils:npm_module_types",
|
||||
"//packages/kbn-config:npm_module_types",
|
||||
"//packages/kbn-config-mocks: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,
|
||||
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"],
|
||||
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-preboot-server-internal
|
||||
|
||||
This package contains the internal types and implementation for Core's server-side preboot 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/preboot/core-preboot-server-internal'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@kbn/core-preboot-server-internal",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -6,5 +6,5 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export type { InternalPrebootServicePreboot } from './types';
|
||||
export { PrebootService } from './preboot_service';
|
||||
export type { InternalPrebootServicePreboot, PrebootServicePreboot } from './types';
|
|
@ -9,8 +9,8 @@
|
|||
import { REPO_ROOT } from '@kbn/utils';
|
||||
import { LoggerFactory } from '@kbn/logging';
|
||||
import { Env } from '@kbn/config';
|
||||
import { getEnvOptions } from '@kbn/config-mocks';
|
||||
import { configServiceMock, loggingSystemMock } from '../mocks';
|
||||
import { configServiceMock, getEnvOptions } from '@kbn/config-mocks';
|
||||
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
|
||||
import { PrebootService } from './preboot_service';
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import type { Logger } from '@kbn/logging';
|
||||
import type { CoreContext } from '@kbn/core-base-server-internal';
|
||||
import { InternalPrebootServicePreboot } from './types';
|
||||
import type { InternalPrebootServicePreboot } from './types';
|
||||
|
||||
/** @internal */
|
||||
export class PrebootService {
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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 { PluginName } from '@kbn/core-base-common';
|
||||
|
||||
/** @internal */
|
||||
export interface InternalPrebootServicePreboot {
|
||||
/**
|
||||
* Indicates whether Kibana is currently on hold and cannot proceed to `setup` yet.
|
||||
*/
|
||||
readonly isSetupOnHold: () => boolean;
|
||||
|
||||
/**
|
||||
* Registers a `Promise` as a precondition before Kibana can proceed to `setup`. This method can be invoked multiple
|
||||
* times and from multiple `preboot` plugins. Kibana will proceed to `setup` only when all registered `Promise` are
|
||||
* resolved, or it will shut down if any of them are rejected.
|
||||
* @param pluginName Name of the plugin that needs to hold `setup`.
|
||||
* @param reason A string that explains the reason why this promise should hold `setup`. It's supposed to be a human
|
||||
* readable string that will be recorded in the logs or standard output.
|
||||
* @param promise A `Promise` that should resolved before Kibana can proceed to `setup`.
|
||||
*/
|
||||
readonly holdSetupUntilResolved: (
|
||||
pluginName: PluginName,
|
||||
reason: string,
|
||||
promise: Promise<{ shouldReloadConfig: boolean } | undefined>
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Returns a `Promise` that is resolved only when all `Promise` instances registered with {@link holdSetupUntilResolved}
|
||||
* are resolved, or rejected if any of them are rejected. If the supplied `Promise` resolves to an object with the
|
||||
* `shouldReloadConfig` property set to `true`, it indicates that Kibana configuration might have changed and Kibana
|
||||
* needs to reload it from the disk.
|
||||
*/
|
||||
readonly waitUntilCanSetup: () => Promise<{ shouldReloadConfig: boolean }>;
|
||||
}
|
|
@ -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/**/*"
|
||||
]
|
||||
}
|
102
packages/core/preboot/core-preboot-server-mocks/BUILD.bazel
Normal file
102
packages/core/preboot/core-preboot-server-mocks/BUILD.bazel
Normal file
|
@ -0,0 +1,102 @@
|
|||
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-preboot-server-mocks"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-preboot-server-mocks"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/kbn-utility-types",
|
||||
"//packages/core/preboot/core-preboot-server-internal",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/kbn-utility-types:npm_module_types",
|
||||
"//packages/core/preboot/core-preboot-server-internal:npm_module_types",
|
||||
"//packages/core/preboot/core-preboot-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",
|
||||
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-preboot-server-mocks
|
||||
|
||||
This package contains the mocks for Core's server-side preboot 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/preboot/core-preboot-server-mocks'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@kbn/core-preboot-server-mocks",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
13
packages/core/preboot/core-preboot-server-mocks/src/index.ts
Normal file
13
packages/core/preboot/core-preboot-server-mocks/src/index.ts
Normal file
|
@ -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.
|
||||
*/
|
||||
|
||||
export { prebootServiceMock } from './preboot_service.mock';
|
||||
export type {
|
||||
InternalPrebootServicePrebootMock,
|
||||
PrebootServicePrebootMock,
|
||||
} from './preboot_service.mock';
|
|
@ -5,10 +5,12 @@
|
|||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import type { InternalPrebootServicePreboot, PrebootServicePreboot } from './types';
|
||||
import { PrebootService } from './preboot_service';
|
||||
import { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import type {
|
||||
InternalPrebootServicePreboot,
|
||||
PrebootService,
|
||||
} from '@kbn/core-preboot-server-internal';
|
||||
import type { PrebootServicePreboot } from '@kbn/core-preboot-server';
|
||||
|
||||
export type InternalPrebootServicePrebootMock = jest.Mocked<InternalPrebootServicePreboot>;
|
||||
export type PrebootServicePrebootMock = jest.Mocked<PrebootServicePreboot>;
|
|
@ -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/**/*"
|
||||
]
|
||||
}
|
97
packages/core/preboot/core-preboot-server/BUILD.bazel
Normal file
97
packages/core/preboot/core-preboot-server/BUILD.bazel
Normal file
|
@ -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-preboot-server"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-preboot-server"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
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",
|
||||
]
|
||||
|
||||
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",
|
||||
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"],
|
||||
)
|
3
packages/core/preboot/core-preboot-server/README.md
Normal file
3
packages/core/preboot/core-preboot-server/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-preboot-server
|
||||
|
||||
Contains public types for Core's server-side `preboot` service
|
13
packages/core/preboot/core-preboot-server/jest.config.js
Normal file
13
packages/core/preboot/core-preboot-server/jest.config.js
Normal file
|
@ -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/preboot/core-preboot-server'],
|
||||
};
|
7
packages/core/preboot/core-preboot-server/package.json
Normal file
7
packages/core/preboot/core-preboot-server/package.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@kbn/core-preboot-server",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -5,40 +5,6 @@
|
|||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { PluginName } from '@kbn/core-base-common';
|
||||
|
||||
/** @internal */
|
||||
export interface InternalPrebootServicePreboot {
|
||||
/**
|
||||
* Indicates whether Kibana is currently on hold and cannot proceed to `setup` yet.
|
||||
*/
|
||||
readonly isSetupOnHold: () => boolean;
|
||||
|
||||
/**
|
||||
* Registers a `Promise` as a precondition before Kibana can proceed to `setup`. This method can be invoked multiple
|
||||
* times and from multiple `preboot` plugins. Kibana will proceed to `setup` only when all registered `Promise` are
|
||||
* resolved, or it will shut down if any of them are rejected.
|
||||
* @param pluginName Name of the plugin that needs to hold `setup`.
|
||||
* @param reason A string that explains the reason why this promise should hold `setup`. It's supposed to be a human
|
||||
* readable string that will be recorded in the logs or standard output.
|
||||
* @param promise A `Promise` that should resolved before Kibana can proceed to `setup`.
|
||||
*/
|
||||
readonly holdSetupUntilResolved: (
|
||||
pluginName: PluginName,
|
||||
reason: string,
|
||||
promise: Promise<{ shouldReloadConfig: boolean } | undefined>
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Returns a `Promise` that is resolved only when all `Promise` instances registered with {@link holdSetupUntilResolved}
|
||||
* are resolved, or rejected if any of them are rejected. If the supplied `Promise` resolves to an object with the
|
||||
* `shouldReloadConfig` property set to `true`, it indicates that Kibana configuration might have changed and Kibana
|
||||
* needs to reload it from the disk.
|
||||
*/
|
||||
readonly waitUntilCanSetup: () => Promise<{ shouldReloadConfig: boolean }>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kibana Preboot Service allows to control the boot flow of Kibana. Preboot plugins can use it to hold the boot until certain condition is met.
|
||||
*
|
9
packages/core/preboot/core-preboot-server/src/index.ts
Normal file
9
packages/core/preboot/core-preboot-server/src/index.ts
Normal file
|
@ -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 type { PrebootServicePreboot } from './contracts';
|
18
packages/core/preboot/core-preboot-server/tsconfig.json
Normal file
18
packages/core/preboot/core-preboot-server/tsconfig.json
Normal file
|
@ -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/**/*"
|
||||
]
|
||||
}
|
|
@ -42,6 +42,7 @@ import type {
|
|||
ExecutionContextSetup,
|
||||
ExecutionContextStart,
|
||||
} from '@kbn/core-execution-context-server';
|
||||
import type { PrebootServicePreboot } from '@kbn/core-preboot-server';
|
||||
import {
|
||||
ElasticsearchServiceSetup,
|
||||
configSchema as elasticsearchConfigSchema,
|
||||
|
@ -76,13 +77,10 @@ import {
|
|||
CoreEnvironmentUsageData,
|
||||
CoreServicesUsageData,
|
||||
} from './core_usage_data';
|
||||
import { PrebootServicePreboot } from './preboot';
|
||||
import type { CoreRequestHandlerContext } from './core_route_handler_context';
|
||||
import type { PrebootCoreRequestHandlerContext } from './preboot_core_route_handler_context';
|
||||
import { KibanaResponseFactory, RouteMethod } from './http';
|
||||
|
||||
export type { PrebootServicePreboot } from './preboot';
|
||||
|
||||
export type {
|
||||
CoreUsageStats,
|
||||
CoreUsageData,
|
||||
|
|
|
@ -21,6 +21,7 @@ import type {
|
|||
InternalExecutionContextSetup,
|
||||
InternalExecutionContextStart,
|
||||
} from '@kbn/core-execution-context-server-internal';
|
||||
import { InternalPrebootServicePreboot } from '@kbn/core-preboot-server-internal';
|
||||
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
|
||||
import { InternalContextPreboot, InternalContextSetup } from './context';
|
||||
import {
|
||||
|
@ -49,7 +50,6 @@ import { InternalStatusServiceSetup } from './status';
|
|||
import { CoreUsageDataStart, InternalCoreUsageDataSetup } from './core_usage_data';
|
||||
import { I18nServiceSetup } from './i18n';
|
||||
import { InternalDeprecationsServiceSetup, InternalDeprecationsServiceStart } from './deprecations';
|
||||
import { InternalPrebootServicePreboot } from './preboot';
|
||||
|
||||
/** @internal */
|
||||
export interface InternalCorePreboot {
|
||||
|
|
|
@ -17,6 +17,7 @@ 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 { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
|
||||
import { prebootServiceMock } from '@kbn/core-preboot-server-mocks';
|
||||
import type {
|
||||
PluginInitializerContext,
|
||||
CoreSetup,
|
||||
|
@ -41,8 +42,6 @@ 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';
|
||||
import { prebootServiceMock } from './preboot/preboot_service.mock';
|
||||
|
||||
export { configServiceMock, configDeprecationsMock } from '@kbn/config-mocks';
|
||||
export { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
export { httpServerMock } from './http/http_server.mocks';
|
||||
|
|
|
@ -110,10 +110,10 @@ jest.doMock('./i18n/i18n_service', () => ({
|
|||
I18nService: jest.fn(() => mockI18nService),
|
||||
}));
|
||||
|
||||
import { prebootServiceMock } from './preboot/preboot_service.mock';
|
||||
import { prebootServiceMock } from '@kbn/core-preboot-server-mocks';
|
||||
|
||||
export const mockPrebootService = prebootServiceMock.create();
|
||||
jest.doMock('./preboot/preboot_service', () => ({
|
||||
jest.doMock('@kbn/core-preboot-server-internal', () => ({
|
||||
PrebootService: jest.fn(() => mockPrebootService),
|
||||
}));
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import {
|
|||
ExecutionContextService,
|
||||
executionContextConfig,
|
||||
} from '@kbn/core-execution-context-server-internal';
|
||||
import { PrebootService } from '@kbn/core-preboot-server-internal';
|
||||
import { CoreApp } from './core_app';
|
||||
import { I18nService } from './i18n';
|
||||
import { ElasticsearchService } from './elasticsearch';
|
||||
|
@ -55,7 +56,6 @@ 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 { PrebootService } from './preboot';
|
||||
import { DiscoveredPlugins } from './plugins';
|
||||
import type { RequestHandlerContext, PrebootRequestHandlerContext } from '.';
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { IBasePath, IRouter, Logger, PrebootServicePreboot } from '@kbn/core/server';
|
||||
import type { PrebootServicePreboot } from '@kbn/core-preboot-server';
|
||||
import type { IBasePath, IRouter, Logger } from '@kbn/core/server';
|
||||
import type { PublicContract, PublicMethodsOf } from '@kbn/utility-types';
|
||||
|
||||
import type { ConfigType } from '../config';
|
||||
|
|
24
yarn.lock
24
yarn.lock
|
@ -3228,6 +3228,18 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-preboot-server-internal@link:bazel-bin/packages/core/preboot/core-preboot-server-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-preboot-server-mocks@link:bazel-bin/packages/core/preboot/core-preboot-server-mocks":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-preboot-server@link:bazel-bin/packages/core/preboot/core-preboot-server":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-theme-browser-internal@link:bazel-bin/packages/core/theme/core-theme-browser-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
@ -6779,6 +6791,18 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-preboot-server-internal@link:bazel-bin/packages/core/preboot/core-preboot-server-internal/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-preboot-server-mocks@link:bazel-bin/packages/core/preboot/core-preboot-server-mocks/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-preboot-server@link:bazel-bin/packages/core/preboot/core-preboot-server/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-public-internal-base@link:bazel-bin/packages/core/public/internal-base/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue