SKA: Extract list of Kibana solutions into a dedicated package (#213353)

## Summary

The intent is to have a centralised place to store the list of Kibana
solutions and serverless project types.
To that end, this PR creates a `@kbn/projects-solutions-groups` package.
It also adds the new solution type `'chat'`.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Gerard Soldevila 2025-03-20 10:20:07 +01:00 committed by GitHub
parent dcbefc3b27
commit adb4bdf8d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
83 changed files with 767 additions and 108 deletions

View file

@ -12,13 +12,16 @@ import axios from 'axios';
import { getKibanaDir } from '#pipeline-utils'; import { getKibanaDir } from '#pipeline-utils';
async function getPrProjects() { async function getPrProjects() {
const match = /^(keep.?)?kibana-pr-([0-9]+)-(elasticsearch|security|observability)$/; // BOOKMARK - List of Kibana project types
const match = /^(keep.?)?kibana-pr-([0-9]+)-(elasticsearch|security|observability|chat)$/;
try { try {
// BOOKMARK - List of Kibana project types
return ( return (
await Promise.all([ await Promise.all([
projectRequest.get('/api/v1/serverless/projects/elasticsearch'), projectRequest.get('/api/v1/serverless/projects/elasticsearch'),
projectRequest.get('/api/v1/serverless/projects/security'), projectRequest.get('/api/v1/serverless/projects/security'),
projectRequest.get('/api/v1/serverless/projects/observability'), projectRequest.get('/api/v1/serverless/projects/observability'),
// TODO handle the new 'chat' project type - https://elastic.slack.com/archives/C5UDAFZQU/p1741692053429579
]) ])
) )
.map((response) => response.data.items) .map((response) => response.data.items)
@ -47,11 +50,13 @@ async function deleteProject({
id, id,
name, name,
}: { }: {
type: 'elasticsearch' | 'observability' | 'security'; // BOOKMARK - List of Kibana project types
type: 'elasticsearch' | 'security' | 'observability' | 'chat';
id: number; id: number;
name: string; name: string;
}) { }) {
try { try {
// TODO handle the new 'chat' project type, and ideally rename 'elasticsearch' to 'search'
await projectRequest.delete(`/api/v1/serverless/projects/${type}/${id}`); await projectRequest.delete(`/api/v1/serverless/projects/${type}/${id}`);
execSync(`.buildkite/scripts/common/deployment_credentials.sh unset ${name}`, { execSync(`.buildkite/scripts/common/deployment_credentials.sh unset ${name}`, {

View file

@ -9,6 +9,7 @@ KIBANA_IMAGE="docker.elastic.co/kibana-ci/kibana-serverless:pr-$BUILDKITE_PULL_R
deploy() { deploy() {
PROJECT_TYPE=$1 PROJECT_TYPE=$1
# BOOKMARK - List of Kibana solutions
case $PROJECT_TYPE in case $PROJECT_TYPE in
elasticsearch) elasticsearch)
PROJECT_TYPE_LABEL='Elasticsearch Serverless' PROJECT_TYPE_LABEL='Elasticsearch Serverless'

3
.github/CODEOWNERS vendored
View file

@ -339,6 +339,7 @@ src/platform/packages/private/kbn-node-libs-browser-webpack-plugin @elastic/kiba
src/platform/packages/private/kbn-optimizer-webpack-helpers @elastic/kibana-operations src/platform/packages/private/kbn-optimizer-webpack-helpers @elastic/kibana-operations
src/platform/packages/private/kbn-panel-loader @elastic/kibana-presentation src/platform/packages/private/kbn-panel-loader @elastic/kibana-presentation
src/platform/packages/private/kbn-peggy @elastic/kibana-operations src/platform/packages/private/kbn-peggy @elastic/kibana-operations
src/platform/packages/private/kbn-projects-solutions-groups @elastic/kibana-core
src/platform/packages/private/kbn-react-mute-legacy-root-warning @elastic/appex-sharedux src/platform/packages/private/kbn-react-mute-legacy-root-warning @elastic/appex-sharedux
src/platform/packages/private/kbn-repo-packages @elastic/kibana-operations src/platform/packages/private/kbn-repo-packages @elastic/kibana-operations
src/platform/packages/private/kbn-repo-path @elastic/kibana-operations src/platform/packages/private/kbn-repo-path @elastic/kibana-operations
@ -568,6 +569,7 @@ src/platform/packages/shared/response-ops/alerts-fields-browser @elastic/respons
src/platform/packages/shared/response-ops/alerts-table @elastic/response-ops src/platform/packages/shared/response-ops/alerts-table @elastic/response-ops
src/platform/packages/shared/response-ops/rule_form @elastic/response-ops src/platform/packages/shared/response-ops/rule_form @elastic/response-ops
src/platform/packages/shared/response-ops/rule_params @elastic/response-ops src/platform/packages/shared/response-ops/rule_params @elastic/response-ops
src/platform/packages/shared/serverless/settings/chat_project @elastic/search-kibana
src/platform/packages/shared/serverless/settings/common @elastic/appex-sharedux @elastic/kibana-management src/platform/packages/shared/serverless/settings/common @elastic/appex-sharedux @elastic/kibana-management
src/platform/packages/shared/serverless/settings/observability_project @elastic/appex-sharedux @elastic/kibana-management @elastic/obs-ux-management-team src/platform/packages/shared/serverless/settings/observability_project @elastic/appex-sharedux @elastic/kibana-management @elastic/obs-ux-management-team
src/platform/packages/shared/serverless/settings/search_project @elastic/search-kibana @elastic/kibana-management src/platform/packages/shared/serverless/settings/search_project @elastic/search-kibana @elastic/kibana-management
@ -931,6 +933,7 @@ x-pack/platform/plugins/shared/streams_app @elastic/streams-program-team
x-pack/platform/plugins/shared/task_manager @elastic/response-ops x-pack/platform/plugins/shared/task_manager @elastic/response-ops
x-pack/platform/plugins/shared/timelines @elastic/security-threat-hunting-investigations x-pack/platform/plugins/shared/timelines @elastic/security-threat-hunting-investigations
x-pack/platform/plugins/shared/triggers_actions_ui @elastic/response-ops x-pack/platform/plugins/shared/triggers_actions_ui @elastic/response-ops
x-pack/solutions/chat/plugins/serverless_chat @elastic/search-kibana
x-pack/solutions/observability/packages/alert-details @elastic/obs-ux-management-team x-pack/solutions/observability/packages/alert-details @elastic/obs-ux-management-team
x-pack/solutions/observability/packages/alerting-test-data @elastic/obs-ux-management-team x-pack/solutions/observability/packages/alerting-test-data @elastic/obs-ux-management-team
x-pack/solutions/observability/packages/get-padded-alert-time-range-util @elastic/obs-ux-management-team x-pack/solutions/observability/packages/get-padded-alert-time-range-util @elastic/obs-ux-management-team

1
.gitignore vendored
View file

@ -63,6 +63,7 @@ webpackstats.json
!/config/README.md !/config/README.md
!/config/serverless.yml !/config/serverless.yml
!/config/serverless.es.yml !/config/serverless.es.yml
!/config/serverless.chat.yml
!/config/serverless.oblt.yml !/config/serverless.oblt.yml
!/config/serverless.security.yml !/config/serverless.security.yml
!/config/serverless.security.essentials.yml !/config/serverless.security.essentials.yml

View file

@ -2,7 +2,8 @@ as work on serverless picks up we will add config values to these files that
define how Kibana will run in "serverless" modes. To start Kibana locally with define how Kibana will run in "serverless" modes. To start Kibana locally with
this configuration, pass `--serverless={mode}` or run `yarn serverless-{mode}` this configuration, pass `--serverless={mode}` or run `yarn serverless-{mode}`
valid modes are currently: `es`, `oblt`, and `security` [//]: # (BOOKMARK - List of Kibana project types)
valid modes are currently: `es`, `oblt`, `security` and `chat`
configuration is applied in the following order, later values override configuration is applied in the following order, later values override
1. serverless.yml (serverless configs go first) 1. serverless.yml (serverless configs go first)

View file

@ -0,0 +1,41 @@
# Chat Project Config
## Enable the Serverless Chat plugin
xpack.serverless.chat.enabled: true
## Cloud settings
xpack.cloud.serverless.project_type: search
## Set the home route
uiSettings.overrides.defaultRoute: /app/home
## Disable plugins that belong to other solutions
xpack.apm.enabled: false
xpack.entities_data_access.enabled: false
xpack.infra.enabled: false
xpack.inventory.enabled: false
xpack.investigate.enabled: false
xpack.investigateApp.enabled: false
xpack.observability.enabled: false
xpack.observabilityAIAssistantApp.enabled: false
xpack.observabilityLogsExplorer.enabled: false
xpack.profiling.enabled: false
xpack.serverless.observability.enabled: false
xpack.slo.enabled: false
xpack.uptime.enabled: false
xpack.legacy_uptime.enabled: false
xpack.ux.enabled: false
xpack.search.enabled: false
xpack.searchAssistant.enabled: false
xpack.search.connectors.enabled: false
xpack.search.homepage.enabled: false
xpack.searchIndices.enabled: false
xpack.searchInferenceEndpoints.enabled: false
xpack.searchNotebooks.enabled: false
xpack.searchPlayground.enabled: false
xpack.searchSynonyms.enabled: false
xpack.serverless.search.enabled: false
xpack.cloudSecurityPosture.enabled: false
xpack.securitySolution.enabled: false
xpack.securitySolutionEss.enabled: false
xpack.securitySolutionServerless.enabled: false

View file

@ -107,7 +107,10 @@ Contains all of the gold+ (non-basic) modules that are common to all Kibana solu
## [x-pack/solutions](https://github.com/elastic/kibana/tree/main/x-pack/solutions) ## [x-pack/solutions](https://github.com/elastic/kibana/tree/main/x-pack/solutions)
Contains all of the code that is specific to each Kibana solution. At the moment, we have a folder for [observability](https://github.com/elastic/kibana/tree/main/x-pack/solutions/observability), another for [security](https://github.com/elastic/kibana/tree/main/x-pack/solutions/security), and another for [search](https://github.com/elastic/kibana/tree/main/x-pack/solutions/search). These folders contain the modules that belong to each solution, and these modules are also categorised as plugins or packages. [//]: # (BOOKMARK - List of Kibana solutions)
Contains all of the code that is specific to each Kibana solution. At the moment, we have a folder for [observability](https://github.com/elastic/kibana/tree/main/x-pack/solutions/observability), another for [security](https://github.com/elastic/kibana/tree/main/x-pack/solutions/security), another for [search](https://github.com/elastic/kibana/tree/main/x-pack/solutions/search) and another for [chat](https://github.com/elastic/kibana/tree/main/x-pack/solutions/chat) (serverless only).
These folders contain the modules that belong to each solution, and these modules are also categorised as plugins or packages.
Unlike the `src/platform` and the `x-pack/platform` code, the solution-specific modules are `private` by definition, aka they cannot be accessed from platform nor from other solutions. Unlike the `src/platform` and the `x-pack/platform` code, the solution-specific modules are `private` by definition, aka they cannot be accessed from platform nor from other solutions.
### [x-pack/build_chromium](https://github.com/elastic/kibana/tree/main/x-pack/build_chromium) ### [x-pack/build_chromium](https://github.com/elastic/kibana/tree/main/x-pack/build_chromium)

View file

@ -743,6 +743,7 @@
"@kbn/profiling-data-access-plugin": "link:x-pack/solutions/observability/plugins/profiling_data_access", "@kbn/profiling-data-access-plugin": "link:x-pack/solutions/observability/plugins/profiling_data_access",
"@kbn/profiling-plugin": "link:x-pack/solutions/observability/plugins/profiling", "@kbn/profiling-plugin": "link:x-pack/solutions/observability/plugins/profiling",
"@kbn/profiling-utils": "link:src/platform/packages/shared/kbn-profiling-utils", "@kbn/profiling-utils": "link:src/platform/packages/shared/kbn-profiling-utils",
"@kbn/projects-solutions-groups": "link:src/platform/packages/private/kbn-projects-solutions-groups",
"@kbn/random-sampling": "link:x-pack/platform/packages/private/kbn-random-sampling", "@kbn/random-sampling": "link:x-pack/platform/packages/private/kbn-random-sampling",
"@kbn/react-field": "link:src/platform/packages/shared/kbn-react-field", "@kbn/react-field": "link:src/platform/packages/shared/kbn-react-field",
"@kbn/react-hooks": "link:src/platform/packages/shared/kbn-react-hooks", "@kbn/react-hooks": "link:src/platform/packages/shared/kbn-react-hooks",
@ -879,6 +880,8 @@
"@kbn/server-route-repository-client": "link:src/platform/packages/shared/kbn-server-route-repository-client", "@kbn/server-route-repository-client": "link:src/platform/packages/shared/kbn-server-route-repository-client",
"@kbn/server-route-repository-utils": "link:src/platform/packages/shared/kbn-server-route-repository-utils", "@kbn/server-route-repository-utils": "link:src/platform/packages/shared/kbn-server-route-repository-utils",
"@kbn/serverless": "link:x-pack/platform/plugins/shared/serverless", "@kbn/serverless": "link:x-pack/platform/plugins/shared/serverless",
"@kbn/serverless-chat": "link:x-pack/solutions/chat/plugins/serverless_chat",
"@kbn/serverless-chat-settings": "link:src/platform/packages/shared/serverless/settings/chat_project",
"@kbn/serverless-common-settings": "link:src/platform/packages/shared/serverless/settings/common", "@kbn/serverless-common-settings": "link:src/platform/packages/shared/serverless/settings/common",
"@kbn/serverless-observability": "link:x-pack/solutions/observability/plugins/serverless_observability", "@kbn/serverless-observability": "link:x-pack/solutions/observability/plugins/serverless_observability",
"@kbn/serverless-observability-settings": "link:src/platform/packages/shared/serverless/settings/observability_project", "@kbn/serverless-observability-settings": "link:src/platform/packages/shared/serverless/settings/observability_project",

View file

@ -7,13 +7,13 @@
* License v3.0 only", or the "Server Side Public License, v 1". * License v3.0 only", or the "Server Side Public License, v 1".
*/ */
export const aggregationGroups = [ import { KIBANA_SOLUTIONS } from '@kbn/projects-solutions-groups';
'x-pack/solutions/observability/plugins',
'x-pack/solutions/observability/packages', export const aggregationGroups: string[] = [
'x-pack/solutions/security/plugins', ...KIBANA_SOLUTIONS.flatMap((solution) => [
'x-pack/solutions/security/packages', `x-pack/solutions/${solution}/plugins`,
'x-pack/solutions/search/plugins', `x-pack/solutions/${solution}/packages`,
'x-pack/solutions/search/packages', ]),
'x-pack/platform/plugins', 'x-pack/platform/plugins',
'x-pack/platform/packages', 'x-pack/platform/packages',
'x-pack/packages', 'x-pack/packages',
@ -27,7 +27,7 @@ export const aggregationGroups = [
'test', 'test',
]; ];
export const excludePaths = [ export const excludePaths: string[] = [
'(^|/)target($|/)', '(^|/)target($|/)',
'^kbn', '^kbn',
'^@kbn', '^@kbn',

View file

@ -7,6 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1". * License v3.0 only", or the "Server Side Public License, v 1".
*/ */
import { KIBANA_SOLUTIONS } from '@kbn/projects-solutions-groups';
import { identifyDependencyUsageWithCruiser as identifyDependencyUsage } from './cruiser.ts'; import { identifyDependencyUsageWithCruiser as identifyDependencyUsage } from './cruiser.ts';
import { cruise } from 'dependency-cruiser'; import { cruise } from 'dependency-cruiser';
@ -113,12 +114,16 @@ describe('identifyDependencyUsage', () => {
const [, configWithDepth2] = (cruise as jest.Mock).mock.calls[0]; const [, configWithDepth2] = (cruise as jest.Mock).mock.calls[0];
const [, configWithDepth1] = (cruise as jest.Mock).mock.calls[1]; const [, configWithDepth1] = (cruise as jest.Mock).mock.calls[1];
const solutionsFolders = KIBANA_SOLUTIONS.flatMap((solution) => [
`x-pack/solutions/${solution}/plugins`,
`x-pack/solutions/${solution}/packages`,
]).join('|');
expect(configWithDepth2.collapse).toMatchInlineSnapshot( expect(configWithDepth2.collapse).toMatchInlineSnapshot(
`"^(x-pack/solutions/observability/plugins|x-pack/solutions/observability/packages|x-pack/solutions/security/plugins|x-pack/solutions/security/packages|x-pack/solutions/search/plugins|x-pack/solutions/search/packages|x-pack/platform/plugins|x-pack/platform/packages|x-pack/packages|src/platform/plugins|src/platform/packages|src/core/packages|packages|src|x-pack/test|x-pack/test_serverless|test)/([^/]+)/([^/]+)"` `"^(${solutionsFolders}|x-pack/platform/plugins|x-pack/platform/packages|x-pack/packages|src/platform/plugins|src/platform/packages|src/core/packages|packages|src|x-pack/test|x-pack/test_serverless|test)/([^/]+)/([^/]+)"`
); );
expect(configWithDepth1.collapse).toMatchInlineSnapshot( expect(configWithDepth1.collapse).toMatchInlineSnapshot(
`"^(x-pack/solutions/observability/plugins|x-pack/solutions/observability/packages|x-pack/solutions/security/plugins|x-pack/solutions/security/packages|x-pack/solutions/search/plugins|x-pack/solutions/search/packages|x-pack/platform/plugins|x-pack/platform/packages|x-pack/packages|src/platform/plugins|src/platform/packages|src/core/packages|packages|src|x-pack/test|x-pack/test_serverless|test)/([^/]+)|^node_modules/(@[^/]+/[^/]+|[^/]+)"` `"^(${solutionsFolders}|x-pack/platform/plugins|x-pack/platform/packages|x-pack/packages|src/platform/plugins|src/platform/packages|src/core/packages|packages|src|x-pack/test|x-pack/test_serverless|test)/([^/]+)|^node_modules/(@[^/]+/[^/]+|[^/]+)"`
); );
}); });

View file

@ -16,5 +16,6 @@
], ],
"kbn_references": [ "kbn_references": [
"@kbn/repo-info", "@kbn/repo-info",
"@kbn/projects-solutions-groups",
], ],
} }

View file

@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1". * License v3.0 only", or the "Server Side Public License, v 1".
*/ */
import type { ModuleGroup, ModuleVisibility } from '@kbn/repo-info/types'; import type { ModuleGroup, ModuleVisibility } from '@kbn/projects-solutions-groups';
import type { ModuleId } from '@kbn/repo-source-classifier'; import type { ModuleId } from '@kbn/repo-source-classifier';
/** /**

View file

@ -11,7 +11,7 @@ import { RuleTester } from 'eslint';
import dedent from 'dedent'; import dedent from 'dedent';
import { NoGroupCrossingImportsRule } from './no_group_crossing_imports'; import { NoGroupCrossingImportsRule } from './no_group_crossing_imports';
import { formatSuggestions } from '../helpers/report'; import { formatSuggestions } from '../helpers/report';
import type { ModuleGroup, ModuleVisibility } from '@kbn/repo-info/types'; import type { ModuleGroup, ModuleVisibility } from '@kbn/projects-solutions-groups';
import type { KibanaPackageManifest } from '@kbn/repo-packages'; import type { KibanaPackageManifest } from '@kbn/repo-packages';
interface ModuleInfo { interface ModuleInfo {

View file

@ -12,7 +12,7 @@ import dedent from 'dedent';
import { NoGroupCrossingManifestsRule } from './no_group_crossing_manifests'; import { NoGroupCrossingManifestsRule } from './no_group_crossing_manifests';
import { formatSuggestions } from '../helpers/report'; import { formatSuggestions } from '../helpers/report';
import { ModuleId } from '@kbn/repo-source-classifier/src/module_id'; import { ModuleId } from '@kbn/repo-source-classifier/src/module_id';
import { ModuleGroup, ModuleVisibility } from '@kbn/repo-info/types'; import type { ModuleGroup, ModuleVisibility } from '@kbn/projects-solutions-groups';
const makePlugin = (filename: string) => ({ const makePlugin = (filename: string) => ({
filename, filename,

View file

@ -13,7 +13,7 @@ import type { Rule } from 'eslint';
import type { Node } from 'estree'; import type { Node } from 'estree';
import { getPackages, getPluginPackagesFilter } from '@kbn/repo-packages'; import { getPackages, getPluginPackagesFilter } from '@kbn/repo-packages';
import { REPO_ROOT } from '@kbn/repo-info'; import { REPO_ROOT } from '@kbn/repo-info';
import type { ModuleGroup, ModuleVisibility } from '@kbn/repo-info/types'; import type { ModuleGroup, ModuleVisibility } from '@kbn/projects-solutions-groups';
import { getSourcePath } from '../helpers/source'; import { getSourcePath } from '../helpers/source';
import { getImportResolver } from '../get_import_resolver'; import { getImportResolver } from '../get_import_resolver';
import { getRepoSourceClassifier } from '../helpers/repo_source_classifier'; import { getRepoSourceClassifier } from '../helpers/repo_source_classifier';

View file

@ -15,6 +15,7 @@
"@kbn/repo-source-classifier", "@kbn/repo-source-classifier",
"@kbn/repo-info", "@kbn/repo-info",
"@kbn/repo-packages", "@kbn/repo-packages",
"@kbn/projects-solutions-groups",
], ],
"exclude": [ "exclude": [
"target/**/*", "target/**/*",

View file

@ -19,6 +19,11 @@ import { REPO_ROOT } from '@kbn/repo-info';
import { createFailError, createFlagError, isFailError } from '@kbn/dev-cli-errors'; import { createFailError, createFlagError, isFailError } from '@kbn/dev-cli-errors';
import { sortPackageJson } from '@kbn/sort-package-json'; import { sortPackageJson } from '@kbn/sort-package-json';
import {
KIBANA_GROUPS,
type KibanaGroup,
type ModuleVisibility,
} from '@kbn/projects-solutions-groups';
import { validateElasticTeam } from '../lib/validate_elastic_team'; import { validateElasticTeam } from '../lib/validate_elastic_team';
import { PKG_TEMPLATE_DIR, determineDevPackageDir, determinePackageDir } from '../paths'; import { PKG_TEMPLATE_DIR, determineDevPackageDir, determinePackageDir } from '../paths';
import type { GenerateCommand } from '../generate_command'; import type { GenerateCommand } from '../generate_command';
@ -67,8 +72,8 @@ export const PackageCommand: GenerateCommand = {
const web = !!flags.web; const web = !!flags.web;
const dev = !!flags.dev; const dev = !!flags.dev;
let group: 'platform' | 'observability' | 'security' | 'search' = 'platform'; let group: KibanaGroup = 'platform';
let visibility: 'private' | 'shared' = 'private'; let visibility: ModuleVisibility = 'private';
let calculatedPackageDir: string; let calculatedPackageDir: string;
const owner = const owner =
@ -109,14 +114,14 @@ export const PackageCommand: GenerateCommand = {
} else { } else {
group = ( group = (
await inquirer.prompt<{ await inquirer.prompt<{
group: 'platform' | 'observability' | 'security' | 'search'; group: KibanaGroup;
}>({ }>({
type: 'list', type: 'list',
choices: [ choices: [
{ name: 'Platform', value: 'platform' }, ...KIBANA_GROUPS.map((groupName) => ({
{ name: 'Observability', value: 'observability' }, name: groupName,
{ name: 'Security', value: 'security' }, value: groupName,
{ name: 'Search', value: 'search' }, })),
], ],
name: 'group', name: 'group',
message: `What group is this package part of?`, message: `What group is this package part of?`,
@ -143,7 +148,7 @@ export const PackageCommand: GenerateCommand = {
visibility = ( visibility = (
await inquirer.prompt<{ await inquirer.prompt<{
visibility: 'private' | 'shared'; visibility: ModuleVisibility;
}>({ }>({
type: 'list', type: 'list',
choices: [ choices: [

View file

@ -10,6 +10,11 @@
import { resolve } from 'path'; import { resolve } from 'path';
import { REPO_ROOT } from '@kbn/repo-info'; import { REPO_ROOT } from '@kbn/repo-info';
import {
type KibanaGroup,
KIBANA_SOLUTIONS,
ModuleVisibility,
} from '@kbn/projects-solutions-groups';
export const TEMPLATE_DIR = resolve(__dirname, '../templates'); export const TEMPLATE_DIR = resolve(__dirname, '../templates');
export const PKG_TEMPLATE_DIR = resolve(TEMPLATE_DIR, 'package'); export const PKG_TEMPLATE_DIR = resolve(TEMPLATE_DIR, 'package');
@ -19,9 +24,10 @@ export const PKG_DIRS: Record<string, string> = {
'oss|platform|shared': resolve(REPO_ROOT, 'src/platform/packages/shared'), 'oss|platform|shared': resolve(REPO_ROOT, 'src/platform/packages/shared'),
'xpack|platform|private': resolve(REPO_ROOT, 'x-pack/platform/packages/private'), 'xpack|platform|private': resolve(REPO_ROOT, 'x-pack/platform/packages/private'),
'xpack|platform|shared': resolve(REPO_ROOT, 'x-pack/platform/packages/shared'), 'xpack|platform|shared': resolve(REPO_ROOT, 'x-pack/platform/packages/shared'),
'xpack|observability|private': resolve(REPO_ROOT, 'x-pack/solutions/observability/packages'), ...KIBANA_SOLUTIONS.reduce<Record<string, string>>((agg, solution) => {
'xpack|security|private': resolve(REPO_ROOT, 'x-pack/solutions/security/packages'), agg[`xpack|${solution}|private`] = resolve(REPO_ROOT, `x-pack/solutions/${solution}/packages`);
'xpack|search|private': resolve(REPO_ROOT, 'x-pack/solutions/search/packages'), return agg;
}, {}),
}; };
function folderName(pkgId: string) { function folderName(pkgId: string) {
@ -39,8 +45,8 @@ export function determinePackageDir({
xpack, xpack,
}: { }: {
pkgId: string; pkgId: string;
group: 'observability' | 'platform' | 'security' | 'search'; group: KibanaGroup;
visibility: 'private' | 'shared'; visibility: ModuleVisibility;
xpack: boolean; xpack: boolean;
}) { }) {
const dir = PKG_DIRS[`${xpack ? 'xpack' : 'oss'}|${group}|${visibility}`]; const dir = PKG_DIRS[`${xpack ? 'xpack' : 'oss'}|${group}|${visibility}`];

View file

@ -17,6 +17,7 @@
"@kbn/dev-cli-errors", "@kbn/dev-cli-errors",
"@kbn/tooling-log", "@kbn/tooling-log",
"@kbn/repo-packages", "@kbn/repo-packages",
"@kbn/projects-solutions-groups",
], ],
"exclude": [ "exclude": [
"target/**/*", "target/**/*",

View file

@ -8,6 +8,7 @@
*/ */
import type { JSONSchema } from 'json-schema-typed'; import type { JSONSchema } from 'json-schema-typed';
import { KIBANA_GROUPS } from '@kbn/projects-solutions-groups';
import { desc } from './desc'; import { desc } from './desc';
export const PLUGIN_ID_PATTERN = /^[a-z][a-zA-Z_]*$/; export const PLUGIN_ID_PATTERN = /^[a-z][a-zA-Z_]*$/;
@ -49,7 +50,7 @@ export const MANIFEST_V2: JSONSchema = {
`, `,
}, },
group: { group: {
enum: ['platform', 'observability', 'security', 'search'], enum: KIBANA_GROUPS,
description: desc` description: desc`
Specifies the group to which this module pertains. Specifies the group to which this module pertains.
`, `,

View file

@ -12,5 +12,8 @@
], ],
"exclude": [ "exclude": [
"target/**/*", "target/**/*",
],
"kbn_references": [
"@kbn/projects-solutions-groups",
] ]
} }

View file

@ -31,10 +31,14 @@ const createSAMLResponseSchema = schema.object({
roles: schema.arrayOf(schema.string()), roles: schema.arrayOf(schema.string()),
}); });
// BOOKMARK - List of Kibana project types
const projectToAlias = new Map<string, string>([ const projectToAlias = new Map<string, string>([
['observability', 'oblt'], ['observability', 'oblt'],
['security', 'security'], ['security', 'security'],
['search', 'es'], ['search', 'es'],
// TODO add new 'chat' solution
// https://elastic.slack.com/archives/C04HT4P1YS3/p1741690997400059
// https://github.com/elastic/kibana/issues/213469
]); ]);
const readServerlessRoles = (projectType: string) => { const readServerlessRoles = (projectType: string) => {

View file

@ -151,6 +151,7 @@ pageLoadAssetSize:
securitySolutionEss: 31781 securitySolutionEss: 31781
securitySolutionServerless: 62488 securitySolutionServerless: 62488
serverless: 16573 serverless: 16573
serverlessChat: 22715
serverlessObservability: 68747 serverlessObservability: 68747
serverlessSearch: 72995 serverlessSearch: 72995
sessionView: 77750 sessionView: 77750

View file

@ -11,6 +11,7 @@ import Path from 'path';
import { REPO_ROOT } from '@kbn/repo-info'; import { REPO_ROOT } from '@kbn/repo-info';
import inquirer from 'inquirer'; import inquirer from 'inquirer';
import { KIBANA_SOLUTIONS } from '@kbn/projects-solutions-groups';
export interface Answers { export interface Answers {
name: string; name: string;
@ -56,18 +57,10 @@ export const INTERNAL_PLUGIN_LOCATIONS: Array<{ name: string; value: string }> =
name: 'X-Pack Platform (shared)', name: 'X-Pack Platform (shared)',
value: Path.resolve(REPO_ROOT, 'x-pack/platform/plugins/shared'), value: Path.resolve(REPO_ROOT, 'x-pack/platform/plugins/shared'),
}, },
{ ...KIBANA_SOLUTIONS.map((solution) => ({
name: 'X-Pack Observability', name: `X-Pack ${solution}`,
value: Path.resolve(REPO_ROOT, 'x-pack/solutions/observability/plugins'), value: Path.resolve(REPO_ROOT, `x-pack/solutions/${solution}/plugins`),
}, })),
{
name: 'X-Pack Security',
value: Path.resolve(REPO_ROOT, 'x-pack/solutions/security/plugins'),
},
{
name: 'X-Pack Search',
value: Path.resolve(REPO_ROOT, 'x-pack/solutions/search/plugins'),
},
{ {
name: 'X-Pack Functional Testing', name: 'X-Pack Functional Testing',
value: Path.resolve(REPO_ROOT, 'x-pack/test/plugin_functional/plugins'), value: Path.resolve(REPO_ROOT, 'x-pack/test/plugin_functional/plugins'),

View file

@ -20,5 +20,6 @@
"@kbn/dev-cli-runner", "@kbn/dev-cli-runner",
"@kbn/dev-cli-errors", "@kbn/dev-cli-errors",
"@kbn/jest-serializers", "@kbn/jest-serializers",
"@kbn/projects-solutions-groups",
], ],
} }

View file

@ -18,5 +18,6 @@
"@kbn/repo-info", "@kbn/repo-info",
"@kbn/repo-packages", "@kbn/repo-packages",
"@kbn/tooling-log", "@kbn/tooling-log",
"@kbn/projects-solutions-groups",
] ]
} }

View file

@ -10,6 +10,7 @@
import { basename, join } from 'path'; import { basename, join } from 'path';
import type { ToolingLog } from '@kbn/tooling-log'; import type { ToolingLog } from '@kbn/tooling-log';
import { orderBy } from 'lodash'; import { orderBy } from 'lodash';
import { KIBANA_SOLUTIONS } from '@kbn/projects-solutions-groups';
import type { Package } from '../types'; import type { Package } from '../types';
import { HARDCODED_MODULE_PATHS, applyTransforms } from './transforms'; import { HARDCODED_MODULE_PATHS, applyTransforms } from './transforms';
import { import {
@ -99,7 +100,7 @@ export const calculateModuleTargetFolder = (module: Package): string => {
moduleFolder moduleFolder
); );
} }
} else if (group === 'observability' || group === 'security' || group === 'search') { } else if (KIBANA_SOLUTIONS.some((solution) => solution === group)) {
path = join( path = join(
BASE_FOLDER, BASE_FOLDER,
'x-pack', // all solution modules are 'x-pack' 'x-pack', // all solution modules are 'x-pack'

View file

@ -7,7 +7,11 @@
* License v3.0 only", or the "Server Side Public License, v 1". * License v3.0 only", or the "Server Side Public License, v 1".
*/ */
import type { ModuleGroup, ModuleVisibility } from '@kbn/repo-info/types'; import {
KIBANA_SOLUTIONS,
type ModuleGroup,
type ModuleVisibility,
} from '@kbn/projects-solutions-groups';
interface ModuleAttrs { interface ModuleAttrs {
group: ModuleGroup; group: ModuleGroup;
@ -37,18 +41,13 @@ const MODULE_GROUPING_BY_PATH: Record<string, ModuleAttrs> = ['packages', 'plugi
group: 'platform', group: 'platform',
visibility: 'private', visibility: 'private',
}, },
[`x-pack/solutions/observability/${type}`]: { ...KIBANA_SOLUTIONS.reduce<Record<string, ModuleAttrs>>((acc, solution) => {
group: 'observability', acc[`x-pack/solutions/${solution}/${type}`] = {
visibility: 'private', group: solution,
}, visibility: 'private',
[`x-pack/solutions/security/${type}`]: { };
group: 'security', return acc;
visibility: 'private', }, {}),
},
[`x-pack/solutions/search/${type}`]: {
group: 'search',
visibility: 'private',
},
})) }))
.reduce((acc, current) => ({ ...acc, ...current }), { .reduce((acc, current) => ({ ...acc, ...current }), {
'src/platform/test': { 'src/platform/test': {

View file

@ -8,7 +8,7 @@
*/ */
import type { KibanaPackageManifest } from '@kbn/repo-packages'; import type { KibanaPackageManifest } from '@kbn/repo-packages';
import type { ModuleGroup, ModuleVisibility } from '@kbn/repo-info/types'; import type { ModuleGroup, ModuleVisibility } from '@kbn/projects-solutions-groups';
import type { ModuleType } from './module_type'; import type { ModuleType } from './module_type';
import type { PkgInfo } from './pkg_info'; import type { PkgInfo } from './pkg_info';

View file

@ -8,7 +8,7 @@
*/ */
import type { ImportResolver } from '@kbn/import-resolver'; import type { ImportResolver } from '@kbn/import-resolver';
import type { ModuleGroup, ModuleVisibility } from '@kbn/repo-info/types'; import type { ModuleGroup, ModuleVisibility } from '@kbn/projects-solutions-groups';
import type { KibanaPackageManifest } from '@kbn/repo-packages/modern/types'; import type { KibanaPackageManifest } from '@kbn/repo-packages/modern/types';
import type { ModuleId } from './module_id'; import type { ModuleId } from './module_id';
import type { ModuleType } from './module_type'; import type { ModuleType } from './module_type';

View file

@ -14,6 +14,7 @@
"@kbn/import-resolver", "@kbn/import-resolver",
"@kbn/repo-info", "@kbn/repo-info",
"@kbn/repo-packages", "@kbn/repo-packages",
"@kbn/projects-solutions-groups",
], ],
"exclude": [ "exclude": [
"target/**/*", "target/**/*",

View file

@ -17,9 +17,11 @@ import { getConfigFromFiles } from '@kbn/config';
const isNotEmpty = _.negate(_.isEmpty); const isNotEmpty = _.negate(_.isEmpty);
const isNotNull = _.negate(_.isNull); const isNotNull = _.negate(_.isNull);
/** @typedef {'es' | 'oblt' | 'security'} ServerlessProjectMode */ /**
/** @type {ServerlessProjectMode[]} */ * BOOKMARK - List of Kibana project types
const VALID_SERVERLESS_PROJECT_MODE = ['es', 'oblt', 'security']; * @type {import('@kbn/projects-solutions-groups').KibanaProject[]}
* */
const VALID_SERVERLESS_PROJECT_MODE = ['es', 'oblt', 'security', 'chat'];
/** /**
* Collects paths to configurations to be included in the final configuration stack. * Collects paths to configurations to be included in the final configuration stack.

View file

@ -18,6 +18,7 @@
"@kbn/config", "@kbn/config",
"@kbn/dev-utils", "@kbn/dev-utils",
"@kbn/apm-config-loader", "@kbn/apm-config-loader",
"@kbn/projects-solutions-groups",
], ],
"exclude": [ "exclude": [
"target/**/*", "target/**/*",

View file

@ -20,6 +20,7 @@ export const DEFAULT_APP_CATEGORIES: Record<string, AppCategory> = Object.freeze
euiIconType: 'logoKibana', euiIconType: 'logoKibana',
order: 1000, order: 1000,
}, },
// BOOKMARK - List of Kibana solutions - TODO handle the new 'chat' project type - https://elastic.slack.com/archives/C061KHPJS2C/p1741691346619339
enterpriseSearch: { enterpriseSearch: {
id: 'enterpriseSearch', id: 'enterpriseSearch',
label: i18n.translate('core.ui.searchNavList.label', { label: i18n.translate('core.ui.searchNavList.label', {

View file

@ -7,8 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1". * License v3.0 only", or the "Server Side Public License, v 1".
*/ */
import { schema, TypeOf, Type } from '@kbn/config-schema'; import { schema, TypeOf, type Type } from '@kbn/config-schema';
import { ServiceConfigDescriptor } from '@kbn/core-base-server-internal'; import type { ServiceConfigDescriptor } from '@kbn/core-base-server-internal';
import { KIBANA_PROJECTS, type KibanaProject } from '@kbn/projects-solutions-groups';
// Config validation for how to run Kibana in Serverless mode. // Config validation for how to run Kibana in Serverless mode.
// Clients need to specify the project type to run in. // Clients need to specify the project type to run in.
@ -17,12 +18,11 @@ import { ServiceConfigDescriptor } from '@kbn/core-base-server-internal';
// If we even decide to extend this further, and converting it into an object, // If we even decide to extend this further, and converting it into an object,
// BWC can be ensured by adding the object definition as another alternative to `schema.oneOf`. // BWC can be ensured by adding the object definition as another alternative to `schema.oneOf`.
export const VALID_SERVERLESS_PROJECT_TYPES = ['es', 'oblt', 'security']; // BOOKMARK - List of Kibana project types
const serverlessConfigSchema = schema.maybe( const serverlessConfigSchema = schema.maybe(
schema.oneOf( schema.oneOf(
VALID_SERVERLESS_PROJECT_TYPES.map((projectName) => schema.literal(projectName)) as [ KIBANA_PROJECTS.map((projectName) => schema.literal(projectName)) as [
Type<(typeof VALID_SERVERLESS_PROJECT_TYPES)[number]> // This cast is needed because it's different to Type<T>[] :sight: Type<KibanaProject> // This cast is needed because it's different to Type<T>[] :sight:
] ]
) )
); );

View file

@ -78,6 +78,7 @@
"@kbn/core-user-profile-server-internal", "@kbn/core-user-profile-server-internal",
"@kbn/core-feature-flags-server-internal", "@kbn/core-feature-flags-server-internal",
"@kbn/core-http-rate-limiter-internal", "@kbn/core-http-rate-limiter-internal",
"@kbn/projects-solutions-groups",
], ],
"exclude": [ "exclude": [
"target/**/*", "target/**/*",

View file

@ -7,6 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1". * License v3.0 only", or the "Server Side Public License, v 1".
*/ */
import { KIBANA_SOLUTIONS } from '@kbn/projects-solutions-groups';
/** /**
* These patterns are used to identify files that are not supposed * These patterns are used to identify files that are not supposed
* to be snake_case because their names are determined by other * to be snake_case because their names are determined by other
@ -108,9 +110,7 @@ export const KEBAB_CASE_DIRECTORY_GLOBS = [
'src/platform/packages/shared/*', 'src/platform/packages/shared/*',
'x-pack/platform/packages/private/*', 'x-pack/platform/packages/private/*',
'x-pack/platform/packages/shared/*', 'x-pack/platform/packages/shared/*',
'x-pack/solutions/observability/packages/*', ...KIBANA_SOLUTIONS.map((solution) => `x-pack/solutions/${solution}/packages/*`),
'x-pack/solutions/search/packages/*',
'x-pack/solutions/security/packages/*',
]; ];
/** /**

View file

@ -46,5 +46,6 @@
"@kbn/dev-proc-runner", "@kbn/dev-proc-runner",
"@kbn/core-i18n-server-internal", "@kbn/core-i18n-server-internal",
"@kbn/code-owners", "@kbn/code-owners",
"@kbn/projects-solutions-groups",
] ]
} }

View file

@ -10,13 +10,20 @@
/** /**
* Code owner area names * Code owner area names
*/ */
export const CODE_OWNER_AREAS = ['platform', 'search', 'observability', 'security'] as const; export const CODE_OWNER_AREAS = [
'platform',
'search',
'observability',
'security',
'chat',
] as const;
export type CodeOwnerArea = (typeof CODE_OWNER_AREAS)[number]; export type CodeOwnerArea = (typeof CODE_OWNER_AREAS)[number];
/** /**
* Area mappings for code owners * Area mappings for code owners
*/ */
export const CODE_OWNER_AREA_MAPPINGS: { [area in CodeOwnerArea]: string[] } = { export const CODE_OWNER_AREA_MAPPINGS: { [area in CodeOwnerArea]: string[] } = {
// BOOKMARK - List of Kibana solutions
platform: [ platform: [
'elastic/appex-ai-infra', 'elastic/appex-ai-infra',
'elastic/appex-qa', 'elastic/appex-qa',
@ -78,6 +85,10 @@ export const CODE_OWNER_AREA_MAPPINGS: { [area in CodeOwnerArea]: string[] } = {
'elastic/security-threat-hunting-explore', 'elastic/security-threat-hunting-explore',
'elastic/security-threat-hunting-investigations', 'elastic/security-threat-hunting-investigations',
], ],
chat: [
// TODO add owner teams here (once they exist)
// https://github.com/elastic/kibana/issues/213469
],
}; };
/** /**

View file

@ -0,0 +1,3 @@
# @kbn/projects-solutions-groups
Contains some Kibana constants and types that are used across the codebase.

View file

@ -0,0 +1,97 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
/**
* The base group, for all modules that are commonly used across solutions.
*/
export const KIBANA_PLATFORM = 'platform' as const;
/**
* Constant for the Kibana Observability solution.
*/
export const KIBANA_OBSERVABILITY_SOLUTION = 'observability' as const;
/**
* Constant for the Kibana Security solution.
*/
export const KIBANA_SECURITY_SOLUTION = 'security' as const;
/**
* Constant for the Kibana Search solution.
*/
export const KIBANA_SEARCH_SOLUTION = 'search' as const;
/**
* Constant for the Kibana Chat (workchat) solution.
*/
export const KIBANA_CHAT_SOLUTION = 'chat' as const;
/**
* A list of all Kibana solutions.
*/
export const KIBANA_SOLUTIONS = [
KIBANA_OBSERVABILITY_SOLUTION,
KIBANA_SECURITY_SOLUTION,
KIBANA_SEARCH_SOLUTION,
KIBANA_CHAT_SOLUTION,
] as const; // BOOKMARK - List of Kibana solutions
/**
* A type that defines the existing solutions.
*/
export type KibanaSolution = (typeof KIBANA_SOLUTIONS)[number];
/**
* A list of all Kibana groups (platform + solutions).
*/
export const KIBANA_GROUPS = [KIBANA_PLATFORM, ...KIBANA_SOLUTIONS] as const;
/**
* A type that defines the existing groups (platform + solutions).
*/
export type KibanaGroup = (typeof KIBANA_GROUPS)[number];
/**
* The groups to which a module can belong.
* 'common' is the default for uncategorised modules.
*/
export type ModuleGroup = KibanaGroup | 'common';
/**
* ModuleVisibility tells whether a module is accessible from any module (shared) or only from modules of the same group (private)
*/
export type ModuleVisibility = 'private' | 'shared';
/**
* Constant for the Kibana Observability (workchat) serverless project type.
*/
export const KIBANA_OBSERVABILITY_PROJECT = 'oblt' as const;
/**
* Constant for the Kibana Security (workchat) serverless project type.
*/
export const KIBANA_SECURITY_PROJECT = 'security' as const;
/**
* Constant for the Kibana Search (workchat) serverless project type.
*/
export const KIBANA_SEARCH_PROJECT = 'es' as const;
/**
* Constant for the Kibana Chat (workchat) serverless project type.
*/
export const KIBANA_CHAT_PROJECT = 'chat' as const;
/**
* A list of all Kibana serverless project types.
*/
export const KIBANA_PROJECTS = [
KIBANA_OBSERVABILITY_PROJECT,
KIBANA_SECURITY_PROJECT,
KIBANA_SEARCH_PROJECT,
KIBANA_CHAT_PROJECT,
] as const; // BOOKMARK - List of Kibana project types
/**
* A type that defines the existing serverless project types.
*/
export type KibanaProject = (typeof KIBANA_PROJECTS)[number];

View file

@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/projects-solutions-groups",
"owner": "@elastic/kibana-core",
"group": "platform",
"visibility": "private",
}

View file

@ -0,0 +1,6 @@
{
"name": "@kbn/projects-solutions-groups",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
}

View file

@ -0,0 +1,13 @@
{
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
},
"include": [
"**/*.ts",
],
"exclude": [
"target/**/*"
],
"kbn_references": []
}

View file

@ -121,14 +121,14 @@ class Package {
/** /**
* the group to which this package belongs * the group to which this package belongs
* @type {import('@kbn/repo-info/types').ModuleGroup} * @type {import('@kbn/projects-solutions-groups').ModuleGroup}
* @readonly * @readonly
*/ */
this.group = group; this.group = group;
/** /**
* the visibility of this package, i.e. whether it can be accessed by everybody or only modules in the same group * the visibility of this package, i.e. whether it can be accessed by everybody or only modules in the same group
* @type {import('@kbn/repo-info/types').ModuleVisibility} * @type {import('@kbn/projects-solutions-groups').ModuleVisibility}
* @readonly * @readonly
*/ */
this.visibility = visibility; this.visibility = visibility;
@ -159,7 +159,7 @@ class Package {
/** /**
* Returns the group to which this package belongs * Returns the group to which this package belongs
* @readonly * @readonly
* @returns {import('@kbn/repo-info/types').ModuleGroup} * @returns {import('@kbn/projects-solutions-groups').ModuleGroup}
*/ */
getGroup() { getGroup() {
return this.group; return this.group;
@ -168,7 +168,7 @@ class Package {
/** /**
* Returns the package visibility, i.e. whether it can be accessed by everybody or only packages in the same group * Returns the package visibility, i.e. whether it can be accessed by everybody or only packages in the same group
* @readonly * @readonly
* @returns {import('@kbn/repo-info/types').ModuleVisibility} * @returns {import('@kbn/projects-solutions-groups').ModuleVisibility}
*/ */
getVisibility() { getVisibility() {
return this.visibility; return this.visibility;
@ -203,9 +203,9 @@ class Package {
determineGroupAndVisibility() { determineGroupAndVisibility() {
const dir = this.normalizedRepoRelativeDir; const dir = this.normalizedRepoRelativeDir;
/** @type {import('@kbn/repo-info/types').ModuleGroup} */ /** @type {import('@kbn/projects-solutions-groups').ModuleGroup} */
let group = 'common'; let group = 'common';
/** @type {import('@kbn/repo-info/types').ModuleVisibility} */ /** @type {import('@kbn/projects-solutions-groups').ModuleVisibility} */
let visibility = 'shared'; let visibility = 'shared';
if (dir.startsWith('src/platform/') || dir.startsWith('x-pack/platform/')) { if (dir.startsWith('src/platform/') || dir.startsWith('x-pack/platform/')) {
@ -214,6 +214,7 @@ class Package {
/src\/platform\/[^\/]+\/shared/.test(dir) || /x-pack\/platform\/[^\/]+\/shared/.test(dir) /src\/platform\/[^\/]+\/shared/.test(dir) || /x-pack\/platform\/[^\/]+\/shared/.test(dir)
? 'shared' ? 'shared'
: 'private'; : 'private';
// BOOKMARK - List of Kibana solutions
} else if (dir.startsWith('x-pack/solutions/search/')) { } else if (dir.startsWith('x-pack/solutions/search/')) {
group = 'search'; group = 'search';
visibility = 'private'; visibility = 'private';
@ -223,10 +224,14 @@ class Package {
} else if (dir.startsWith('x-pack/solutions/observability/')) { } else if (dir.startsWith('x-pack/solutions/observability/')) {
group = 'observability'; group = 'observability';
visibility = 'private'; visibility = 'private';
} else if (dir.startsWith('x-pack/solutions/chat/')) {
group = 'chat';
visibility = 'private';
} else { } else {
group = this.manifest.group ?? 'common'; group = this.manifest.group ?? 'common';
// if the group is 'private-only', enforce it // if the group is 'private-only', enforce it
visibility = ['search', 'security', 'observability'].includes(group) // BOOKMARK - List of Kibana solutions - FIXME we could use KIBANA_SOLUTIONS array here once we modernize this / get rid of Bazel
visibility = ['search', 'security', 'observability', 'chat'].includes(group)
? 'private' ? 'private'
: this.manifest.visibility ?? 'shared'; : this.manifest.visibility ?? 'shared';
} }

View file

@ -262,15 +262,16 @@ function validatePackageManifest(parsed, repoRoot, path) {
); );
} }
// BOOKMARK - List of Kibana Solutions
if ( if (
group !== undefined && group !== undefined &&
(!isSomeString(group) || (!isSomeString(group) ||
!['platform', 'search', 'security', 'observability', 'common'].includes(group)) !['platform', 'search', 'security', 'observability', 'chat'].includes(group))
) { ) {
throw err( throw err(
`plugin.group`, `plugin.group`,
group, group,
`must have a valid value ("platform" | "search" | "security" | "observability" | "common")` `must have a valid value ("platform" | "search" | "security" | "observability" | "chat")`
); );
} }

View file

@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1". * License v3.0 only", or the "Server Side Public License, v 1".
*/ */
import type { ModuleGroup, ModuleVisibility } from '@kbn/repo-info/types'; import type { KibanaGroup, ModuleVisibility } from '@kbn/projects-solutions-groups';
import type { Package } from './package'; import type { Package } from './package';
import type { PLUGIN_CATEGORY } from './plugin_category_info'; import type { PLUGIN_CATEGORY } from './plugin_category_info';
@ -95,7 +95,7 @@ export interface PackageManifestBaseFields {
/** /**
* Specifies the group to which this package belongs * Specifies the group to which this package belongs
*/ */
group?: ModuleGroup; group?: KibanaGroup;
/** /**
* Specifies the package visibility, i.e. whether it can be accessed by everybody or only packages in the same group * Specifies the package visibility, i.e. whether it can be accessed by everybody or only packages in the same group
*/ */

View file

@ -16,6 +16,6 @@
"target/**/*", "target/**/*",
], ],
"kbn_references": [ "kbn_references": [
"@kbn/repo-info", "@kbn/projects-solutions-groups",
] ]
} }

View file

@ -12,6 +12,7 @@ import Fs from 'fs';
import { REPO_ROOT } from '@kbn/repo-info'; import { REPO_ROOT } from '@kbn/repo-info';
import { run } from '@kbn/dev-cli-runner'; import { run } from '@kbn/dev-cli-runner';
import { KIBANA_SOLUTIONS } from '@kbn/projects-solutions-groups';
import { discoverPlugins } from './discover_plugins'; import { discoverPlugins } from './discover_plugins';
import { generatePluginList } from './generate_plugin_list'; import { generatePluginList } from './generate_plugin_list';
@ -27,16 +28,13 @@ export function runPluginListCli() {
log.info('looking for x-pack plugins'); log.info('looking for x-pack plugins');
const xpackLegacyPlugins = discoverPlugins('x-pack/plugins'); const xpackLegacyPlugins = discoverPlugins('x-pack/plugins');
const xpackPlatformPlugins = discoverPlugins('x-pack/platform/plugins'); const xpackPlatformPlugins = discoverPlugins('x-pack/platform/plugins');
const xpackSearchPlugins = discoverPlugins('x-pack/solutions/search/plugins'); const solutionsPlugins = KIBANA_SOLUTIONS.flatMap((solution) =>
const xpackSecurityPlugins = discoverPlugins('x-pack/solutions/security/plugins'); discoverPlugins(`x-pack/solutions/${solution}/plugins`)
const xpackObservabilityPlugins = discoverPlugins('x-pack/solutions/observability/plugins'); );
log.success( log.success(
`found ${ `found ${
xpackLegacyPlugins.length + xpackLegacyPlugins.length + xpackPlatformPlugins.length + solutionsPlugins.length
xpackPlatformPlugins.length +
xpackSearchPlugins.length +
xpackSecurityPlugins.length +
xpackObservabilityPlugins.length
} plugins` } plugins`
); );
@ -45,13 +43,7 @@ export function runPluginListCli() {
OUTPUT_PATH, OUTPUT_PATH,
generatePluginList( generatePluginList(
[...ossLegacyPlugins, ...ossPlatformPlugins], [...ossLegacyPlugins, ...ossPlatformPlugins],
[ [...xpackLegacyPlugins, ...xpackPlatformPlugins, ...solutionsPlugins]
...xpackLegacyPlugins,
...xpackPlatformPlugins,
...xpackSearchPlugins,
...xpackSecurityPlugins,
...xpackObservabilityPlugins,
]
) )
); );
}); });

View file

@ -17,6 +17,7 @@
"@kbn/repo-packages", "@kbn/repo-packages",
"@kbn/some-dev-log", "@kbn/some-dev-log",
"@kbn/stdio-dev-helpers", "@kbn/stdio-dev-helpers",
"@kbn/projects-solutions-groups",
], ],
"exclude": [ "exclude": [
"target/**/*", "target/**/*",

View file

@ -14,5 +14,8 @@
], ],
"exclude": [ "exclude": [
"target/**/*", "target/**/*",
],
"kbn_references": [
"@kbn/projects-solutions-groups",
] ]
} }

View file

@ -7,8 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1". * License v3.0 only", or the "Server Side Public License, v 1".
*/ */
export type ModuleGroup = 'platform' | 'observability' | 'search' | 'security' | 'common'; import type { KibanaGroup, ModuleVisibility } from '@kbn/projects-solutions-groups';
export type ModuleVisibility = 'private' | 'shared';
export interface KibanaPackageJson { export interface KibanaPackageJson {
name: string; name: string;
@ -30,6 +29,6 @@ export interface KibanaPackageJson {
[name: string]: string | undefined; [name: string]: string | undefined;
}; };
[key: string]: unknown; [key: string]: unknown;
group?: ModuleGroup; group?: KibanaGroup;
visibility?: ModuleVisibility; visibility?: ModuleVisibility;
} }

View file

@ -14,6 +14,7 @@ import { REPO_ROOT } from '@kbn/repo-info';
import fs from 'fs'; import fs from 'fs';
import yaml from 'js-yaml'; import yaml from 'js-yaml';
import { createFailError } from '@kbn/dev-cli-errors'; import { createFailError } from '@kbn/dev-cli-errors';
import { KIBANA_SOLUTIONS } from '@kbn/projects-solutions-groups';
export const DEFAULT_TEST_PATH_PATTERNS = ['src/platform/plugins', 'x-pack/**/plugins']; export const DEFAULT_TEST_PATH_PATTERNS = ['src/platform/plugins', 'x-pack/**/plugins'];
@ -36,9 +37,10 @@ export const getScoutPlaywrightConfigs = (searchPaths: string[], log: ToolingLog
const files = patterns.flatMap((pattern) => fastGlob.sync(pattern, { onlyFiles: true })); const files = patterns.flatMap((pattern) => fastGlob.sync(pattern, { onlyFiles: true }));
const typeMappings: Record<string, string> = { const typeMappings: Record<string, string> = {
'x-pack/solutions/security': 'security', ...KIBANA_SOLUTIONS.reduce<Record<string, string>>((agg, solution) => {
'x-pack/solutions/search': 'search', agg[`x-pack/solutions/${solution}`] = solution;
'x-pack/solutions/observability': 'observability', return agg;
}, {}),
'x-pack/platform/plugins': 'platform', 'x-pack/platform/plugins': 'platform',
'src/platform/plugins': 'platform', 'src/platform/plugins': 'platform',
}; };
@ -46,7 +48,7 @@ export const getScoutPlaywrightConfigs = (searchPaths: string[], log: ToolingLog
const matchPluginPath = (filePath: string): { pluginPath: string; pluginName: string } | null => { const matchPluginPath = (filePath: string): { pluginPath: string; pluginName: string } | null => {
const regexes = [ const regexes = [
/(x-pack\/platform\/plugins\/(?:private|shared|[^\/]+)\/([^\/]+))\/ui_tests\//, /(x-pack\/platform\/plugins\/(?:private|shared|[^\/]+)\/([^\/]+))\/ui_tests\//,
/(x-pack\/solutions\/[^\/]+\/plugins\/([^\/]+))\/ui_tests\//, /(x-pack\/solutions\/[^\/]+\/plugins\/([^\/]+))\/ui_tests\//, // covers all Kibana solutions
/(src\/platform\/plugins\/(?:private|shared)?\/?([^\/]+))\/ui_tests\//, /(src\/platform\/plugins\/(?:private|shared)?\/?([^\/]+))\/ui_tests\//,
]; ];

View file

@ -30,5 +30,6 @@
"@kbn/scout-reporting", "@kbn/scout-reporting",
"@kbn/apm-synthtrace", "@kbn/apm-synthtrace",
"@kbn/apm-synthtrace-client", "@kbn/apm-synthtrace-client",
"@kbn/projects-solutions-groups"
] ]
} }

View file

@ -0,0 +1,34 @@
---
id: serverless/packages/settings/chat_project
slug: /serverless/packages/settings/chat_project
title: Serverless Chat Advanced Settings
description: A package of settings for the Serverless Chat project.
tags: ['serverless', 'package']
date: 2023-08-24
---
This package contains a list of UI settings that are only available in the Serverless Chat project.
This list is consumed by the `serverless_chat` plugin, which sets up its project settings:
```ts
export class ServerlessChatPlugin
implements
Plugin<
ServerlessChatPluginSetup,
ServerlessChatPluginStart,
SetupDependencies,
StartDependencies
>
{
public setup(
{ getStartServices, http }: CoreSetup<StartDependencies>,
pluginsSetup: SetupDependencies
) {
pluginsSetup.serverless.setupProjectSettings(CHAT_PROJECT_SETTINGS);
return {};
}
}
```
If you need to register a setting that should be available in the Serverless Chat project, make sure to add
its Id to this list.

View file

@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
export const CHAT_PROJECT_SETTINGS = [];

View file

@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/serverless-chat-settings",
"owner": "@elastic/search-kibana",
"group": "platform",
"visibility": "shared"
}

View file

@ -0,0 +1,6 @@
{
"name": "@kbn/serverless-chat-settings",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
}

View file

@ -0,0 +1,17 @@
{
"extends": "../../../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node"
]
},
"include": [
"**/*.ts",
],
"exclude": [
"target/**/*"
],
"kbn_references": []
}

View file

@ -7,4 +7,5 @@
* License v3.0 only", or the "Server Side Public License, v 1". * License v3.0 only", or the "Server Side Public License, v 1".
*/ */
export type ProjectType = 'observability' | 'security' | 'search'; // BOOKMARK - List of Kibana project types - TODO unify with the definitions under @kbn/projects-solutions-groups
export type ProjectType = 'observability' | 'security' | 'search' | 'chat';

View file

@ -1444,6 +1444,8 @@
"@kbn/profiling-plugin/*": ["x-pack/solutions/observability/plugins/profiling/*"], "@kbn/profiling-plugin/*": ["x-pack/solutions/observability/plugins/profiling/*"],
"@kbn/profiling-utils": ["src/platform/packages/shared/kbn-profiling-utils"], "@kbn/profiling-utils": ["src/platform/packages/shared/kbn-profiling-utils"],
"@kbn/profiling-utils/*": ["src/platform/packages/shared/kbn-profiling-utils/*"], "@kbn/profiling-utils/*": ["src/platform/packages/shared/kbn-profiling-utils/*"],
"@kbn/projects-solutions-groups": ["src/platform/packages/private/kbn-projects-solutions-groups"],
"@kbn/projects-solutions-groups/*": ["src/platform/packages/private/kbn-projects-solutions-groups/*"],
"@kbn/random-sampling": ["x-pack/platform/packages/private/kbn-random-sampling"], "@kbn/random-sampling": ["x-pack/platform/packages/private/kbn-random-sampling"],
"@kbn/random-sampling/*": ["x-pack/platform/packages/private/kbn-random-sampling/*"], "@kbn/random-sampling/*": ["x-pack/platform/packages/private/kbn-random-sampling/*"],
"@kbn/react-field": ["src/platform/packages/shared/kbn-react-field"], "@kbn/react-field": ["src/platform/packages/shared/kbn-react-field"],
@ -1742,6 +1744,10 @@
"@kbn/server-route-repository-utils/*": ["src/platform/packages/shared/kbn-server-route-repository-utils/*"], "@kbn/server-route-repository-utils/*": ["src/platform/packages/shared/kbn-server-route-repository-utils/*"],
"@kbn/serverless": ["x-pack/platform/plugins/shared/serverless"], "@kbn/serverless": ["x-pack/platform/plugins/shared/serverless"],
"@kbn/serverless/*": ["x-pack/platform/plugins/shared/serverless/*"], "@kbn/serverless/*": ["x-pack/platform/plugins/shared/serverless/*"],
"@kbn/serverless-chat": ["x-pack/solutions/chat/plugins/serverless_chat"],
"@kbn/serverless-chat/*": ["x-pack/solutions/chat/plugins/serverless_chat/*"],
"@kbn/serverless-chat-settings": ["src/platform/packages/shared/serverless/settings/chat_project"],
"@kbn/serverless-chat-settings/*": ["src/platform/packages/shared/serverless/settings/chat_project/*"],
"@kbn/serverless-common-settings": ["src/platform/packages/shared/serverless/settings/common"], "@kbn/serverless-common-settings": ["src/platform/packages/shared/serverless/settings/common"],
"@kbn/serverless-common-settings/*": ["src/platform/packages/shared/serverless/settings/common/*"], "@kbn/serverless-common-settings/*": ["src/platform/packages/shared/serverless/settings/common/*"],
"@kbn/serverless-observability": ["x-pack/solutions/observability/plugins/serverless_observability"], "@kbn/serverless-observability": ["x-pack/solutions/observability/plugins/serverless_observability"],

View file

@ -30,5 +30,10 @@
"output": "platform/plugins/private/telemetry_collection_xpack/schema/xpack_security.json", "output": "platform/plugins/private/telemetry_collection_xpack/schema/xpack_security.json",
"root": "solutions/security", "root": "solutions/security",
"exclude": [] "exclude": []
},
{
"output": "platform/plugins/private/telemetry_collection_xpack/schema/xpack_chat.json",
"root": "solutions/chat",
"exclude": []
} }
] ]

View file

@ -10,9 +10,11 @@ There are currently 7 files:
It is automatically generated by `@kbn/telemetry-tools` based on the `schema` property provided by all the registered Usage Collectors via the `usageCollection.makeUsageCollector` API. It is automatically generated by `@kbn/telemetry-tools` based on the `schema` property provided by all the registered Usage Collectors via the `usageCollection.makeUsageCollector` API.
More details in the [Schema field](../../../../usage_collection/README.md#schema-field) chapter in the UsageCollection's docs. More details in the [Schema field](../../../../usage_collection/README.md#schema-field) chapter in the UsageCollection's docs.
- `xpack_platform.json`: Same as `xpack_plugins.json` but for collectors defined in `<ROOT_DIR>/x-pack/platform/*`. - `xpack_platform.json`: Same as `xpack_plugins.json` but for collectors defined in `<ROOT_DIR>/x-pack/platform/*`.
[//]: # (BOOKMARK - List of Kibana solutions)
- `xpack_observability.json`: Same as `xpack_plugins.json` but for collectors defined in `<ROOT_DIR>/x-pack/solutions/observability/*`. - `xpack_observability.json`: Same as `xpack_plugins.json` but for collectors defined in `<ROOT_DIR>/x-pack/solutions/observability/*`.
- `xpack_search.json`: Same as `xpack_plugins.json` but for collectors defined in `<ROOT_DIR>/x-pack/solutions/search/*`. - `xpack_search.json`: Same as `xpack_plugins.json` but for collectors defined in `<ROOT_DIR>/x-pack/solutions/search/*`.
- `xpack_security.json`: Same as `xpack_plugins.json` but for collectors defined in `<ROOT_DIR>/x-pack/solutions/security/*`. - `xpack_security.json`: Same as `xpack_plugins.json` but for collectors defined in `<ROOT_DIR>/x-pack/solutions/security/*`.
- `xpack_chat.json`: Same as `xpack_plugins.json` but for collectors defined in `<ROOT_DIR>/x-pack/solutions/chat/*`.
- `xpack_monitoring.json`: It declares the payload sent by the monitoring-sourced telemetry. The actual schema for the payload is declared under `properties.monitoringTelemetry.properties.stats.items`, but due to the general behaviour in the `@kbn/telemetry-tools`, it gets nested down in that path. - `xpack_monitoring.json`: It declares the payload sent by the monitoring-sourced telemetry. The actual schema for the payload is declared under `properties.monitoringTelemetry.properties.stats.items`, but due to the general behaviour in the `@kbn/telemetry-tools`, it gets nested down in that path.
NOTE: Despite its similarities to ES mappings, the intention of these files is not to define any index mappings. They should be considered as a tool to understand the format of the payload that will be sent when reporting telemetry to the Remote Service. NOTE: Despite its similarities to ES mappings, the intention of these files is not to define any index mappings. They should be considered as a tool to understand the format of the payload that will be sent when reporting telemetry to the Remote Service.

View file

@ -0,0 +1,3 @@
{
"properties": {}
}

View file

@ -0,0 +1,2 @@
/build
/target

View file

@ -0,0 +1,3 @@
# Serverless Chat project plugin
The `serverlessChat` plugin is an internal plugin for Kibana's Chat Solution.

View file

@ -0,0 +1,16 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
preset: '@kbn/test',
rootDir: '../../../../../',
projects: [
'<rootDir>/x-pack/solutions/chat/plugins/chat_serverless/server/*/jest.config.js',
'<rootDir>/x-pack/solutions/chat/plugins/chat_serverless/public/*/jest.config.js',
],
};

View file

@ -0,0 +1,23 @@
{
"type": "plugin",
"id": "@kbn/serverless-chat",
"owner": "@elastic/search-kibana",
"group": "chat",
"visibility": "private",
"description": "Serverless customizations for chat.",
"plugin": {
"id": "serverlessChat",
"browser": true,
"server": true,
"configPath": [
"xpack",
"serverless",
"chat"
],
"requiredPlugins": [
"serverless",
],
"optionalPlugins": [],
"requiredBundles": []
}
}

View file

@ -0,0 +1,11 @@
{
"name": "@kbn/serverless-chat",
"version": "1.0.0",
"license": "Elastic License 2.0",
"private": true,
"scripts": {
"build": "yarn plugin-helpers build",
"plugin-helpers": "node ../../../../../scripts/plugin_helpers",
"kbn": "node ../../../../../scripts/kbn"
}
}

View file

@ -0,0 +1,16 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { ChatServerlessPlugin } from './plugin';
// This exports static code and TypeScript types,
// as well as, Kibana Platform `plugin()` initializer.
export function plugin() {
return new ChatServerlessPlugin();
}
export type { ChatServerlessPluginSetup, ChatServerlessPluginStart } from './types';

View file

@ -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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
preset: '@kbn/test',
rootDir: '../../../../../..',
/** all nested directories have their own Jest config file */
testMatch: [
'<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/public/**/*.test.{js,mjs,ts,tsx}',
],
roots: ['<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/public'],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/solutions/chat/plugins/serverless_chat/public',
coverageReporters: ['text', 'html'],
collectCoverageFrom: [
'<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/public/**/*.{ts,tsx}',
'!<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/public/*.test.{ts,tsx}',
'!<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/public/{__test__,__snapshots__,__examples__,*mock*,tests,test_helpers,integration_tests,types}/**/*',
'!<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/public/*mock*.{ts,tsx}',
'!<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/public/*.test.{ts,tsx}',
'!<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/public/*.d.ts',
'!<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/public/*.config.ts',
'!<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/public/index.{js,ts,tsx}',
],
};

View file

@ -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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
import type {
ChatServerlessPluginSetup,
ChatServerlessPluginStart,
ChatServerlessPluginSetupDeps,
ChatServerlessPluginStartDeps,
} from './types';
export class ChatServerlessPlugin
implements
Plugin<
ChatServerlessPluginSetup,
ChatServerlessPluginStart,
ChatServerlessPluginSetupDeps,
ChatServerlessPluginStartDeps
>
{
constructor() {}
public setup(
core: CoreSetup,
setupDeps: ChatServerlessPluginSetupDeps
): ChatServerlessPluginSetup {
return {};
}
public start(
core: CoreStart,
startDeps: ChatServerlessPluginStartDeps
): ChatServerlessPluginStart {
return {};
}
public stop() {}
}

View file

@ -0,0 +1,22 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ChatServerlessPluginSetup {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ChatServerlessPluginStart {}
export interface ChatServerlessPluginSetupDeps {
serverless: ServerlessPluginSetup;
}
export interface ChatServerlessPluginStartDeps {
serverless: ServerlessPluginStart;
}

View 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { schema, TypeOf } from '@kbn/config-schema';
import { PluginConfigDescriptor } from '@kbn/core/server';
export * from './types';
const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: false }),
});
type ConfigType = TypeOf<typeof configSchema>;
export const config: PluginConfigDescriptor<ConfigType> = {
schema: configSchema,
};
export type ServerlessChatConfig = TypeOf<typeof configSchema>;

View file

@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { PluginInitializerContext } from '@kbn/core/server';
export { config } from './config';
// This exports static code and TypeScript types,
// as well as, Kibana Platform `plugin()` initializer.
export async function plugin(initializerContext: PluginInitializerContext) {
const { ServerlessChatPlugin } = await import('./plugin');
return new ServerlessChatPlugin(initializerContext);
}
export type { ServerlessChatPluginSetup, ServerlessChatPluginStart } from './types';

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
preset: '@kbn/test',
rootDir: '../../../../../..',
roots: ['<rootDir>/x-pack/solutions/chat/plugins/serverless_chat/server/'],
};

View file

@ -0,0 +1,54 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type {
Logger,
PluginInitializerContext,
Plugin,
CoreSetup,
CoreStart,
} from '@kbn/core/server';
import { CHAT_PROJECT_SETTINGS } from '@kbn/serverless-chat-settings';
import type { ServerlessChatConfig } from './config';
import type {
ServerlessChatPluginSetup,
ServerlessChatPluginStart,
SetupDependencies,
StartDependencies,
} from './types';
export class ServerlessChatPlugin
implements
Plugin<
ServerlessChatPluginSetup,
ServerlessChatPluginStart,
SetupDependencies,
StartDependencies
>
{
// @ts-ignore config is not used for now
private readonly config: ServerlessChatConfig;
// @ts-ignore logger is not used for now
private readonly logger: Logger;
constructor(initializerContext: PluginInitializerContext) {
this.config = initializerContext.config.get<ServerlessChatConfig>();
this.logger = initializerContext.logger.get();
}
public setup(core: CoreSetup<StartDependencies>, { serverless }: SetupDependencies) {
serverless.setupProjectSettings(CHAT_PROJECT_SETTINGS);
return {};
}
public start(core: CoreStart) {
return {};
}
public stop() {}
}

View file

@ -0,0 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { ServerlessPluginSetup } from '@kbn/serverless/server';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ServerlessChatPluginSetup {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ServerlessChatPluginStart {}
export interface SetupDependencies {
serverless: ServerlessPluginSetup;
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface StartDependencies {}

View file

@ -0,0 +1,23 @@
{
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types"
},
"include": [
"index.ts",
"common/**/*.ts",
"public/**/*.ts",
"public/**/*.tsx",
"server/**/*.ts",
"../../../../../typings/**/*",
],
"exclude": [
"target/**/*"
],
"kbn_references": [
"@kbn/core",
"@kbn/serverless",
"@kbn/config-schema",
"@kbn/serverless-chat-settings",
]
}

View file

@ -18,9 +18,11 @@ import ossPlatformTelemetrySchema from '@kbn/telemetry-plugin/schema/oss_platfor
import ossPackagesTelemetrySchema from '@kbn/telemetry-plugin/schema/kbn_packages.json'; import ossPackagesTelemetrySchema from '@kbn/telemetry-plugin/schema/kbn_packages.json';
import xpackPluginsTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_plugins.json'; import xpackPluginsTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_plugins.json';
import xpackPlatformTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_platform.json'; import xpackPlatformTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_platform.json';
// BOOKMARK - List of Kibana Solutions
import xpackObservabilityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_observability.json'; import xpackObservabilityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_observability.json';
import xpackSearchTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_search.json'; import xpackSearchTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_search.json';
import xpackSecurityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_security.json'; import xpackSecurityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_security.json';
import xpackChatTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_chat.json';
import type { UnencryptedTelemetryPayload } from '@kbn/telemetry-plugin/common/types'; import type { UnencryptedTelemetryPayload } from '@kbn/telemetry-plugin/common/types';
import type { import type {
UsageStatsPayload, UsageStatsPayload,
@ -177,6 +179,7 @@ export default function ({ getService }: FtrProviderContext) {
xpackObservabilityTelemetrySchema, xpackObservabilityTelemetrySchema,
xpackSearchTelemetrySchema, xpackSearchTelemetrySchema,
xpackSecurityTelemetrySchema, xpackSecurityTelemetrySchema,
xpackChatTelemetrySchema,
] as TelemetrySchemaObject[]; ] as TelemetrySchemaObject[];
const plugins = schemas.reduce((acc, schema) => deepmerge(acc, schema)); const plugins = schemas.reduce((acc, schema) => deepmerge(acc, schema));

View file

@ -14,9 +14,11 @@ import ossPackagesTelemetrySchema from '@kbn/telemetry-plugin/schema/kbn_package
import xpackRootTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_root.json'; import xpackRootTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_root.json';
import xpackPluginsTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_plugins.json'; import xpackPluginsTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_plugins.json';
import xpackPlatformTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_platform.json'; import xpackPlatformTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_platform.json';
// BOOKMARK - List of Kibana Solutions
import xpackObservabilityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_observability.json'; import xpackObservabilityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_observability.json';
import xpackSearchTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_search.json'; import xpackSearchTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_search.json';
import xpackSecurityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_security.json'; import xpackSecurityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_security.json';
import xpackChatTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_chat.json';
import { assertTelemetryPayload } from '@kbn/telemetry-tools'; import { assertTelemetryPayload } from '@kbn/telemetry-tools';
import type { TelemetrySchemaObject } from '@kbn/telemetry-tools/src/schema_ftr_validations/schema_to_config_schema'; import type { TelemetrySchemaObject } from '@kbn/telemetry-tools/src/schema_ftr_validations/schema_to_config_schema';
import { import {
@ -73,6 +75,7 @@ export default function ({ getService }: FtrProviderContext) {
xpackObservabilityTelemetrySchema, xpackObservabilityTelemetrySchema,
xpackSearchTelemetrySchema, xpackSearchTelemetrySchema,
xpackSecurityTelemetrySchema, xpackSecurityTelemetrySchema,
xpackChatTelemetrySchema,
] as TelemetrySchemaObject[]; ] as TelemetrySchemaObject[];
const plugins = schemas.reduce((acc, schema) => deepmerge(acc, schema)); const plugins = schemas.reduce((acc, schema) => deepmerge(acc, schema));

View file

@ -14,9 +14,11 @@ import ossPackagesTelemetrySchema from '@kbn/telemetry-plugin/schema/kbn_package
import ossPlatformTelemetrySchema from '@kbn/telemetry-plugin/schema/oss_platform.json'; import ossPlatformTelemetrySchema from '@kbn/telemetry-plugin/schema/oss_platform.json';
import xpackPluginsTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_plugins.json'; import xpackPluginsTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_plugins.json';
import xpackPlatformTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_platform.json'; import xpackPlatformTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_platform.json';
// BOOKMARK - List of Kibana Solutions
import xpackObservabilityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_observability.json'; import xpackObservabilityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_observability.json';
import xpackSearchTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_search.json'; import xpackSearchTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_search.json';
import xpackSecurityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_security.json'; import xpackSecurityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_security.json';
import xpackChatTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_chat.json';
import { assertTelemetryPayload } from '@kbn/telemetry-tools'; import { assertTelemetryPayload } from '@kbn/telemetry-tools';
import type { TelemetrySchemaObject } from '@kbn/telemetry-tools/src/schema_ftr_validations/schema_to_config_schema'; import type { TelemetrySchemaObject } from '@kbn/telemetry-tools/src/schema_ftr_validations/schema_to_config_schema';
import type { UsageStatsPayloadTestFriendly } from '@kbn/test-suites-xpack/api_integration/services/usage_api'; import type { UsageStatsPayloadTestFriendly } from '@kbn/test-suites-xpack/api_integration/services/usage_api';
@ -57,6 +59,7 @@ export default function ({ getService }: FtrProviderContext) {
xpackObservabilityTelemetrySchema, xpackObservabilityTelemetrySchema,
xpackSearchTelemetrySchema, xpackSearchTelemetrySchema,
xpackSecurityTelemetrySchema, xpackSecurityTelemetrySchema,
xpackChatTelemetrySchema,
] as TelemetrySchemaObject[]; ] as TelemetrySchemaObject[];
const plugins = schemas.reduce((acc, schema) => deepmerge(acc, schema)); const plugins = schemas.reduce((acc, schema) => deepmerge(acc, schema));

View file

@ -6566,6 +6566,10 @@
version "0.0.0" version "0.0.0"
uid "" uid ""
"@kbn/projects-solutions-groups@link:src/platform/packages/private/kbn-projects-solutions-groups":
version "0.0.0"
uid ""
"@kbn/random-sampling@link:x-pack/platform/packages/private/kbn-random-sampling": "@kbn/random-sampling@link:x-pack/platform/packages/private/kbn-random-sampling":
version "0.0.0" version "0.0.0"
uid "" uid ""
@ -7158,6 +7162,14 @@
version "0.0.0" version "0.0.0"
uid "" uid ""
"@kbn/serverless-chat-settings@link:src/platform/packages/shared/serverless/settings/chat_project":
version "0.0.0"
uid ""
"@kbn/serverless-chat@link:x-pack/solutions/chat/plugins/serverless_chat":
version "0.0.0"
uid ""
"@kbn/serverless-common-settings@link:src/platform/packages/shared/serverless/settings/common": "@kbn/serverless-common-settings@link:src/platform/packages/shared/serverless/settings/common":
version "0.0.0" version "0.0.0"
uid "" uid ""