Introduce the @kbn/core-base-* core packages (#132502)

* Introduce the `@kbn/core-server-internal-base` package

* adapt more usages

* fix more imports

* fix import order

* remove jest config because no tests

* update generated doc

* add core nested directory to ignore snake_case list

* add internal-base packages for common and public

* move CoreContext to @kbn/core-public-internal-base

* adapt a few imports

* update generated doc

* use export type

* update generated doc again

* review comments

* import more types from packages

* fix merge conflicts

* update bazel package folders to new structure

* add empty new packages

* add internal packages

* Remove empty packages for now

* actually export stuff

* Add CoreService to client-side package

* adapt client-side usages of CoreService

* adapt server-side usages of CoreService

* Adapt server-side PluginName usages

* Adapt server-side CoreContext usages

* Adapt client-side CoreContext usages

* Adapt server-side ServiceConfigDescriptor usages

* fix some other imports

* fix last (?) server-side errors

* update generarted doc
This commit is contained in:
Pierre Gayvallet 2022-06-01 13:19:49 +02:00 committed by GitHub
parent 3892d63884
commit 9b75efdd1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
118 changed files with 956 additions and 244 deletions

View file

@ -172,7 +172,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [MountPoint](./kibana-plugin-core-public.mountpoint.md) | A function that should mount DOM content inside the provided container element and return a handler to unmount it. |
| [NavType](./kibana-plugin-core-public.navtype.md) | |
| [PluginInitializer](./kibana-plugin-core-public.plugininitializer.md) | The <code>plugin</code> export at the root of a plugin's <code>public</code> directory should conform to this interface. |
| [PluginOpaqueId](./kibana-plugin-core-public.pluginopaqueid.md) | |
| [PublicAppDeepLinkInfo](./kibana-plugin-core-public.publicappdeeplinkinfo.md) | Public information about a registered app's [deepLinks](./kibana-plugin-core-public.appdeeplink.md) |
| [PublicAppInfo](./kibana-plugin-core-public.publicappinfo.md) | Public information about a registered [application](./kibana-plugin-core-public.app.md) |
| [PublicUiSettingsParams](./kibana-plugin-core-public.publicuisettingsparams.md) | A sub-set of [UiSettingsParams](./kibana-plugin-core-public.uisettingsparams.md) exposed to the client-side. |

View file

@ -1,12 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [PluginOpaqueId](./kibana-plugin-core-public.pluginopaqueid.md)
## PluginOpaqueId type
<b>Signature:</b>
```typescript
export declare type PluginOpaqueId = symbol;
```

View file

@ -301,8 +301,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [OnPreRoutingHandler](./kibana-plugin-core-server.onpreroutinghandler.md) | See [OnPreRoutingToolkit](./kibana-plugin-core-server.onpreroutingtoolkit.md)<!-- -->. |
| [PluginConfigSchema](./kibana-plugin-core-server.pluginconfigschema.md) | Dedicated type for plugin configuration schema. |
| [PluginInitializer](./kibana-plugin-core-server.plugininitializer.md) | The <code>plugin</code> export at the root of a plugin's <code>server</code> directory should conform to this interface. |
| [PluginName](./kibana-plugin-core-server.pluginname.md) | Dedicated type for plugin name/id that is supposed to make Map/Set/Arrays that use it as a key or value more obvious. |
| [PluginOpaqueId](./kibana-plugin-core-server.pluginopaqueid.md) | |
| [PublicUiSettingsParams](./kibana-plugin-core-server.publicuisettingsparams.md) | A sub-set of [UiSettingsParams](./kibana-plugin-core-server.uisettingsparams.md) exposed to the client-side. |
| [RedirectResponseOptions](./kibana-plugin-core-server.redirectresponseoptions.md) | HTTP response parameters for redirection response |
| [RequestHandler](./kibana-plugin-core-server.requesthandler.md) | A function executed when route path matched requested resource path. Request handler is expected to return a result of one of [KibanaResponseFactory](./kibana-plugin-core-server.kibanaresponsefactory.md) functions. If anything else is returned, or an error is thrown, the HTTP service will automatically log the error and respond <code>500 - Internal Server Error</code>. |

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [PluginName](./kibana-plugin-core-server.pluginname.md)
## PluginName type
Dedicated type for plugin name/id that is supposed to make Map/Set/Arrays that use it as a key or value more obvious.
<b>Signature:</b>
```typescript
export declare type PluginName = string;
```

View file

@ -1,12 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [PluginOpaqueId](./kibana-plugin-core-server.pluginopaqueid.md)
## PluginOpaqueId type
<b>Signature:</b>
```typescript
export declare type PluginOpaqueId = symbol;
```

View file

@ -147,6 +147,10 @@
"@kbn/config": "link:bazel-bin/packages/kbn-config",
"@kbn/config-mocks": "link:bazel-bin/packages/kbn-config-mocks",
"@kbn/config-schema": "link:bazel-bin/packages/kbn-config-schema",
"@kbn/core-base-browser-internal": "link:bazel-bin/packages/core/base/core-base-browser-internal",
"@kbn/core-base-common": "link:bazel-bin/packages/core/base/core-base-common",
"@kbn/core-base-common-internal": "link:bazel-bin/packages/core/base/core-base-common-internal",
"@kbn/core-base-server-internal": "link:bazel-bin/packages/core/base/core-base-server-internal",
"@kbn/crypto": "link:bazel-bin/packages/kbn-crypto",
"@kbn/datemath": "link:bazel-bin/packages/kbn-datemath",
"@kbn/doc-links": "link:bazel-bin/packages/kbn-doc-links",
@ -636,6 +640,15 @@
"@types/kbn__config": "link:bazel-bin/packages/kbn-config/npm_module_types",
"@types/kbn__config-mocks": "link:bazel-bin/packages/kbn-config-mocks/npm_module_types",
"@types/kbn__config-schema": "link:bazel-bin/packages/kbn-config-schema/npm_module_types",
"@types/kbn__core-base-browser": "link:bazel-bin/packages/core/base/core-base-browser/npm_module_types",
"@types/kbn__core-base-browser-internal": "link:bazel-bin/packages/core/base/core-base-browser-internal/npm_module_types",
"@types/kbn__core-base-common": "link:bazel-bin/packages/core/base/core-base-common/npm_module_types",
"@types/kbn__core-base-common-internal": "link:bazel-bin/packages/core/base/core-base-common-internal/npm_module_types",
"@types/kbn__core-base-server": "link:bazel-bin/packages/core/base/core-base-server/npm_module_types",
"@types/kbn__core-base-server-internal": "link:bazel-bin/packages/core/base/core-base-server-internal/npm_module_types",
"@types/kbn__core-common-internal-base": "link:bazel-bin/packages/core/common/internal-base/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__crypto": "link:bazel-bin/packages/kbn-crypto/npm_module_types",
"@types/kbn__datemath": "link:bazel-bin/packages/kbn-datemath/npm_module_types",
"@types/kbn__dev-cli-errors": "link:bazel-bin/packages/kbn-dev-cli-errors/npm_module_types",

View file

@ -14,6 +14,10 @@ filegroup(
"//packages/analytics/shippers/elastic_v3/common:build",
"//packages/analytics/shippers/elastic_v3/server:build",
"//packages/analytics/shippers/fullstory:build",
"//packages/core/base/core-base-browser-internal:build",
"//packages/core/base/core-base-common-internal:build",
"//packages/core/base/core-base-common:build",
"//packages/core/base/core-base-server-internal:build",
"//packages/elastic-apm-synthtrace:build",
"//packages/elastic-safer-lodash-set:build",
"//packages/kbn-ace:build",
@ -132,6 +136,10 @@ filegroup(
"//packages/analytics/shippers/elastic_v3/common:build_types",
"//packages/analytics/shippers/elastic_v3/server:build_types",
"//packages/analytics/shippers/fullstory:build_types",
"//packages/core/base/core-base-browser-internal:build_types",
"//packages/core/base/core-base-common-internal:build_types",
"//packages/core/base/core-base-common:build_types",
"//packages/core/base/core-base-server-internal:build_types",
"//packages/elastic-apm-synthtrace:build_types",
"//packages/elastic-safer-lodash-set:build_types",
"//packages/kbn-ace:build_types",

View file

@ -0,0 +1,108 @@
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-base-browser-internal"
PKG_REQUIRE_NAME = "@kbn/core-base-browser-internal"
SOURCE_FILES = glob(
[
"src/**/*.ts",
"src/**/*.tsx",
],
exclude = [
"**/*.test.*",
],
)
SRCS = SOURCE_FILES
filegroup(
name = "srcs",
srcs = SRCS,
)
NPM_MODULE_EXTRA_FILES = [
"package.json",
]
RUNTIME_DEPS = [
"@npm//react"
]
TYPES_DEPS = [
"@npm//@types/node",
"@npm//@types/jest",
"@npm//@types/react",
"//packages/kbn-utility-types:npm_module_types",
"//packages/kbn-config:npm_module_types",
"//packages/core/base/core-base-common-internal:npm_module_types",
]
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
jsts_transpiler(
name = "target_web",
srcs = SRCS,
build_pkg_name = package_name(),
web = True,
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.bazel.json",
],
)
ts_project(
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = TYPES_DEPS,
declaration = True,
emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src",
tsconfig = ":tsconfig",
)
js_library(
name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
pkg_npm(
name = "npm_module",
deps = [":" + PKG_DIRNAME],
)
filegroup(
name = "build",
srcs = [":npm_module"],
visibility = ["//visibility:public"],
)
pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)
filegroup(
name = "build_types",
srcs = [":npm_module_types"],
visibility = ["//visibility:public"],
)

View file

@ -0,0 +1,3 @@
# @kbn/core-base-browser-internal
Package containing base browser internal types of Core

View 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',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/base/core-base-browser-internal'],
};

View file

@ -0,0 +1,8 @@
{
"name": "@kbn/core-base-browser-internal",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"browser": "./target_web/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View 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.
*/
import type { EnvironmentMode, PackageInfo } from '@kbn/config';
import type { CoreId } from '@kbn/core-base-common-internal';
/** @internal */
export interface CoreContext {
coreId: CoreId;
env: {
mode: Readonly<EnvironmentMode>;
packageInfo: Readonly<PackageInfo>;
};
}

View 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 type { CoreContext } from './core_context';
export type { CoreService } from './services';

View file

@ -0,0 +1,20 @@
/*
* 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 { MaybePromise } from '@kbn/utility-types';
/**
* Base interface that all core service should implement
*
* @internal
*/
export interface CoreService<TSetup = void, TStart = void> {
setup(...params: any[]): MaybePromise<TSetup>;
start(...params: any[]): MaybePromise<TStart>;
stop(): MaybePromise<void>;
}

View file

@ -0,0 +1,18 @@
{
"extends": "../../../../tsconfig.bazel.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src",
"stripInternal": false,
"types": [
"jest",
"node",
"react"
]
},
"include": [
"src/**/*"
]
}

View file

@ -0,0 +1,124 @@
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-base-common-internal"
PKG_REQUIRE_NAME = "@kbn/core-base-common-internal"
SOURCE_FILES = glob(
[
"src/**/*.ts",
"src/**/*.tsx",
],
exclude = [
"**/*.test.*",
],
)
SRCS = SOURCE_FILES
filegroup(
name = "srcs",
srcs = SRCS,
)
NPM_MODULE_EXTRA_FILES = [
"package.json",
]
# In this array place runtime dependencies, including other packages and NPM packages
# which must be available for this code to run.
#
# To reference other packages use:
# "//repo/relative/path/to/package"
# eg. "//packages/kbn-utils"
#
# To reference a NPM package use:
# "@npm//name-of-package"
# eg. "@npm//lodash"
RUNTIME_DEPS = [
"@npm//react"
]
# In this array place dependencies necessary to build the types, which will include the
# :npm_module_types target of other packages and packages from NPM, including @types/*
# packages.
#
# To reference the types for another package use:
# "//repo/relative/path/to/package:npm_module_types"
# eg. "//packages/kbn-utils:npm_module_types"
#
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"@npm//@types/node",
"@npm//@types/jest",
"@npm//@types/react"
]
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
jsts_transpiler(
name = "target_web",
srcs = SRCS,
build_pkg_name = package_name(),
web = True,
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.bazel.json",
],
)
ts_project(
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = TYPES_DEPS,
declaration = True,
emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src",
tsconfig = ":tsconfig",
)
js_library(
name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
pkg_npm(
name = "npm_module",
deps = [":" + PKG_DIRNAME],
)
filegroup(
name = "build",
srcs = [":npm_module"],
visibility = ["//visibility:public"],
)
pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)
filegroup(
name = "build_types",
srcs = [":npm_module_types"],
visibility = ["//visibility:public"],
)

View file

@ -0,0 +1,3 @@
# @kbn/core-base-common-internal
Package containing base common internal types of Core

View 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',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/base/core-base-common-internal'],
};

View file

@ -0,0 +1,8 @@
{
"name": "@kbn/core-base-common-internal",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"browser": "./target_web/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -7,8 +7,4 @@
*/
/** @internal */
export interface CoreService<TSetup = void, TStart = void> {
setup(...params: any[]): TSetup | Promise<TSetup>;
start(...params: any[]): TStart | Promise<TStart>;
stop(): void | Promise<void>;
}
export type CoreId = symbol;

View 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 { CoreId } from './core';

View file

@ -0,0 +1,18 @@
{
"extends": "../../../../tsconfig.bazel.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src",
"stripInternal": false,
"types": [
"jest",
"node",
"react"
]
},
"include": [
"src/**/*"
]
}

View file

@ -0,0 +1,114 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
PKG_DIRNAME = "core-base-common"
PKG_REQUIRE_NAME = "@kbn/core-base-common"
SOURCE_FILES = glob(
[
"src/**/*.ts",
],
exclude = [
"**/*.test.*",
],
)
SRCS = SOURCE_FILES
filegroup(
name = "srcs",
srcs = SRCS,
)
NPM_MODULE_EXTRA_FILES = [
"package.json",
]
# In this array place runtime dependencies, including other packages and NPM packages
# which must be available for this code to run.
#
# To reference other packages use:
# "//repo/relative/path/to/package"
# eg. "//packages/kbn-utils"
#
# To reference a NPM package use:
# "@npm//name-of-package"
# eg. "@npm//lodash"
RUNTIME_DEPS = [
]
# In this array place dependencies necessary to build the types, which will include the
# :npm_module_types target of other packages and packages from NPM, including @types/*
# packages.
#
# To reference the types for another package use:
# "//repo/relative/path/to/package:npm_module_types"
# eg. "//packages/kbn-utils:npm_module_types"
#
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"@npm//@types/node",
"@npm//@types/jest",
]
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"],
)

View file

@ -0,0 +1,3 @@
# @kbn/core-base-common
Package containing base common public types of Core

View 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/base/core-base-common'],
};

View file

@ -0,0 +1,7 @@
{
"name": "@kbn/core-base-common",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View 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 { PluginOpaqueId, PluginName } from './plugins';

View file

@ -0,0 +1,18 @@
/*
* 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.
*/
/**
* Dedicated type for plugin name/id that is supposed to make Map/Set/Arrays
* that use it as a key or value more obvious.
*
* @public
*/
export type PluginName = string;
/** @public */
export type PluginOpaqueId = symbol;

View file

@ -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/**/*"
]
}

View file

@ -0,0 +1,99 @@
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-base-server-internal"
PKG_REQUIRE_NAME = "@kbn/core-base-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 = [
]
TYPES_DEPS = [
"@npm//@types/node",
"@npm//@types/jest",
"//packages/kbn-config:npm_module_types",
"//packages/kbn-logging:npm_module_types",
"//packages/kbn-utility-types:npm_module_types",
"//packages/core/base/core-base-common-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"],
)

View file

@ -0,0 +1,3 @@
# @kbn/core-base-server-internal
Package containing base server internal types of Core

View 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/base/core-base-server-internal'],
};

View file

@ -0,0 +1,7 @@
{
"name": "@kbn/core-base-server-internal",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -6,11 +6,9 @@
* Side Public License, v 1.
*/
import { LoggerFactory } from '@kbn/logging';
import { IConfigService, Env } from '@kbn/config';
/** @internal */
export type CoreId = symbol;
import type { IConfigService, Env } from '@kbn/config';
import type { LoggerFactory } from '@kbn/logging';
import type { CoreId } from '@kbn/core-base-common-internal';
/**
* Groups all main Kibana's core modules/systems/services that are consumed in a

View 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 type { CoreContext } from './core_context';
export type { CoreService, ServiceConfigDescriptor } from './services';

View file

@ -0,0 +1,39 @@
/*
* 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 { MaybePromise } from '@kbn/utility-types';
import type { ConfigDeprecationProvider } from '@kbn/config';
import type { Type } from '@kbn/config-schema';
/**
* Descriptor of a core service configuration
*
* @internal
*/
export interface ServiceConfigDescriptor<T = any> {
path: string;
/**
* Schema to use to validate the configuration.
*/
schema: Type<T>;
/**
* Provider for the {@link ConfigDeprecation} to apply to the plugin configuration.
*/
deprecations?: ConfigDeprecationProvider;
}
/**
* Base interface that all core service should implement
*
* @internal
*/
export interface CoreService<TSetup = void, TStart = void> {
setup(...params: any[]): MaybePromise<TSetup>;
start(...params: any[]): MaybePromise<TStart>;
stop(): MaybePromise<void>;
}

View file

@ -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/**/*"
]
}

View file

@ -25,6 +25,7 @@ export const BAZEL_PACKAGE_DIRS = [
'packages/analytics',
'packages/analytics/shippers',
'packages/analytics/shippers/elastic_v3',
'packages/core/*',
];
/**

View file

@ -8,10 +8,10 @@
import type { AnalyticsClient } from '@kbn/analytics-client';
import { createAnalytics } from '@kbn/analytics-client';
import type { CoreContext } from '@kbn/core-base-browser-internal';
import { of } from 'rxjs';
import { trackClicks } from './track_clicks';
import { InjectedMetadataSetup } from '../injected_metadata';
import { CoreContext } from '../core_system';
import { getSessionId } from './get_session_id';
import { createLogger } from './logger';

View file

@ -7,6 +7,7 @@
*/
import { UnregisterCallback } from 'history';
import type { CoreContext } from '@kbn/core-base-browser-internal';
import {
InternalApplicationSetup,
InternalApplicationStart,
@ -14,7 +15,6 @@ import {
AppMountParameters,
} from '../application';
import type { HttpSetup, HttpStart } from '../http';
import type { CoreContext } from '../core_system';
import type { NotificationsSetup, NotificationsStart } from '../notifications';
import type { IUiSettingsClient } from '../ui_settings';
import type { InjectedMetadataSetup } from '../injected_metadata';

View file

@ -5,8 +5,8 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { CoreId } from '../server';
import { PackageInfo, EnvironmentMode } from '../server/types';
import type { CoreContext } from '@kbn/core-base-browser-internal';
import { CoreSetup, CoreStart } from '.';
import { ChromeService } from './chrome';
import { FatalErrorsService, FatalErrorsSetup } from './fatal_errors';
@ -42,15 +42,6 @@ interface Params {
injectedMetadata: InjectedMetadataParams['injectedMetadata'];
}
/** @internal */
export interface CoreContext {
coreId: CoreId;
env: {
mode: Readonly<EnvironmentMode>;
packageInfo: Readonly<PackageInfo>;
};
}
/** @internal */
export interface InternalCoreSetup extends Omit<CoreSetup, 'application' | 'getStartServices'> {
application: InternalApplicationSetup;

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import type { CoreService } from '../../types';
import type { CoreService } from '@kbn/core-base-browser-internal';
import type { HttpStart } from '../http';
import { DeprecationsClient, ResolveDeprecationResponse } from './deprecations_client';
import type { DomainDeprecationDetails } from '../../server/types';

View file

@ -8,8 +8,9 @@
import { compact, isEqual, isUndefined, omitBy } from 'lodash';
import { BehaviorSubject, Observable, Subscription, map } from 'rxjs';
import type { CoreService } from '@kbn/core-base-browser-internal';
import { AnalyticsServiceSetup } from '../analytics';
import { CoreService, KibanaExecutionContext } from '../../types';
import { KibanaExecutionContext } from '../../types';
// Should be exported from elastic/apm-rum
export type LabelValue = string | number | boolean;

View file

@ -6,8 +6,8 @@
* Side Public License, v 1.
*/
import type { CoreService } from '@kbn/core-base-browser-internal';
import { IAnonymousPaths, IBasePath } from '..';
import { CoreService } from '../../types';
interface Deps {
basePath: IBasePath;

View file

@ -6,9 +6,8 @@
* Side Public License, v 1.
*/
import type { CoreService } from '@kbn/core-base-browser-internal';
import { IExternalUrlPolicy } from '../../server/types';
import { CoreService } from '../../types';
import { IExternalUrl } from './types';
import { InjectedMetadataSetup } from '../injected_metadata';
import { Sha256 } from '../utils';

View file

@ -6,6 +6,7 @@
* Side Public License, v 1.
*/
import type { CoreService } from '@kbn/core-base-browser-internal';
import { HttpSetup, HttpStart } from './types';
import { InjectedMetadataSetup } from '../injected_metadata';
import { FatalErrorsSetup } from '../fatal_errors';
@ -13,7 +14,6 @@ import { BasePath } from './base_path';
import { AnonymousPathsService } from './anonymous_paths_service';
import { LoadingCountService } from './loading_count_service';
import { Fetch } from './fetch';
import { CoreService } from '../../types';
import { ExternalUrlService } from './external_url_service';
import { ExecutionContextSetup } from '../execution_context';

View file

@ -16,8 +16,8 @@ import {
takeUntil,
tap,
} from 'rxjs/operators';
import type { CoreService } from '@kbn/core-base-browser-internal';
import { FatalErrorsSetup } from '../fatal_errors';
import { CoreService } from '../../types';
/** @public */
export interface LoadingCountSetup {

View file

@ -69,7 +69,8 @@ export type {
IExternalUrlPolicy,
DomainDeprecationDetails,
} from '../server/types';
export type { CoreContext, CoreSystem } from './core_system';
export type { CoreContext } from '@kbn/core-base-browser-internal';
export type { CoreSystem } from './core_system';
export { DEFAULT_APP_CATEGORIES, APP_WRAPPER_CLASS } from '../utils';
export type { AppCategory, UiSettingsParams, UserProvidedValues, UiSettingsType } from '../types';

View file

@ -9,14 +9,9 @@
import { get } from 'lodash';
import { deepFreeze } from '@kbn/std';
import type { ThemeVersion } from '@kbn/ui-shared-deps-npm';
import type { EnvironmentMode, PackageInfo } from '@kbn/config';
import { DiscoveredPlugin, PluginName } from '../../server';
import {
EnvironmentMode,
IExternalUrlPolicy,
PackageInfo,
UiSettingsParams,
UserProvidedValues,
} from '../../server/types';
import { IExternalUrlPolicy, UiSettingsParams, UserProvidedValues } from '../../server/types';
import { AppCategory } from '..';
export interface InjectedPluginMetadata {

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { CoreService } from '../../types';
import type { CoreService } from '@kbn/core-base-browser-internal';
const createCoreServiceMock = (): jest.Mocked<CoreService> => {
return {

View file

@ -6,8 +6,8 @@
* Side Public License, v 1.
*/
import type { CoreService } from '@kbn/core-base-browser-internal';
import { IUiSettingsClient } from '../ui_settings';
import { CoreService } from '../../types';
import { MomentService } from './moment';
import { StylesService } from './styles';

View file

@ -8,10 +8,10 @@
import moment from 'moment-timezone';
import { merge, Subscription } from 'rxjs';
import { tap } from 'rxjs/operators';
import type { CoreService } from '@kbn/core-base-browser-internal';
import { IUiSettingsClient } from '../../ui_settings';
import { CoreService } from '../../../types';
interface StartDeps {
uiSettings: IUiSettingsClient;

View file

@ -8,8 +8,8 @@
import { Subscription } from 'rxjs';
import type { CoreService } from '@kbn/core-base-browser-internal';
import { IUiSettingsClient } from '../../ui_settings';
import { CoreService } from '../../../types';
// @ts-expect-error
import disableAnimationsCss from '!!raw-loader!./disable_animations.css';

View file

@ -7,9 +7,10 @@
*/
import { createMemoryHistory } from 'history';
import type { CoreContext } from '@kbn/core-base-browser-internal';
// Only import types from '.' to avoid triggering default Jest mocks.
import { CoreContext, PluginInitializerContext, AppMountParameters } from '.';
import { PluginInitializerContext, AppMountParameters } from '.';
// Import values from their individual modules instead.
import { ScopedHistory } from './application';

View file

@ -7,9 +7,9 @@
*/
import { omit } from 'lodash';
import type { CoreContext } from '@kbn/core-base-browser-internal';
import { DiscoveredPlugin } from '../../server';
import { PluginOpaqueId, PackageInfo, EnvironmentMode } from '../../server/types';
import { CoreContext } from '../core_system';
import { PluginWrapper } from './plugin';
import { PluginsServiceSetupDeps, PluginsServiceStartDeps } from './plugins_service';
import { CoreSetup, CoreStart } from '..';

View file

@ -6,9 +6,8 @@
* Side Public License, v 1.
*/
import { PluginName, PluginOpaqueId } from '../../server';
import { CoreService } from '../../types';
import { CoreContext } from '../core_system';
import type { CoreService, CoreContext } from '@kbn/core-base-browser-internal';
import type { PluginName, PluginOpaqueId } from '@kbn/core-base-common';
import { PluginWrapper } from './plugin';
import {
createPluginInitializerContext,

View file

@ -11,6 +11,7 @@ import { AnalyticsClient } from '@kbn/analytics-client';
import type { ButtonColor } from '@elastic/eui';
import type { ConfigPath } from '@kbn/config';
import { ContextProviderOpts } from '@kbn/analytics-client';
import { CoreContext } from '@kbn/core-base-browser-internal';
import type { DocLinks } from '@kbn/doc-links';
import { EnvironmentMode } from '@kbn/config';
import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
@ -35,6 +36,8 @@ import { Observable } from 'rxjs';
import { OptInConfig } from '@kbn/analytics-client';
import { PackageInfo } from '@kbn/config';
import { Path } from 'history';
import { PluginName } from '@kbn/core-base-common';
import { PluginOpaqueId } from '@kbn/core-base-common';
import { default as React_2 } from 'react';
import { RecursiveReadonly } from '@kbn/utility-types';
import * as Rx from 'rxjs';
@ -388,18 +391,7 @@ export interface ChromeUserBanner {
export { ContextProviderOpts }
// @internal (undocumented)
export interface CoreContext {
// Warning: (ae-forgotten-export) The symbol "CoreId" needs to be exported by the entry point index.d.ts
//
// (undocumented)
coreId: CoreId;
// (undocumented)
env: {
mode: Readonly<EnvironmentMode>;
packageInfo: Readonly<PackageInfo>;
};
}
export { CoreContext }
// @public
export interface CoreSetup<TPluginsStart extends object = object, TStart = unknown> {
@ -966,8 +958,7 @@ export interface PluginInitializerContext<ConfigSchema extends object = object>
readonly opaqueId: PluginOpaqueId;
}
// @public (undocumented)
export type PluginOpaqueId = symbol;
export { PluginOpaqueId }
// @public
export type PublicAppDeepLinkInfo = Omit<AppDeepLink, 'deepLinks' | 'keywords' | 'navLinkStatus' | 'searchable'> & {
@ -1574,6 +1565,6 @@ export interface UserProvidedValues<T = any> {
// Warnings were encountered during analysis:
//
// src/core/public/core_system.ts:195:21 - (ae-forgotten-export) The symbol "InternalApplicationStart" needs to be exported by the entry point index.d.ts
// src/core/public/core_system.ts:186:21 - (ae-forgotten-export) The symbol "InternalApplicationStart" needs to be exported by the entry point index.d.ts
```

View file

@ -6,8 +6,8 @@
* Side Public License, v 1.
*/
import { CoreService } from '../../types';
import { CoreStart } from '..';
import type { CoreService } from '@kbn/core-base-browser-internal';
import type { HttpStart } from '../http';
import { SavedObjectsClient, SavedObjectsClientContract } from './saved_objects_client';
/**
@ -20,7 +20,7 @@ export interface SavedObjectsStart {
export class SavedObjectsService implements CoreService<void, SavedObjectsStart> {
public async setup() {}
public async start({ http }: { http: CoreStart['http'] }): Promise<SavedObjectsStart> {
public async start({ http }: { http: HttpStart }): Promise<SavedObjectsStart> {
return { client: new SavedObjectsClient(http) };
}
public async stop() {}

View file

@ -6,10 +6,10 @@
* Side Public License, v 1.
*/
import { of } from 'rxjs';
import type { AnalyticsClient } from '@kbn/analytics-client';
import { createAnalytics } from '@kbn/analytics-client';
import { of } from 'rxjs';
import type { CoreContext } from '../core_context';
import type { CoreContext } from '@kbn/core-base-server-internal';
/**
* Exposes the public APIs of the AnalyticsClient during the preboot phase

View file

@ -6,9 +6,9 @@
* Side Public License, v 1.
*/
import type { CoreContext } from '@kbn/core-base-server-internal';
import { Logger } from '@kbn/logging';
import { Capabilities, CapabilitiesProvider, CapabilitiesSwitcher } from './types';
import { CoreContext } from '../core_context';
import { InternalHttpServicePreboot, InternalHttpServiceSetup, KibanaRequest } from '../http';
import { mergeCapabilities } from './merge_capabilities';
import { getCapabilitiesResolver, CapabilitiesResolver } from './resolve_capabilities';

View file

@ -8,7 +8,9 @@
import { flatten } from 'lodash';
import { ShallowPromise, MaybePromise } from '@kbn/utility-types';
import type { CoreId, PluginOpaqueId, RequestHandler, RequestHandlerContext } from '../..';
import type { PluginOpaqueId } from '@kbn/core-base-common';
import type { CoreId } from '@kbn/core-base-common-internal';
import type { RequestHandler, RequestHandlerContext } from '../..';
/**
* A function that returns a context value for a specific key of given context type.

View file

@ -6,10 +6,10 @@
* Side Public License, v 1.
*/
import { PluginOpaqueId } from '..';
import type { PluginOpaqueId } from '@kbn/core-base-common';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { MockContextConstructor } from './context_service.test.mocks';
import { ContextService } from './context_service';
import { CoreContext } from '../core_context';
const pluginDependencies = new Map<PluginOpaqueId, PluginOpaqueId[]>();

View file

@ -6,9 +6,9 @@
* Side Public License, v 1.
*/
import { PluginOpaqueId } from '..';
import type { PluginOpaqueId } from '@kbn/core-base-common';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { IContextContainer, ContextContainer } from './container';
import { CoreContext } from '../core_context';
type PrebootDeps = SetupDeps;

View file

@ -11,12 +11,12 @@ import { stringify } from 'querystring';
import { Env } from '@kbn/config';
import { schema } from '@kbn/config-schema';
import { fromRoot } from '@kbn/utils';
import { Logger } from '@kbn/logging';
import type { Logger } from '@kbn/logging';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { IRouter, IBasePath, IKibanaResponse, KibanaResponseFactory, KibanaRequest } from '../http';
import { HttpResources, HttpResourcesServiceToolkit } from '../http_resources';
import { InternalCorePreboot, InternalCoreSetup } from '../internal_types';
import { CoreContext } from '../core_context';
import { registerBundleRoutes } from './bundle_routes';
import { UiPlugins } from '../plugins';

View file

@ -10,7 +10,7 @@ import { REPO_ROOT } from '@kbn/utils';
import type { DeeplyMockedKeys } from '@kbn/utility-types/jest';
import { Env, IConfigService } from '@kbn/config';
import { configServiceMock, getEnvOptions } from '@kbn/config-mocks';
import { CoreContext } from './core_context';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { loggingSystemMock } from './logging/logging_system.mock';
import { ILoggingSystem } from './logging';

View file

@ -16,9 +16,9 @@ import type {
AggregationsSingleBucketAggregateBase,
SearchTotalHits,
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { CoreService } from '../../types';
import { Logger, SavedObjectsServiceStart, SavedObjectTypeRegistry } from '..';
import { CoreContext } from '../core_context';
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
import type { Logger } from '@kbn/logging';
import { SavedObjectsServiceStart, SavedObjectTypeRegistry } from '..';
import { ElasticsearchConfigType } from '../elasticsearch/elasticsearch_config';
import { HttpConfigType, InternalHttpServiceSetup } from '../http';
import { LoggingConfigType } from '../logging';

View file

@ -7,7 +7,7 @@
*/
import { TypeOf, schema } from '@kbn/config-schema';
import { ServiceConfigDescriptor } from '../internal_types';
import type { ServiceConfigDescriptor } from '@kbn/core-base-server-internal';
interface DirectiveValidationOptions {
allowNone: boolean;

View file

@ -7,7 +7,7 @@
*/
import { schema, TypeOf } from '@kbn/config-schema';
import { ServiceConfigDescriptor } from '../internal_types';
import type { ServiceConfigDescriptor } from '@kbn/core-base-server-internal';
const configSchema = schema.object({
// `deprecation.skip_deprecated_settings` is consistent with the equivalent ES feature and config property

View file

@ -10,12 +10,11 @@ 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 { DeprecationsFactory } from './deprecations_factory';
import { DomainDeprecationDetails, RegisterDeprecationsConfig } from './types';
import { registerRoutes } from './routes';
import { config as deprecationConfig, DeprecationConfigType } from './deprecation_config';
import { CoreContext } from '../core_context';
import { CoreService } from '../../types';
import { InternalHttpServiceSetup } from '../http';
import { IScopedClusterClient } from '../elasticsearch/client';
import { SavedObjectsClientContract } from '../saved_objects/types';

View file

@ -7,7 +7,7 @@
*/
import { getDocLinks, getDocLinksMeta } from '@kbn/doc-links';
import type { CoreContext } from '../core_context';
import type { CoreContext } from '@kbn/core-base-server-internal';
import type { DocLinksServiceSetup, DocLinksServiceStart } from './types';
/** @internal */

View file

@ -11,8 +11,8 @@ import { readPkcs12Keystore, readPkcs12Truststore } from '@kbn/crypto';
import { i18n } from '@kbn/i18n';
import { Duration } from 'moment';
import { readFileSync } from 'fs';
import type { ServiceConfigDescriptor } from '@kbn/core-base-server-internal';
import { ConfigDeprecationProvider } from '..';
import { ServiceConfigDescriptor } from '../internal_types';
import { getReservedHeaders } from './default_headers';
const hostURISchema = schema.uri({ scheme: ['http', 'https'] });

View file

@ -27,7 +27,7 @@ import { first, concatMap } from 'rxjs/operators';
import { REPO_ROOT } from '@kbn/utils';
import { Env } from '@kbn/config';
import { configServiceMock, getEnvOptions } from '@kbn/config-mocks';
import { CoreContext } from '../core_context';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { loggingSystemMock } from '../logging/logging_system.mock';
import { httpServiceMock } from '../http/http_service.mock';
import { executionContextServiceMock } from '../execution_context/execution_context_service.mock';

View file

@ -10,10 +10,9 @@ import { firstValueFrom, Observable, Subject } from 'rxjs';
import { map, shareReplay, takeUntil } from 'rxjs/operators';
import type { Logger } from '@kbn/logging';
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
import { registerAnalyticsContextProvider } from './register_analytics_context_provider';
import { AnalyticsServiceSetup } from '../analytics';
import { CoreService } from '../../types';
import { CoreContext } from '../core_context';
import { ClusterClient, ElasticsearchClientConfig } from './client';
import { ElasticsearchConfig, ElasticsearchConfigType } from './elasticsearch_config';

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { PathConfigType } from '@kbn/utils';
import type { PathConfigType } from '@kbn/utils';
import type { Logger } from '@kbn/logging';
import { mkdir } from './fs';

View file

@ -8,11 +8,11 @@
import { BehaviorSubject } from 'rxjs';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { EnvironmentService } from './environment_service';
import { resolveInstanceUuid } from './resolve_uuid';
import { createDataFolder } from './create_data_folder';
import { writePidFile } from './write_pid_file';
import { CoreContext } from '../core_context';
import type { AnalyticsServicePreboot } from '../analytics';
import { configServiceMock } from '@kbn/config-mocks';

View file

@ -10,8 +10,8 @@ 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 type { AnalyticsServicePreboot } from '../analytics';
import { CoreContext } from '../core_context';
import { HttpConfigType, config as httpConfigDef } from '../http';
import { PidConfigType, config as pidConfigDef } from './pid_config';
import { resolveInstanceUuid } from './resolve_uuid';

View file

@ -7,7 +7,7 @@
*/
import { TypeOf, schema } from '@kbn/config-schema';
import { ServiceConfigDescriptor } from '../internal_types';
import type { ServiceConfigDescriptor } from '@kbn/core-base-server-internal';
const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: true }),

View file

@ -11,8 +11,8 @@ import { isUndefined, omitBy } from 'lodash';
import type { Subscription } from 'rxjs';
import type { Logger } from '@kbn/logging';
import type { CoreService, KibanaExecutionContext } from '../../types';
import type { CoreContext } from '../core_context';
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
import type { KibanaExecutionContext } from '../../types';
import type { ExecutionContextConfigType } from './execution_context_config';
import {

View file

@ -8,11 +8,11 @@
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 { hostname } from 'os';
import url from 'url';
import type { Duration } from 'moment';
import { ServiceConfigDescriptor } from '../internal_types';
import { CspConfigType, CspConfig, ICspConfig } from '../csp';
import { ExternalUrlConfig, IExternalUrlConfig } from '../external_url';
import {

View file

@ -10,14 +10,14 @@ import { Observable, Subscription, combineLatest, firstValueFrom } from 'rxjs';
import { map } from 'rxjs/operators';
import { pick } from '@kbn/std';
import type { Logger } from '@kbn/logging';
import { Logger } from '@kbn/logging';
import { Env } from '@kbn/config';
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
import type { PluginOpaqueId } from '@kbn/core-base-common';
import type { RequestHandlerContext } from '..';
import type { InternalExecutionContextSetup } from '../execution_context';
import { CoreService } from '../../types';
import { ContextSetup, InternalContextPreboot } from '../context';
import { CoreContext } from '../core_context';
import { PluginOpaqueId } from '../plugins';
import { CspConfigType, config as cspConfig } from '../csp';
import { Router } from './router';

View file

@ -15,7 +15,7 @@ import { ByteSizeValue } from '@kbn/config-schema';
import { Env } from '@kbn/config';
import { getEnvOptions, configServiceMock } from '@kbn/config-mocks';
import { CoreContext } from '../../core_context';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { HttpService } from '../http_service';
import { contextServiceMock } from '../../context/context_service.mock';

View file

@ -12,8 +12,8 @@ import { REPO_ROOT } from '@kbn/utils';
import { ByteSizeValue } from '@kbn/config-schema';
import { Env } from '@kbn/config';
import { getEnvOptions, configServiceMock } from '@kbn/config-mocks';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { HttpService } from './http_service';
import { CoreContext } from '../core_context';
import { loggingSystemMock } from '../logging/logging_system.mock';
const coreId = Symbol('core');

View file

@ -7,9 +7,8 @@
*/
import type { Logger } from '@kbn/logging';
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
import { RequestHandlerContext } from '..';
import { CoreContext } from '../core_context';
import {
IRouter,
RouteConfig,
@ -18,10 +17,7 @@ import {
KibanaResponseFactory,
InternalHttpServicePreboot,
} from '../http';
import { InternalRenderingServicePreboot, InternalRenderingServiceSetup } from '../rendering';
import { CoreService } from '../../types';
import {
InternalHttpResourcesSetup,
HttpResources,

View file

@ -9,7 +9,7 @@
import { firstValueFrom } from 'rxjs';
import type { Logger } from '@kbn/logging';
import type { IConfigService } from '@kbn/config';
import { CoreContext } from '../core_context';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { InternalHttpServicePreboot, InternalHttpServiceSetup } from '../http';
import { config as i18nConfigDef, I18nConfigType } from './i18n_config';
import { getKibanaTranslationFiles } from './get_kibana_translation_files';

View file

@ -117,7 +117,7 @@ export type {
HandlerContextType,
HandlerParameters,
} from './context';
export type { CoreId } from './core_context';
export type { CoreId } from '@kbn/core-base-common-internal';
export { CspConfig } from './csp';
export type { ICspConfig } from './csp';

View file

@ -6,9 +6,6 @@
* Side Public License, v 1.
*/
import { Type } from '@kbn/config-schema';
import type { ConfigDeprecationProvider } from '@kbn/config';
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
import { InternalContextPreboot, ContextSetup } from './context';
import {
@ -101,18 +98,3 @@ export interface InternalCoreStart {
executionContext: InternalExecutionContextStart;
deprecations: InternalDeprecationsServiceStart;
}
/**
* @internal
*/
export interface ServiceConfigDescriptor<T = any> {
path: string;
/**
* Schema to use to validate the configuration.
*/
schema: Type<T>;
/**
* Provider for the {@link ConfigDeprecation} to apply to the plugin configuration.
*/
deprecations?: ConfigDeprecationProvider;
}

View file

@ -8,10 +8,9 @@
import { Observable, Subscription } from 'rxjs';
import { Logger } from '@kbn/logging';
import { CoreService } from '../../types';
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
import { LoggingConfig, LoggerContextConfigInput } from './logging_config';
import { ILoggingSystem } from './logging_system';
import { CoreContext } from '../core_context';
/**
* Provides APIs to plugins for customizing the plugin's logger.

View file

@ -7,9 +7,8 @@
*/
import { firstValueFrom, ReplaySubject } from 'rxjs';
import type { Logger } from '@kbn/logging';
import { CoreService } from '../../types';
import { CoreContext } from '../core_context';
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
import { Logger } from '@kbn/logging';
import { InternalHttpServiceSetup } from '../http';
import { InternalMetricsServiceSetup, InternalMetricsServiceStart, OpsMetrics } from './types';
import { OpsMetricsCollector } from './ops_metrics_collector';

View file

@ -17,10 +17,10 @@ import { firstValueFrom, from } from 'rxjs';
import { map, toArray } from 'rxjs/operators';
import { resolve } from 'path';
import { ConfigService, Env } from '@kbn/config';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { PluginsConfig, PluginsConfigType, config } from '../plugins_config';
import type { InstanceInfo } from '../plugin_context';
import { discover } from './plugins_discovery';
import { CoreContext } from '../../core_context';
import { PluginType } from '../types';
const KIBANA_ROOT = process.cwd();

View file

@ -8,8 +8,8 @@
import { from, merge } from 'rxjs';
import { catchError, filter, map, mergeMap, concatMap, shareReplay, toArray } from 'rxjs/operators';
import type { Logger } from '@kbn/logging';
import { CoreContext } from '../../core_context';
import { Logger } from '@kbn/logging';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { PluginWrapper } from '../plugin';
import { createPluginInitializerContext, InstanceInfo } from '../plugin_context';
import { PluginsConfig } from '../plugins_config';

View file

@ -13,7 +13,7 @@ import { schema } from '@kbn/config-schema';
import { Env } from '@kbn/config';
import { configServiceMock, getEnvOptions } from '@kbn/config-mocks';
import { CoreContext } from '../core_context';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { coreMock } from '../mocks';
import { loggingSystemMock } from '../logging/logging_system.mock';

View file

@ -10,19 +10,19 @@ import { duration } from 'moment';
import { first } from 'rxjs/operators';
import { REPO_ROOT } from '@kbn/utils';
import { fromRoot } from '@kbn/utils';
import { Env } from '@kbn/config';
import { rawConfigServiceMock, getEnvOptions, configServiceMock } from '@kbn/config-mocks';
import type { CoreContext } from '@kbn/core-base-server-internal';
import {
createPluginInitializerContext,
createPluginPrebootSetupContext,
InstanceInfo,
} from './plugin_context';
import { CoreContext } from '../core_context';
import { loggingSystemMock } from '../logging/logging_system.mock';
import { PluginManifest, PluginType } from './types';
import { Server } from '../server';
import { schema, ByteSizeValue } from '@kbn/config-schema';
import { ConfigService } from '@kbn/config';
import { ConfigService, Env } from '@kbn/config';
import { PluginWrapper } from './plugin';
import { coreMock } from '../mocks';

View file

@ -7,15 +7,16 @@
*/
import { shareReplay } from 'rxjs/operators';
import type { CoreContext } from '@kbn/core-base-server-internal';
import type { PluginOpaqueId } from '@kbn/core-base-common';
import type { RequestHandlerContext } from '..';
import { CoreContext } from '../core_context';
import { PluginWrapper } from './plugin';
import {
PluginsServicePrebootSetupDeps,
PluginsServiceSetupDeps,
PluginsServiceStartDeps,
} from './plugins_service';
import { PluginInitializerContext, PluginManifest, PluginOpaqueId } from './types';
import { PluginInitializerContext, PluginManifest } from './types';
import { IRouter, RequestHandlerContextProvider } from '../http';
import { getGlobalConfig, getGlobalConfig$ } from './legacy_config';
import { CorePreboot, CoreSetup, CoreStart } from '..';

View file

@ -8,7 +8,7 @@
import { schema, TypeOf } from '@kbn/config-schema';
import { Env } from '@kbn/config';
import { ServiceConfigDescriptor } from '../internal_types';
import type { ServiceConfigDescriptor } from '@kbn/core-base-server-internal';
const configSchema = schema.object({
initialize: schema.boolean({ defaultValue: true }),

View file

@ -11,10 +11,10 @@ import { firstValueFrom, Observable } from 'rxjs';
import { filter, map, tap, toArray } from 'rxjs/operators';
import { getFlattenedObject } from '@kbn/std';
import type { Logger } from '@kbn/logging';
import { Logger } from '@kbn/logging';
import type { IConfigService } from '@kbn/config';
import { CoreService } from '../../types';
import { CoreContext } from '../core_context';
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
import type { PluginName } from '@kbn/core-base-common';
import { discover, PluginDiscoveryError, PluginDiscoveryErrorType } from './discovery';
import { PluginWrapper } from './plugin';
import {
@ -22,7 +22,6 @@ import {
InternalPluginInfo,
PluginConfigDescriptor,
PluginDependencies,
PluginName,
PluginType,
} from './types';
import { PluginsConfig, PluginsConfigType } from './plugins_config';

View file

@ -15,14 +15,15 @@ import {
import { BehaviorSubject } from 'rxjs';
import { REPO_ROOT } from '@kbn/utils';
import type { Logger } from '@kbn/logging';
import type { PluginName } from '@kbn/core-base-common';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { Logger } from '@kbn/logging';
import { Env } from '@kbn/config';
import { configServiceMock, getEnvOptions } from '@kbn/config-mocks';
import { CoreContext } from '../core_context';
import { loggingSystemMock } from '../logging/logging_system.mock';
import { PluginWrapper } from './plugin';
import { PluginName, PluginType } from './types';
import { PluginType } from './types';
import { PluginsSystem } from './plugins_system';
import { coreMock } from '../mocks';

View file

@ -7,10 +7,11 @@
*/
import { withTimeout, isPromise } from '@kbn/std';
import type { Logger } from '@kbn/logging';
import { CoreContext } from '../core_context';
import type { PluginName } from '@kbn/core-base-common';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { Logger } from '@kbn/logging';
import { PluginWrapper } from './plugin';
import { DiscoveredPlugin, PluginDependencies, PluginName, PluginType } from './types';
import { DiscoveredPlugin, PluginDependencies, PluginType } from './types';
import {
createPluginPrebootSetupContext,
createPluginSetupContext,

View file

@ -17,6 +17,7 @@ import type {
PackageInfo,
ConfigDeprecationProvider,
} from '@kbn/config';
import type { PluginName, PluginOpaqueId } from '@kbn/core-base-common';
import { ElasticsearchConfigType } from '../elasticsearch/elasticsearch_config';
import { SavedObjectsConfigType } from '../saved_objects/saved_objects_config';
@ -24,6 +25,9 @@ import { CorePreboot, CoreSetup, CoreStart } from '..';
type Maybe<T> = T | undefined;
// re-exporting for now to avoid adapting all imports, will be removed later on in the migration process
export type { PluginName, PluginOpaqueId } from '@kbn/core-base-common';
/**
* Dedicated type for plugin configuration schema.
*
@ -126,17 +130,6 @@ export type MakeUsageFromSchema<T> = {
: boolean;
};
/**
* Dedicated type for plugin name/id that is supposed to make Map/Set/Arrays
* that use it as a key or value more obvious.
*
* @public
*/
export type PluginName = string;
/** @public */
export type PluginOpaqueId = symbol;
/** @public */
export enum PluginType {
/**

View file

@ -6,8 +6,8 @@
* Side Public License, v 1.
*/
import { Logger } from '@kbn/logging';
import { CoreContext } from '../core_context';
import type { Logger } from '@kbn/logging';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { InternalPrebootServicePreboot } from './types';
/** @internal */

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { PluginName } from '..';
import type { PluginName } from '@kbn/core-base-common';
/** @internal */
export interface InternalPrebootServicePreboot {

Some files were not shown because too many files have changed in this diff Show more