Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ packages/core/rendering/core-rendering-browser-mocks @elastic/kibana-core
packages/core/rendering/core-rendering-server-internal @elastic/kibana-core
packages/core/rendering/core-rendering-server-mocks @elastic/kibana-core
packages/core/root/core-root-browser-internal @elastic/kibana-core
packages/core/root/core-root-server-internal @elastic/kibana-core
packages/core/saved-objects/core-saved-objects-api-browser @elastic/kibana-core
packages/core/saved-objects/core-saved-objects-api-server @elastic/kibana-core
packages/core/saved-objects/core-saved-objects-api-server-internal @elastic/kibana-core
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
"@kbn/core-rendering-server-internal": "link:bazel-bin/packages/core/rendering/core-rendering-server-internal",
"@kbn/core-rendering-server-mocks": "link:bazel-bin/packages/core/rendering/core-rendering-server-mocks",
"@kbn/core-root-browser-internal": "link:bazel-bin/packages/core/root/core-root-browser-internal",
"@kbn/core-root-server-internal": "link:bazel-bin/packages/core/root/core-root-server-internal",
"@kbn/core-saved-objects-api-browser": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-browser",
"@kbn/core-saved-objects-api-server": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server",
"@kbn/core-saved-objects-api-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server-internal",
Expand Down
2 changes: 2 additions & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ filegroup(
"//packages/core/rendering/core-rendering-server-internal:build",
"//packages/core/rendering/core-rendering-server-mocks:build",
"//packages/core/root/core-root-browser-internal:build",
"//packages/core/root/core-root-server-internal:build",
"//packages/core/saved-objects/core-saved-objects-api-browser:build",
"//packages/core/saved-objects/core-saved-objects-api-server:build",
"//packages/core/saved-objects/core-saved-objects-api-server-internal:build",
Expand Down Expand Up @@ -508,6 +509,7 @@ filegroup(
"//packages/core/rendering/core-rendering-server-internal:build_types",
"//packages/core/rendering/core-rendering-server-mocks:build_types",
"//packages/core/root/core-root-browser-internal:build_types",
"//packages/core/root/core-root-server-internal:build_types",
"//packages/core/saved-objects/core-saved-objects-api-browser:build_types",
"//packages/core/saved-objects/core-saved-objects-api-server:build_types",
"//packages/core/saved-objects/core-saved-objects-api-server-internal:build_types",
Expand Down
167 changes: 167 additions & 0 deletions packages/core/root/core-root-server-internal/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
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-root-server-internal"
PKG_REQUIRE_NAME = "@kbn/core-root-server-internal"

SOURCE_FILES = glob(
[
"**/*.ts",
],
exclude = [
"**/*.config.js",
"**/*.mock.*",
"**/*.test.*",
"**/*.stories.*",
"**/__snapshots__/**",
"**/integration_tests/**",
"**/mocks/**",
"**/scripts/**",
"**/storybook/**",
"**/test_fixtures/**",
"**/test_helpers/**",
],
)

SRCS = SOURCE_FILES

filegroup(
name = "srcs",
srcs = SRCS,
)

NPM_MODULE_EXTRA_FILES = [
"package.json",
]

RUNTIME_DEPS = [
"@npm//elastic-apm-node",
"//packages/kbn-utils",
"//packages/kbn-config",
"//packages/kbn-ebt-tools",
"//packages/core/doc-links/core-doc-links-server-internal",
"//packages/core/logging/core-logging-server-internal",
"//packages/core/config/core-config-server-internal",
"//packages/core/node/core-node-server-internal",
"//packages/core/analytics/core-analytics-server-internal",
"//packages/core/environment/core-environment-server-internal",
"//packages/core/execution-context/core-execution-context-server-internal",
"//packages/core/preboot/core-preboot-server-internal",
"//packages/core/http/core-http-context-server-internal",
"//packages/core/http/core-http-server-internal",
"//packages/core/elasticsearch/core-elasticsearch-server-internal",
"//packages/core/metrics/core-metrics-server-internal",
"//packages/core/capabilities/core-capabilities-server-internal",
"//packages/core/saved-objects/core-saved-objects-base-server-internal",
"//packages/core/saved-objects/core-saved-objects-server-internal",
"//packages/core/i18n/core-i18n-server-internal",
"//packages/core/deprecations/core-deprecations-server-internal",
"//packages/core/usage-data/core-usage-data-server-internal",
"//packages/core/status/core-status-server-internal",
"//packages/core/ui-settings/core-ui-settings-server-internal",
"//packages/core/http/core-http-request-handler-context-server-internal",
"//packages/core/rendering/core-rendering-server-internal",
"//packages/core/http/core-http-resources-server-internal",
"//packages/core/plugins/core-plugins-server-internal",
"//packages/core/apps/core-apps-server-internal",
]

TYPES_DEPS = [
"@npm//@types/node",
"@npm//@types/jest",
"@npm//elastic-apm-node",
"//packages/kbn-utils:npm_module_types",
"//packages/kbn-logging:npm_module_types",
"//packages/kbn-config:npm_module_types",
"//packages/kbn-ebt-tools:npm_module_types",
"//packages/core/base/core-base-server-internal:npm_module_types",
"//packages/core/doc-links/core-doc-links-server-internal:npm_module_types",
"//packages/core/logging/core-logging-server-internal:npm_module_types",
"//packages/core/config/core-config-server-internal:npm_module_types",
"//packages/core/node/core-node-server-internal:npm_module_types",
"//packages/core/analytics/core-analytics-server-internal:npm_module_types",
"//packages/core/analytics/core-analytics-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/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/metrics/core-metrics-server-internal:npm_module_types",
"//packages/core/capabilities/core-capabilities-server-internal:npm_module_types",
"//packages/core/saved-objects/core-saved-objects-server:npm_module_types",
"//packages/core/saved-objects/core-saved-objects-base-server-internal:npm_module_types",
"//packages/core/saved-objects/core-saved-objects-server-internal:npm_module_types",
"//packages/core/i18n/core-i18n-server-internal:npm_module_types",
"//packages/core/deprecations/core-deprecations-server-internal:npm_module_types",
"//packages/core/usage-data/core-usage-data-server-internal:npm_module_types",
"//packages/core/status/core-status-server-internal:npm_module_types",
"//packages/core/ui-settings/core-ui-settings-server-internal:npm_module_types",
"//packages/core/http/core-http-request-handler-context-server-internal:npm_module_types",
"//packages/core/http/core-http-request-handler-context-server:npm_module_types",
"//packages/core/rendering/core-rendering-server-internal:npm_module_types",
"//packages/core/http/core-http-resources-server-internal:npm_module_types",
"//packages/core/lifecycle/core-lifecycle-server-internal:npm_module_types",
"//packages/core/plugins/core-plugins-server-internal:npm_module_types",
"//packages/core/apps/core-apps-server-internal:npm_module_types",
]

jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)

ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.bazel.json",
],
)

ts_project(
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = TYPES_DEPS,
declaration = True,
emit_declaration_only = True,
out_dir = "target_types",
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"],
)

js_library(
name = "npm_module_types",
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
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"],
)

filegroup(
name = "build_types",
srcs = [":npm_module_types"],
visibility = ["//visibility:public"],
)
6 changes: 6 additions & 0 deletions packages/core/root/core-root-server-internal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# @kbn/core-root-server-internal

This package exposes the root components required to start the Core system on the server side.
- the `Root` class
- the `Server` class
- the `bootstap` function
9 changes: 9 additions & 0 deletions packages/core/root/core-root-server-internal/index.ts
Original file line number Diff line number Diff line change
@@ -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 { Server, Root, bootstrap } from './src';
13 changes: 13 additions & 0 deletions packages/core/root/core-root-server-internal/jest.config.js
Original file line number Diff line number Diff line change
@@ -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/root/core-root-server-internal'],
};
7 changes: 7 additions & 0 deletions packages/core/root/core-root-server-internal/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-root-server-internal",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": [],
}
9 changes: 9 additions & 0 deletions packages/core/root/core-root-server-internal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@kbn/core-root-server-internal",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"author": "Kibana Core",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
11 changes: 11 additions & 0 deletions packages/core/root/core-root-server-internal/src/index.ts
Original file line number Diff line number Diff line change
@@ -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 { Server } from './server';
export { bootstrap } from './bootstrap';
export { Root } from './root';
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
distinctUntilChanged,
} from 'rxjs/operators';
import type { Logger, LoggerFactory } from '@kbn/logging';
import { Env, RawConfigurationProvider } from '@kbn/config';
import type { Env, RawConfigurationProvider } from '@kbn/config';
import { LoggingConfigType, LoggingSystem } from '@kbn/core-logging-server-internal';
import apm from 'elastic-apm-node';
import { isEqual } from 'lodash';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import apm from 'elastic-apm-node';
import { config as pathConfig } from '@kbn/utils';
import { reportPerformanceMetricEvent } from '@kbn/ebt-tools';
import type { Logger, LoggerFactory } from '@kbn/logging';
import { ConfigService, Env, RawConfigurationProvider } from '@kbn/config';
import type { ServiceConfigDescriptor } from '@kbn/core-base-server-internal';
Expand All @@ -24,7 +25,6 @@ import {
import { NodeService, nodeConfig } from '@kbn/core-node-server-internal';
import { AnalyticsService } from '@kbn/core-analytics-server-internal';
import type { AnalyticsServiceSetup, AnalyticsServiceStart } from '@kbn/core-analytics-server';
import { reportPerformanceMetricEvent } from '@kbn/ebt-tools';
import { EnvironmentService, pidConfig } from '@kbn/core-environment-server-internal';
import {
ExecutionContextService,
Expand Down Expand Up @@ -69,7 +69,7 @@ import type {
import { RenderingService } from '@kbn/core-rendering-server-internal';

import { HttpResourcesService } from '@kbn/core-http-resources-server-internal';
import {
import type {
InternalCorePreboot,
InternalCoreSetup,
InternalCoreStart,
Expand Down
15 changes: 15 additions & 0 deletions packages/core/root/core-root-server-internal/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "../../../../tsconfig.bazel.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "target_types",
"types": [
"jest",
"node"
]
},
"include": [
"**/*.ts",
]
}
4 changes: 2 additions & 2 deletions src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ import type { RequestHandlerContext } from '@kbn/core-http-request-handler-conte
import type { HttpResources } from '@kbn/core-http-resources-server';
import type { PluginsServiceSetup, PluginsServiceStart } from '@kbn/core-plugins-server-internal';

export { bootstrap } from '@kbn/core-root-server-internal';

export type { PluginOpaqueId } from '@kbn/core-base-common';
export type {
CoreUsageStats,
Expand All @@ -65,8 +67,6 @@ export type {

export type { KibanaExecutionContext } from '@kbn/core-execution-context-common';
export type { IExecutionContextContainer } from '@kbn/core-execution-context-server';

export { bootstrap } from './bootstrap';
export type { Capabilities } from '@kbn/core-capabilities-common';
export type {
CapabilitiesProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Side Public License, v 1.
*/

import { Root } from '@kbn/core-root-server-internal';
import * as kbnTestServer from '../../../test_helpers/kbn_server';
import { Root } from '../../root';

describe('Core app routes', () => {
let root: Root;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Side Public License, v 1.
*/

import { Root } from '@kbn/core-root-server-internal';
import * as kbnTestServer from '../../../test_helpers/kbn_server';
import { Root } from '../../root';

describe('default route provider', () => {
let esServer: kbnTestServer.TestElasticsearchUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Side Public License, v 1.
*/

import { Root } from '@kbn/core-root-server-internal';
import * as kbnTestServer from '../../../test_helpers/kbn_server';
import { Root } from '../../root';

describe('Platform assets', function () {
let root: Root;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { esTestConfig } from '@kbn/test';
import * as http from 'http';
import supertest from 'supertest';

import { Root } from '@kbn/core-root-server-internal';
import {
createRootWithCorePlugins,
createTestServers,
TestElasticsearchUtils,
TestKibanaUtils,
} from '../../../test_helpers/kbn_server';
import { Root } from '../../root';

describe('elasticsearch clients', () => {
let esServer: TestElasticsearchUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getEnvOptions } from '@kbn/config-mocks';
import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
import type { InternalCoreStart } from '@kbn/core-lifecycle-server-internal';
import { Root } from '../../../root';
import { Root } from '@kbn/core-root-server-internal';

const kibanaVersion = Env.createDefault(REPO_ROOT, getEnvOptions()).packageInfo.version;
const logFilePath = path.join(__dirname, '7.7.2_xpack_100k.log');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Path from 'path';
import fs from 'fs/promises';
import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
import { Root } from '../../../root';
import { Root } from '@kbn/core-root-server-internal';

const logFilePath = Path.join(__dirname, '7_13_failed_action_tasks.log');

Expand Down
Loading