mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Migrate server-side capabilities domain to packages (#136708)
* create @kbn/core-capabilities-common, start fixing imports * create @kbn/core-capabilities-server * adapt more imports * adapt integration tests * fix more type usages * create the remaining packages * move code to packages * fix imports * fix import from integration tests
This commit is contained in:
parent
7e7d37dd56
commit
6c9d93f3a0
51 changed files with 787 additions and 113 deletions
|
@ -156,6 +156,10 @@
|
|||
"@kbn/core-base-common-internal": "link:bazel-bin/packages/core/base/core-base-common-internal",
|
||||
"@kbn/core-base-server-internal": "link:bazel-bin/packages/core/base/core-base-server-internal",
|
||||
"@kbn/core-base-server-mocks": "link:bazel-bin/packages/core/base/core-base-server-mocks",
|
||||
"@kbn/core-capabilities-common": "link:bazel-bin/packages/core/capabilities/core-capabilities-common",
|
||||
"@kbn/core-capabilities-server": "link:bazel-bin/packages/core/capabilities/core-capabilities-server",
|
||||
"@kbn/core-capabilities-server-internal": "link:bazel-bin/packages/core/capabilities/core-capabilities-server-internal",
|
||||
"@kbn/core-capabilities-server-mocks": "link:bazel-bin/packages/core/capabilities/core-capabilities-server-mocks",
|
||||
"@kbn/core-config-server-internal": "link:bazel-bin/packages/core/config/core-config-server-internal",
|
||||
"@kbn/core-config-server-mocks": "link:bazel-bin/packages/core/config/core-config-server-mocks",
|
||||
"@kbn/core-deprecations-browser": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser",
|
||||
|
@ -746,6 +750,10 @@
|
|||
"@types/kbn__core-base-server": "link:bazel-bin/packages/core/base/core-base-server/npm_module_types",
|
||||
"@types/kbn__core-base-server-internal": "link:bazel-bin/packages/core/base/core-base-server-internal/npm_module_types",
|
||||
"@types/kbn__core-base-server-mocks": "link:bazel-bin/packages/core/base/core-base-server-mocks/npm_module_types",
|
||||
"@types/kbn__core-capabilities-common": "link:bazel-bin/packages/core/capabilities/core-capabilities-common/npm_module_types",
|
||||
"@types/kbn__core-capabilities-server": "link:bazel-bin/packages/core/capabilities/core-capabilities-server/npm_module_types",
|
||||
"@types/kbn__core-capabilities-server-internal": "link:bazel-bin/packages/core/capabilities/core-capabilities-server-internal/npm_module_types",
|
||||
"@types/kbn__core-capabilities-server-mocks": "link:bazel-bin/packages/core/capabilities/core-capabilities-server-mocks/npm_module_types",
|
||||
"@types/kbn__core-common-internal-base": "link:bazel-bin/packages/core/common/internal-base/npm_module_types",
|
||||
"@types/kbn__core-config-server-internal": "link:bazel-bin/packages/core/config/core-config-server-internal/npm_module_types",
|
||||
"@types/kbn__core-config-server-mocks": "link:bazel-bin/packages/core/config/core-config-server-mocks/npm_module_types",
|
||||
|
|
|
@ -26,6 +26,10 @@ filegroup(
|
|||
"//packages/core/base/core-base-common:build",
|
||||
"//packages/core/base/core-base-server-internal:build",
|
||||
"//packages/core/base/core-base-server-mocks:build",
|
||||
"//packages/core/capabilities/core-capabilities-common:build",
|
||||
"//packages/core/capabilities/core-capabilities-server-internal:build",
|
||||
"//packages/core/capabilities/core-capabilities-server-mocks:build",
|
||||
"//packages/core/capabilities/core-capabilities-server:build",
|
||||
"//packages/core/config/core-config-server-internal:build",
|
||||
"//packages/core/deprecations/core-deprecations-browser-internal:build",
|
||||
"//packages/core/deprecations/core-deprecations-browser-mocks:build",
|
||||
|
@ -242,6 +246,10 @@ filegroup(
|
|||
"//packages/core/base/core-base-common:build_types",
|
||||
"//packages/core/base/core-base-server-internal:build_types",
|
||||
"//packages/core/base/core-base-server-mocks:build_types",
|
||||
"//packages/core/capabilities/core-capabilities-common:build_types",
|
||||
"//packages/core/capabilities/core-capabilities-server-internal:build_types",
|
||||
"//packages/core/capabilities/core-capabilities-server-mocks:build_types",
|
||||
"//packages/core/capabilities/core-capabilities-server:build_types",
|
||||
"//packages/core/config/core-config-server-internal:build_types",
|
||||
"//packages/core/deprecations/core-deprecations-browser-internal:build_types",
|
||||
"//packages/core/deprecations/core-deprecations-browser-mocks:build_types",
|
||||
|
|
105
packages/core/capabilities/core-capabilities-common/BUILD.bazel
Normal file
105
packages/core/capabilities/core-capabilities-common/BUILD.bazel
Normal file
|
@ -0,0 +1,105 @@
|
|||
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-capabilities-common"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-capabilities-common"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_web",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
web = True,
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-capabilities-common
|
||||
|
||||
Empty package generated by @kbn/generate
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/capabilities/core-capabilities-common'],
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@kbn/core-capabilities-common",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"browser": "./target_web/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -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 { Capabilities } from './capabilities';
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
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-capabilities-server-internal"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-capabilities-server-internal"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"@npm//lodash",
|
||||
"//packages/kbn-config-schema",
|
||||
### test dependencies
|
||||
"//packages/core/base/core-base-server-mocks",
|
||||
"//packages/core/http/core-http-router-server-mocks",
|
||||
"//packages/core/http/core-http-server-mocks",
|
||||
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"@npm//lodash",
|
||||
"//packages/kbn-utility-types:npm_module_types",
|
||||
"//packages/kbn-config-schema:npm_module_types",
|
||||
"//packages/kbn-logging:npm_module_types",
|
||||
"//packages/core/base/core-base-server-internal:npm_module_types",
|
||||
"//packages/core/http/core-http-server:npm_module_types",
|
||||
"//packages/core/http/core-http-server-internal:npm_module_types",
|
||||
"//packages/core/capabilities/core-capabilities-common:npm_module_types",
|
||||
"//packages/core/capabilities/core-capabilities-server:npm_module_types",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-capabilities-server-internal
|
||||
|
||||
Empty package generated by @kbn/generate
|
|
@ -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/capabilities/core-capabilities-server-internal'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@kbn/core-capabilities-server-internal",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -13,7 +13,8 @@ import {
|
|||
InternalHttpServicePrebootMock,
|
||||
InternalHttpServiceSetupMock,
|
||||
} from '@kbn/core-http-server-mocks';
|
||||
import { CapabilitiesService, CapabilitiesSetup } from './capabilities_service';
|
||||
import type { CapabilitiesSetup } from '@kbn/core-capabilities-server';
|
||||
import { CapabilitiesService } from './capabilities_service';
|
||||
|
||||
describe('CapabilitiesService', () => {
|
||||
let http: InternalHttpServiceSetupMock;
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* 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 { CoreContext } from '@kbn/core-base-server-internal';
|
||||
import type { Logger } from '@kbn/logging';
|
||||
import type {
|
||||
InternalHttpServicePreboot,
|
||||
InternalHttpServiceSetup,
|
||||
} from '@kbn/core-http-server-internal';
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
import type {
|
||||
CapabilitiesProvider,
|
||||
CapabilitiesSwitcher,
|
||||
CapabilitiesStart,
|
||||
CapabilitiesSetup,
|
||||
} from '@kbn/core-capabilities-server';
|
||||
import { mergeCapabilities } from './merge_capabilities';
|
||||
import { getCapabilitiesResolver, CapabilitiesResolver } from './resolve_capabilities';
|
||||
import { registerRoutes } from './routes';
|
||||
|
||||
interface PrebootSetupDeps {
|
||||
http: InternalHttpServicePreboot;
|
||||
}
|
||||
|
||||
interface SetupDeps {
|
||||
http: InternalHttpServiceSetup;
|
||||
}
|
||||
|
||||
const defaultCapabilities: Capabilities = {
|
||||
navLinks: {},
|
||||
management: {},
|
||||
catalogue: {},
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export class CapabilitiesService {
|
||||
private readonly logger: Logger;
|
||||
private readonly capabilitiesProviders: CapabilitiesProvider[] = [];
|
||||
private readonly capabilitiesSwitchers: CapabilitiesSwitcher[] = [];
|
||||
private readonly resolveCapabilities: CapabilitiesResolver;
|
||||
|
||||
constructor(core: CoreContext) {
|
||||
this.logger = core.logger.get('capabilities-service');
|
||||
this.resolveCapabilities = getCapabilitiesResolver(
|
||||
() =>
|
||||
mergeCapabilities(
|
||||
defaultCapabilities,
|
||||
...this.capabilitiesProviders.map((provider) => provider())
|
||||
),
|
||||
() => this.capabilitiesSwitchers
|
||||
);
|
||||
}
|
||||
|
||||
public preboot(prebootDeps: PrebootSetupDeps) {
|
||||
this.logger.debug('Prebooting capabilities service');
|
||||
|
||||
// The preboot server has no need for real capabilities.
|
||||
// Returning the un-augmented defaults is sufficient.
|
||||
prebootDeps.http.registerRoutes('', (router) => {
|
||||
registerRoutes(router, async () => defaultCapabilities);
|
||||
});
|
||||
}
|
||||
|
||||
public setup(setupDeps: SetupDeps): CapabilitiesSetup {
|
||||
this.logger.debug('Setting up capabilities service');
|
||||
|
||||
registerRoutes(setupDeps.http.createRouter(''), this.resolveCapabilities);
|
||||
|
||||
return {
|
||||
registerProvider: (provider: CapabilitiesProvider) => {
|
||||
this.capabilitiesProviders.push(provider);
|
||||
},
|
||||
registerSwitcher: (switcher: CapabilitiesSwitcher) => {
|
||||
this.capabilitiesSwitchers.push(switcher);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public start(): CapabilitiesStart {
|
||||
return {
|
||||
resolveCapabilities: (request, options) =>
|
||||
this.resolveCapabilities(request, [], options?.useDefaultCapabilities ?? false),
|
||||
};
|
||||
}
|
||||
}
|
|
@ -7,9 +7,3 @@
|
|||
*/
|
||||
|
||||
export { CapabilitiesService } from './capabilities_service';
|
||||
export type {
|
||||
CapabilitiesSetup,
|
||||
CapabilitiesStart,
|
||||
ResolveCapabilitiesOptions,
|
||||
} from './capabilities_service';
|
||||
export type { Capabilities, CapabilitiesSwitcher, CapabilitiesProvider } from './types';
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import { mergeWith } from 'lodash';
|
||||
import { Capabilities } from './types';
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
|
||||
export const mergeCapabilities = (...sources: Array<Partial<Capabilities>>): Capabilities =>
|
||||
mergeWith({}, ...sources, (a: any, b: any) => {
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import type { KibanaRequest } from '@kbn/core-http-server';
|
||||
import { httpServerMock } from '@kbn/core-http-server-mocks';
|
||||
import { Capabilities } from './types';
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
import { resolveCapabilities } from './resolve_capabilities';
|
||||
|
||||
describe('resolveCapabilities', () => {
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
import { cloneDeep } from 'lodash';
|
||||
import type { KibanaRequest } from '@kbn/core-http-server';
|
||||
import { Capabilities, CapabilitiesSwitcher } from './types';
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
import type { CapabilitiesSwitcher } from '@kbn/core-capabilities-server';
|
||||
|
||||
export type CapabilitiesResolver = (
|
||||
request: KibanaRequest,
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import type { IRouter } from '@kbn/core-http-server';
|
||||
import { CapabilitiesResolver } from '../resolve_capabilities';
|
||||
import type { CapabilitiesResolver } from '../resolve_capabilities';
|
||||
import { registerCapabilitiesRoutes } from './resolve_capabilities';
|
||||
|
||||
export function registerRoutes(router: IRouter, resolver: CapabilitiesResolver) {
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { IRouter } from '@kbn/core-http-server';
|
||||
import { CapabilitiesResolver } from '../resolve_capabilities';
|
||||
import type { CapabilitiesResolver } from '../resolve_capabilities';
|
||||
|
||||
const applicationIdRegexp = /^[a-zA-Z0-9_:-]+$/;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
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-capabilities-server-mocks"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-capabilities-server-mocks"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/kbn-utility-types:npm_module_types",
|
||||
"//packages/core/capabilities/core-capabilities-common:npm_module_types",
|
||||
"//packages/core/capabilities/core-capabilities-server:npm_module_types",
|
||||
"//packages/core/capabilities/core-capabilities-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",
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-capabilities-server-mocks
|
||||
|
||||
Empty package generated by @kbn/generate
|
|
@ -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/capabilities/core-capabilities-server-mocks'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@kbn/core-capabilities-server-mocks",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -7,8 +7,9 @@
|
|||
*/
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import { CapabilitiesService, CapabilitiesSetup, CapabilitiesStart } from './capabilities_service';
|
||||
import { Capabilities } from './types';
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
import type { CapabilitiesSetup, CapabilitiesStart } from '@kbn/core-capabilities-server';
|
||||
import type { CapabilitiesService } from '@kbn/core-capabilities-server-internal';
|
||||
|
||||
const createSetupContractMock = () => {
|
||||
const setupContract: jest.Mocked<CapabilitiesSetup> = {
|
||||
|
@ -33,7 +34,8 @@ const createCapabilitiesMock = (): Capabilities => {
|
|||
};
|
||||
};
|
||||
|
||||
type CapabilitiesServiceContract = PublicMethodsOf<CapabilitiesService>;
|
||||
export type CapabilitiesServiceContract = PublicMethodsOf<CapabilitiesService>;
|
||||
|
||||
const createMock = () => {
|
||||
const mocked: jest.Mocked<CapabilitiesServiceContract> = {
|
||||
preboot: jest.fn(),
|
|
@ -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 { capabilitiesServiceMock } from './capabilities_service.mock';
|
||||
export type { CapabilitiesServiceContract } from './capabilities_service.mock';
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
100
packages/core/capabilities/core-capabilities-server/BUILD.bazel
Normal file
100
packages/core/capabilities/core-capabilities-server/BUILD.bazel
Normal file
|
@ -0,0 +1,100 @@
|
|||
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-capabilities-server"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-capabilities-server"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/*.stories.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/kbn-utility-types",
|
||||
"//packages/core/http/core-http-server:npm_module_types",
|
||||
"//packages/core/capabilities/core-capabilities-common:npm_module_types"
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-capabilities-server
|
||||
|
||||
Empty package generated by @kbn/generate
|
|
@ -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/capabilities/core-capabilities-server'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@kbn/core-capabilities-server",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -6,10 +6,9 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { MaybePromise } from '@kbn/utility-types';
|
||||
import type { KibanaRequest } from '@kbn/core-http-server';
|
||||
import { Capabilities } from '../../types/capabilities';
|
||||
|
||||
export type { Capabilities };
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
|
||||
/**
|
||||
* See {@link CapabilitiesSetup}
|
||||
|
@ -25,4 +24,4 @@ export type CapabilitiesSwitcher = (
|
|||
request: KibanaRequest,
|
||||
uiCapabilities: Capabilities,
|
||||
useDefaultCapabilities: boolean
|
||||
) => Partial<Capabilities> | Promise<Partial<Capabilities>>;
|
||||
) => MaybePromise<Partial<Capabilities>>;
|
|
@ -6,17 +6,9 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { CoreContext } from '@kbn/core-base-server-internal';
|
||||
import type { Logger } from '@kbn/logging';
|
||||
import type { KibanaRequest } from '@kbn/core-http-server';
|
||||
import type {
|
||||
InternalHttpServicePreboot,
|
||||
InternalHttpServiceSetup,
|
||||
} from '@kbn/core-http-server-internal';
|
||||
import { Capabilities, CapabilitiesProvider, CapabilitiesSwitcher } from './types';
|
||||
import { mergeCapabilities } from './merge_capabilities';
|
||||
import { getCapabilitiesResolver, CapabilitiesResolver } from './resolve_capabilities';
|
||||
import { registerRoutes } from './routes';
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
import type { CapabilitiesSwitcher, CapabilitiesProvider } from './capabilities';
|
||||
|
||||
/**
|
||||
* APIs to manage the {@link Capabilities} that will be used by the application.
|
||||
|
@ -123,69 +115,3 @@ export interface CapabilitiesStart {
|
|||
options?: ResolveCapabilitiesOptions
|
||||
): Promise<Capabilities>;
|
||||
}
|
||||
|
||||
interface PrebootSetupDeps {
|
||||
http: InternalHttpServicePreboot;
|
||||
}
|
||||
|
||||
interface SetupDeps {
|
||||
http: InternalHttpServiceSetup;
|
||||
}
|
||||
|
||||
const defaultCapabilities: Capabilities = {
|
||||
navLinks: {},
|
||||
management: {},
|
||||
catalogue: {},
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export class CapabilitiesService {
|
||||
private readonly logger: Logger;
|
||||
private readonly capabilitiesProviders: CapabilitiesProvider[] = [];
|
||||
private readonly capabilitiesSwitchers: CapabilitiesSwitcher[] = [];
|
||||
private readonly resolveCapabilities: CapabilitiesResolver;
|
||||
|
||||
constructor(core: CoreContext) {
|
||||
this.logger = core.logger.get('capabilities-service');
|
||||
this.resolveCapabilities = getCapabilitiesResolver(
|
||||
() =>
|
||||
mergeCapabilities(
|
||||
defaultCapabilities,
|
||||
...this.capabilitiesProviders.map((provider) => provider())
|
||||
),
|
||||
() => this.capabilitiesSwitchers
|
||||
);
|
||||
}
|
||||
|
||||
public preboot(prebootDeps: PrebootSetupDeps) {
|
||||
this.logger.debug('Prebooting capabilities service');
|
||||
|
||||
// The preboot server has no need for real capabilities.
|
||||
// Returning the un-augmented defaults is sufficient.
|
||||
prebootDeps.http.registerRoutes('', (router) => {
|
||||
registerRoutes(router, async () => defaultCapabilities);
|
||||
});
|
||||
}
|
||||
|
||||
public setup(setupDeps: SetupDeps): CapabilitiesSetup {
|
||||
this.logger.debug('Setting up capabilities service');
|
||||
|
||||
registerRoutes(setupDeps.http.createRouter(''), this.resolveCapabilities);
|
||||
|
||||
return {
|
||||
registerProvider: (provider: CapabilitiesProvider) => {
|
||||
this.capabilitiesProviders.push(provider);
|
||||
},
|
||||
registerSwitcher: (switcher: CapabilitiesSwitcher) => {
|
||||
this.capabilitiesSwitchers.push(switcher);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public start(): CapabilitiesStart {
|
||||
return {
|
||||
resolveCapabilities: (request, options) =>
|
||||
this.resolveCapabilities(request, [], options?.useDefaultCapabilities ?? false),
|
||||
};
|
||||
}
|
||||
}
|
|
@ -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 { CapabilitiesSwitcher, CapabilitiesProvider } from './capabilities';
|
||||
export type { CapabilitiesSetup, CapabilitiesStart, ResolveCapabilitiesOptions } from './contracts';
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -14,10 +14,11 @@ import { createBrowserHistory, History } from 'history';
|
|||
import type { PluginOpaqueId } from '@kbn/core-base-common';
|
||||
import type { ThemeServiceStart } from '@kbn/core-theme-browser';
|
||||
import type { HttpSetup, HttpStart } from '@kbn/core-http-browser';
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
import type { MountPoint } from '../types';
|
||||
import type { OverlayStart } from '../overlays';
|
||||
import { AppRouter } from './ui';
|
||||
import { type Capabilities, CapabilitiesService } from './capabilities';
|
||||
import { CapabilitiesService } from './capabilities';
|
||||
import type {
|
||||
App,
|
||||
AppDeepLink,
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
import type { RecursiveReadonly } from '@kbn/utility-types';
|
||||
import { deepFreeze } from '@kbn/std';
|
||||
import type { HttpStart } from '@kbn/core-http-browser';
|
||||
|
||||
import type { Capabilities } from '../../../types/capabilities';
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
|
||||
interface StartDeps {
|
||||
appIds: string[];
|
||||
|
|
|
@ -6,5 +6,4 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export type { Capabilities } from '../../../types/capabilities';
|
||||
export { CapabilitiesService } from './capabilities_service';
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
export { ApplicationService } from './application_service';
|
||||
export { ScopedHistory } from './scoped_history';
|
||||
export { AppNavLinkStatus, AppStatus } from './types';
|
||||
|
||||
export type { Capabilities } from './capabilities';
|
||||
export type {
|
||||
App,
|
||||
AppMount,
|
||||
|
|
|
@ -5,14 +5,15 @@
|
|||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { ButtonColor } from '@elastic/eui';
|
||||
import { Observable } from 'rxjs';
|
||||
import { History } from 'history';
|
||||
import { RecursiveReadonly } from '@kbn/utility-types';
|
||||
|
||||
import type { CoreTheme } from '@kbn/core-theme-browser';
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
import { MountPoint } from '../types';
|
||||
import { Capabilities } from './capabilities';
|
||||
import { PluginOpaqueId } from '../plugins';
|
||||
import { AppCategory } from '../../types';
|
||||
import { ScopedHistory } from './scoped_history';
|
||||
|
|
|
@ -44,6 +44,7 @@ import type {
|
|||
} from '@kbn/core-fatal-errors-browser';
|
||||
import type { UiSettingsState, IUiSettingsClient } from '@kbn/core-ui-settings-browser';
|
||||
import type { DeprecationsServiceStart } from '@kbn/core-deprecations-browser';
|
||||
import type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
import type {
|
||||
ChromeBadge,
|
||||
ChromeBreadcrumb,
|
||||
|
@ -74,7 +75,7 @@ import type {
|
|||
PluginInitializerContext,
|
||||
PluginOpaqueId,
|
||||
} from './plugins';
|
||||
import type { ApplicationSetup, Capabilities, ApplicationStart } from './application';
|
||||
import type { ApplicationSetup, ApplicationStart } from './application';
|
||||
import type { SavedObjectsStart } from './saved_objects';
|
||||
|
||||
export type { PackageInfo, EnvironmentMode } from '@kbn/config';
|
||||
|
|
|
@ -58,12 +58,12 @@ import type {
|
|||
ElasticsearchServicePreboot,
|
||||
} from '@kbn/core-elasticsearch-server';
|
||||
import { configSchema as elasticsearchConfigSchema } from '@kbn/core-elasticsearch-server-internal';
|
||||
import { HttpResources } from './http_resources';
|
||||
import type { CapabilitiesSetup, CapabilitiesStart } from '@kbn/core-capabilities-server';
|
||||
|
||||
import { HttpResources } from './http_resources';
|
||||
import { PluginsServiceSetup, PluginsServiceStart, PluginOpaqueId } from './plugins';
|
||||
import { UiSettingsServiceSetup, UiSettingsServiceStart } from './ui_settings';
|
||||
import { SavedObjectsServiceSetup, SavedObjectsServiceStart } from './saved_objects';
|
||||
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
|
||||
import { MetricsServiceSetup, MetricsServiceStart } from './metrics';
|
||||
import { StatusServiceSetup } from './status';
|
||||
import { CoreUsageDataStart, CoreUsageDataSetup } from './core_usage_data';
|
||||
|
@ -95,12 +95,12 @@ 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 {
|
||||
Capabilities,
|
||||
CapabilitiesProvider,
|
||||
CapabilitiesSwitcher,
|
||||
ResolveCapabilitiesOptions,
|
||||
} from './capabilities';
|
||||
} from '@kbn/core-capabilities-server';
|
||||
export type {
|
||||
ConfigPath,
|
||||
ConfigService,
|
||||
|
|
|
@ -19,7 +19,8 @@ import {
|
|||
InternalHttpServiceSetup,
|
||||
} from '@kbn/core-http-server-internal';
|
||||
import { createHttpServer } from '@kbn/core-http-server-mocks';
|
||||
import { CapabilitiesService, CapabilitiesSetup } from '../../capabilities';
|
||||
import type { CapabilitiesSetup } from '@kbn/core-capabilities-server';
|
||||
import { CapabilitiesService } from '@kbn/core-capabilities-server-internal';
|
||||
|
||||
const coreId = Symbol('core');
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import type {
|
|||
InternalElasticsearchServiceSetup,
|
||||
InternalElasticsearchServiceStart,
|
||||
} from '@kbn/core-elasticsearch-server-internal';
|
||||
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
|
||||
import type { CapabilitiesSetup, CapabilitiesStart } from '@kbn/core-capabilities-server';
|
||||
import {
|
||||
InternalSavedObjectsServiceSetup,
|
||||
InternalSavedObjectsServiceStart,
|
||||
|
|
|
@ -21,6 +21,7 @@ import { prebootServiceMock } from '@kbn/core-preboot-server-mocks';
|
|||
import { contextServiceMock } from '@kbn/core-http-context-server-mocks';
|
||||
import { httpServiceMock } from '@kbn/core-http-server-mocks';
|
||||
import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
|
||||
import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
|
||||
import type {
|
||||
PluginInitializerContext,
|
||||
CoreSetup,
|
||||
|
@ -36,7 +37,6 @@ import { typeRegistryMock as savedObjectsTypeRegistryMock } from './saved_object
|
|||
import { renderingMock } from './rendering/rendering_service.mock';
|
||||
import { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock';
|
||||
import { SharedGlobalConfig } from './plugins';
|
||||
import { capabilitiesServiceMock } from './capabilities/capabilities_service.mock';
|
||||
import { metricsServiceMock } from './metrics/metrics_service.mock';
|
||||
import { statusServiceMock } from './status/status_service.mock';
|
||||
import { coreUsageDataServiceMock } from './core_usage_data/core_usage_data_service.mock';
|
||||
|
@ -58,7 +58,7 @@ export { metricsServiceMock } from './metrics/metrics_service.mock';
|
|||
export { renderingMock } from './rendering/rendering_service.mock';
|
||||
export { statusServiceMock } from './status/status_service.mock';
|
||||
export { contextServiceMock } from '@kbn/core-http-context-server-mocks';
|
||||
export { capabilitiesServiceMock } from './capabilities/capabilities_service.mock';
|
||||
export { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
|
||||
export { coreUsageDataServiceMock } from './core_usage_data/core_usage_data_service.mock';
|
||||
export { i18nServiceMock } from './i18n/i18n_service.mock';
|
||||
export { deprecationsServiceMock } from './deprecations/deprecations_service.mock';
|
||||
|
|
|
@ -41,6 +41,7 @@ import {
|
|||
ElasticsearchService,
|
||||
config as elasticsearchConfig,
|
||||
} from '@kbn/core-elasticsearch-server-internal';
|
||||
import { CapabilitiesService } from '@kbn/core-capabilities-server-internal';
|
||||
import { CoreApp } from './core_app';
|
||||
import { I18nService } from './i18n';
|
||||
import { HttpResourcesService } from './http_resources';
|
||||
|
@ -49,7 +50,6 @@ import { UiSettingsService } from './ui_settings';
|
|||
import { PluginsService, config as pluginsConfig } from './plugins';
|
||||
import { SavedObjectsService, SavedObjectsServiceStart } from './saved_objects';
|
||||
import { MetricsService, opsConfig } from './metrics';
|
||||
import { CapabilitiesService } from './capabilities';
|
||||
// do not try to shorten the import to `./status`, it will break server test mocking
|
||||
import { StatusService } from './status/status_service';
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
* Use * syntax so that these exports do not break when internal
|
||||
* types are stripped.
|
||||
*/
|
||||
export * from './capabilities';
|
||||
export * from './app_category';
|
||||
export * from './saved_objects';
|
||||
export type { Capabilities } from '@kbn/core-capabilities-common';
|
||||
export type { KibanaExecutionContext } from '@kbn/core-execution-context-common';
|
||||
export type {
|
||||
UiSettingsType,
|
||||
|
|
32
yarn.lock
32
yarn.lock
|
@ -3071,6 +3071,22 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-capabilities-common@link:bazel-bin/packages/core/capabilities/core-capabilities-common":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-capabilities-server-internal@link:bazel-bin/packages/core/capabilities/core-capabilities-server-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-capabilities-server-mocks@link:bazel-bin/packages/core/capabilities/core-capabilities-server-mocks":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-capabilities-server@link:bazel-bin/packages/core/capabilities/core-capabilities-server":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-config-server-internal@link:bazel-bin/packages/core/config/core-config-server-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
@ -6771,6 +6787,22 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-capabilities-common@link:bazel-bin/packages/core/capabilities/core-capabilities-common/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-capabilities-server-internal@link:bazel-bin/packages/core/capabilities/core-capabilities-server-internal/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-capabilities-server-mocks@link:bazel-bin/packages/core/capabilities/core-capabilities-server-mocks/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-capabilities-server@link:bazel-bin/packages/core/capabilities/core-capabilities-server/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-common-internal-base@link:bazel-bin/packages/core/common/internal-base/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue