mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Creates package core-lifecycle-server and moves public core lifecycle… (#143828)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
42879f7656
commit
8176ac74f0
117 changed files with 2012 additions and 727 deletions
6
.github/CODEOWNERS
vendored
6
.github/CODEOWNERS
vendored
|
@ -782,6 +782,9 @@ packages/core/integrations/core-integrations-browser-mocks @elastic/kibana-core
|
|||
packages/core/lifecycle/core-lifecycle-browser @elastic/kibana-core
|
||||
packages/core/lifecycle/core-lifecycle-browser-internal @elastic/kibana-core
|
||||
packages/core/lifecycle/core-lifecycle-browser-mocks @elastic/kibana-core
|
||||
packages/core/lifecycle/core-lifecycle-server @elastic/kibana-core
|
||||
packages/core/lifecycle/core-lifecycle-server-internal @elastic/kibana-core
|
||||
packages/core/lifecycle/core-lifecycle-server-mocks @elastic/kibana-core
|
||||
packages/core/logging/core-logging-server @elastic/kibana-core
|
||||
packages/core/logging/core-logging-server-internal @elastic/kibana-core
|
||||
packages/core/logging/core-logging-server-mocks @elastic/kibana-core
|
||||
|
@ -805,6 +808,9 @@ packages/core/plugins/core-plugins-base-server-internal @elastic/kibana-core
|
|||
packages/core/plugins/core-plugins-browser @elastic/kibana-core
|
||||
packages/core/plugins/core-plugins-browser-internal @elastic/kibana-core
|
||||
packages/core/plugins/core-plugins-browser-mocks @elastic/kibana-core
|
||||
packages/core/plugins/core-plugins-server @elastic/kibana-core
|
||||
packages/core/plugins/core-plugins-server-internal @elastic/kibana-core
|
||||
packages/core/plugins/core-plugins-server-mocks @elastic/kibana-core
|
||||
packages/core/preboot/core-preboot-server @elastic/kibana-core
|
||||
packages/core/preboot/core-preboot-server-internal @elastic/kibana-core
|
||||
packages/core/preboot/core-preboot-server-mocks @elastic/kibana-core
|
||||
|
|
12
package.json
12
package.json
|
@ -241,6 +241,9 @@
|
|||
"@kbn/core-lifecycle-browser": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser",
|
||||
"@kbn/core-lifecycle-browser-internal": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser-internal",
|
||||
"@kbn/core-lifecycle-browser-mocks": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser-mocks",
|
||||
"@kbn/core-lifecycle-server": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server",
|
||||
"@kbn/core-lifecycle-server-internal": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server-internal",
|
||||
"@kbn/core-lifecycle-server-mocks": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server-mocks",
|
||||
"@kbn/core-logging-server": "link:bazel-bin/packages/core/logging/core-logging-server",
|
||||
"@kbn/core-logging-server-internal": "link:bazel-bin/packages/core/logging/core-logging-server-internal",
|
||||
"@kbn/core-logging-server-mocks": "link:bazel-bin/packages/core/logging/core-logging-server-mocks",
|
||||
|
@ -264,6 +267,9 @@
|
|||
"@kbn/core-plugins-browser": "link:bazel-bin/packages/core/plugins/core-plugins-browser",
|
||||
"@kbn/core-plugins-browser-internal": "link:bazel-bin/packages/core/plugins/core-plugins-browser-internal",
|
||||
"@kbn/core-plugins-browser-mocks": "link:bazel-bin/packages/core/plugins/core-plugins-browser-mocks",
|
||||
"@kbn/core-plugins-server": "link:bazel-bin/packages/core/plugins/core-plugins-server",
|
||||
"@kbn/core-plugins-server-internal": "link:bazel-bin/packages/core/plugins/core-plugins-server-internal",
|
||||
"@kbn/core-plugins-server-mocks": "link:bazel-bin/packages/core/plugins/core-plugins-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",
|
||||
|
@ -979,6 +985,9 @@
|
|||
"@types/kbn__core-lifecycle-browser": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser/npm_module_types",
|
||||
"@types/kbn__core-lifecycle-browser-internal": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser-internal/npm_module_types",
|
||||
"@types/kbn__core-lifecycle-browser-mocks": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser-mocks/npm_module_types",
|
||||
"@types/kbn__core-lifecycle-server": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server/npm_module_types",
|
||||
"@types/kbn__core-lifecycle-server-internal": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server-internal/npm_module_types",
|
||||
"@types/kbn__core-lifecycle-server-mocks": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server-mocks/npm_module_types",
|
||||
"@types/kbn__core-logging-server": "link:bazel-bin/packages/core/logging/core-logging-server/npm_module_types",
|
||||
"@types/kbn__core-logging-server-internal": "link:bazel-bin/packages/core/logging/core-logging-server-internal/npm_module_types",
|
||||
"@types/kbn__core-logging-server-mocks": "link:bazel-bin/packages/core/logging/core-logging-server-mocks/npm_module_types",
|
||||
|
@ -1002,6 +1011,9 @@
|
|||
"@types/kbn__core-plugins-browser": "link:bazel-bin/packages/core/plugins/core-plugins-browser/npm_module_types",
|
||||
"@types/kbn__core-plugins-browser-internal": "link:bazel-bin/packages/core/plugins/core-plugins-browser-internal/npm_module_types",
|
||||
"@types/kbn__core-plugins-browser-mocks": "link:bazel-bin/packages/core/plugins/core-plugins-browser-mocks/npm_module_types",
|
||||
"@types/kbn__core-plugins-server": "link:bazel-bin/packages/core/plugins/core-plugins-server/npm_module_types",
|
||||
"@types/kbn__core-plugins-server-internal": "link:bazel-bin/packages/core/plugins/core-plugins-server-internal/npm_module_types",
|
||||
"@types/kbn__core-plugins-server-mocks": "link:bazel-bin/packages/core/plugins/core-plugins-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",
|
||||
|
|
|
@ -105,6 +105,9 @@ filegroup(
|
|||
"//packages/core/lifecycle/core-lifecycle-browser:build",
|
||||
"//packages/core/lifecycle/core-lifecycle-browser-internal:build",
|
||||
"//packages/core/lifecycle/core-lifecycle-browser-mocks:build",
|
||||
"//packages/core/lifecycle/core-lifecycle-server:build",
|
||||
"//packages/core/lifecycle/core-lifecycle-server-internal:build",
|
||||
"//packages/core/lifecycle/core-lifecycle-server-mocks:build",
|
||||
"//packages/core/logging/core-logging-server:build",
|
||||
"//packages/core/logging/core-logging-server-internal:build",
|
||||
"//packages/core/logging/core-logging-server-mocks:build",
|
||||
|
@ -128,6 +131,9 @@ filegroup(
|
|||
"//packages/core/plugins/core-plugins-browser:build",
|
||||
"//packages/core/plugins/core-plugins-browser-internal:build",
|
||||
"//packages/core/plugins/core-plugins-browser-mocks:build",
|
||||
"//packages/core/plugins/core-plugins-server:build",
|
||||
"//packages/core/plugins/core-plugins-server-internal:build",
|
||||
"//packages/core/plugins/core-plugins-server-mocks:build",
|
||||
"//packages/core/preboot/core-preboot-server:build",
|
||||
"//packages/core/preboot/core-preboot-server-internal:build",
|
||||
"//packages/core/preboot/core-preboot-server-mocks:build",
|
||||
|
@ -454,6 +460,9 @@ filegroup(
|
|||
"//packages/core/lifecycle/core-lifecycle-browser:build_types",
|
||||
"//packages/core/lifecycle/core-lifecycle-browser-internal:build_types",
|
||||
"//packages/core/lifecycle/core-lifecycle-browser-mocks:build_types",
|
||||
"//packages/core/lifecycle/core-lifecycle-server:build_types",
|
||||
"//packages/core/lifecycle/core-lifecycle-server-internal:build_types",
|
||||
"//packages/core/lifecycle/core-lifecycle-server-mocks:build_types",
|
||||
"//packages/core/logging/core-logging-server:build_types",
|
||||
"//packages/core/logging/core-logging-server-internal:build_types",
|
||||
"//packages/core/logging/core-logging-server-mocks:build_types",
|
||||
|
@ -477,6 +486,9 @@ filegroup(
|
|||
"//packages/core/plugins/core-plugins-browser:build_types",
|
||||
"//packages/core/plugins/core-plugins-browser-internal:build_types",
|
||||
"//packages/core/plugins/core-plugins-browser-mocks:build_types",
|
||||
"//packages/core/plugins/core-plugins-server:build_types",
|
||||
"//packages/core/plugins/core-plugins-server-internal:build_types",
|
||||
"//packages/core/plugins/core-plugins-server-mocks:build_types",
|
||||
"//packages/core/preboot/core-preboot-server:build_types",
|
||||
"//packages/core/preboot/core-preboot-server-internal:build_types",
|
||||
"//packages/core/preboot/core-preboot-server-mocks:build_types",
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_config")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
|
||||
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
|
||||
|
||||
PKG_DIRNAME = "core-lifecycle-server-internal"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-lifecycle-server-internal"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.config.js",
|
||||
"**/*.mock.*",
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
"**/__snapshots__/**",
|
||||
"**/integration_tests/**",
|
||||
"**/mocks/**",
|
||||
"**/scripts/**",
|
||||
"**/storybook/**",
|
||||
"**/test_fixtures/**",
|
||||
"**/test_helpers/**",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/core/logging/core-logging-server-internal:npm_module_types",
|
||||
"//packages/core/analytics/core-analytics-server:npm_module_types",
|
||||
"//packages/core/preboot/core-preboot-server-internal:npm_module_types",
|
||||
"//packages/core/http/core-http-context-server-internal:npm_module_types",
|
||||
"//packages/core/http/core-http-server-internal:npm_module_types",
|
||||
"//packages/core/elasticsearch/core-elasticsearch-server-internal:npm_module_types",
|
||||
"//packages/core/ui-settings/core-ui-settings-server-internal:npm_module_types",
|
||||
"//packages/core/http/core-http-resources-server-internal:npm_module_types",
|
||||
"//packages/core/capabilities/core-capabilities-server:npm_module_types",
|
||||
"//packages/core/doc-links/core-doc-links-server:npm_module_types",
|
||||
"//packages/core/i18n/core-i18n-server:npm_module_types",
|
||||
"//packages/core/environment/core-environment-server-internal:npm_module_types",
|
||||
"//packages/core/execution-context/core-execution-context-server-internal:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-server-internal:npm_module_types",
|
||||
"//packages/core/metrics/core-metrics-server-internal:npm_module_types",
|
||||
"//packages/core/rendering/core-rendering-server-internal:npm_module_types",
|
||||
"//packages/core/saved-objects/core-saved-objects-server-internal:npm_module_types",
|
||||
"//packages/core/status/core-status-server-internal:npm_module_types",
|
||||
"//packages/core/usage-data/core-usage-data-base-server-internal:npm_module_types",
|
||||
"//packages/core/usage-data/core-usage-data-server:npm_module_types",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,7 @@
|
|||
# @kbn/core-lifecycle-server-internal
|
||||
|
||||
|
||||
This package contains the internal types for core's server-side lifecycle contracts:
|
||||
- `InternalCorePreboot`
|
||||
- `InternalCoreSetup`
|
||||
- `InternalCoreStart`
|
|
@ -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 { InternalCorePreboot, InternalCoreSetup, InternalCoreStart } from './src';
|
|
@ -6,13 +6,8 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export const mockPackage = {
|
||||
raw: { __dirname: '/tmp' } as any,
|
||||
module.exports = {
|
||||
preset: '@kbn/test/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/lifecycle/core-lifecycle-server-internal'],
|
||||
};
|
||||
|
||||
jest.doMock('load-json-file', () => ({
|
||||
sync: () => mockPackage.raw,
|
||||
}));
|
||||
|
||||
export const mockDiscover = jest.fn();
|
||||
jest.mock('../../plugins/discovery/plugins_discovery', () => ({ discover: mockDiscover }));
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/core-lifecycle-server-internal",
|
||||
"owner": "@elastic/kibana-core",
|
||||
"runtimeDeps": [],
|
||||
"typeDeps": [],
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-lifecycle-server-internal",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"author": "Kibana Core",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* 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 { InternalCorePreboot } from './internal_core_preboot';
|
||||
export type { InternalCoreSetup } from './internal_core_setup';
|
||||
export type { InternalCoreStart } from './internal_core_start';
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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 { InternalLoggingServicePreboot } from '@kbn/core-logging-server-internal';
|
||||
import type { AnalyticsServicePreboot } from '@kbn/core-analytics-server';
|
||||
import type { InternalPrebootServicePreboot } from '@kbn/core-preboot-server-internal';
|
||||
import type { InternalContextPreboot } from '@kbn/core-http-context-server-internal';
|
||||
import type { InternalHttpServicePreboot } from '@kbn/core-http-server-internal';
|
||||
import type { InternalElasticsearchServicePreboot } from '@kbn/core-elasticsearch-server-internal';
|
||||
import type { InternalUiSettingsServicePreboot } from '@kbn/core-ui-settings-server-internal';
|
||||
import type { InternalHttpResourcesPreboot } from '@kbn/core-http-resources-server-internal';
|
||||
|
||||
/** @internal */
|
||||
export interface InternalCorePreboot {
|
||||
analytics: AnalyticsServicePreboot;
|
||||
context: InternalContextPreboot;
|
||||
http: InternalHttpServicePreboot;
|
||||
elasticsearch: InternalElasticsearchServicePreboot;
|
||||
uiSettings: InternalUiSettingsServicePreboot;
|
||||
httpResources: InternalHttpResourcesPreboot;
|
||||
logging: InternalLoggingServicePreboot;
|
||||
preboot: InternalPrebootServicePreboot;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* 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 { AnalyticsServiceSetup } from '@kbn/core-analytics-server';
|
||||
import type { CapabilitiesSetup } from '@kbn/core-capabilities-server';
|
||||
import type { DocLinksServiceSetup } from '@kbn/core-doc-links-server';
|
||||
import type { I18nServiceSetup } from '@kbn/core-i18n-server';
|
||||
import type { InternalElasticsearchServiceSetup } from '@kbn/core-elasticsearch-server-internal';
|
||||
import type { InternalEnvironmentServiceSetup } from '@kbn/core-environment-server-internal';
|
||||
import type { InternalExecutionContextSetup } from '@kbn/core-execution-context-server-internal';
|
||||
import type { InternalContextSetup } from '@kbn/core-http-context-server-internal';
|
||||
import type { InternalDeprecationsServiceSetup } from '@kbn/core-deprecations-server-internal';
|
||||
import type { InternalHttpResourcesSetup } from '@kbn/core-http-resources-server-internal';
|
||||
import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal';
|
||||
import type { InternalLoggingServiceSetup } from '@kbn/core-logging-server-internal';
|
||||
import type { InternalMetricsServiceSetup } from '@kbn/core-metrics-server-internal';
|
||||
import type { InternalRenderingServiceSetup } from '@kbn/core-rendering-server-internal';
|
||||
import type { InternalSavedObjectsServiceSetup } from '@kbn/core-saved-objects-server-internal';
|
||||
import type { InternalStatusServiceSetup } from '@kbn/core-status-server-internal';
|
||||
import type { InternalUiSettingsServiceSetup } from '@kbn/core-ui-settings-server-internal';
|
||||
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
|
||||
|
||||
/** @internal */
|
||||
export interface InternalCoreSetup {
|
||||
analytics: AnalyticsServiceSetup;
|
||||
capabilities: CapabilitiesSetup;
|
||||
context: InternalContextSetup;
|
||||
docLinks: DocLinksServiceSetup;
|
||||
http: InternalHttpServiceSetup;
|
||||
elasticsearch: InternalElasticsearchServiceSetup;
|
||||
executionContext: InternalExecutionContextSetup;
|
||||
i18n: I18nServiceSetup;
|
||||
savedObjects: InternalSavedObjectsServiceSetup;
|
||||
status: InternalStatusServiceSetup;
|
||||
uiSettings: InternalUiSettingsServiceSetup;
|
||||
environment: InternalEnvironmentServiceSetup;
|
||||
rendering: InternalRenderingServiceSetup;
|
||||
httpResources: InternalHttpResourcesSetup;
|
||||
logging: InternalLoggingServiceSetup;
|
||||
metrics: InternalMetricsServiceSetup;
|
||||
deprecations: InternalDeprecationsServiceSetup;
|
||||
coreUsageData: InternalCoreUsageDataSetup;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* 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 { AnalyticsServiceStart } from '@kbn/core-analytics-server';
|
||||
import type { CapabilitiesStart } from '@kbn/core-capabilities-server';
|
||||
import type { InternalDeprecationsServiceStart } from '@kbn/core-deprecations-server-internal';
|
||||
import type { DocLinksServiceStart } from '@kbn/core-doc-links-server';
|
||||
import type { InternalElasticsearchServiceStart } from '@kbn/core-elasticsearch-server-internal';
|
||||
import type { InternalExecutionContextStart } from '@kbn/core-execution-context-server-internal';
|
||||
import type { InternalHttpServiceStart } from '@kbn/core-http-server-internal';
|
||||
import type { InternalMetricsServiceStart } from '@kbn/core-metrics-server-internal';
|
||||
import type { InternalSavedObjectsServiceStart } from '@kbn/core-saved-objects-server-internal';
|
||||
import type { InternalUiSettingsServiceStart } from '@kbn/core-ui-settings-server-internal';
|
||||
import type { CoreUsageDataStart } from '@kbn/core-usage-data-server';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface InternalCoreStart {
|
||||
analytics: AnalyticsServiceStart;
|
||||
capabilities: CapabilitiesStart;
|
||||
elasticsearch: InternalElasticsearchServiceStart;
|
||||
docLinks: DocLinksServiceStart;
|
||||
http: InternalHttpServiceStart;
|
||||
metrics: InternalMetricsServiceStart;
|
||||
savedObjects: InternalSavedObjectsServiceStart;
|
||||
uiSettings: InternalUiSettingsServiceStart;
|
||||
coreUsageData: CoreUsageDataStart;
|
||||
executionContext: InternalExecutionContextStart;
|
||||
deprecations: InternalDeprecationsServiceStart;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
]
|
||||
}
|
143
packages/core/lifecycle/core-lifecycle-server-mocks/BUILD.bazel
Normal file
143
packages/core/lifecycle/core-lifecycle-server-mocks/BUILD.bazel
Normal file
|
@ -0,0 +1,143 @@
|
|||
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-lifecycle-server-mocks"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-lifecycle-server-mocks"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.config.js",
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
"**/__snapshots__/**",
|
||||
"**/integration_tests/**",
|
||||
"**/scripts/**",
|
||||
"**/storybook/**",
|
||||
"**/test_fixtures/**",
|
||||
"**/test_helpers/**",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/core/analytics/core-analytics-server-mocks",
|
||||
"//packages/core/capabilities/core-capabilities-server-mocks",
|
||||
"//packages/core/doc-links/core-doc-links-server-mocks",
|
||||
"//packages/core/deprecations/core-deprecations-server-mocks",
|
||||
"//packages/core/elasticsearch/core-elasticsearch-server-mocks",
|
||||
"//packages/core/environment/core-environment-server-mocks",
|
||||
"//packages/core/execution-context/core-execution-context-server-mocks",
|
||||
"//packages/core/http/core-http-context-server-mocks",
|
||||
"//packages/core/http/core-http-server-mocks",
|
||||
"//packages/core/http/core-http-resources-server-mocks",
|
||||
"//packages/core/i18n/core-i18n-server-mocks",
|
||||
"//packages/core/lifecycle/core-lifecycle-server",
|
||||
"//packages/core/metrics/core-metrics-server-mocks",
|
||||
"//packages/core/preboot/core-preboot-server-mocks",
|
||||
"//packages/core/rendering/core-rendering-server-mocks",
|
||||
"//packages/core/saved-objects/core-saved-objects-server-mocks",
|
||||
"//packages/core/status/core-status-server-mocks",
|
||||
"//packages/core/ui-settings/core-ui-settings-server-mocks",
|
||||
"//packages/core/usage-data/core-usage-data-server-mocks",
|
||||
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/kbn-utility-types-jest:npm_module_types",
|
||||
"//packages/core/analytics/core-analytics-server-mocks:npm_module_types",
|
||||
"//packages/core/capabilities/core-capabilities-server-mocks:npm_module_types",
|
||||
"//packages/core/doc-links/core-doc-links-server-mocks:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-server-mocks:npm_module_types",
|
||||
"//packages/core/elasticsearch/core-elasticsearch-server-mocks:npm_module_types",
|
||||
"//packages/core/environment/core-environment-server-mocks:npm_module_types",
|
||||
"//packages/core/execution-context/core-execution-context-server-mocks:npm_module_types",
|
||||
"//packages/core/http/core-http-context-server-mocks:npm_module_types",
|
||||
"//packages/core/http/core-http-server-mocks:npm_module_types",
|
||||
"//packages/core/http/core-http-resources-server-mocks:npm_module_types",
|
||||
"//packages/core/i18n/core-i18n-server-mocks:npm_module_types",
|
||||
"//packages/core/lifecycle/core-lifecycle-server:npm_module_types",
|
||||
"//packages/core/metrics/core-metrics-server-mocks:npm_module_types",
|
||||
"//packages/core/preboot/core-preboot-server-mocks:npm_module_types",
|
||||
"//packages/core/rendering/core-rendering-server-mocks:npm_module_types",
|
||||
"//packages/core/saved-objects/core-saved-objects-server-mocks:npm_module_types",
|
||||
"//packages/core/status/core-status-server-mocks:npm_module_types",
|
||||
"//packages/core/ui-settings/core-ui-settings-server-mocks:npm_module_types",
|
||||
"//packages/core/usage-data/core-usage-data-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",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,5 @@
|
|||
# @kbn/core-lifecycle-server-mocks
|
||||
|
||||
This package contains the mocks for core's server-side lifecycle contracts:
|
||||
- `coreLifecycleMock`
|
||||
- `coreInternalLifecycleMock`
|
|
@ -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 { coreLifecycleMock, coreInternalLifecycleMock } from './src';
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/lifecycle/core-lifecycle-server-mocks'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/core-lifecycle-server-mocks",
|
||||
"owner": "@elastic/kibana-core",
|
||||
"runtimeDeps": [],
|
||||
"typeDeps": [],
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-lifecycle-server-mocks",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"author": "Kibana Core",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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 { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
|
||||
import { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
|
||||
import { httpServiceMock } from '@kbn/core-http-server-mocks';
|
||||
import { prebootServiceMock } from '@kbn/core-preboot-server-mocks';
|
||||
import type { MockedKeys } from '@kbn/utility-types-jest';
|
||||
import type { CorePreboot } from '@kbn/core-lifecycle-server';
|
||||
|
||||
type CorePrebootMockType = MockedKeys<CorePreboot> & {
|
||||
elasticsearch: ReturnType<typeof elasticsearchServiceMock.createPreboot>;
|
||||
};
|
||||
|
||||
export function createCorePrebootMock() {
|
||||
const mock: CorePrebootMockType = {
|
||||
analytics: analyticsServiceMock.createAnalyticsServicePreboot(),
|
||||
elasticsearch: elasticsearchServiceMock.createPreboot(),
|
||||
http: httpServiceMock.createPrebootContract() as CorePrebootMockType['http'],
|
||||
preboot: prebootServiceMock.createPrebootContract(),
|
||||
};
|
||||
|
||||
return mock;
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* 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 { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
|
||||
import type { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
|
||||
import { httpServiceMock } from '@kbn/core-http-server-mocks';
|
||||
import { httpResourcesMock } from '@kbn/core-http-resources-server-mocks';
|
||||
import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
|
||||
import type { CoreSetup, StartServicesAccessor } from '@kbn/core-lifecycle-server';
|
||||
import type { MockedKeys } from '@kbn/utility-types-jest';
|
||||
import { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
|
||||
import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
|
||||
import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
|
||||
import { i18nServiceMock } from '@kbn/core-i18n-server-mocks';
|
||||
import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
|
||||
import { statusServiceMock } from '@kbn/core-status-server-mocks';
|
||||
import { loggingServiceMock } from '@kbn/core-logging-server-mocks';
|
||||
import { metricsServiceMock } from '@kbn/core-metrics-server-mocks';
|
||||
import { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';
|
||||
import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
|
||||
import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
|
||||
import { createCoreStartMock } from './core_start.mock';
|
||||
|
||||
type CoreSetupMockType = MockedKeys<CoreSetup> & {
|
||||
elasticsearch: ReturnType<typeof elasticsearchServiceMock.createSetup>;
|
||||
getStartServices: jest.MockedFunction<StartServicesAccessor<any, any>>;
|
||||
};
|
||||
|
||||
export function createCoreSetupMock({
|
||||
pluginStartDeps = {},
|
||||
pluginStartContract,
|
||||
}: {
|
||||
pluginStartDeps?: object;
|
||||
pluginStartContract?: any;
|
||||
} = {}) {
|
||||
const httpMock: jest.Mocked<CoreSetup['http']> = {
|
||||
...httpServiceMock.createSetupContract<RequestHandlerContext>(),
|
||||
resources: httpResourcesMock.createRegistrar(),
|
||||
};
|
||||
|
||||
const uiSettingsMock = {
|
||||
register: uiSettingsServiceMock.createSetupContract().register,
|
||||
};
|
||||
|
||||
const mock: CoreSetupMockType = {
|
||||
analytics: analyticsServiceMock.createAnalyticsServiceSetup(),
|
||||
capabilities: capabilitiesServiceMock.createSetupContract(),
|
||||
docLinks: docLinksServiceMock.createSetupContract(),
|
||||
elasticsearch: elasticsearchServiceMock.createSetup(),
|
||||
http: httpMock,
|
||||
i18n: i18nServiceMock.createSetupContract(),
|
||||
savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
|
||||
status: statusServiceMock.createSetupContract(),
|
||||
uiSettings: uiSettingsMock,
|
||||
logging: loggingServiceMock.createSetupContract(),
|
||||
metrics: metricsServiceMock.createSetupContract(),
|
||||
deprecations: deprecationsServiceMock.createSetupContract(),
|
||||
executionContext: executionContextServiceMock.createInternalSetupContract(),
|
||||
coreUsageData: {
|
||||
registerUsageCounter: coreUsageDataServiceMock.createSetupContract().registerUsageCounter,
|
||||
},
|
||||
getStartServices: jest
|
||||
.fn<Promise<[ReturnType<typeof createCoreStartMock>, object, any]>, []>()
|
||||
.mockResolvedValue([createCoreStartMock(), pluginStartDeps, pluginStartContract]),
|
||||
};
|
||||
|
||||
return mock;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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 { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
|
||||
import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
|
||||
import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
|
||||
import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
|
||||
import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
|
||||
import { httpServiceMock } from '@kbn/core-http-server-mocks';
|
||||
import type { CoreStart } from '@kbn/core-lifecycle-server';
|
||||
import { metricsServiceMock } from '@kbn/core-metrics-server-mocks';
|
||||
import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
|
||||
import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
|
||||
import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
|
||||
import type { MockedKeys } from '@kbn/utility-types-jest';
|
||||
|
||||
export function createCoreStartMock() {
|
||||
const mock: MockedKeys<CoreStart> = {
|
||||
analytics: analyticsServiceMock.createAnalyticsServiceStart(),
|
||||
capabilities: capabilitiesServiceMock.createStartContract(),
|
||||
docLinks: docLinksServiceMock.createStartContract(),
|
||||
elasticsearch: elasticsearchServiceMock.createStart(),
|
||||
http: httpServiceMock.createStartContract(),
|
||||
metrics: metricsServiceMock.createStartContract(),
|
||||
savedObjects: savedObjectsServiceMock.createStartContract(),
|
||||
uiSettings: uiSettingsServiceMock.createStartContract(),
|
||||
coreUsageData: coreUsageDataServiceMock.createStartContract(),
|
||||
executionContext: executionContextServiceMock.createInternalStartContract(),
|
||||
};
|
||||
|
||||
return mock;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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 { createCorePrebootMock } from './core_preboot.mock';
|
||||
import { createCoreSetupMock } from './core_setup.mock';
|
||||
import { createCoreStartMock } from './core_start.mock';
|
||||
|
||||
import { createInternalCorePrebootMock } from './internal_core_preboot.mock';
|
||||
import { createInternalCoreSetupMock } from './internal_core_setup.mock';
|
||||
import { createInternalCoreStartMock } from './internal_core_start.mock';
|
||||
|
||||
export const coreLifecycleMock = {
|
||||
createPreboot: createCorePrebootMock,
|
||||
createCoreSetup: createCoreSetupMock,
|
||||
createCoreStart: createCoreStartMock,
|
||||
};
|
||||
|
||||
export const coreInternalLifecycleMock = {
|
||||
createInternalPreboot: createInternalCorePrebootMock,
|
||||
createInternalSetup: createInternalCoreSetupMock,
|
||||
createInternalStart: createInternalCoreStartMock,
|
||||
};
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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 { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
|
||||
import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
|
||||
import { contextServiceMock } from '@kbn/core-http-context-server-mocks';
|
||||
import { httpResourcesMock } from '@kbn/core-http-resources-server-mocks';
|
||||
import { httpServiceMock } from '@kbn/core-http-server-mocks';
|
||||
import { loggingServiceMock } from '@kbn/core-logging-server-mocks';
|
||||
import { prebootServiceMock } from '@kbn/core-preboot-server-mocks';
|
||||
import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
|
||||
|
||||
export function createInternalCorePrebootMock() {
|
||||
const prebootDeps = {
|
||||
analytics: analyticsServiceMock.createAnalyticsServicePreboot(),
|
||||
context: contextServiceMock.createPrebootContract(),
|
||||
elasticsearch: elasticsearchServiceMock.createInternalPreboot(),
|
||||
http: httpServiceMock.createInternalPrebootContract(),
|
||||
httpResources: httpResourcesMock.createPrebootContract(),
|
||||
uiSettings: uiSettingsServiceMock.createPrebootContract(),
|
||||
logging: loggingServiceMock.createInternalPrebootContract(),
|
||||
preboot: prebootServiceMock.createInternalPrebootContract(),
|
||||
};
|
||||
return prebootDeps;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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 { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
|
||||
import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
|
||||
import { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';
|
||||
import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
|
||||
import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
|
||||
import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
|
||||
import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
|
||||
import { contextServiceMock } from '@kbn/core-http-context-server-mocks';
|
||||
import { httpResourcesMock } from '@kbn/core-http-resources-server-mocks';
|
||||
import { httpServiceMock } from '@kbn/core-http-server-mocks';
|
||||
import { i18nServiceMock } from '@kbn/core-i18n-server-mocks';
|
||||
import { loggingServiceMock } from '@kbn/core-logging-server-mocks';
|
||||
import { metricsServiceMock } from '@kbn/core-metrics-server-mocks';
|
||||
import { renderingServiceMock } from '@kbn/core-rendering-server-mocks';
|
||||
import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
|
||||
import { statusServiceMock } from '@kbn/core-status-server-mocks';
|
||||
import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
|
||||
import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
|
||||
|
||||
export function createInternalCoreSetupMock() {
|
||||
const setupDeps = {
|
||||
analytics: analyticsServiceMock.createAnalyticsServiceSetup(),
|
||||
capabilities: capabilitiesServiceMock.createSetupContract(),
|
||||
context: contextServiceMock.createSetupContract(),
|
||||
docLinks: docLinksServiceMock.createSetupContract(),
|
||||
elasticsearch: elasticsearchServiceMock.createInternalSetup(),
|
||||
http: httpServiceMock.createInternalSetupContract(),
|
||||
savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
|
||||
status: statusServiceMock.createInternalSetupContract(),
|
||||
environment: environmentServiceMock.createSetupContract(),
|
||||
i18n: i18nServiceMock.createSetupContract(),
|
||||
httpResources: httpResourcesMock.createSetupContract(),
|
||||
rendering: renderingServiceMock.createSetupContract(),
|
||||
uiSettings: uiSettingsServiceMock.createSetupContract(),
|
||||
logging: loggingServiceMock.createInternalSetupContract(),
|
||||
metrics: metricsServiceMock.createInternalSetupContract(),
|
||||
deprecations: deprecationsServiceMock.createInternalSetupContract(),
|
||||
executionContext: executionContextServiceMock.createInternalSetupContract(),
|
||||
coreUsageData: coreUsageDataServiceMock.createSetupContract(),
|
||||
};
|
||||
return setupDeps;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* 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 { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
|
||||
import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
|
||||
import { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';
|
||||
import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
|
||||
import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
|
||||
import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
|
||||
import { httpServiceMock } from '@kbn/core-http-server-mocks';
|
||||
import { metricsServiceMock } from '@kbn/core-metrics-server-mocks';
|
||||
import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
|
||||
import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
|
||||
import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
|
||||
|
||||
export function createInternalCoreStartMock() {
|
||||
const startDeps = {
|
||||
analytics: analyticsServiceMock.createAnalyticsServiceStart(),
|
||||
capabilities: capabilitiesServiceMock.createStartContract(),
|
||||
docLinks: docLinksServiceMock.createStartContract(),
|
||||
elasticsearch: elasticsearchServiceMock.createInternalStart(),
|
||||
http: httpServiceMock.createInternalStartContract(),
|
||||
metrics: metricsServiceMock.createInternalStartContract(),
|
||||
savedObjects: savedObjectsServiceMock.createInternalStartContract(),
|
||||
uiSettings: uiSettingsServiceMock.createStartContract(),
|
||||
coreUsageData: coreUsageDataServiceMock.createStartContract(),
|
||||
executionContext: executionContextServiceMock.createInternalStartContract(),
|
||||
deprecations: deprecationsServiceMock.createInternalStartContract(),
|
||||
};
|
||||
return startDeps;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
]
|
||||
}
|
122
packages/core/lifecycle/core-lifecycle-server/BUILD.bazel
Normal file
122
packages/core/lifecycle/core-lifecycle-server/BUILD.bazel
Normal file
|
@ -0,0 +1,122 @@
|
|||
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-lifecycle-server"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-lifecycle-server"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.config.js",
|
||||
"**/*.mock.*",
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
"**/__snapshots__/**",
|
||||
"**/integration_tests/**",
|
||||
"**/mocks/**",
|
||||
"**/scripts/**",
|
||||
"**/storybook/**",
|
||||
"**/test_fixtures/**",
|
||||
"**/test_helpers/**",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/core/analytics/core-analytics-server:npm_module_types",
|
||||
"//packages/core/capabilities/core-capabilities-server:npm_module_types",
|
||||
"//packages/core/deprecations/core-deprecations-server:npm_module_types",
|
||||
"//packages/core/doc-links/core-doc-links-server:npm_module_types",
|
||||
"//packages/core/elasticsearch/core-elasticsearch-server:npm_module_types",
|
||||
"//packages/core/execution-context/core-execution-context-server:npm_module_types",
|
||||
"//packages/core/http/core-http-server:npm_module_types",
|
||||
"//packages/core/http/core-http-request-handler-context-server:npm_module_types",
|
||||
"//packages/core/http/core-http-resources-server:npm_module_types",
|
||||
"//packages/core/i18n/core-i18n-server:npm_module_types",
|
||||
"//packages/core/logging/core-logging-server:npm_module_types",
|
||||
"//packages/core/metrics/core-metrics-server:npm_module_types",
|
||||
"//packages/core/preboot/core-preboot-server:npm_module_types",
|
||||
"//packages/core/saved-objects/core-saved-objects-server:npm_module_types",
|
||||
"//packages/core/status/core-status-server:npm_module_types",
|
||||
"//packages/core/ui-settings/core-ui-settings-server:npm_module_types",
|
||||
"//packages/core/usage-data/core-usage-data-server:npm_module_types",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
7
packages/core/lifecycle/core-lifecycle-server/README.md
Normal file
7
packages/core/lifecycle/core-lifecycle-server/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# @kbn/core-lifecycle-server
|
||||
|
||||
This package contains the public types for core's server-side lifecycle contracts and services accessor:
|
||||
- `CorePreboot`
|
||||
- `CoreSetup`
|
||||
- `CoreStart`
|
||||
- `StartServicesAccessor`
|
9
packages/core/lifecycle/core-lifecycle-server/index.ts
Normal file
9
packages/core/lifecycle/core-lifecycle-server/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 { CorePreboot, CoreSetup, CoreStart, StartServicesAccessor } from './src';
|
13
packages/core/lifecycle/core-lifecycle-server/jest.config.js
Normal file
13
packages/core/lifecycle/core-lifecycle-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/lifecycle/core-lifecycle-server'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/core-lifecycle-server",
|
||||
"owner": "@elastic/kibana-core",
|
||||
"runtimeDeps": [],
|
||||
"typeDeps": [],
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-lifecycle-server",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"author": "Kibana Core",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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 { AnalyticsServicePreboot } from '@kbn/core-analytics-server';
|
||||
import type { HttpServicePreboot } from '@kbn/core-http-server';
|
||||
import type { PrebootServicePreboot } from '@kbn/core-preboot-server';
|
||||
import type { ElasticsearchServicePreboot } from '@kbn/core-elasticsearch-server';
|
||||
import type { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
|
||||
|
||||
/**
|
||||
* Context passed to the `setup` method of `preboot` plugins.
|
||||
* @public
|
||||
*/
|
||||
export interface CorePreboot {
|
||||
/** {@link AnalyticsServicePreboot} */
|
||||
analytics: AnalyticsServicePreboot;
|
||||
/** {@link ElasticsearchServicePreboot} */
|
||||
elasticsearch: ElasticsearchServicePreboot;
|
||||
/** {@link HttpServicePreboot} */
|
||||
http: HttpServicePreboot<RequestHandlerContext>;
|
||||
/** {@link PrebootServicePreboot} */
|
||||
preboot: PrebootServicePreboot;
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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 { AnalyticsServiceSetup } from '@kbn/core-analytics-server';
|
||||
import { CapabilitiesSetup } from '@kbn/core-capabilities-server';
|
||||
import { DeprecationsServiceSetup } from '@kbn/core-deprecations-server';
|
||||
import { DocLinksServiceSetup } from '@kbn/core-doc-links-server';
|
||||
import { ElasticsearchServiceSetup } from '@kbn/core-elasticsearch-server';
|
||||
import { ExecutionContextSetup } from '@kbn/core-execution-context-server';
|
||||
import { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
|
||||
import { HttpResources } from '@kbn/core-http-resources-server';
|
||||
import { HttpServiceSetup } from '@kbn/core-http-server';
|
||||
import { I18nServiceSetup } from '@kbn/core-i18n-server';
|
||||
import { LoggingServiceSetup } from '@kbn/core-logging-server';
|
||||
import { MetricsServiceSetup } from '@kbn/core-metrics-server';
|
||||
import { SavedObjectsServiceSetup } from '@kbn/core-saved-objects-server';
|
||||
import { StatusServiceSetup } from '@kbn/core-status-server';
|
||||
import { UiSettingsServiceSetup } from '@kbn/core-ui-settings-server';
|
||||
import { CoreUsageDataSetup } from '@kbn/core-usage-data-server';
|
||||
import { CoreStart } from './core_start';
|
||||
|
||||
/**
|
||||
* Context passed to the `setup` method of `standard` plugins.
|
||||
*
|
||||
* @typeParam TPluginsStart - the type of the consuming plugin's start dependencies. Should be the same
|
||||
* as the consuming {@link Plugin}'s `TPluginsStart` type. Used by `getStartServices`.
|
||||
* @typeParam TStart - the type of the consuming plugin's start contract. Should be the same as the
|
||||
* consuming {@link Plugin}'s `TStart` type. Used by `getStartServices`.
|
||||
* @public
|
||||
*/
|
||||
export interface CoreSetup<TPluginsStart extends object = object, TStart = unknown> {
|
||||
/** {@link AnalyticsServiceSetup} */
|
||||
analytics: AnalyticsServiceSetup;
|
||||
/** {@link CapabilitiesSetup} */
|
||||
capabilities: CapabilitiesSetup;
|
||||
/** {@link DocLinksServiceSetup} */
|
||||
docLinks: DocLinksServiceSetup;
|
||||
/** {@link ElasticsearchServiceSetup} */
|
||||
elasticsearch: ElasticsearchServiceSetup;
|
||||
/** {@link ExecutionContextSetup} */
|
||||
executionContext: ExecutionContextSetup;
|
||||
/** {@link HttpServiceSetup} */
|
||||
http: HttpServiceSetup<RequestHandlerContext> & {
|
||||
/** {@link HttpResources} */
|
||||
resources: HttpResources;
|
||||
};
|
||||
/** {@link I18nServiceSetup} */
|
||||
i18n: I18nServiceSetup;
|
||||
/** {@link LoggingServiceSetup} */
|
||||
logging: LoggingServiceSetup;
|
||||
/** {@link MetricsServiceSetup} */
|
||||
metrics: MetricsServiceSetup;
|
||||
/** {@link SavedObjectsServiceSetup} */
|
||||
savedObjects: SavedObjectsServiceSetup;
|
||||
/** {@link StatusServiceSetup} */
|
||||
status: StatusServiceSetup;
|
||||
/** {@link UiSettingsServiceSetup} */
|
||||
uiSettings: UiSettingsServiceSetup;
|
||||
/** {@link DeprecationsServiceSetup} */
|
||||
deprecations: DeprecationsServiceSetup;
|
||||
/** {@link StartServicesAccessor} */
|
||||
getStartServices: StartServicesAccessor<TPluginsStart, TStart>;
|
||||
/** @internal {@link CoreUsageDataSetup} */
|
||||
coreUsageData: CoreUsageDataSetup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows plugins to get access to APIs available in start inside async handlers.
|
||||
* Promise will not resolve until Core and plugin dependencies have completed `start`.
|
||||
* This should only be used inside handlers registered during `setup` that will only be executed
|
||||
* after `start` lifecycle.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type StartServicesAccessor<
|
||||
TPluginsStart extends object = object,
|
||||
TStart = unknown
|
||||
> = () => Promise<[CoreStart, TPluginsStart, TStart]>;
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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 { AnalyticsServiceStart } from '@kbn/core-analytics-server';
|
||||
import { CapabilitiesStart } from '@kbn/core-capabilities-server';
|
||||
import { DocLinksServiceStart } from '@kbn/core-doc-links-server';
|
||||
import { ElasticsearchServiceStart } from '@kbn/core-elasticsearch-server';
|
||||
import { ExecutionContextStart } from '@kbn/core-execution-context-server';
|
||||
import { HttpServiceStart } from '@kbn/core-http-server';
|
||||
import { MetricsServiceStart } from '@kbn/core-metrics-server';
|
||||
import { SavedObjectsServiceStart } from '@kbn/core-saved-objects-server';
|
||||
import { UiSettingsServiceStart } from '@kbn/core-ui-settings-server';
|
||||
import { CoreUsageDataStart } from '@kbn/core-usage-data-server';
|
||||
|
||||
/**
|
||||
* Context passed to the plugins `start` method.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface CoreStart {
|
||||
/** {@link AnalyticsServiceStart} */
|
||||
analytics: AnalyticsServiceStart;
|
||||
/** {@link CapabilitiesStart} */
|
||||
capabilities: CapabilitiesStart;
|
||||
/** {@link DocLinksServiceStart} */
|
||||
docLinks: DocLinksServiceStart;
|
||||
/** {@link ElasticsearchServiceStart} */
|
||||
elasticsearch: ElasticsearchServiceStart;
|
||||
/** {@link ExecutionContextStart} */
|
||||
executionContext: ExecutionContextStart;
|
||||
/** {@link HttpServiceStart} */
|
||||
http: HttpServiceStart;
|
||||
/** {@link MetricsServiceStart} */
|
||||
metrics: MetricsServiceStart;
|
||||
/** {@link SavedObjectsServiceStart} */
|
||||
savedObjects: SavedObjectsServiceStart;
|
||||
/** {@link UiSettingsServiceStart} */
|
||||
uiSettings: UiSettingsServiceStart;
|
||||
/** @internal {@link CoreUsageDataStart} */
|
||||
coreUsageData: CoreUsageDataStart;
|
||||
}
|
10
packages/core/lifecycle/core-lifecycle-server/src/index.ts
Normal file
10
packages/core/lifecycle/core-lifecycle-server/src/index.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
export type { CorePreboot } from './core_preboot';
|
||||
export type { CoreSetup, StartServicesAccessor } from './core_setup';
|
||||
export type { CoreStart } from './core_start';
|
17
packages/core/lifecycle/core-lifecycle-server/tsconfig.json
Normal file
17
packages/core/lifecycle/core-lifecycle-server/tsconfig.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
]
|
||||
}
|
155
packages/core/plugins/core-plugins-server-internal/BUILD.bazel
Normal file
155
packages/core/plugins/core-plugins-server-internal/BUILD.bazel
Normal file
|
@ -0,0 +1,155 @@
|
|||
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-plugins-server-internal"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-plugins-server-internal"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.config.js",
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
"**/__snapshots__/**",
|
||||
"**/integration_tests/**",
|
||||
"**/mocks/**",
|
||||
"**/scripts/**",
|
||||
"**/storybook/**",
|
||||
"**/test_fixtures/**",
|
||||
"**/test_helpers/**",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"@npm//moment",
|
||||
"@npm//rxjs",
|
||||
"@npm//semver",
|
||||
"@npm//type-detect",
|
||||
"@npm//lodash",
|
||||
"//packages/kbn-std",
|
||||
"//packages/kbn-config",
|
||||
"//packages/kbn-config-schema",
|
||||
"//packages/kbn-logging",
|
||||
"//packages/kbn-utils",
|
||||
"//packages/core/base/core-base-common",
|
||||
"//packages/core/base/core-base-server-internal",
|
||||
"//packages/core/lifecycle/core-lifecycle-server-internal",
|
||||
"//packages/core/elasticsearch/core-elasticsearch-server-internal",
|
||||
"//packages/core/node/core-node-server",
|
||||
"//packages/core/saved-objects/core-saved-objects-base-server-internal",
|
||||
# test dependencies
|
||||
"@npm//mock-fs",
|
||||
"//packages/kbn-config-mocks",
|
||||
"//packages/core/base/core-base-server-mocks",
|
||||
"//packages/core/lifecycle/core-lifecycle-server-mocks",
|
||||
"//packages/core/logging/core-logging-server-mocks",
|
||||
"//packages/core/node/core-node-server-mocks",
|
||||
"//packages/core/plugins/core-plugins-server",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"@npm//moment",
|
||||
"@npm//rxjs",
|
||||
"@npm//semver",
|
||||
"@npm//type-detect",
|
||||
"@npm//lodash",
|
||||
"//packages/kbn-std:npm_module_types",
|
||||
"//packages/kbn-config:npm_module_types",
|
||||
"//packages/kbn-config-schema:npm_module_types",
|
||||
"//packages/kbn-logging:npm_module_types",
|
||||
"//packages/kbn-utils:npm_module_types",
|
||||
"//packages/core/base/core-base-common:npm_module_types",
|
||||
"//packages/core/base/core-base-server-internal:npm_module_types",
|
||||
"//packages/core/elasticsearch/core-elasticsearch-server-internal:npm_module_types",
|
||||
"//packages/core/node/core-node-server:npm_module_types",
|
||||
"//packages/core/saved-objects/core-saved-objects-base-server-internal:npm_module_types",
|
||||
"//packages/core/http/core-http-server:npm_module_types",
|
||||
"//packages/core/http/core-http-request-handler-context-server:npm_module_types",
|
||||
"//packages/core/lifecycle/core-lifecycle-server:npm_module_types",
|
||||
"//packages/core/lifecycle/core-lifecycle-server-internal:npm_module_types",
|
||||
"//packages/core/plugins/core-plugins-server:npm_module_types",
|
||||
# test dependencies' mocks
|
||||
"@npm//mock-fs",
|
||||
"//packages/kbn-config-mocks:npm_module_types",
|
||||
"//packages/core/base/core-base-server-mocks:npm_module_types",
|
||||
"//packages/core/lifecycle/core-lifecycle-server-mocks:npm_module_types",
|
||||
"//packages/core/logging/core-logging-server-mocks:npm_module_types",
|
||||
"//packages/core/node/core-node-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",
|
||||
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-plugins-server-internal
|
||||
|
||||
This package contains the internal types and implementation for Core's server-side `plugins` service.
|
15
packages/core/plugins/core-plugins-server-internal/index.ts
Normal file
15
packages/core/plugins/core-plugins-server-internal/index.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* 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 { PluginsService, PluginWrapper, config, isNewPlatformPlugin } from './src';
|
||||
export type {
|
||||
PluginsServiceSetup,
|
||||
PluginsServiceStart,
|
||||
DiscoveredPlugins,
|
||||
PluginDependencies,
|
||||
} from './src';
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/plugins/core-plugins-server-internal'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/core-plugins-server-internal",
|
||||
"owner": "@elastic/kibana-core",
|
||||
"runtimeDeps": [],
|
||||
"typeDeps": [],
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-plugins-server-internal",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"author": "Kibana Core",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { PluginConfigDescriptor } from './types';
|
||||
import type { PluginConfigDescriptor } from '@kbn/core-plugins-server';
|
||||
import { createBrowserConfig } from './create_browser_config';
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { ExposedToBrowserDescriptor, PluginConfigDescriptor } from './types';
|
||||
import { ExposedToBrowserDescriptor, PluginConfigDescriptor } from '@kbn/core-plugins-server';
|
||||
|
||||
export const createBrowserConfig = <T = unknown>(
|
||||
config: T,
|
|
@ -13,7 +13,7 @@ import { promisify } from 'util';
|
|||
import { snakeCase } from 'lodash';
|
||||
import { isConfigPath, PackageInfo } from '@kbn/config';
|
||||
import { PluginType } from '@kbn/core-base-common';
|
||||
import { PluginManifest } from '../types';
|
||||
import { PluginManifest } from '@kbn/core-plugins-server';
|
||||
import { PluginDiscoveryError } from './plugin_discovery_error';
|
||||
import { isCamelCase } from './is_camel_case';
|
||||
|
|
@ -22,7 +22,7 @@ import type { NodeInfo } from '@kbn/core-node-server';
|
|||
import { PluginsConfig, PluginsConfigType, config } from '../plugins_config';
|
||||
import type { InstanceInfo } from '../plugin_context';
|
||||
import { discover } from './plugins_discovery';
|
||||
import { PluginType } from '../types';
|
||||
import { PluginType } from '@kbn/core-base-common';
|
||||
|
||||
const KIBANA_ROOT = process.cwd();
|
||||
|
|
@ -15,4 +15,5 @@ export type {
|
|||
export { config } from './plugins_config';
|
||||
/** @internal */
|
||||
export { isNewPlatformPlugin } from './discovery';
|
||||
export * from './types';
|
||||
export type { PluginDependencies } from './types';
|
||||
export { PluginWrapper } from './plugin';
|
|
@ -5,37 +5,17 @@
|
|||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { take } from 'rxjs/operators';
|
||||
import { ConfigService, Env } from '@kbn/config';
|
||||
import { getEnvOptions, rawConfigServiceMock } from '@kbn/config-mocks';
|
||||
import { getGlobalConfig, getGlobalConfig$ } from './legacy_config';
|
||||
import { REPO_ROOT } from '@kbn/utils';
|
||||
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
import { duration } from 'moment';
|
||||
import { fromRoot } from '@kbn/utils';
|
||||
import { ByteSizeValue } from '@kbn/config-schema';
|
||||
import { Server } from '../server';
|
||||
import { createCoreContextConfigServiceMock } from './test_helpers';
|
||||
|
||||
describe('Legacy config', () => {
|
||||
let env: Env;
|
||||
let logger: ReturnType<typeof loggingSystemMock.create>;
|
||||
|
||||
beforeEach(() => {
|
||||
env = Env.createDefault(REPO_ROOT, getEnvOptions());
|
||||
logger = loggingSystemMock.create();
|
||||
});
|
||||
|
||||
const createConfigService = (rawConfig: Record<string, any> = {}): ConfigService => {
|
||||
const rawConfigService = rawConfigServiceMock.create({ rawConfig });
|
||||
const server = new Server(rawConfigService, env, logger);
|
||||
server.setupCoreConfig();
|
||||
return server.configService;
|
||||
};
|
||||
|
||||
describe('getGlobalConfig', () => {
|
||||
it('should return the global config', async () => {
|
||||
const configService = createConfigService();
|
||||
const configService = createCoreContextConfigServiceMock();
|
||||
await configService.validate();
|
||||
|
||||
const legacyConfig = getGlobalConfig(configService);
|
||||
|
@ -54,7 +34,7 @@ describe('Legacy config', () => {
|
|||
|
||||
describe('getGlobalConfig$', () => {
|
||||
it('should return an observable for the global config', async () => {
|
||||
const configService = createConfigService();
|
||||
const configService = createCoreContextConfigServiceMock();
|
||||
|
||||
const legacyConfig = await getGlobalConfig$(configService).pipe(take(1)).toPromise();
|
||||
|
|
@ -20,7 +20,7 @@ import {
|
|||
type SavedObjectsConfigType,
|
||||
savedObjectsConfig,
|
||||
} from '@kbn/core-saved-objects-base-server-internal';
|
||||
import { SharedGlobalConfig, SharedGlobalConfigKeys } from './types';
|
||||
import { SharedGlobalConfig, SharedGlobalConfigKeys } from '@kbn/core-plugins-server';
|
||||
|
||||
const createGlobalConfig = ({
|
||||
elasticsearch,
|
|
@ -17,10 +17,11 @@ import type { CoreContext } from '@kbn/core-base-server-internal';
|
|||
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
import type { NodeInfo } from '@kbn/core-node-server';
|
||||
import { nodeServiceMock } from '@kbn/core-node-server-mocks';
|
||||
import { coreMock } from '../mocks';
|
||||
|
||||
import type { PluginManifest } from '@kbn/core-plugins-server';
|
||||
import { PluginWrapper } from './plugin';
|
||||
import { PluginManifest, PluginType } from './types';
|
||||
import { PluginType } from '@kbn/core-base-common';
|
||||
import { coreInternalLifecycleMock } from '@kbn/core-lifecycle-server-mocks';
|
||||
|
||||
import {
|
||||
createPluginInitializerContext,
|
||||
createPluginSetupContext,
|
||||
|
@ -72,7 +73,7 @@ let coreContext: CoreContext;
|
|||
let instanceInfo: InstanceInfo;
|
||||
let nodeInfo: NodeInfo;
|
||||
|
||||
const setupDeps = coreMock.createInternalSetup();
|
||||
const setupDeps = coreInternalLifecycleMock.createInternalSetup();
|
||||
|
||||
beforeEach(() => {
|
||||
coreId = Symbol('core');
|
|
@ -12,18 +12,17 @@ import { firstValueFrom, Subject } from 'rxjs';
|
|||
import { isPromise } from '@kbn/std';
|
||||
import { isConfigSchema } from '@kbn/config-schema';
|
||||
import type { Logger } from '@kbn/logging';
|
||||
import { PluginType } from '@kbn/core-base-common';
|
||||
import {
|
||||
import { type PluginOpaqueId, PluginType } from '@kbn/core-base-common';
|
||||
import type {
|
||||
AsyncPlugin,
|
||||
Plugin,
|
||||
PluginConfigDescriptor,
|
||||
PluginInitializer,
|
||||
PluginInitializerContext,
|
||||
PluginManifest,
|
||||
PluginOpaqueId,
|
||||
PrebootPlugin,
|
||||
} from './types';
|
||||
import { CorePreboot, CoreSetup, CoreStart } from '..';
|
||||
} from '@kbn/core-plugins-server';
|
||||
import type { CorePreboot, CoreSetup, CoreStart } from '@kbn/core-lifecycle-server';
|
||||
|
||||
const OSS_PATH_REGEX = /[\/|\\]src[\/|\\]plugins[\/|\\]/; // Matches src/plugins directory on POSIX and Windows
|
||||
const XPACK_PATH_REGEX = /[\/|\\]x-pack[\/|\\]plugins[\/|\\]/; // Matches x-pack/plugins directory on POSIX and Windows
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
import { duration } from 'moment';
|
||||
import { first } from 'rxjs/operators';
|
||||
import { REPO_ROOT } from '@kbn/utils';
|
||||
import { fromRoot } from '@kbn/utils';
|
||||
import { REPO_ROOT, fromRoot } from '@kbn/utils';
|
||||
import { rawConfigServiceMock, getEnvOptions, configServiceMock } from '@kbn/config-mocks';
|
||||
import type { CoreContext } from '@kbn/core-base-server-internal';
|
||||
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
|
@ -21,12 +20,15 @@ import {
|
|||
InstanceInfo,
|
||||
} from './plugin_context';
|
||||
|
||||
import { PluginManifest, PluginType } from './types';
|
||||
import { Server } from '../server';
|
||||
import { PluginType } from '@kbn/core-base-common';
|
||||
import { PluginManifest } from '@kbn/core-plugins-server';
|
||||
import { schema, ByteSizeValue } from '@kbn/config-schema';
|
||||
import { ConfigService, Env } from '@kbn/config';
|
||||
import { PluginWrapper } from './plugin';
|
||||
import { coreMock } from '../mocks';
|
||||
|
||||
import { coreInternalLifecycleMock } from '@kbn/core-lifecycle-server-mocks';
|
||||
import { mockCoreContext } from '@kbn/core-base-server-mocks';
|
||||
import { createCoreContextConfigServiceMock } from './test_helpers';
|
||||
|
||||
function createPluginManifest(manifestProps: Partial<PluginManifest> = {}): PluginManifest {
|
||||
return {
|
||||
|
@ -54,7 +56,6 @@ describe('createPluginInitializerContext', () => {
|
|||
let opaqueId: symbol;
|
||||
let env: Env;
|
||||
let coreContext: CoreContext;
|
||||
let server: Server;
|
||||
let instanceInfo: InstanceInfo;
|
||||
let nodeInfo: NodeInfo;
|
||||
|
||||
|
@ -67,10 +68,11 @@ describe('createPluginInitializerContext', () => {
|
|||
};
|
||||
nodeInfo = nodeServiceMock.createInternalPrebootContract();
|
||||
env = Env.createDefault(REPO_ROOT, getEnvOptions());
|
||||
const config$ = rawConfigServiceMock.create({ rawConfig: {} });
|
||||
server = new Server(config$, env, logger);
|
||||
server.setupCoreConfig();
|
||||
coreContext = { coreId, env, logger, configService: server.configService };
|
||||
coreContext = mockCoreContext.create({
|
||||
env,
|
||||
logger,
|
||||
configService: configServiceMock.create(),
|
||||
});
|
||||
});
|
||||
|
||||
describe('context.config', () => {
|
||||
|
@ -115,7 +117,12 @@ describe('createPluginInitializerContext', () => {
|
|||
});
|
||||
|
||||
it('config.globalConfig$ should be an observable for the global config', async () => {
|
||||
const configService = createCoreContextConfigServiceMock();
|
||||
|
||||
coreContext = { coreId, env, logger, configService };
|
||||
|
||||
const manifest = createPluginManifest();
|
||||
|
||||
const pluginInitializerContext = createPluginInitializerContext({
|
||||
coreContext,
|
||||
opaqueId,
|
||||
|
@ -229,7 +236,7 @@ describe('createPluginPrebootSetupContext', () => {
|
|||
}),
|
||||
});
|
||||
|
||||
const corePreboot = coreMock.createInternalPreboot();
|
||||
const corePreboot = coreInternalLifecycleMock.createInternalPreboot();
|
||||
const prebootSetupContext = createPluginPrebootSetupContext(coreContext, corePreboot, plugin);
|
||||
|
||||
const holdSetupPromise = Promise.resolve(undefined);
|
|
@ -11,16 +11,16 @@ import type { CoreContext } from '@kbn/core-base-server-internal';
|
|||
import type { PluginOpaqueId } from '@kbn/core-base-common';
|
||||
import type { NodeInfo } from '@kbn/core-node-server';
|
||||
import type { IRouter, IContextProvider } from '@kbn/core-http-server';
|
||||
import type { RequestHandlerContext } from '..';
|
||||
import { PluginInitializerContext, PluginManifest } from '@kbn/core-plugins-server';
|
||||
import { CorePreboot, CoreSetup, CoreStart } from '@kbn/core-lifecycle-server';
|
||||
import type { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
|
||||
import { PluginWrapper } from './plugin';
|
||||
import {
|
||||
PluginsServicePrebootSetupDeps,
|
||||
PluginsServiceSetupDeps,
|
||||
PluginsServiceStartDeps,
|
||||
} from './plugins_service';
|
||||
import { PluginInitializerContext, PluginManifest } from './types';
|
||||
import { getGlobalConfig, getGlobalConfig$ } from './legacy_config';
|
||||
import { CorePreboot, CoreSetup, CoreStart } from '..';
|
||||
|
||||
/** @internal */
|
||||
export interface InstanceInfo {
|
|
@ -19,14 +19,15 @@ import { rawConfigServiceMock, getEnvOptions } from '@kbn/config-mocks';
|
|||
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
|
||||
import { nodeServiceMock } from '@kbn/core-node-server-mocks';
|
||||
import { coreMock } from '../mocks';
|
||||
import { coreInternalLifecycleMock } from '@kbn/core-lifecycle-server-mocks';
|
||||
import { PluginDiscoveryError } from './discovery';
|
||||
import { PluginWrapper } from './plugin';
|
||||
import { PluginsService } from './plugins_service';
|
||||
import { PluginsSystem } from './plugins_system';
|
||||
import { config } from './plugins_config';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { DiscoveredPlugin, PluginConfigDescriptor, PluginType } from './types';
|
||||
import type { PluginConfigDescriptor } from '@kbn/core-plugins-server';
|
||||
import { DiscoveredPlugin, PluginType } from '@kbn/core-base-common';
|
||||
|
||||
const MockPluginsSystem: jest.Mock<PluginsSystem<PluginType>> = PluginsSystem as any;
|
||||
|
||||
|
@ -40,9 +41,9 @@ let standardMockPluginSystem: jest.Mocked<PluginsSystem<PluginType.standard>>;
|
|||
let environmentPreboot: ReturnType<typeof environmentServiceMock.createPrebootContract>;
|
||||
let nodePreboot: ReturnType<typeof nodeServiceMock.createInternalPrebootContract>;
|
||||
|
||||
const prebootDeps = coreMock.createInternalPreboot();
|
||||
const setupDeps = coreMock.createInternalSetup();
|
||||
const startDeps = coreMock.createInternalStart();
|
||||
const prebootDeps = coreInternalLifecycleMock.createInternalPreboot();
|
||||
const setupDeps = coreInternalLifecycleMock.createInternalSetup();
|
||||
const startDeps = coreInternalLifecycleMock.createInternalStart();
|
||||
const logger = loggingSystemMock.create();
|
||||
|
||||
expect.addSnapshotSerializer(createAbsolutePathSerializer());
|
|
@ -14,17 +14,24 @@ import { getFlattenedObject } from '@kbn/std';
|
|||
import { Logger } from '@kbn/logging';
|
||||
import type { IConfigService } from '@kbn/config';
|
||||
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
|
||||
import type { PluginName } from '@kbn/core-base-common';
|
||||
import { type PluginName, PluginType } from '@kbn/core-base-common';
|
||||
import type { InternalEnvironmentServicePreboot } from '@kbn/core-environment-server-internal';
|
||||
import type { InternalNodeServicePreboot } from '@kbn/core-node-server-internal';
|
||||
import type { InternalPluginInfo, UiPlugins } from '@kbn/core-plugins-base-server-internal';
|
||||
import {
|
||||
InternalCorePreboot,
|
||||
InternalCoreSetup,
|
||||
InternalCoreStart,
|
||||
} from '@kbn/core-lifecycle-server-internal';
|
||||
import { PluginConfigDescriptor } from '@kbn/core-plugins-server';
|
||||
import type { DiscoveredPlugin } from '@kbn/core-base-common';
|
||||
import { discover, PluginDiscoveryError, PluginDiscoveryErrorType } from './discovery';
|
||||
import { PluginWrapper } from './plugin';
|
||||
import { DiscoveredPlugin, PluginConfigDescriptor, PluginDependencies, PluginType } from './types';
|
||||
|
||||
import type { PluginDependencies } from './types';
|
||||
import { PluginsConfig, PluginsConfigType } from './plugins_config';
|
||||
import { PluginsSystem } from './plugins_system';
|
||||
import { createBrowserConfig } from './create_browser_config';
|
||||
import { InternalCorePreboot, InternalCoreSetup, InternalCoreStart } from '../internal_types';
|
||||
|
||||
/** @internal */
|
||||
export type DiscoveredPlugins = {
|
|
@ -15,7 +15,7 @@ import {
|
|||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
import { REPO_ROOT } from '@kbn/utils';
|
||||
import type { PluginName } from '@kbn/core-base-common';
|
||||
import { type PluginName, PluginType } from '@kbn/core-base-common';
|
||||
import type { CoreContext } from '@kbn/core-base-server-internal';
|
||||
import { Logger } from '@kbn/logging';
|
||||
import { Env } from '@kbn/config';
|
||||
|
@ -23,9 +23,8 @@ import { configServiceMock, getEnvOptions } from '@kbn/config-mocks';
|
|||
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||
|
||||
import { PluginWrapper } from './plugin';
|
||||
import { PluginType } from './types';
|
||||
import { PluginsSystem } from './plugins_system';
|
||||
import { coreMock } from '../mocks';
|
||||
import { coreInternalLifecycleMock } from '@kbn/core-lifecycle-server-mocks';
|
||||
|
||||
function createPlugin(
|
||||
id: string,
|
||||
|
@ -63,9 +62,9 @@ function createPlugin(
|
|||
});
|
||||
}
|
||||
|
||||
const prebootDeps = coreMock.createInternalPreboot();
|
||||
const setupDeps = coreMock.createInternalSetup();
|
||||
const startDeps = coreMock.createInternalStart();
|
||||
const prebootDeps = coreInternalLifecycleMock.createInternalPreboot();
|
||||
const setupDeps = coreInternalLifecycleMock.createInternalSetup();
|
||||
const startDeps = coreInternalLifecycleMock.createInternalStart();
|
||||
|
||||
let pluginsSystem: PluginsSystem<PluginType.standard>;
|
||||
let configService: ReturnType<typeof configServiceMock.create>;
|
|
@ -7,17 +7,18 @@
|
|||
*/
|
||||
|
||||
import { withTimeout, isPromise } from '@kbn/std';
|
||||
import type { PluginName } from '@kbn/core-base-common';
|
||||
import type { DiscoveredPlugin, 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, PluginType } from './types';
|
||||
import type { Logger } from '@kbn/logging';
|
||||
import { PluginType } from '@kbn/core-base-common';
|
||||
import type { PluginWrapper } from './plugin';
|
||||
import { type PluginDependencies } from './types';
|
||||
import {
|
||||
createPluginPrebootSetupContext,
|
||||
createPluginSetupContext,
|
||||
createPluginStartContext,
|
||||
} from './plugin_context';
|
||||
import {
|
||||
import type {
|
||||
PluginsServicePrebootSetupDeps,
|
||||
PluginsServiceSetupDeps,
|
||||
PluginsServiceStartDeps,
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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 { IConfigService } from '@kbn/config';
|
||||
import { configServiceMock } from '@kbn/config-mocks';
|
||||
import { ByteSizeValue } from '@kbn/config-schema';
|
||||
import { fromRoot } from '@kbn/utils';
|
||||
import { duration } from 'moment';
|
||||
import { from } from 'rxjs';
|
||||
|
||||
export const createCoreContextConfigServiceMock = (): IConfigService => {
|
||||
const configService = configServiceMock.create();
|
||||
const getPathConfig = (path: string | string[]) => {
|
||||
switch (path) {
|
||||
case 'elasticsearch':
|
||||
return {
|
||||
shardTimeout: duration(30, 's'),
|
||||
requestTimeout: duration(30, 's'),
|
||||
pingTimeout: duration(30, 's'),
|
||||
someOtherProps: 'unused',
|
||||
};
|
||||
case 'path':
|
||||
return { data: fromRoot('data'), someOtherProps: 'unused' };
|
||||
case 'savedObjects':
|
||||
return { maxImportPayloadBytes: new ByteSizeValue(26214400), someOtherProps: 'unused' };
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
};
|
||||
configService.atPath.mockImplementation((path) => {
|
||||
return from([getPathConfig(path)]);
|
||||
});
|
||||
configService.atPathSync.mockImplementation((path) => {
|
||||
return getPathConfig(path);
|
||||
});
|
||||
|
||||
return configService;
|
||||
};
|
|
@ -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 { createCoreContextConfigServiceMock } from './create_core_context_config_service.mock';
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { ExposedToBrowserDescriptor } from './types';
|
||||
import type { ExposedToBrowserDescriptor } from '@kbn/core-plugins-server';
|
||||
|
||||
describe('ExposedToBrowserDescriptor', () => {
|
||||
interface ConfigType {
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* 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, PluginOpaqueId } from '@kbn/core-base-common';
|
||||
|
||||
/** @internal */
|
||||
export interface PluginDependencies {
|
||||
asNames: ReadonlyMap<PluginName, PluginName[]>;
|
||||
asOpaqueIds: ReadonlyMap<PluginOpaqueId, PluginOpaqueId[]>;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
]
|
||||
}
|
106
packages/core/plugins/core-plugins-server-mocks/BUILD.bazel
Normal file
106
packages/core/plugins/core-plugins-server-mocks/BUILD.bazel
Normal file
|
@ -0,0 +1,106 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_config")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
|
||||
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
|
||||
|
||||
PKG_DIRNAME = "core-plugins-server-mocks"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-plugins-server-mocks"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.config.js",
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
"**/__snapshots__/**",
|
||||
"**/integration_tests/**",
|
||||
"**/scripts/**",
|
||||
"**/storybook/**",
|
||||
"**/test_fixtures/**",
|
||||
"**/test_helpers/**",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/core/plugins/core-plugins-server-internal",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/kbn-utility-types:npm_module_types",
|
||||
"//packages/core/plugins/core-plugins-server-internal:npm_module_types",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,4 @@
|
|||
# @kbn/core-plugins-server-mocks
|
||||
|
||||
This package contains mocks for Core's server-side `plugins` service.
|
||||
- `pluginsServiceMock`
|
9
packages/core/plugins/core-plugins-server-mocks/index.ts
Normal file
9
packages/core/plugins/core-plugins-server-mocks/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 { pluginServiceMock } from './src';
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/plugins/core-plugins-server-mocks'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/core-plugins-server-mocks",
|
||||
"owner": "@elastic/kibana-core",
|
||||
"runtimeDeps": [],
|
||||
"typeDeps": [],
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-plugins-server-mocks",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"author": "Kibana Core",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -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 { pluginServiceMock } from './plugins_service.mock';
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import type { PluginsService, PluginsServiceSetup } from './plugins_service';
|
||||
import { PluginsService, type PluginsServiceSetup } from '@kbn/core-plugins-server-internal';
|
||||
|
||||
type PluginsServiceMock = jest.Mocked<PublicMethodsOf<PluginsService>>;
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
]
|
||||
}
|
119
packages/core/plugins/core-plugins-server/BUILD.bazel
Normal file
119
packages/core/plugins/core-plugins-server/BUILD.bazel
Normal file
|
@ -0,0 +1,119 @@
|
|||
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-plugins-server"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-plugins-server"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.config.js",
|
||||
"**/*.mock.*",
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
"**/__snapshots__/**",
|
||||
"**/integration_tests/**",
|
||||
"**/mocks/**",
|
||||
"**/scripts/**",
|
||||
"**/storybook/**",
|
||||
"**/test_fixtures/**",
|
||||
"**/test_helpers/**",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"@npm//rxjs",
|
||||
"//packages/kbn-config-schema",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"@npm//rxjs",
|
||||
"//packages/kbn-config:npm_module_types",
|
||||
"//packages/kbn-config-schema:npm_module_types",
|
||||
"//packages/kbn-utility-types:npm_module_types",
|
||||
"//packages/kbn-utils:npm_module_types",
|
||||
"//packages/kbn-logging:npm_module_types",
|
||||
"//packages/core/base/core-base-common:npm_module_types",
|
||||
"//packages/core/node/core-node-server:npm_module_types",
|
||||
"//packages/core/elasticsearch/core-elasticsearch-server-internal:npm_module_types",
|
||||
"//packages/core/saved-objects/core-saved-objects-base-server-internal:npm_module_types",
|
||||
"//packages/core/lifecycle/core-lifecycle-server:npm_module_types",
|
||||
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
3
packages/core/plugins/core-plugins-server/README.md
Normal file
3
packages/core/plugins/core-plugins-server/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-plugins-server
|
||||
|
||||
This package contains the public types for core's server-side plugins service.
|
23
packages/core/plugins/core-plugins-server/index.ts
Normal file
23
packages/core/plugins/core-plugins-server/index.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* 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 {
|
||||
PrebootPlugin,
|
||||
Plugin,
|
||||
AsyncPlugin,
|
||||
PluginConfigDescriptor,
|
||||
PluginConfigSchema,
|
||||
PluginInitializer,
|
||||
PluginInitializerContext,
|
||||
PluginManifest,
|
||||
SharedGlobalConfig,
|
||||
MakeUsageFromSchema,
|
||||
ExposedToBrowserDescriptor,
|
||||
} from './src';
|
||||
|
||||
export { SharedGlobalConfigKeys } from './src';
|
13
packages/core/plugins/core-plugins-server/jest.config.js
Normal file
13
packages/core/plugins/core-plugins-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/plugins/core-plugins-server'],
|
||||
};
|
7
packages/core/plugins/core-plugins-server/kibana.jsonc
Normal file
7
packages/core/plugins/core-plugins-server/kibana.jsonc
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/core-plugins-server",
|
||||
"owner": "@elastic/kibana-core",
|
||||
"runtimeDeps": [],
|
||||
"typeDeps": [],
|
||||
}
|
8
packages/core/plugins/core-plugins-server/package.json
Normal file
8
packages/core/plugins/core-plugins-server/package.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-plugins-server",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"author": "Kibana Core",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
23
packages/core/plugins/core-plugins-server/src/index.ts
Normal file
23
packages/core/plugins/core-plugins-server/src/index.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* 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 {
|
||||
PrebootPlugin,
|
||||
Plugin,
|
||||
AsyncPlugin,
|
||||
PluginConfigDescriptor,
|
||||
PluginConfigSchema,
|
||||
PluginInitializer,
|
||||
PluginInitializerContext,
|
||||
PluginManifest,
|
||||
SharedGlobalConfig,
|
||||
MakeUsageFromSchema,
|
||||
ExposedToBrowserDescriptor,
|
||||
} from './types';
|
||||
|
||||
export { SharedGlobalConfigKeys } from './shared_global_config';
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export const SharedGlobalConfigKeys = {
|
||||
// We can add more if really needed
|
||||
elasticsearch: ['shardTimeout', 'requestTimeout', 'pingTimeout'] as const,
|
||||
path: ['data'] as const,
|
||||
savedObjects: ['maxImportPayloadBytes'] as const,
|
||||
};
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
import { Observable } from 'rxjs';
|
||||
import { Type } from '@kbn/config-schema';
|
||||
import { RecursiveReadonly } from '@kbn/utility-types';
|
||||
import { PathConfigType } from '@kbn/utils';
|
||||
import { LoggerFactory } from '@kbn/logging';
|
||||
import type { RecursiveReadonly } from '@kbn/utility-types';
|
||||
import type { PathConfigType } from '@kbn/utils';
|
||||
import type { LoggerFactory } from '@kbn/logging';
|
||||
import type {
|
||||
ConfigPath,
|
||||
EnvironmentMode,
|
||||
|
@ -21,14 +21,10 @@ import type { PluginName, PluginOpaqueId, PluginType } from '@kbn/core-base-comm
|
|||
import type { NodeInfo } from '@kbn/core-node-server';
|
||||
import type { ElasticsearchConfigType } from '@kbn/core-elasticsearch-server-internal';
|
||||
import type { SavedObjectsConfigType } from '@kbn/core-saved-objects-base-server-internal';
|
||||
import { CorePreboot, CoreSetup, CoreStart } from '..';
|
||||
|
||||
import type { CorePreboot, CoreSetup, CoreStart } from '@kbn/core-lifecycle-server';
|
||||
import { SharedGlobalConfigKeys } from './shared_global_config';
|
||||
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, DiscoveredPlugin } from '@kbn/core-base-common';
|
||||
export { PluginType } from '@kbn/core-base-common';
|
||||
|
||||
/**
|
||||
* Dedicated type for plugin configuration schema.
|
||||
*
|
||||
|
@ -131,12 +127,6 @@ export type MakeUsageFromSchema<T> = {
|
|||
: boolean;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export interface PluginDependencies {
|
||||
asNames: ReadonlyMap<PluginName, PluginName[]>;
|
||||
asOpaqueIds: ReadonlyMap<PluginOpaqueId, PluginOpaqueId[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the set of required and optional properties plugin can define in its
|
||||
* mandatory JSON manifest file.
|
||||
|
@ -303,13 +293,6 @@ export interface AsyncPlugin<
|
|||
stop?(): void;
|
||||
}
|
||||
|
||||
export const SharedGlobalConfigKeys = {
|
||||
// We can add more if really needed
|
||||
elasticsearch: ['shardTimeout', 'requestTimeout', 'pingTimeout'] as const,
|
||||
path: ['data'] as const,
|
||||
savedObjects: ['maxImportPayloadBytes'] as const,
|
||||
};
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
17
packages/core/plugins/core-plugins-server/tsconfig.json
Normal file
17
packages/core/plugins/core-plugins-server/tsconfig.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
]
|
||||
}
|
|
@ -13,7 +13,7 @@ import { mockRouter } from '@kbn/core-http-router-server-mocks';
|
|||
import type { UiPlugins } from '@kbn/core-plugins-base-server-internal';
|
||||
import { coreMock, httpServerMock } from '../mocks';
|
||||
import { httpResourcesMock } from '@kbn/core-http-resources-server-mocks';
|
||||
import { PluginType } from '../plugins';
|
||||
import { PluginType } from '@kbn/core-base-common';
|
||||
import { CoreApp } from './core_app';
|
||||
import { RequestHandlerContext } from '..';
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import type {
|
|||
} from '@kbn/core-http-server';
|
||||
import type { UiPlugins } from '@kbn/core-plugins-base-server-internal';
|
||||
import type { HttpResources, HttpResourcesServiceToolkit } from '@kbn/core-http-resources-server';
|
||||
import { InternalCorePreboot, InternalCoreSetup } from '../internal_types';
|
||||
import { InternalCorePreboot, InternalCoreSetup } from '@kbn/core-lifecycle-server-internal';
|
||||
import { registerBundleRoutes } from './bundle_routes';
|
||||
import type { InternalCoreAppRequestHandlerContext } from './internal_types';
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue