diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 63fdf3044be5f..4dc48e657542b 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -782,6 +782,9 @@ packages/core/integrations/core-integrations-browser-mocks @elastic/kibana-core
packages/core/lifecycle/core-lifecycle-browser @elastic/kibana-core
packages/core/lifecycle/core-lifecycle-browser-internal @elastic/kibana-core
packages/core/lifecycle/core-lifecycle-browser-mocks @elastic/kibana-core
+packages/core/lifecycle/core-lifecycle-server @elastic/kibana-core
+packages/core/lifecycle/core-lifecycle-server-internal @elastic/kibana-core
+packages/core/lifecycle/core-lifecycle-server-mocks @elastic/kibana-core
packages/core/logging/core-logging-server @elastic/kibana-core
packages/core/logging/core-logging-server-internal @elastic/kibana-core
packages/core/logging/core-logging-server-mocks @elastic/kibana-core
@@ -805,6 +808,9 @@ packages/core/plugins/core-plugins-base-server-internal @elastic/kibana-core
packages/core/plugins/core-plugins-browser @elastic/kibana-core
packages/core/plugins/core-plugins-browser-internal @elastic/kibana-core
packages/core/plugins/core-plugins-browser-mocks @elastic/kibana-core
+packages/core/plugins/core-plugins-server @elastic/kibana-core
+packages/core/plugins/core-plugins-server-internal @elastic/kibana-core
+packages/core/plugins/core-plugins-server-mocks @elastic/kibana-core
packages/core/preboot/core-preboot-server @elastic/kibana-core
packages/core/preboot/core-preboot-server-internal @elastic/kibana-core
packages/core/preboot/core-preboot-server-mocks @elastic/kibana-core
diff --git a/.github/relabel.yml b/.github/relabel.yml
index a737be356ce81..eb9a2fd557f45 100644
--- a/.github/relabel.yml
+++ b/.github/relabel.yml
@@ -1,3 +1,3 @@
issues:
- missingLabel: needs-team
- regex: ^(\:ml)|(Team:.*)$
\ No newline at end of file
+ regex: (^\:ml$)|(^Team:.+$)|(^EUI$)
diff --git a/.github/workflows/add-fleet-issues-to-ingest-project.yml b/.github/workflows/add-fleet-issues-to-ingest-project.yml
new file mode 100644
index 0000000000000..117ec649cd8a1
--- /dev/null
+++ b/.github/workflows/add-fleet-issues-to-ingest-project.yml
@@ -0,0 +1,51 @@
+name: Add Fleet issue to Platform Ingest project
+
+on:
+ issues:
+ types:
+ - labeled
+
+env:
+ INGEST_PROJECT_ID: 'PVT_kwDOAGc3Zs4AEzn4'
+ FLEET_LABEL: 'Team:Fleet'
+ AREA_FIELD_ID: 'PVTSSF_lADOAGc3Zs4AEzn4zgEgZSo'
+ FLEET_UI_OPTION_ID: '411a7b86'
+
+jobs:
+ add_to_ingest_project:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: octokit/graphql-action@v2.x
+ id: add_to_project
+ if: ${{ github.event.label.name == env.FLEET_LABEL }}
+ with:
+ query: |
+ # Variables have to be snake cased because of https://github.com/octokit/graphql-action/issues/164
+ mutation AddToIngestProject($project_id: ID!, $content_id: ID!) {
+ addProjectV2ItemById(input: { projectId: $project_id, contentId: $content_id }) {
+ item {
+ id
+ }
+ }
+ }
+ project_id: ${{ env.INGEST_PROJECT_ID }}
+ content_id: ${{ github.event.issue.node_id }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.FLEET_TECH_KIBANA_USER_TOKEN }}
+ - uses: octokit/graphql-action@v2.x
+ id: set_fleet_ui_area
+ if: github.event.label.name == env.FLEET_LABEL
+ with:
+ query: |
+ mutation updateIngestArea($item_id: ID!, $project_id: ID!, $area_field_id: ID!, $area_id: String) {
+ updateProjectV2ItemFieldValue(
+ input: { itemId: $item_id, projectId: $project_id, fieldId: $area_field_id, value: { singleSelectOptionId: $area_id } }) {
+ clientMutationId
+ }
+ }
+ item_id: ${{ fromJSON(steps.add_to_project.outputs.data).addProjectV2ItemById.item.id }}
+ project_id: ${{ env.INGEST_PROJECT_ID }}
+ area_field_id: ${{ env.AREA_FIELD_ID }}
+ area_id: ${{ env.FLEET_UI_OPTION_ID }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.FLEET_TECH_KIBANA_USER_TOKEN }}
diff --git a/.github/workflows/add-to-fleet-project.yml b/.github/workflows/add-to-fleet-project.yml
deleted file mode 100644
index e828a3a5b637e..0000000000000
--- a/.github/workflows/add-to-fleet-project.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-name: Add to Fleet:Quality project
-on:
- issues:
- types:
- - labeled
-jobs:
- add_to_project:
- runs-on: ubuntu-latest
- if: |
- contains(github.event.issue.labels.*.name, 'Team:Fleet') && (
- contains(github.event.issue.labels.*.name, 'technical debt') ||
- contains(github.event.issue.labels.*.name, 'bug') ||
- contains(github.event.issue.labels.*.name, 'performance') ||
- contains(github.event.issue.labels.*.name, 'failed-test') ||
- contains(github.event.issue.labels.*.name, 'chore')
- )
- steps:
- - uses: octokit/graphql-action@v2.x
- id: add_to_project
- with:
- headers: '{"GraphQL-Features": "projects_next_graphql"}'
- query: |
- mutation add_to_project($projectid: ID!, $contentid: ID!) {
- addProjectNextItem(input:{projectId:$projectid contentId:$contentid}) {
- projectNextItem {
- id
- }
- }
- }
- projectid: ${{ env.PROJECT_ID }}
- contentid: ${{ github.event.issue.node_id }}
- env:
- # https://github.com/orgs/elastic/projects/763
- PROJECT_ID: "PN_kwDOAGc3Zs4AAsH6"
- # Token with `write:org` access
- GITHUB_TOKEN: ${{ secrets.FLEET_TECH_KIBANA_USER_TOKEN }}
diff --git a/api_docs/actions.devdocs.json b/api_docs/actions.devdocs.json
index 0f63f83fedf12..278caf26266e3 100644
--- a/api_docs/actions.devdocs.json
+++ b/api_docs/actions.devdocs.json
@@ -772,6 +772,102 @@
}
],
"initialIsOpen": false
+ },
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.UnsecuredActionsClient",
+ "type": "Class",
+ "tags": [],
+ "label": "UnsecuredActionsClient",
+ "description": [],
+ "path": "x-pack/plugins/actions/server/unsecured_actions_client/unsecured_actions_client.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "children": [
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.UnsecuredActionsClient.Unnamed",
+ "type": "Function",
+ "tags": [],
+ "label": "Constructor",
+ "description": [],
+ "signature": [
+ "any"
+ ],
+ "path": "x-pack/plugins/actions/server/unsecured_actions_client/unsecured_actions_client.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "children": [
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.UnsecuredActionsClient.Unnamed.$1",
+ "type": "Object",
+ "tags": [],
+ "label": "params",
+ "description": [],
+ "signature": [
+ "UnsecuredActionsClientOpts"
+ ],
+ "path": "x-pack/plugins/actions/server/unsecured_actions_client/unsecured_actions_client.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "isRequired": true
+ }
+ ],
+ "returnComment": []
+ },
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.UnsecuredActionsClient.bulkEnqueueExecution",
+ "type": "Function",
+ "tags": [],
+ "label": "bulkEnqueueExecution",
+ "description": [],
+ "signature": [
+ "(requesterId: string, actionsToExecute: ",
+ "ExecuteOptions",
+ "[]) => Promise"
+ ],
+ "path": "x-pack/plugins/actions/server/unsecured_actions_client/unsecured_actions_client.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "children": [
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.UnsecuredActionsClient.bulkEnqueueExecution.$1",
+ "type": "string",
+ "tags": [],
+ "label": "requesterId",
+ "description": [],
+ "signature": [
+ "string"
+ ],
+ "path": "x-pack/plugins/actions/server/unsecured_actions_client/unsecured_actions_client.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "isRequired": true
+ },
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.UnsecuredActionsClient.bulkEnqueueExecution.$2",
+ "type": "Array",
+ "tags": [],
+ "label": "actionsToExecute",
+ "description": [],
+ "signature": [
+ "ExecuteOptions",
+ "[]"
+ ],
+ "path": "x-pack/plugins/actions/server/unsecured_actions_client/unsecured_actions_client.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "isRequired": true
+ }
+ ],
+ "returnComment": []
+ }
+ ],
+ "initialIsOpen": false
}
],
"functions": [
@@ -1494,6 +1590,70 @@
],
"initialIsOpen": false
},
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.IUnsecuredActionsClient",
+ "type": "Interface",
+ "tags": [],
+ "label": "IUnsecuredActionsClient",
+ "description": [],
+ "path": "x-pack/plugins/actions/server/unsecured_actions_client/unsecured_actions_client.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "children": [
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.IUnsecuredActionsClient.bulkEnqueueExecution",
+ "type": "Function",
+ "tags": [],
+ "label": "bulkEnqueueExecution",
+ "description": [],
+ "signature": [
+ "(requesterId: string, actionsToExecute: ",
+ "ExecuteOptions",
+ "[]) => Promise"
+ ],
+ "path": "x-pack/plugins/actions/server/unsecured_actions_client/unsecured_actions_client.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "children": [
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.IUnsecuredActionsClient.bulkEnqueueExecution.$1",
+ "type": "string",
+ "tags": [],
+ "label": "requesterId",
+ "description": [],
+ "signature": [
+ "string"
+ ],
+ "path": "x-pack/plugins/actions/server/unsecured_actions_client/unsecured_actions_client.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "isRequired": true
+ },
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.IUnsecuredActionsClient.bulkEnqueueExecution.$2",
+ "type": "Array",
+ "tags": [],
+ "label": "actionsToExecute",
+ "description": [],
+ "signature": [
+ "ExecuteOptions",
+ "[]"
+ ],
+ "path": "x-pack/plugins/actions/server/unsecured_actions_client/unsecured_actions_client.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "isRequired": true
+ }
+ ],
+ "returnComment": []
+ }
+ ],
+ "initialIsOpen": false
+ },
{
"parentPluginId": "actions",
"id": "def-server.PreConfiguredAction",
@@ -2240,6 +2400,29 @@
"deprecated": false,
"trackAdoption": false
},
+ {
+ "parentPluginId": "actions",
+ "id": "def-server.PluginStartContract.getUnsecuredActionsClient",
+ "type": "Function",
+ "tags": [],
+ "label": "getUnsecuredActionsClient",
+ "description": [],
+ "signature": [
+ "() => ",
+ {
+ "pluginId": "actions",
+ "scope": "server",
+ "docId": "kibActionsPluginApi",
+ "section": "def-server.IUnsecuredActionsClient",
+ "text": "IUnsecuredActionsClient"
+ }
+ ],
+ "path": "x-pack/plugins/actions/server/plugin.ts",
+ "deprecated": false,
+ "trackAdoption": false,
+ "children": [],
+ "returnComment": []
+ },
{
"parentPluginId": "actions",
"id": "def-server.PluginStartContract.renderActionParameterTemplates",
diff --git a/api_docs/actions.mdx b/api_docs/actions.mdx
index d644934bb674c..dfbf7265b6b6d 100644
--- a/api_docs/actions.mdx
+++ b/api_docs/actions.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/actions
title: "actions"
image: https://source.unsplash.com/400x175/?github
description: API docs for the actions plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'actions']
---
import actionsObj from './actions.devdocs.json';
@@ -21,7 +21,7 @@ Contact [Response Ops](https://github.com/orgs/elastic/teams/response-ops) for q
| Public API count | Any count | Items lacking comments | Missing exports |
|-------------------|-----------|------------------------|-----------------|
-| 214 | 0 | 209 | 23 |
+| 225 | 0 | 220 | 24 |
## Client
diff --git a/api_docs/advanced_settings.mdx b/api_docs/advanced_settings.mdx
index 7a76f4d13c19b..0df95c1c05aae 100644
--- a/api_docs/advanced_settings.mdx
+++ b/api_docs/advanced_settings.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/advancedSettings
title: "advancedSettings"
image: https://source.unsplash.com/400x175/?github
description: API docs for the advancedSettings plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'advancedSettings']
---
import advancedSettingsObj from './advanced_settings.devdocs.json';
diff --git a/api_docs/aiops.mdx b/api_docs/aiops.mdx
index 2e6699edb8a1c..a0cde4b0714b8 100644
--- a/api_docs/aiops.mdx
+++ b/api_docs/aiops.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/aiops
title: "aiops"
image: https://source.unsplash.com/400x175/?github
description: API docs for the aiops plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiops']
---
import aiopsObj from './aiops.devdocs.json';
diff --git a/api_docs/alerting.devdocs.json b/api_docs/alerting.devdocs.json
index 56a1f7d4b752d..8c5f809ce25dd 100644
--- a/api_docs/alerting.devdocs.json
+++ b/api_docs/alerting.devdocs.json
@@ -1717,38 +1717,38 @@
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.executionId",
- "type": "string",
+ "id": "def-server.RuleExecutorOptions.createdBy",
+ "type": "CompoundType",
"tags": [],
- "label": "executionId",
+ "label": "createdBy",
"description": [],
+ "signature": [
+ "string | null"
+ ],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
"trackAdoption": false
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.startedAt",
- "type": "Object",
+ "id": "def-server.RuleExecutorOptions.executionId",
+ "type": "string",
"tags": [],
- "label": "startedAt",
+ "label": "executionId",
"description": [],
- "signature": [
- "Date"
- ],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
"trackAdoption": false
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.previousStartedAt",
- "type": "CompoundType",
+ "id": "def-server.RuleExecutorOptions.logger",
+ "type": "Object",
"tags": [],
- "label": "previousStartedAt",
+ "label": "logger",
"description": [],
"signature": [
- "Date | null"
+ "Logger"
],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
@@ -1756,21 +1756,11 @@
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.services",
- "type": "Object",
+ "id": "def-server.RuleExecutorOptions.name",
+ "type": "string",
"tags": [],
- "label": "services",
+ "label": "name",
"description": [],
- "signature": [
- {
- "pluginId": "alerting",
- "scope": "server",
- "docId": "kibAlertingPluginApi",
- "section": "def-server.RuleExecutorServices",
- "text": "RuleExecutorServices"
- },
- ""
- ],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
"trackAdoption": false
@@ -1791,13 +1781,13 @@
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.state",
- "type": "Uncategorized",
+ "id": "def-server.RuleExecutorOptions.previousStartedAt",
+ "type": "CompoundType",
"tags": [],
- "label": "state",
+ "label": "previousStartedAt",
"description": [],
"signature": [
- "State"
+ "Date | null"
],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
@@ -1827,49 +1817,59 @@
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.spaceId",
- "type": "string",
+ "id": "def-server.RuleExecutorOptions.services",
+ "type": "Object",
"tags": [],
- "label": "spaceId",
+ "label": "services",
"description": [],
+ "signature": [
+ {
+ "pluginId": "alerting",
+ "scope": "server",
+ "docId": "kibAlertingPluginApi",
+ "section": "def-server.RuleExecutorServices",
+ "text": "RuleExecutorServices"
+ },
+ ""
+ ],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
"trackAdoption": false
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.namespace",
+ "id": "def-server.RuleExecutorOptions.spaceId",
"type": "string",
"tags": [],
- "label": "namespace",
+ "label": "spaceId",
"description": [],
- "signature": [
- "string | undefined"
- ],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
"trackAdoption": false
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.name",
- "type": "string",
+ "id": "def-server.RuleExecutorOptions.startedAt",
+ "type": "Object",
"tags": [],
- "label": "name",
+ "label": "startedAt",
"description": [],
+ "signature": [
+ "Date"
+ ],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
"trackAdoption": false
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.tags",
- "type": "Array",
+ "id": "def-server.RuleExecutorOptions.state",
+ "type": "Uncategorized",
"tags": [],
- "label": "tags",
+ "label": "state",
"description": [],
"signature": [
- "string[]"
+ "State"
],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
@@ -1877,13 +1877,13 @@
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.createdBy",
- "type": "CompoundType",
+ "id": "def-server.RuleExecutorOptions.tags",
+ "type": "Array",
"tags": [],
- "label": "createdBy",
+ "label": "tags",
"description": [],
"signature": [
- "string | null"
+ "string[]"
],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
@@ -1905,13 +1905,13 @@
},
{
"parentPluginId": "alerting",
- "id": "def-server.RuleExecutorOptions.logger",
- "type": "Object",
+ "id": "def-server.RuleExecutorOptions.namespace",
+ "type": "string",
"tags": [],
- "label": "logger",
+ "label": "namespace",
"description": [],
"signature": [
- "Logger"
+ "string | undefined"
],
"path": "x-pack/plugins/alerting/server/types.ts",
"deprecated": false,
diff --git a/api_docs/alerting.mdx b/api_docs/alerting.mdx
index 758497cc8d70e..f4d63e40b4b01 100644
--- a/api_docs/alerting.mdx
+++ b/api_docs/alerting.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/alerting
title: "alerting"
image: https://source.unsplash.com/400x175/?github
description: API docs for the alerting plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'alerting']
---
import alertingObj from './alerting.devdocs.json';
diff --git a/api_docs/apm.devdocs.json b/api_docs/apm.devdocs.json
index b59192b6334c8..ac49342b5faa2 100644
--- a/api_docs/apm.devdocs.json
+++ b/api_docs/apm.devdocs.json
@@ -110,13 +110,7 @@
"text": "APMPlugin"
},
" implements ",
- {
- "pluginId": "core",
- "scope": "server",
- "docId": "kibCorePluginApi",
- "section": "def-server.Plugin",
- "text": "Plugin"
- },
+ "Plugin",
"<",
{
"pluginId": "apm",
@@ -157,13 +151,7 @@
"label": "initContext",
"description": [],
"signature": [
- {
- "pluginId": "core",
- "scope": "server",
- "docId": "kibCorePluginApi",
- "section": "def-server.PluginInitializerContext",
- "text": "PluginInitializerContext"
- },
+ "PluginInitializerContext",
""
],
"path": "x-pack/plugins/apm/server/plugin.ts",
@@ -183,13 +171,7 @@
"description": [],
"signature": [
"(core: ",
- {
- "pluginId": "core",
- "scope": "server",
- "docId": "kibCorePluginApi",
- "section": "def-server.CoreSetup",
- "text": "CoreSetup"
- },
+ "CoreSetup",
"<",
"APMPluginStartDependencies",
", unknown>, plugins: ",
@@ -220,13 +202,7 @@
"label": "core",
"description": [],
"signature": [
- {
- "pluginId": "core",
- "scope": "server",
- "docId": "kibCorePluginApi",
- "section": "def-server.CoreSetup",
- "text": "CoreSetup"
- },
+ "CoreSetup",
"<",
"APMPluginStartDependencies",
", unknown>"
@@ -263,13 +239,7 @@
"description": [],
"signature": [
"(core: ",
- {
- "pluginId": "core",
- "scope": "server",
- "docId": "kibCorePluginApi",
- "section": "def-server.CoreStart",
- "text": "CoreStart"
- },
+ "CoreStart",
") => void"
],
"path": "x-pack/plugins/apm/server/plugin.ts",
@@ -284,13 +254,7 @@
"label": "core",
"description": [],
"signature": [
- {
- "pluginId": "core",
- "scope": "server",
- "docId": "kibCorePluginApi",
- "section": "def-server.CoreStart",
- "text": "CoreStart"
- }
+ "CoreStart"
],
"path": "x-pack/plugins/apm/server/plugin.ts",
"deprecated": false,
@@ -501,7 +465,7 @@
"section": "def-server.LicensingPluginStart",
"text": "LicensingPluginStart"
},
- ">; }; observability: { setup: { getScopedAnnotationsClient: (requestContext: ",
+ ">; }; observability: { setup: { getAlertDetailsConfig(): Readonly<{} & { apm: Readonly<{} & { enabled: boolean; }>; metrics: Readonly<{} & { enabled: boolean; }>; logs: Readonly<{} & { enabled: boolean; }>; uptime: Readonly<{} & { enabled: boolean; }>; }>; getScopedAnnotationsClient: (requestContext: ",
"RequestHandlerContext",
" & { licensing: Promise<",
{
@@ -753,7 +717,7 @@
"label": "APIEndpoint",
"description": [],
"signature": [
- "\"POST /internal/apm/data_view/static\" | \"GET /internal/apm/data_view/title\" | \"GET /internal/apm/environments\" | \"GET /internal/apm/services/{serviceName}/errors/groups/main_statistics\" | \"GET /internal/apm/services/{serviceName}/errors/groups/main_statistics_by_transaction_name\" | \"POST /internal/apm/services/{serviceName}/errors/groups/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/errors/{groupId}\" | \"GET /internal/apm/services/{serviceName}/errors/distribution\" | \"GET /internal/apm/services/{serviceName}/errors/{groupId}/top_erroneous_transactions\" | \"POST /internal/apm/latency/overall_distribution/transactions\" | \"GET /internal/apm/services/{serviceName}/metrics/charts\" | \"GET /internal/apm/services/{serviceName}/metrics/nodes\" | \"GET /internal/apm/services/{serviceName}/metrics/serverless/charts\" | \"GET /internal/apm/services/{serviceName}/metrics/serverless/summary\" | \"GET /internal/apm/services/{serviceName}/metrics/serverless/functions_overview\" | \"GET /internal/apm/services/{serviceName}/metrics/serverless/active_instances\" | \"GET /internal/apm/observability_overview\" | \"GET /internal/apm/observability_overview/has_data\" | \"GET /internal/apm/service-map\" | \"GET /internal/apm/service-map/service/{serviceName}\" | \"GET /internal/apm/service-map/dependency\" | \"GET /internal/apm/services\" | \"POST /internal/apm/services/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/metadata/details\" | \"GET /internal/apm/services/{serviceName}/metadata/icons\" | \"GET /internal/apm/services/{serviceName}/agent\" | \"GET /internal/apm/services/{serviceName}/transaction_types\" | \"GET /internal/apm/services/{serviceName}/node/{serviceNodeName}/metadata\" | \"GET /api/apm/services/{serviceName}/annotation/search\" | \"POST /api/apm/services/{serviceName}/annotation\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}\" | \"GET /internal/apm/services/{serviceName}/throughput\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/main_statistics\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/dependencies\" | \"GET /internal/apm/services/{serviceName}/dependencies/breakdown\" | \"GET /internal/apm/services/{serviceName}/anomaly_charts\" | \"GET /internal/apm/sorted_and_filtered_services\" | \"GET /internal/apm/service-groups\" | \"GET /internal/apm/service-group\" | \"POST /internal/apm/service-group\" | \"DELETE /internal/apm/service-group\" | \"GET /internal/apm/service-group/services\" | \"GET /internal/apm/service_groups/services_count\" | \"GET /internal/apm/suggestions\" | \"GET /internal/apm/traces/{traceId}\" | \"GET /internal/apm/traces\" | \"GET /internal/apm/traces/{traceId}/root_transaction\" | \"GET /internal/apm/transactions/{transactionId}\" | \"GET /internal/apm/traces/find\" | \"GET /internal/apm/services/{serviceName}/transactions/groups/main_statistics\" | \"GET /internal/apm/services/{serviceName}/transactions/groups/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/latency\" | \"GET /internal/apm/services/{serviceName}/transactions/traces/samples\" | \"GET /internal/apm/services/{serviceName}/transaction/charts/breakdown\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/error_rate\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/coldstart_rate\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/coldstart_rate_by_transaction_name\" | \"GET /internal/apm/rule_types/transaction_error_rate/chart_preview\" | \"GET /internal/apm/rule_types/transaction_duration/chart_preview\" | \"GET /internal/apm/rule_types/error_count/chart_preview\" | \"GET /api/apm/settings/agent-configuration\" | \"GET /api/apm/settings/agent-configuration/view\" | \"DELETE /api/apm/settings/agent-configuration\" | \"PUT /api/apm/settings/agent-configuration\" | \"POST /api/apm/settings/agent-configuration/search\" | \"GET /api/apm/settings/agent-configuration/environments\" | \"GET /api/apm/settings/agent-configuration/agent_name\" | \"GET /internal/apm/settings/anomaly-detection/jobs\" | \"POST /internal/apm/settings/anomaly-detection/jobs\" | \"GET /internal/apm/settings/anomaly-detection/environments\" | \"POST /internal/apm/settings/anomaly-detection/update_to_v3\" | \"GET /internal/apm/settings/apm-index-settings\" | \"GET /internal/apm/settings/apm-indices\" | \"POST /internal/apm/settings/apm-indices/save\" | \"GET /internal/apm/settings/custom_links/transaction\" | \"GET /internal/apm/settings/custom_links\" | \"POST /internal/apm/settings/custom_links\" | \"PUT /internal/apm/settings/custom_links/{id}\" | \"DELETE /internal/apm/settings/custom_links/{id}\" | \"GET /api/apm/sourcemaps\" | \"POST /api/apm/sourcemaps\" | \"DELETE /api/apm/sourcemaps/{id}\" | \"GET /internal/apm/fleet/has_apm_policies\" | \"GET /internal/apm/fleet/agents\" | \"POST /api/apm/fleet/apm_server_schema\" | \"GET /internal/apm/fleet/apm_server_schema/unsupported\" | \"GET /internal/apm/fleet/migration_check\" | \"POST /internal/apm/fleet/cloud_apm_package_policy\" | \"GET /internal/apm/fleet/java_agent_versions\" | \"GET /internal/apm/dependencies/top_dependencies\" | \"GET /internal/apm/dependencies/upstream_services\" | \"GET /internal/apm/dependencies/metadata\" | \"GET /internal/apm/dependencies/charts/latency\" | \"GET /internal/apm/dependencies/charts/throughput\" | \"GET /internal/apm/dependencies/charts/error_rate\" | \"GET /internal/apm/dependencies/operations\" | \"GET /internal/apm/dependencies/charts/distribution\" | \"GET /internal/apm/dependencies/operations/spans\" | \"GET /internal/apm/correlations/field_candidates/transactions\" | \"POST /internal/apm/correlations/field_stats/transactions\" | \"GET /internal/apm/correlations/field_value_stats/transactions\" | \"POST /internal/apm/correlations/field_value_pairs/transactions\" | \"POST /internal/apm/correlations/significant_correlations/transactions\" | \"POST /internal/apm/correlations/p_values/transactions\" | \"GET /internal/apm/fallback_to_transactions\" | \"GET /internal/apm/has_data\" | \"GET /internal/apm/event_metadata/{processorEvent}/{id}\" | \"GET /internal/apm/agent_keys\" | \"GET /internal/apm/agent_keys/privileges\" | \"POST /internal/apm/api_key/invalidate\" | \"POST /api/apm/agent_keys\" | \"GET /internal/apm/storage_explorer\" | \"GET /internal/apm/services/{serviceName}/storage_details\" | \"GET /internal/apm/storage_chart\" | \"GET /internal/apm/storage_explorer/privileges\" | \"GET /internal/apm/storage_explorer_summary_stats\" | \"GET /internal/apm/traces/{traceId}/span_links/{spanId}/parents\" | \"GET /internal/apm/traces/{traceId}/span_links/{spanId}/children\" | \"GET /internal/apm/services/{serviceName}/infrastructure_attributes\" | \"GET /internal/apm/debug-telemetry\" | \"GET /internal/apm/time_range_metadata\" | \"GET /internal/apm/settings/labs\""
+ "\"POST /internal/apm/data_view/static\" | \"GET /internal/apm/data_view/title\" | \"GET /internal/apm/environments\" | \"GET /internal/apm/services/{serviceName}/errors/groups/main_statistics\" | \"GET /internal/apm/services/{serviceName}/errors/groups/main_statistics_by_transaction_name\" | \"POST /internal/apm/services/{serviceName}/errors/groups/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/errors/{groupId}\" | \"GET /internal/apm/services/{serviceName}/errors/distribution\" | \"GET /internal/apm/services/{serviceName}/errors/{groupId}/top_erroneous_transactions\" | \"POST /internal/apm/latency/overall_distribution/transactions\" | \"GET /internal/apm/services/{serviceName}/metrics/charts\" | \"GET /internal/apm/services/{serviceName}/metrics/nodes\" | \"GET /internal/apm/services/{serviceName}/metrics/serverless/charts\" | \"GET /internal/apm/services/{serviceName}/metrics/serverless/summary\" | \"GET /internal/apm/services/{serviceName}/metrics/serverless/functions_overview\" | \"GET /internal/apm/services/{serviceName}/metrics/serverless/active_instances\" | \"GET /internal/apm/observability_overview\" | \"GET /internal/apm/observability_overview/has_data\" | \"GET /internal/apm/service-map\" | \"GET /internal/apm/service-map/service/{serviceName}\" | \"GET /internal/apm/service-map/dependency\" | \"GET /internal/apm/services\" | \"POST /internal/apm/services/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/metadata/details\" | \"GET /internal/apm/services/{serviceName}/metadata/icons\" | \"GET /internal/apm/services/{serviceName}/agent\" | \"GET /internal/apm/services/{serviceName}/transaction_types\" | \"GET /internal/apm/services/{serviceName}/node/{serviceNodeName}/metadata\" | \"GET /api/apm/services/{serviceName}/annotation/search\" | \"POST /api/apm/services/{serviceName}/annotation\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}\" | \"GET /internal/apm/services/{serviceName}/throughput\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/main_statistics\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/dependencies\" | \"GET /internal/apm/services/{serviceName}/dependencies/breakdown\" | \"GET /internal/apm/services/{serviceName}/anomaly_charts\" | \"GET /internal/apm/sorted_and_filtered_services\" | \"GET /internal/apm/service-groups\" | \"GET /internal/apm/service-group\" | \"POST /internal/apm/service-group\" | \"DELETE /internal/apm/service-group\" | \"GET /internal/apm/service-group/services\" | \"GET /internal/apm/service_groups/services_count\" | \"GET /internal/apm/suggestions\" | \"GET /internal/apm/traces/{traceId}\" | \"GET /internal/apm/traces\" | \"GET /internal/apm/traces/{traceId}/root_transaction\" | \"GET /internal/apm/transactions/{transactionId}\" | \"GET /internal/apm/traces/find\" | \"GET /internal/apm/services/{serviceName}/transactions/groups/main_statistics\" | \"GET /internal/apm/services/{serviceName}/transactions/groups/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/latency\" | \"GET /internal/apm/services/{serviceName}/transactions/traces/samples\" | \"GET /internal/apm/services/{serviceName}/transaction/charts/breakdown\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/error_rate\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/coldstart_rate\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/coldstart_rate_by_transaction_name\" | \"GET /internal/apm/rule_types/transaction_error_rate/chart_preview\" | \"GET /internal/apm/rule_types/transaction_duration/chart_preview\" | \"GET /internal/apm/rule_types/error_count/chart_preview\" | \"GET /api/apm/settings/agent-configuration\" | \"GET /api/apm/settings/agent-configuration/view\" | \"DELETE /api/apm/settings/agent-configuration\" | \"PUT /api/apm/settings/agent-configuration\" | \"POST /api/apm/settings/agent-configuration/search\" | \"GET /api/apm/settings/agent-configuration/environments\" | \"GET /api/apm/settings/agent-configuration/agent_name\" | \"GET /internal/apm/settings/anomaly-detection/jobs\" | \"POST /internal/apm/settings/anomaly-detection/jobs\" | \"GET /internal/apm/settings/anomaly-detection/environments\" | \"POST /internal/apm/settings/anomaly-detection/update_to_v3\" | \"GET /internal/apm/settings/apm-index-settings\" | \"GET /internal/apm/settings/apm-indices\" | \"POST /internal/apm/settings/apm-indices/save\" | \"GET /internal/apm/settings/custom_links/transaction\" | \"GET /internal/apm/settings/custom_links\" | \"POST /internal/apm/settings/custom_links\" | \"PUT /internal/apm/settings/custom_links/{id}\" | \"DELETE /internal/apm/settings/custom_links/{id}\" | \"GET /api/apm/sourcemaps\" | \"POST /api/apm/sourcemaps\" | \"DELETE /api/apm/sourcemaps/{id}\" | \"GET /internal/apm/fleet/has_apm_policies\" | \"GET /internal/apm/fleet/agents\" | \"POST /api/apm/fleet/apm_server_schema\" | \"GET /internal/apm/fleet/apm_server_schema/unsupported\" | \"GET /internal/apm/fleet/migration_check\" | \"POST /internal/apm/fleet/cloud_apm_package_policy\" | \"GET /internal/apm/fleet/java_agent_versions\" | \"GET /internal/apm/dependencies/top_dependencies\" | \"GET /internal/apm/dependencies/upstream_services\" | \"GET /internal/apm/dependencies/metadata\" | \"GET /internal/apm/dependencies/charts/latency\" | \"GET /internal/apm/dependencies/charts/throughput\" | \"GET /internal/apm/dependencies/charts/error_rate\" | \"GET /internal/apm/dependencies/operations\" | \"GET /internal/apm/dependencies/charts/distribution\" | \"GET /internal/apm/dependencies/operations/spans\" | \"GET /internal/apm/correlations/field_candidates/transactions\" | \"POST /internal/apm/correlations/field_stats/transactions\" | \"GET /internal/apm/correlations/field_value_stats/transactions\" | \"POST /internal/apm/correlations/field_value_pairs/transactions\" | \"POST /internal/apm/correlations/significant_correlations/transactions\" | \"POST /internal/apm/correlations/p_values/transactions\" | \"GET /internal/apm/fallback_to_transactions\" | \"GET /internal/apm/has_data\" | \"GET /internal/apm/event_metadata/{processorEvent}/{id}\" | \"GET /internal/apm/agent_keys\" | \"GET /internal/apm/agent_keys/privileges\" | \"POST /internal/apm/api_key/invalidate\" | \"POST /api/apm/agent_keys\" | \"GET /internal/apm/storage_explorer\" | \"GET /internal/apm/services/{serviceName}/storage_details\" | \"GET /internal/apm/storage_chart\" | \"GET /internal/apm/storage_explorer/privileges\" | \"GET /internal/apm/storage_explorer_summary_stats\" | \"GET /internal/apm/storage_explorer/is_cross_cluster_search\" | \"GET /internal/apm/storage_explorer/get_services\" | \"GET /internal/apm/traces/{traceId}/span_links/{spanId}/parents\" | \"GET /internal/apm/traces/{traceId}/span_links/{spanId}/children\" | \"GET /internal/apm/services/{serviceName}/infrastructure_attributes\" | \"GET /internal/apm/debug-telemetry\" | \"GET /internal/apm/time_range_metadata\" | \"GET /internal/apm/settings/labs\""
],
"path": "x-pack/plugins/apm/server/routes/apm_routes/get_global_apm_server_route_repository.ts",
"deprecated": false,
@@ -1027,6 +991,76 @@
"SpanLinkDetails",
"[]; }, ",
"APMRouteCreateOptions",
+ ">; \"GET /internal/apm/storage_explorer/get_services\": ",
+ "ServerRoute",
+ "<\"GET /internal/apm/storage_explorer/get_services\", ",
+ "TypeC",
+ "<{ query: ",
+ "IntersectionC",
+ "<[",
+ "TypeC",
+ "<{ indexLifecyclePhase: ",
+ "UnionC",
+ "<[",
+ "LiteralC",
+ "<",
+ "IndexLifecyclePhaseSelectOption",
+ ".All>, ",
+ "LiteralC",
+ "<",
+ "IndexLifecyclePhaseSelectOption",
+ ".Hot>, ",
+ "LiteralC",
+ "<",
+ "IndexLifecyclePhaseSelectOption",
+ ".Warm>, ",
+ "LiteralC",
+ "<",
+ "IndexLifecyclePhaseSelectOption",
+ ".Cold>, ",
+ "LiteralC",
+ "<",
+ "IndexLifecyclePhaseSelectOption",
+ ".Frozen>]>; }>, ",
+ "TypeC",
+ "<{ environment: ",
+ "UnionC",
+ "<[",
+ "LiteralC",
+ "<\"ENVIRONMENT_NOT_DEFINED\">, ",
+ "LiteralC",
+ "<\"ENVIRONMENT_ALL\">, ",
+ "BrandC",
+ "<",
+ "StringC",
+ ", ",
+ "NonEmptyStringBrand",
+ ">]>; }>, ",
+ "TypeC",
+ "<{ kuery: ",
+ "StringC",
+ "; }>]>; }>, ",
+ {
+ "pluginId": "apm",
+ "scope": "server",
+ "docId": "kibApmPluginApi",
+ "section": "def-server.APMRouteHandlerResources",
+ "text": "APMRouteHandlerResources"
+ },
+ ", { services: { serviceName: string; }[]; }, ",
+ "APMRouteCreateOptions",
+ ">; \"GET /internal/apm/storage_explorer/is_cross_cluster_search\": ",
+ "ServerRoute",
+ "<\"GET /internal/apm/storage_explorer/is_cross_cluster_search\", undefined, ",
+ {
+ "pluginId": "apm",
+ "scope": "server",
+ "docId": "kibApmPluginApi",
+ "section": "def-server.APMRouteHandlerResources",
+ "text": "APMRouteHandlerResources"
+ },
+ ", { isCrossClusterSearch: boolean; }, ",
+ "APMRouteCreateOptions",
">; \"GET /internal/apm/storage_explorer_summary_stats\": ",
"ServerRoute",
"<\"GET /internal/apm/storage_explorer_summary_stats\", ",
@@ -1093,7 +1127,7 @@
"section": "def-server.APMRouteHandlerResources",
"text": "APMRouteHandlerResources"
},
- ", { tracesPerMinute: number; numberOfServices: number; estimatedSize: number; dailyDataGeneration: number; }, ",
+ ", { tracesPerMinute: number; numberOfServices: number; totalSize: number; diskSpaceUsedPct: number; estimatedIncrementalSize: number; dailyDataGeneration: number; }, ",
"APMRouteCreateOptions",
">; \"GET /internal/apm/storage_explorer/privileges\": ",
"ServerRoute",
@@ -1253,7 +1287,7 @@
"section": "def-common.ProcessorEvent",
"text": "ProcessorEvent"
},
- "; docs: number; size: number; }[]; }, ",
+ "; docs: number; size: number; }[]; indicesStats: { indexName: string; numberOfDocs: number; primary?: string | number | undefined; replica?: string | number | undefined; size?: number | undefined; dataStream?: string | undefined; lifecyclePhase?: string | undefined; }[]; }, ",
"APMRouteCreateOptions",
">; \"GET /internal/apm/storage_explorer\": ",
"ServerRoute",
diff --git a/api_docs/apm.mdx b/api_docs/apm.mdx
index 913c686a7a008..28bca33e4c614 100644
--- a/api_docs/apm.mdx
+++ b/api_docs/apm.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/apm
title: "apm"
image: https://source.unsplash.com/400x175/?github
description: API docs for the apm plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'apm']
---
import apmObj from './apm.devdocs.json';
diff --git a/api_docs/banners.mdx b/api_docs/banners.mdx
index 0188bd4bbd567..7d791faedf094 100644
--- a/api_docs/banners.mdx
+++ b/api_docs/banners.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/banners
title: "banners"
image: https://source.unsplash.com/400x175/?github
description: API docs for the banners plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'banners']
---
import bannersObj from './banners.devdocs.json';
diff --git a/api_docs/bfetch.mdx b/api_docs/bfetch.mdx
index 3a48b2eb21a9f..5c5bbe2e36fd1 100644
--- a/api_docs/bfetch.mdx
+++ b/api_docs/bfetch.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/bfetch
title: "bfetch"
image: https://source.unsplash.com/400x175/?github
description: API docs for the bfetch plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'bfetch']
---
import bfetchObj from './bfetch.devdocs.json';
diff --git a/api_docs/canvas.mdx b/api_docs/canvas.mdx
index f9ea21275a294..bc1392ad75b6d 100644
--- a/api_docs/canvas.mdx
+++ b/api_docs/canvas.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/canvas
title: "canvas"
image: https://source.unsplash.com/400x175/?github
description: API docs for the canvas plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'canvas']
---
import canvasObj from './canvas.devdocs.json';
diff --git a/api_docs/cases.devdocs.json b/api_docs/cases.devdocs.json
index 4119ccb5ec28f..f65fddcd5909b 100644
--- a/api_docs/cases.devdocs.json
+++ b/api_docs/cases.devdocs.json
@@ -633,7 +633,7 @@
"section": "def-public.CaseAttachmentsWithoutOwner",
"text": "CaseAttachmentsWithoutOwner"
},
- " | undefined; }"
+ " | undefined; headerContent?: React.ReactNode; }"
],
"path": "x-pack/plugins/cases/public/client/ui/get_create_case_flyout.tsx",
"deprecated": false,
@@ -878,7 +878,7 @@
"label": "hooks",
"description": [],
"signature": [
- "{ getUseCasesAddToNewCaseFlyout: (props?: AddToNewCaseFlyoutProps) => { open: ({ attachments }?: { attachments?: ",
+ "{ getUseCasesAddToNewCaseFlyout: (props?: AddToNewCaseFlyoutProps) => { open: ({ attachments, headerContent, }?: { attachments?: ",
{
"pluginId": "cases",
"scope": "public",
@@ -886,7 +886,7 @@
"section": "def-public.CaseAttachmentsWithoutOwner",
"text": "CaseAttachmentsWithoutOwner"
},
- " | undefined; }) => void; close: () => void; }; getUseCasesAddToExistingCaseModal: (props?: AddToExistingFlyoutProps) => { open: ({ attachments }?: { attachments?: ",
+ " | undefined; headerContent?: React.ReactNode; }) => void; close: () => void; }; getUseCasesAddToExistingCaseModal: (props?: AddToExistingFlyoutProps) => { open: ({ attachments }?: { attachments?: ",
{
"pluginId": "cases",
"scope": "public",
diff --git a/api_docs/cases.mdx b/api_docs/cases.mdx
index 17c2f0bc24b98..d9c5661b5c4b2 100644
--- a/api_docs/cases.mdx
+++ b/api_docs/cases.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cases
title: "cases"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cases plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cases']
---
import casesObj from './cases.devdocs.json';
diff --git a/api_docs/charts.mdx b/api_docs/charts.mdx
index 1292beac03c9e..f3dcfed6730df 100644
--- a/api_docs/charts.mdx
+++ b/api_docs/charts.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/charts
title: "charts"
image: https://source.unsplash.com/400x175/?github
description: API docs for the charts plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'charts']
---
import chartsObj from './charts.devdocs.json';
diff --git a/api_docs/cloud.mdx b/api_docs/cloud.mdx
index 0be814b32854f..c2b55a2aabe72 100644
--- a/api_docs/cloud.mdx
+++ b/api_docs/cloud.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloud
title: "cloud"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cloud plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloud']
---
import cloudObj from './cloud.devdocs.json';
diff --git a/api_docs/cloud_chat.mdx b/api_docs/cloud_chat.mdx
index c59647a5538b5..3ca3216a3dbc4 100644
--- a/api_docs/cloud_chat.mdx
+++ b/api_docs/cloud_chat.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudChat
title: "cloudChat"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cloudChat plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudChat']
---
import cloudChatObj from './cloud_chat.devdocs.json';
diff --git a/api_docs/cloud_experiments.mdx b/api_docs/cloud_experiments.mdx
index 8427d221e4f63..ef7a3d160d2a0 100644
--- a/api_docs/cloud_experiments.mdx
+++ b/api_docs/cloud_experiments.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudExperiments
title: "cloudExperiments"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cloudExperiments plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudExperiments']
---
import cloudExperimentsObj from './cloud_experiments.devdocs.json';
diff --git a/api_docs/cloud_security_posture.mdx b/api_docs/cloud_security_posture.mdx
index 58e7f8a3c0e94..4276a3721f16f 100644
--- a/api_docs/cloud_security_posture.mdx
+++ b/api_docs/cloud_security_posture.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudSecurityPosture
title: "cloudSecurityPosture"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cloudSecurityPosture plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudSecurityPosture']
---
import cloudSecurityPostureObj from './cloud_security_posture.devdocs.json';
diff --git a/api_docs/console.mdx b/api_docs/console.mdx
index cd10bdee5aeb3..563b95c7f9602 100644
--- a/api_docs/console.mdx
+++ b/api_docs/console.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/console
title: "console"
image: https://source.unsplash.com/400x175/?github
description: API docs for the console plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'console']
---
import consoleObj from './console.devdocs.json';
diff --git a/api_docs/controls.mdx b/api_docs/controls.mdx
index 12050905e2c74..f4129d559970f 100644
--- a/api_docs/controls.mdx
+++ b/api_docs/controls.mdx
@@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/controls
title: "controls"
image: https://source.unsplash.com/400x175/?github
description: API docs for the controls plugin
-date: 2022-10-26
+date: 2022-10-28
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'controls']
---
import controlsObj from './controls.devdocs.json';
diff --git a/api_docs/core.devdocs.json b/api_docs/core.devdocs.json
index 969cd53cae5ba..34c162ad5a2a1 100644
--- a/api_docs/core.devdocs.json
+++ b/api_docs/core.devdocs.json
@@ -592,6 +592,30 @@
"plugin": "@kbn/core-analytics-server-internal",
"path": "packages/core/analytics/core-analytics-server-internal/src/analytics_service.ts"
},
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
{
"plugin": "@kbn/core-root-browser-internal",
"path": "packages/core/root/core-root-browser-internal/src/core_system.ts"
@@ -994,6 +1018,22 @@
"plugin": "@kbn/core-execution-context-browser-internal",
"path": "packages/core/execution-context/core-execution-context-browser-internal/src/execution_context_service.ts"
},
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
{
"plugin": "@kbn/core-status-server-internal",
"path": "packages/core/status/core-status-server-internal/src/status_service.ts"
@@ -19467,6 +19507,30 @@
"plugin": "@kbn/core-analytics-server-internal",
"path": "packages/core/analytics/core-analytics-server-internal/src/analytics_service.ts"
},
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
{
"plugin": "@kbn/core-root-browser-internal",
"path": "packages/core/root/core-root-browser-internal/src/core_system.ts"
@@ -19869,6 +19933,22 @@
"plugin": "@kbn/core-execution-context-browser-internal",
"path": "packages/core/execution-context/core-execution-context-browser-internal/src/execution_context_service.ts"
},
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts"
+ },
{
"plugin": "@kbn/core-status-server-internal",
"path": "packages/core/status/core-status-server-internal/src/status_service.ts"
@@ -20197,20 +20277,23 @@
"\nA plugin with asynchronous lifecycle methods.\n"
],
"signature": [
- {
- "pluginId": "core",
- "scope": "server",
- "docId": "kibCorePluginApi",
- "section": "def-server.AsyncPlugin",
- "text": "AsyncPlugin"
- },
+ "AsyncPlugin",
""
],
- "path": "src/core/server/plugins/types.ts",
+ "path": "node_modules/@types/kbn__core-plugins-server/index.d.ts",
"deprecated": true,
"removeBy": "8.8.0",
"trackAdoption": false,
- "references": [],
+ "references": [
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin.ts"
+ },
+ {
+ "plugin": "@kbn/core-plugins-server-internal",
+ "path": "packages/core/plugins/core-plugins-server-internal/src/plugin.ts"
+ }
+ ],
"children": [
{
"parentPluginId": "core",
@@ -20221,16 +20304,10 @@
"description": [],
"signature": [
"(core: ",
- {
- "pluginId": "core",
- "scope": "server",
- "docId": "kibCorePluginApi",
- "section": "def-server.CoreSetup",
- "text": "CoreSetup"
- },
+ "CoreSetup",
"
@@ -72,12 +72,12 @@ export const StepOne = ({ guidedOnboarding }: GuidedOnboardingExampleAppDeps) =>
onFinish={() => setIsTourStepOpen(false)}
step={1}
stepsTotal={1}
- title="Step Add data"
+ title="Step 1"
anchorPosition="rightUp"
>
{
- await guidedOnboardingApi?.completeGuideStep('search', 'add_data');
+ await guidedOnboardingApi?.completeGuideStep('testGuide', 'step1');
}}
>
Complete step 1
diff --git a/examples/guided_onboarding_example/public/components/step_three.tsx b/examples/guided_onboarding_example/public/components/step_three.tsx
index ffe9d87993611..eefb38165beed 100644
--- a/examples/guided_onboarding_example/public/components/step_three.tsx
+++ b/examples/guided_onboarding_example/public/components/step_three.tsx
@@ -30,7 +30,7 @@ export const StepThree = (props: StepThreeProps) => {
useEffect(() => {
const subscription = guidedOnboardingApi
- ?.isGuideStepActive$('search', 'search_experience')
+ ?.isGuideStepActive$('testGuide', 'step3')
.subscribe((isStepActive) => {
setIsTourStepOpen(isStepActive);
});
@@ -53,9 +53,17 @@ export const StepThree = (props: StepThreeProps) => {
+
+
+
@@ -73,12 +81,12 @@ export const StepThree = (props: StepThreeProps) => {
}}
step={1}
stepsTotal={1}
- title="Step Build search experience"
+ title="Step 3"
anchorPosition="rightUp"
>
{
- await guidedOnboardingApi?.completeGuideStep('search', 'search_experience');
+ await guidedOnboardingApi?.completeGuideStep('testGuide', 'step3');
}}
>
Complete step 3
diff --git a/examples/guided_onboarding_example/public/components/step_two.tsx b/examples/guided_onboarding_example/public/components/step_two.tsx
index 07f4fd7e63e0c..89c0c37e46e4a 100644
--- a/examples/guided_onboarding_example/public/components/step_two.tsx
+++ b/examples/guided_onboarding_example/public/components/step_two.tsx
@@ -6,37 +6,17 @@
* Side Public License, v 1.
*/
-import React, { useEffect, useState } from 'react';
+import React from 'react';
-import { EuiButton, EuiSpacer, EuiText, EuiTitle, EuiTourStep } from '@elastic/eui';
+import { EuiText, EuiTitle } from '@elastic/eui';
-import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public/types';
import { FormattedMessage } from '@kbn/i18n-react';
import {
EuiPageContentHeader_Deprecated as EuiPageContentHeader,
EuiPageContentBody_Deprecated as EuiPageContentBody,
} from '@elastic/eui';
-interface StepTwoProps {
- guidedOnboarding: GuidedOnboardingPluginStart;
-}
-
-export const StepTwo = (props: StepTwoProps) => {
- const {
- guidedOnboarding: { guidedOnboardingApi },
- } = props;
-
- const [isTourStepOpen, setIsTourStepOpen] = useState(false);
-
- useEffect(() => {
- const subscription = guidedOnboardingApi
- ?.isGuideStepActive$('search', 'browse_docs')
- .subscribe((isStepActive) => {
- setIsTourStepOpen(isStepActive);
- });
- return () => subscription?.unsubscribe();
- }, [guidedOnboardingApi]);
-
+export const StepTwo = () => {
return (
<>
@@ -54,36 +34,11 @@ export const StepTwo = (props: StepTwoProps) => {
-
-
- Click this button to complete step 2.
-
- }
- isStepOpen={isTourStepOpen}
- minWidth={300}
- onFinish={() => {
- setIsTourStepOpen(false);
- }}
- step={1}
- stepsTotal={1}
- title="Step Browse documents"
- anchorPosition="rightUp"
- >
- {
- await guidedOnboardingApi?.completeGuideStep('search', 'browse_docs');
- }}
- >
- Complete step 2
-
-
>
);
diff --git a/package.json b/package.json
index 7144902af8e39..6b392f582dc14 100644
--- a/package.json
+++ b/package.json
@@ -241,6 +241,9 @@
"@kbn/core-lifecycle-browser": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser",
"@kbn/core-lifecycle-browser-internal": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser-internal",
"@kbn/core-lifecycle-browser-mocks": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser-mocks",
+ "@kbn/core-lifecycle-server": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server",
+ "@kbn/core-lifecycle-server-internal": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server-internal",
+ "@kbn/core-lifecycle-server-mocks": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server-mocks",
"@kbn/core-logging-server": "link:bazel-bin/packages/core/logging/core-logging-server",
"@kbn/core-logging-server-internal": "link:bazel-bin/packages/core/logging/core-logging-server-internal",
"@kbn/core-logging-server-mocks": "link:bazel-bin/packages/core/logging/core-logging-server-mocks",
@@ -264,6 +267,9 @@
"@kbn/core-plugins-browser": "link:bazel-bin/packages/core/plugins/core-plugins-browser",
"@kbn/core-plugins-browser-internal": "link:bazel-bin/packages/core/plugins/core-plugins-browser-internal",
"@kbn/core-plugins-browser-mocks": "link:bazel-bin/packages/core/plugins/core-plugins-browser-mocks",
+ "@kbn/core-plugins-server": "link:bazel-bin/packages/core/plugins/core-plugins-server",
+ "@kbn/core-plugins-server-internal": "link:bazel-bin/packages/core/plugins/core-plugins-server-internal",
+ "@kbn/core-plugins-server-mocks": "link:bazel-bin/packages/core/plugins/core-plugins-server-mocks",
"@kbn/core-preboot-server": "link:bazel-bin/packages/core/preboot/core-preboot-server",
"@kbn/core-preboot-server-internal": "link:bazel-bin/packages/core/preboot/core-preboot-server-internal",
"@kbn/core-preboot-server-mocks": "link:bazel-bin/packages/core/preboot/core-preboot-server-mocks",
@@ -979,6 +985,9 @@
"@types/kbn__core-lifecycle-browser": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser/npm_module_types",
"@types/kbn__core-lifecycle-browser-internal": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser-internal/npm_module_types",
"@types/kbn__core-lifecycle-browser-mocks": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-browser-mocks/npm_module_types",
+ "@types/kbn__core-lifecycle-server": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server/npm_module_types",
+ "@types/kbn__core-lifecycle-server-internal": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server-internal/npm_module_types",
+ "@types/kbn__core-lifecycle-server-mocks": "link:bazel-bin/packages/core/lifecycle/core-lifecycle-server-mocks/npm_module_types",
"@types/kbn__core-logging-server": "link:bazel-bin/packages/core/logging/core-logging-server/npm_module_types",
"@types/kbn__core-logging-server-internal": "link:bazel-bin/packages/core/logging/core-logging-server-internal/npm_module_types",
"@types/kbn__core-logging-server-mocks": "link:bazel-bin/packages/core/logging/core-logging-server-mocks/npm_module_types",
@@ -1002,6 +1011,9 @@
"@types/kbn__core-plugins-browser": "link:bazel-bin/packages/core/plugins/core-plugins-browser/npm_module_types",
"@types/kbn__core-plugins-browser-internal": "link:bazel-bin/packages/core/plugins/core-plugins-browser-internal/npm_module_types",
"@types/kbn__core-plugins-browser-mocks": "link:bazel-bin/packages/core/plugins/core-plugins-browser-mocks/npm_module_types",
+ "@types/kbn__core-plugins-server": "link:bazel-bin/packages/core/plugins/core-plugins-server/npm_module_types",
+ "@types/kbn__core-plugins-server-internal": "link:bazel-bin/packages/core/plugins/core-plugins-server-internal/npm_module_types",
+ "@types/kbn__core-plugins-server-mocks": "link:bazel-bin/packages/core/plugins/core-plugins-server-mocks/npm_module_types",
"@types/kbn__core-preboot-server": "link:bazel-bin/packages/core/preboot/core-preboot-server/npm_module_types",
"@types/kbn__core-preboot-server-internal": "link:bazel-bin/packages/core/preboot/core-preboot-server-internal/npm_module_types",
"@types/kbn__core-preboot-server-mocks": "link:bazel-bin/packages/core/preboot/core-preboot-server-mocks/npm_module_types",
@@ -1307,7 +1319,7 @@
"callsites": "^3.1.0",
"chance": "1.0.18",
"chokidar": "^3.5.3",
- "chromedriver": "^105.0.1",
+ "chromedriver": "^107.0.0",
"clean-webpack-plugin": "^3.0.0",
"compression-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^6.0.2",
@@ -1316,13 +1328,13 @@
"cssnano": "^5.1.12",
"cssnano-preset-default": "^5.2.12",
"csstype": "^3.0.2",
- "cypress": "^10.9.0",
+ "cypress": "^10.10.0",
"cypress-axe": "^1.0.0",
"cypress-file-upload": "^5.0.8",
"cypress-multi-reporters": "^1.6.1",
"cypress-pipe": "^2.0.0",
"cypress-react-selector": "^3.0.0",
- "cypress-real-events": "^1.7.1",
+ "cypress-real-events": "^1.7.2",
"cypress-recurse": "^1.23.0",
"debug": "^2.6.9",
"delete-empty": "^2.0.0",
diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel
index b68c27b27f3dd..d14389555251f 100644
--- a/packages/BUILD.bazel
+++ b/packages/BUILD.bazel
@@ -105,6 +105,9 @@ filegroup(
"//packages/core/lifecycle/core-lifecycle-browser:build",
"//packages/core/lifecycle/core-lifecycle-browser-internal:build",
"//packages/core/lifecycle/core-lifecycle-browser-mocks:build",
+ "//packages/core/lifecycle/core-lifecycle-server:build",
+ "//packages/core/lifecycle/core-lifecycle-server-internal:build",
+ "//packages/core/lifecycle/core-lifecycle-server-mocks:build",
"//packages/core/logging/core-logging-server:build",
"//packages/core/logging/core-logging-server-internal:build",
"//packages/core/logging/core-logging-server-mocks:build",
@@ -128,6 +131,9 @@ filegroup(
"//packages/core/plugins/core-plugins-browser:build",
"//packages/core/plugins/core-plugins-browser-internal:build",
"//packages/core/plugins/core-plugins-browser-mocks:build",
+ "//packages/core/plugins/core-plugins-server:build",
+ "//packages/core/plugins/core-plugins-server-internal:build",
+ "//packages/core/plugins/core-plugins-server-mocks:build",
"//packages/core/preboot/core-preboot-server:build",
"//packages/core/preboot/core-preboot-server-internal:build",
"//packages/core/preboot/core-preboot-server-mocks:build",
@@ -454,6 +460,9 @@ filegroup(
"//packages/core/lifecycle/core-lifecycle-browser:build_types",
"//packages/core/lifecycle/core-lifecycle-browser-internal:build_types",
"//packages/core/lifecycle/core-lifecycle-browser-mocks:build_types",
+ "//packages/core/lifecycle/core-lifecycle-server:build_types",
+ "//packages/core/lifecycle/core-lifecycle-server-internal:build_types",
+ "//packages/core/lifecycle/core-lifecycle-server-mocks:build_types",
"//packages/core/logging/core-logging-server:build_types",
"//packages/core/logging/core-logging-server-internal:build_types",
"//packages/core/logging/core-logging-server-mocks:build_types",
@@ -477,6 +486,9 @@ filegroup(
"//packages/core/plugins/core-plugins-browser:build_types",
"//packages/core/plugins/core-plugins-browser-internal:build_types",
"//packages/core/plugins/core-plugins-browser-mocks:build_types",
+ "//packages/core/plugins/core-plugins-server:build_types",
+ "//packages/core/plugins/core-plugins-server-internal:build_types",
+ "//packages/core/plugins/core-plugins-server-mocks:build_types",
"//packages/core/preboot/core-preboot-server:build_types",
"//packages/core/preboot/core-preboot-server-internal:build_types",
"//packages/core/preboot/core-preboot-server-mocks:build_types",
diff --git a/packages/core/analytics/core-analytics-browser-internal/src/logger.ts b/packages/core/analytics/core-analytics-browser-internal/src/logger.ts
index 869fdbbd9fd85..ff403a7d46d2c 100644
--- a/packages/core/analytics/core-analytics-browser-internal/src/logger.ts
+++ b/packages/core/analytics/core-analytics-browser-internal/src/logger.ts
@@ -30,6 +30,7 @@ export function createLogger(isDev: boolean): Logger {
trace: (...args) => (isDev ? console.trace(...args) : void 0),
// eslint-disable-next-line no-console
log: (...args) => (isDev ? console.log(...args) : void 0),
+ isLevelEnabled: () => true,
get: () => logger,
};
diff --git a/packages/core/lifecycle/core-lifecycle-server-internal/BUILD.bazel b/packages/core/lifecycle/core-lifecycle-server-internal/BUILD.bazel
new file mode 100644
index 0000000000000..f09460293560f
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/BUILD.bazel
@@ -0,0 +1,125 @@
+load("@npm//@bazel/typescript:index.bzl", "ts_config")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
+
+PKG_DIRNAME = "core-lifecycle-server-internal"
+PKG_REQUIRE_NAME = "@kbn/core-lifecycle-server-internal"
+
+SOURCE_FILES = glob(
+ [
+ "**/*.ts",
+ ],
+ exclude = [
+ "**/*.config.js",
+ "**/*.mock.*",
+ "**/*.test.*",
+ "**/*.stories.*",
+ "**/__snapshots__/**",
+ "**/integration_tests/**",
+ "**/mocks/**",
+ "**/scripts/**",
+ "**/storybook/**",
+ "**/test_fixtures/**",
+ "**/test_helpers/**",
+ ],
+)
+
+SRCS = SOURCE_FILES
+
+filegroup(
+ name = "srcs",
+ srcs = SRCS,
+)
+
+NPM_MODULE_EXTRA_FILES = [
+ "package.json",
+]
+
+RUNTIME_DEPS = [
+]
+
+TYPES_DEPS = [
+ "@npm//@types/node",
+ "@npm//@types/jest",
+ "//packages/core/logging/core-logging-server-internal:npm_module_types",
+ "//packages/core/analytics/core-analytics-server:npm_module_types",
+ "//packages/core/preboot/core-preboot-server-internal:npm_module_types",
+ "//packages/core/http/core-http-context-server-internal:npm_module_types",
+ "//packages/core/http/core-http-server-internal:npm_module_types",
+ "//packages/core/elasticsearch/core-elasticsearch-server-internal:npm_module_types",
+ "//packages/core/ui-settings/core-ui-settings-server-internal:npm_module_types",
+ "//packages/core/http/core-http-resources-server-internal:npm_module_types",
+ "//packages/core/capabilities/core-capabilities-server:npm_module_types",
+ "//packages/core/doc-links/core-doc-links-server:npm_module_types",
+ "//packages/core/i18n/core-i18n-server:npm_module_types",
+ "//packages/core/environment/core-environment-server-internal:npm_module_types",
+ "//packages/core/execution-context/core-execution-context-server-internal:npm_module_types",
+ "//packages/core/deprecations/core-deprecations-server-internal:npm_module_types",
+ "//packages/core/metrics/core-metrics-server-internal:npm_module_types",
+ "//packages/core/rendering/core-rendering-server-internal:npm_module_types",
+ "//packages/core/saved-objects/core-saved-objects-server-internal:npm_module_types",
+ "//packages/core/status/core-status-server-internal:npm_module_types",
+ "//packages/core/usage-data/core-usage-data-base-server-internal:npm_module_types",
+ "//packages/core/usage-data/core-usage-data-server:npm_module_types",
+]
+
+jsts_transpiler(
+ name = "target_node",
+ srcs = SRCS,
+ build_pkg_name = package_name(),
+)
+
+ts_config(
+ name = "tsconfig",
+ src = "tsconfig.json",
+ deps = [
+ "//:tsconfig.base.json",
+ "//:tsconfig.bazel.json",
+ ],
+)
+
+ts_project(
+ name = "tsc_types",
+ args = ['--pretty'],
+ srcs = SRCS,
+ deps = TYPES_DEPS,
+ declaration = True,
+ declaration_map = True,
+ emit_declaration_only = True,
+ out_dir = "target_types",
+ tsconfig = ":tsconfig",
+)
+
+js_library(
+ name = PKG_DIRNAME,
+ srcs = NPM_MODULE_EXTRA_FILES,
+ deps = RUNTIME_DEPS + [":target_node"],
+ package_name = PKG_REQUIRE_NAME,
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm(
+ name = "npm_module",
+ deps = [":" + PKG_DIRNAME],
+)
+
+filegroup(
+ name = "build",
+ srcs = [":npm_module"],
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm_types(
+ name = "npm_module_types",
+ srcs = SRCS,
+ deps = [":tsc_types"],
+ package_name = PKG_REQUIRE_NAME,
+ tsconfig = ":tsconfig",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "build_types",
+ srcs = [":npm_module_types"],
+ visibility = ["//visibility:public"],
+)
diff --git a/packages/core/lifecycle/core-lifecycle-server-internal/README.md b/packages/core/lifecycle/core-lifecycle-server-internal/README.md
new file mode 100644
index 0000000000000..b2eecd8ad21ad
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/README.md
@@ -0,0 +1,7 @@
+# @kbn/core-lifecycle-server-internal
+
+
+This package contains the internal types for core's server-side lifecycle contracts:
+- `InternalCorePreboot`
+- `InternalCoreSetup`
+- `InternalCoreStart`
diff --git a/packages/core/lifecycle/core-lifecycle-server-internal/index.ts b/packages/core/lifecycle/core-lifecycle-server-internal/index.ts
new file mode 100644
index 0000000000000..6c3a41be1b49d
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/index.ts
@@ -0,0 +1,9 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export type { InternalCorePreboot, InternalCoreSetup, InternalCoreStart } from './src';
diff --git a/src/core/server/integration_tests/plugins/plugins_service.test.mocks.ts b/packages/core/lifecycle/core-lifecycle-server-internal/jest.config.js
similarity index 56%
rename from src/core/server/integration_tests/plugins/plugins_service.test.mocks.ts
rename to packages/core/lifecycle/core-lifecycle-server-internal/jest.config.js
index d20d3bc094ac4..039817196b1fe 100644
--- a/src/core/server/integration_tests/plugins/plugins_service.test.mocks.ts
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/jest.config.js
@@ -6,13 +6,8 @@
* Side Public License, v 1.
*/
-export const mockPackage = {
- raw: { __dirname: '/tmp' } as any,
+module.exports = {
+ preset: '@kbn/test/jest_node',
+ rootDir: '../../../..',
+ roots: ['/packages/core/lifecycle/core-lifecycle-server-internal'],
};
-
-jest.doMock('load-json-file', () => ({
- sync: () => mockPackage.raw,
-}));
-
-export const mockDiscover = jest.fn();
-jest.mock('../../plugins/discovery/plugins_discovery', () => ({ discover: mockDiscover }));
diff --git a/packages/core/lifecycle/core-lifecycle-server-internal/kibana.jsonc b/packages/core/lifecycle/core-lifecycle-server-internal/kibana.jsonc
new file mode 100644
index 0000000000000..7f8fa2fc8f6ad
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/kibana.jsonc
@@ -0,0 +1,7 @@
+{
+ "type": "shared-common",
+ "id": "@kbn/core-lifecycle-server-internal",
+ "owner": "@elastic/kibana-core",
+ "runtimeDeps": [],
+ "typeDeps": [],
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-internal/package.json b/packages/core/lifecycle/core-lifecycle-server-internal/package.json
new file mode 100644
index 0000000000000..9b0c909b58e0e
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@kbn/core-lifecycle-server-internal",
+ "private": true,
+ "version": "1.0.0",
+ "main": "./target_node/index.js",
+ "author": "Kibana Core",
+ "license": "SSPL-1.0 OR Elastic License 2.0"
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-internal/src/index.ts b/packages/core/lifecycle/core-lifecycle-server-internal/src/index.ts
new file mode 100644
index 0000000000000..617706c7d53f9
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/src/index.ts
@@ -0,0 +1,11 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export type { InternalCorePreboot } from './internal_core_preboot';
+export type { InternalCoreSetup } from './internal_core_setup';
+export type { InternalCoreStart } from './internal_core_start';
diff --git a/packages/core/lifecycle/core-lifecycle-server-internal/src/internal_core_preboot.ts b/packages/core/lifecycle/core-lifecycle-server-internal/src/internal_core_preboot.ts
new file mode 100644
index 0000000000000..18f4c605c1b16
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/src/internal_core_preboot.ts
@@ -0,0 +1,27 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+import type { InternalLoggingServicePreboot } from '@kbn/core-logging-server-internal';
+import type { AnalyticsServicePreboot } from '@kbn/core-analytics-server';
+import type { InternalPrebootServicePreboot } from '@kbn/core-preboot-server-internal';
+import type { InternalContextPreboot } from '@kbn/core-http-context-server-internal';
+import type { InternalHttpServicePreboot } from '@kbn/core-http-server-internal';
+import type { InternalElasticsearchServicePreboot } from '@kbn/core-elasticsearch-server-internal';
+import type { InternalUiSettingsServicePreboot } from '@kbn/core-ui-settings-server-internal';
+import type { InternalHttpResourcesPreboot } from '@kbn/core-http-resources-server-internal';
+
+/** @internal */
+export interface InternalCorePreboot {
+ analytics: AnalyticsServicePreboot;
+ context: InternalContextPreboot;
+ http: InternalHttpServicePreboot;
+ elasticsearch: InternalElasticsearchServicePreboot;
+ uiSettings: InternalUiSettingsServicePreboot;
+ httpResources: InternalHttpResourcesPreboot;
+ logging: InternalLoggingServicePreboot;
+ preboot: InternalPrebootServicePreboot;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-internal/src/internal_core_setup.ts b/packages/core/lifecycle/core-lifecycle-server-internal/src/internal_core_setup.ts
new file mode 100644
index 0000000000000..5e706cd5f5b0c
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/src/internal_core_setup.ts
@@ -0,0 +1,48 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import type { AnalyticsServiceSetup } from '@kbn/core-analytics-server';
+import type { CapabilitiesSetup } from '@kbn/core-capabilities-server';
+import type { DocLinksServiceSetup } from '@kbn/core-doc-links-server';
+import type { I18nServiceSetup } from '@kbn/core-i18n-server';
+import type { InternalElasticsearchServiceSetup } from '@kbn/core-elasticsearch-server-internal';
+import type { InternalEnvironmentServiceSetup } from '@kbn/core-environment-server-internal';
+import type { InternalExecutionContextSetup } from '@kbn/core-execution-context-server-internal';
+import type { InternalContextSetup } from '@kbn/core-http-context-server-internal';
+import type { InternalDeprecationsServiceSetup } from '@kbn/core-deprecations-server-internal';
+import type { InternalHttpResourcesSetup } from '@kbn/core-http-resources-server-internal';
+import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal';
+import type { InternalLoggingServiceSetup } from '@kbn/core-logging-server-internal';
+import type { InternalMetricsServiceSetup } from '@kbn/core-metrics-server-internal';
+import type { InternalRenderingServiceSetup } from '@kbn/core-rendering-server-internal';
+import type { InternalSavedObjectsServiceSetup } from '@kbn/core-saved-objects-server-internal';
+import type { InternalStatusServiceSetup } from '@kbn/core-status-server-internal';
+import type { InternalUiSettingsServiceSetup } from '@kbn/core-ui-settings-server-internal';
+import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
+
+/** @internal */
+export interface InternalCoreSetup {
+ analytics: AnalyticsServiceSetup;
+ capabilities: CapabilitiesSetup;
+ context: InternalContextSetup;
+ docLinks: DocLinksServiceSetup;
+ http: InternalHttpServiceSetup;
+ elasticsearch: InternalElasticsearchServiceSetup;
+ executionContext: InternalExecutionContextSetup;
+ i18n: I18nServiceSetup;
+ savedObjects: InternalSavedObjectsServiceSetup;
+ status: InternalStatusServiceSetup;
+ uiSettings: InternalUiSettingsServiceSetup;
+ environment: InternalEnvironmentServiceSetup;
+ rendering: InternalRenderingServiceSetup;
+ httpResources: InternalHttpResourcesSetup;
+ logging: InternalLoggingServiceSetup;
+ metrics: InternalMetricsServiceSetup;
+ deprecations: InternalDeprecationsServiceSetup;
+ coreUsageData: InternalCoreUsageDataSetup;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-internal/src/internal_core_start.ts b/packages/core/lifecycle/core-lifecycle-server-internal/src/internal_core_start.ts
new file mode 100644
index 0000000000000..e4d777d137b70
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/src/internal_core_start.ts
@@ -0,0 +1,36 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import type { AnalyticsServiceStart } from '@kbn/core-analytics-server';
+import type { CapabilitiesStart } from '@kbn/core-capabilities-server';
+import type { InternalDeprecationsServiceStart } from '@kbn/core-deprecations-server-internal';
+import type { DocLinksServiceStart } from '@kbn/core-doc-links-server';
+import type { InternalElasticsearchServiceStart } from '@kbn/core-elasticsearch-server-internal';
+import type { InternalExecutionContextStart } from '@kbn/core-execution-context-server-internal';
+import type { InternalHttpServiceStart } from '@kbn/core-http-server-internal';
+import type { InternalMetricsServiceStart } from '@kbn/core-metrics-server-internal';
+import type { InternalSavedObjectsServiceStart } from '@kbn/core-saved-objects-server-internal';
+import type { InternalUiSettingsServiceStart } from '@kbn/core-ui-settings-server-internal';
+import type { CoreUsageDataStart } from '@kbn/core-usage-data-server';
+
+/**
+ * @internal
+ */
+export interface InternalCoreStart {
+ analytics: AnalyticsServiceStart;
+ capabilities: CapabilitiesStart;
+ elasticsearch: InternalElasticsearchServiceStart;
+ docLinks: DocLinksServiceStart;
+ http: InternalHttpServiceStart;
+ metrics: InternalMetricsServiceStart;
+ savedObjects: InternalSavedObjectsServiceStart;
+ uiSettings: InternalUiSettingsServiceStart;
+ coreUsageData: CoreUsageDataStart;
+ executionContext: InternalExecutionContextStart;
+ deprecations: InternalDeprecationsServiceStart;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-internal/tsconfig.json b/packages/core/lifecycle/core-lifecycle-server-internal/tsconfig.json
new file mode 100644
index 0000000000000..71bb40fe57f3f
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-internal/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "extends": "../../../../tsconfig.bazel.json",
+ "compilerOptions": {
+ "declaration": true,
+ "declarationMap": true,
+ "emitDeclarationOnly": true,
+ "outDir": "target_types",
+ "stripInternal": false,
+ "types": [
+ "jest",
+ "node"
+ ]
+ },
+ "include": [
+ "**/*.ts",
+ ]
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/BUILD.bazel b/packages/core/lifecycle/core-lifecycle-server-mocks/BUILD.bazel
new file mode 100644
index 0000000000000..95f299b0062cd
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/BUILD.bazel
@@ -0,0 +1,143 @@
+load("@npm//@bazel/typescript:index.bzl", "ts_config")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
+
+PKG_DIRNAME = "core-lifecycle-server-mocks"
+PKG_REQUIRE_NAME = "@kbn/core-lifecycle-server-mocks"
+
+SOURCE_FILES = glob(
+ [
+ "**/*.ts",
+ ],
+ exclude = [
+ "**/*.config.js",
+ "**/*.test.*",
+ "**/*.stories.*",
+ "**/__snapshots__/**",
+ "**/integration_tests/**",
+ "**/scripts/**",
+ "**/storybook/**",
+ "**/test_fixtures/**",
+ "**/test_helpers/**",
+ ],
+)
+
+SRCS = SOURCE_FILES
+
+filegroup(
+ name = "srcs",
+ srcs = SRCS,
+)
+
+NPM_MODULE_EXTRA_FILES = [
+ "package.json",
+]
+
+RUNTIME_DEPS = [
+ "//packages/core/analytics/core-analytics-server-mocks",
+ "//packages/core/capabilities/core-capabilities-server-mocks",
+ "//packages/core/doc-links/core-doc-links-server-mocks",
+ "//packages/core/deprecations/core-deprecations-server-mocks",
+ "//packages/core/elasticsearch/core-elasticsearch-server-mocks",
+ "//packages/core/environment/core-environment-server-mocks",
+ "//packages/core/execution-context/core-execution-context-server-mocks",
+ "//packages/core/http/core-http-context-server-mocks",
+ "//packages/core/http/core-http-server-mocks",
+ "//packages/core/http/core-http-resources-server-mocks",
+ "//packages/core/i18n/core-i18n-server-mocks",
+ "//packages/core/lifecycle/core-lifecycle-server",
+ "//packages/core/metrics/core-metrics-server-mocks",
+ "//packages/core/preboot/core-preboot-server-mocks",
+ "//packages/core/rendering/core-rendering-server-mocks",
+ "//packages/core/saved-objects/core-saved-objects-server-mocks",
+ "//packages/core/status/core-status-server-mocks",
+ "//packages/core/ui-settings/core-ui-settings-server-mocks",
+ "//packages/core/usage-data/core-usage-data-server-mocks",
+
+]
+
+TYPES_DEPS = [
+ "@npm//@types/node",
+ "@npm//@types/jest",
+ "//packages/kbn-utility-types-jest:npm_module_types",
+ "//packages/core/analytics/core-analytics-server-mocks:npm_module_types",
+ "//packages/core/capabilities/core-capabilities-server-mocks:npm_module_types",
+ "//packages/core/doc-links/core-doc-links-server-mocks:npm_module_types",
+ "//packages/core/deprecations/core-deprecations-server-mocks:npm_module_types",
+ "//packages/core/elasticsearch/core-elasticsearch-server-mocks:npm_module_types",
+ "//packages/core/environment/core-environment-server-mocks:npm_module_types",
+ "//packages/core/execution-context/core-execution-context-server-mocks:npm_module_types",
+ "//packages/core/http/core-http-context-server-mocks:npm_module_types",
+ "//packages/core/http/core-http-server-mocks:npm_module_types",
+ "//packages/core/http/core-http-resources-server-mocks:npm_module_types",
+ "//packages/core/i18n/core-i18n-server-mocks:npm_module_types",
+ "//packages/core/lifecycle/core-lifecycle-server:npm_module_types",
+ "//packages/core/metrics/core-metrics-server-mocks:npm_module_types",
+ "//packages/core/preboot/core-preboot-server-mocks:npm_module_types",
+ "//packages/core/rendering/core-rendering-server-mocks:npm_module_types",
+ "//packages/core/saved-objects/core-saved-objects-server-mocks:npm_module_types",
+ "//packages/core/status/core-status-server-mocks:npm_module_types",
+ "//packages/core/ui-settings/core-ui-settings-server-mocks:npm_module_types",
+ "//packages/core/usage-data/core-usage-data-server-mocks:npm_module_types",
+]
+
+jsts_transpiler(
+ name = "target_node",
+ srcs = SRCS,
+ build_pkg_name = package_name(),
+)
+
+ts_config(
+ name = "tsconfig",
+ src = "tsconfig.json",
+ deps = [
+ "//:tsconfig.base.json",
+ "//:tsconfig.bazel.json",
+ ],
+)
+
+ts_project(
+ name = "tsc_types",
+ args = ['--pretty'],
+ srcs = SRCS,
+ deps = TYPES_DEPS,
+ declaration = True,
+ declaration_map = True,
+ emit_declaration_only = True,
+ out_dir = "target_types",
+ tsconfig = ":tsconfig",
+)
+
+js_library(
+ name = PKG_DIRNAME,
+ srcs = NPM_MODULE_EXTRA_FILES,
+ deps = RUNTIME_DEPS + [":target_node"],
+ package_name = PKG_REQUIRE_NAME,
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm(
+ name = "npm_module",
+ deps = [":" + PKG_DIRNAME],
+)
+
+filegroup(
+ name = "build",
+ srcs = [":npm_module"],
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm_types(
+ name = "npm_module_types",
+ srcs = SRCS,
+ deps = [":tsc_types"],
+ package_name = PKG_REQUIRE_NAME,
+ tsconfig = ":tsconfig",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "build_types",
+ srcs = [":npm_module_types"],
+ visibility = ["//visibility:public"],
+)
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/README.md b/packages/core/lifecycle/core-lifecycle-server-mocks/README.md
new file mode 100644
index 0000000000000..6603c268f3d94
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/README.md
@@ -0,0 +1,5 @@
+# @kbn/core-lifecycle-server-mocks
+
+This package contains the mocks for core's server-side lifecycle contracts:
+- `coreLifecycleMock`
+- `coreInternalLifecycleMock`
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/index.ts b/packages/core/lifecycle/core-lifecycle-server-mocks/index.ts
new file mode 100644
index 0000000000000..e17f4db9de973
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/index.ts
@@ -0,0 +1,9 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export { coreLifecycleMock, coreInternalLifecycleMock } from './src';
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/jest.config.js b/packages/core/lifecycle/core-lifecycle-server-mocks/jest.config.js
new file mode 100644
index 0000000000000..3db7ab516cd56
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/jest.config.js
@@ -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: ['/packages/core/lifecycle/core-lifecycle-server-mocks'],
+};
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/kibana.jsonc b/packages/core/lifecycle/core-lifecycle-server-mocks/kibana.jsonc
new file mode 100644
index 0000000000000..ea9bbadfd57e9
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/kibana.jsonc
@@ -0,0 +1,7 @@
+{
+ "type": "shared-common",
+ "id": "@kbn/core-lifecycle-server-mocks",
+ "owner": "@elastic/kibana-core",
+ "runtimeDeps": [],
+ "typeDeps": [],
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/package.json b/packages/core/lifecycle/core-lifecycle-server-mocks/package.json
new file mode 100644
index 0000000000000..ce6bae6105a29
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@kbn/core-lifecycle-server-mocks",
+ "private": true,
+ "version": "1.0.0",
+ "main": "./target_node/index.js",
+ "author": "Kibana Core",
+ "license": "SSPL-1.0 OR Elastic License 2.0"
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_preboot.mock.ts b/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_preboot.mock.ts
new file mode 100644
index 0000000000000..43446f824faed
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_preboot.mock.ts
@@ -0,0 +1,28 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
+import { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
+import { httpServiceMock } from '@kbn/core-http-server-mocks';
+import { prebootServiceMock } from '@kbn/core-preboot-server-mocks';
+import type { MockedKeys } from '@kbn/utility-types-jest';
+import type { CorePreboot } from '@kbn/core-lifecycle-server';
+
+type CorePrebootMockType = MockedKeys & {
+ elasticsearch: ReturnType;
+};
+
+export function createCorePrebootMock() {
+ const mock: CorePrebootMockType = {
+ analytics: analyticsServiceMock.createAnalyticsServicePreboot(),
+ elasticsearch: elasticsearchServiceMock.createPreboot(),
+ http: httpServiceMock.createPrebootContract() as CorePrebootMockType['http'],
+ preboot: prebootServiceMock.createPrebootContract(),
+ };
+
+ return mock;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_setup.mock.ts b/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_setup.mock.ts
new file mode 100644
index 0000000000000..0c4e25e846cab
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_setup.mock.ts
@@ -0,0 +1,73 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
+import type { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
+import { httpServiceMock } from '@kbn/core-http-server-mocks';
+import { httpResourcesMock } from '@kbn/core-http-resources-server-mocks';
+import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
+import type { CoreSetup, StartServicesAccessor } from '@kbn/core-lifecycle-server';
+import type { MockedKeys } from '@kbn/utility-types-jest';
+import { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
+import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
+import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
+import { i18nServiceMock } from '@kbn/core-i18n-server-mocks';
+import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
+import { statusServiceMock } from '@kbn/core-status-server-mocks';
+import { loggingServiceMock } from '@kbn/core-logging-server-mocks';
+import { metricsServiceMock } from '@kbn/core-metrics-server-mocks';
+import { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';
+import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
+import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
+import { createCoreStartMock } from './core_start.mock';
+
+type CoreSetupMockType = MockedKeys & {
+ elasticsearch: ReturnType;
+ getStartServices: jest.MockedFunction>;
+};
+
+export function createCoreSetupMock({
+ pluginStartDeps = {},
+ pluginStartContract,
+}: {
+ pluginStartDeps?: object;
+ pluginStartContract?: any;
+} = {}) {
+ const httpMock: jest.Mocked = {
+ ...httpServiceMock.createSetupContract(),
+ resources: httpResourcesMock.createRegistrar(),
+ };
+
+ const uiSettingsMock = {
+ register: uiSettingsServiceMock.createSetupContract().register,
+ };
+
+ const mock: CoreSetupMockType = {
+ analytics: analyticsServiceMock.createAnalyticsServiceSetup(),
+ capabilities: capabilitiesServiceMock.createSetupContract(),
+ docLinks: docLinksServiceMock.createSetupContract(),
+ elasticsearch: elasticsearchServiceMock.createSetup(),
+ http: httpMock,
+ i18n: i18nServiceMock.createSetupContract(),
+ savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
+ status: statusServiceMock.createSetupContract(),
+ uiSettings: uiSettingsMock,
+ logging: loggingServiceMock.createSetupContract(),
+ metrics: metricsServiceMock.createSetupContract(),
+ deprecations: deprecationsServiceMock.createSetupContract(),
+ executionContext: executionContextServiceMock.createInternalSetupContract(),
+ coreUsageData: {
+ registerUsageCounter: coreUsageDataServiceMock.createSetupContract().registerUsageCounter,
+ },
+ getStartServices: jest
+ .fn, object, any]>, []>()
+ .mockResolvedValue([createCoreStartMock(), pluginStartDeps, pluginStartContract]),
+ };
+
+ return mock;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_start.mock.ts b/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_start.mock.ts
new file mode 100644
index 0000000000000..763a9c403eb39
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_start.mock.ts
@@ -0,0 +1,37 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
+import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
+import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
+import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
+import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
+import { httpServiceMock } from '@kbn/core-http-server-mocks';
+import type { CoreStart } from '@kbn/core-lifecycle-server';
+import { metricsServiceMock } from '@kbn/core-metrics-server-mocks';
+import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
+import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
+import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
+import type { MockedKeys } from '@kbn/utility-types-jest';
+
+export function createCoreStartMock() {
+ const mock: MockedKeys = {
+ analytics: analyticsServiceMock.createAnalyticsServiceStart(),
+ capabilities: capabilitiesServiceMock.createStartContract(),
+ docLinks: docLinksServiceMock.createStartContract(),
+ elasticsearch: elasticsearchServiceMock.createStart(),
+ http: httpServiceMock.createStartContract(),
+ metrics: metricsServiceMock.createStartContract(),
+ savedObjects: savedObjectsServiceMock.createStartContract(),
+ uiSettings: uiSettingsServiceMock.createStartContract(),
+ coreUsageData: coreUsageDataServiceMock.createStartContract(),
+ executionContext: executionContextServiceMock.createInternalStartContract(),
+ };
+
+ return mock;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/src/index.ts b/packages/core/lifecycle/core-lifecycle-server-mocks/src/index.ts
new file mode 100644
index 0000000000000..66f9c1d818351
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/src/index.ts
@@ -0,0 +1,27 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { createCorePrebootMock } from './core_preboot.mock';
+import { createCoreSetupMock } from './core_setup.mock';
+import { createCoreStartMock } from './core_start.mock';
+
+import { createInternalCorePrebootMock } from './internal_core_preboot.mock';
+import { createInternalCoreSetupMock } from './internal_core_setup.mock';
+import { createInternalCoreStartMock } from './internal_core_start.mock';
+
+export const coreLifecycleMock = {
+ createPreboot: createCorePrebootMock,
+ createCoreSetup: createCoreSetupMock,
+ createCoreStart: createCoreStartMock,
+};
+
+export const coreInternalLifecycleMock = {
+ createInternalPreboot: createInternalCorePrebootMock,
+ createInternalSetup: createInternalCoreSetupMock,
+ createInternalStart: createInternalCoreStartMock,
+};
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/src/internal_core_preboot.mock.ts b/packages/core/lifecycle/core-lifecycle-server-mocks/src/internal_core_preboot.mock.ts
new file mode 100644
index 0000000000000..08c6d269f1e38
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/src/internal_core_preboot.mock.ts
@@ -0,0 +1,30 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
+import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
+import { contextServiceMock } from '@kbn/core-http-context-server-mocks';
+import { httpResourcesMock } from '@kbn/core-http-resources-server-mocks';
+import { httpServiceMock } from '@kbn/core-http-server-mocks';
+import { loggingServiceMock } from '@kbn/core-logging-server-mocks';
+import { prebootServiceMock } from '@kbn/core-preboot-server-mocks';
+import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
+
+export function createInternalCorePrebootMock() {
+ const prebootDeps = {
+ analytics: analyticsServiceMock.createAnalyticsServicePreboot(),
+ context: contextServiceMock.createPrebootContract(),
+ elasticsearch: elasticsearchServiceMock.createInternalPreboot(),
+ http: httpServiceMock.createInternalPrebootContract(),
+ httpResources: httpResourcesMock.createPrebootContract(),
+ uiSettings: uiSettingsServiceMock.createPrebootContract(),
+ logging: loggingServiceMock.createInternalPrebootContract(),
+ preboot: prebootServiceMock.createInternalPrebootContract(),
+ };
+ return prebootDeps;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/src/internal_core_setup.mock.ts b/packages/core/lifecycle/core-lifecycle-server-mocks/src/internal_core_setup.mock.ts
new file mode 100644
index 0000000000000..cddb9a49dab3c
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/src/internal_core_setup.mock.ts
@@ -0,0 +1,50 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
+import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
+import { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';
+import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
+import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
+import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
+import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
+import { contextServiceMock } from '@kbn/core-http-context-server-mocks';
+import { httpResourcesMock } from '@kbn/core-http-resources-server-mocks';
+import { httpServiceMock } from '@kbn/core-http-server-mocks';
+import { i18nServiceMock } from '@kbn/core-i18n-server-mocks';
+import { loggingServiceMock } from '@kbn/core-logging-server-mocks';
+import { metricsServiceMock } from '@kbn/core-metrics-server-mocks';
+import { renderingServiceMock } from '@kbn/core-rendering-server-mocks';
+import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
+import { statusServiceMock } from '@kbn/core-status-server-mocks';
+import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
+import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
+
+export function createInternalCoreSetupMock() {
+ const setupDeps = {
+ analytics: analyticsServiceMock.createAnalyticsServiceSetup(),
+ capabilities: capabilitiesServiceMock.createSetupContract(),
+ context: contextServiceMock.createSetupContract(),
+ docLinks: docLinksServiceMock.createSetupContract(),
+ elasticsearch: elasticsearchServiceMock.createInternalSetup(),
+ http: httpServiceMock.createInternalSetupContract(),
+ savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
+ status: statusServiceMock.createInternalSetupContract(),
+ environment: environmentServiceMock.createSetupContract(),
+ i18n: i18nServiceMock.createSetupContract(),
+ httpResources: httpResourcesMock.createSetupContract(),
+ rendering: renderingServiceMock.createSetupContract(),
+ uiSettings: uiSettingsServiceMock.createSetupContract(),
+ logging: loggingServiceMock.createInternalSetupContract(),
+ metrics: metricsServiceMock.createInternalSetupContract(),
+ deprecations: deprecationsServiceMock.createInternalSetupContract(),
+ executionContext: executionContextServiceMock.createInternalSetupContract(),
+ coreUsageData: coreUsageDataServiceMock.createSetupContract(),
+ };
+ return setupDeps;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/src/internal_core_start.mock.ts b/packages/core/lifecycle/core-lifecycle-server-mocks/src/internal_core_start.mock.ts
new file mode 100644
index 0000000000000..6283fa3ce6a88
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/src/internal_core_start.mock.ts
@@ -0,0 +1,36 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
+import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
+import { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';
+import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
+import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
+import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
+import { httpServiceMock } from '@kbn/core-http-server-mocks';
+import { metricsServiceMock } from '@kbn/core-metrics-server-mocks';
+import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
+import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
+import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
+
+export function createInternalCoreStartMock() {
+ const startDeps = {
+ analytics: analyticsServiceMock.createAnalyticsServiceStart(),
+ capabilities: capabilitiesServiceMock.createStartContract(),
+ docLinks: docLinksServiceMock.createStartContract(),
+ elasticsearch: elasticsearchServiceMock.createInternalStart(),
+ http: httpServiceMock.createInternalStartContract(),
+ metrics: metricsServiceMock.createInternalStartContract(),
+ savedObjects: savedObjectsServiceMock.createInternalStartContract(),
+ uiSettings: uiSettingsServiceMock.createStartContract(),
+ coreUsageData: coreUsageDataServiceMock.createStartContract(),
+ executionContext: executionContextServiceMock.createInternalStartContract(),
+ deprecations: deprecationsServiceMock.createInternalStartContract(),
+ };
+ return startDeps;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/tsconfig.json b/packages/core/lifecycle/core-lifecycle-server-mocks/tsconfig.json
new file mode 100644
index 0000000000000..71bb40fe57f3f
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server-mocks/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "extends": "../../../../tsconfig.bazel.json",
+ "compilerOptions": {
+ "declaration": true,
+ "declarationMap": true,
+ "emitDeclarationOnly": true,
+ "outDir": "target_types",
+ "stripInternal": false,
+ "types": [
+ "jest",
+ "node"
+ ]
+ },
+ "include": [
+ "**/*.ts",
+ ]
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server/BUILD.bazel b/packages/core/lifecycle/core-lifecycle-server/BUILD.bazel
new file mode 100644
index 0000000000000..85b3b6ab1ca97
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/BUILD.bazel
@@ -0,0 +1,122 @@
+load("@npm//@bazel/typescript:index.bzl", "ts_config")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
+
+PKG_DIRNAME = "core-lifecycle-server"
+PKG_REQUIRE_NAME = "@kbn/core-lifecycle-server"
+
+SOURCE_FILES = glob(
+ [
+ "**/*.ts",
+ ],
+ exclude = [
+ "**/*.config.js",
+ "**/*.mock.*",
+ "**/*.test.*",
+ "**/*.stories.*",
+ "**/__snapshots__/**",
+ "**/integration_tests/**",
+ "**/mocks/**",
+ "**/scripts/**",
+ "**/storybook/**",
+ "**/test_fixtures/**",
+ "**/test_helpers/**",
+ ],
+)
+
+SRCS = SOURCE_FILES
+
+filegroup(
+ name = "srcs",
+ srcs = SRCS,
+)
+
+NPM_MODULE_EXTRA_FILES = [
+ "package.json",
+]
+
+RUNTIME_DEPS = [
+]
+
+TYPES_DEPS = [
+ "@npm//@types/node",
+ "@npm//@types/jest",
+ "//packages/core/analytics/core-analytics-server:npm_module_types",
+ "//packages/core/capabilities/core-capabilities-server:npm_module_types",
+ "//packages/core/deprecations/core-deprecations-server:npm_module_types",
+ "//packages/core/doc-links/core-doc-links-server:npm_module_types",
+ "//packages/core/elasticsearch/core-elasticsearch-server:npm_module_types",
+ "//packages/core/execution-context/core-execution-context-server:npm_module_types",
+ "//packages/core/http/core-http-server:npm_module_types",
+ "//packages/core/http/core-http-request-handler-context-server:npm_module_types",
+ "//packages/core/http/core-http-resources-server:npm_module_types",
+ "//packages/core/i18n/core-i18n-server:npm_module_types",
+ "//packages/core/logging/core-logging-server:npm_module_types",
+ "//packages/core/metrics/core-metrics-server:npm_module_types",
+ "//packages/core/preboot/core-preboot-server:npm_module_types",
+ "//packages/core/saved-objects/core-saved-objects-server:npm_module_types",
+ "//packages/core/status/core-status-server:npm_module_types",
+ "//packages/core/ui-settings/core-ui-settings-server:npm_module_types",
+ "//packages/core/usage-data/core-usage-data-server:npm_module_types",
+]
+
+jsts_transpiler(
+ name = "target_node",
+ srcs = SRCS,
+ build_pkg_name = package_name(),
+)
+
+ts_config(
+ name = "tsconfig",
+ src = "tsconfig.json",
+ deps = [
+ "//:tsconfig.base.json",
+ "//:tsconfig.bazel.json",
+ ],
+)
+
+ts_project(
+ name = "tsc_types",
+ args = ['--pretty'],
+ srcs = SRCS,
+ deps = TYPES_DEPS,
+ declaration = True,
+ declaration_map = True,
+ emit_declaration_only = True,
+ out_dir = "target_types",
+ tsconfig = ":tsconfig",
+)
+
+js_library(
+ name = PKG_DIRNAME,
+ srcs = NPM_MODULE_EXTRA_FILES,
+ deps = RUNTIME_DEPS + [":target_node"],
+ package_name = PKG_REQUIRE_NAME,
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm(
+ name = "npm_module",
+ deps = [":" + PKG_DIRNAME],
+)
+
+filegroup(
+ name = "build",
+ srcs = [":npm_module"],
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm_types(
+ name = "npm_module_types",
+ srcs = SRCS,
+ deps = [":tsc_types"],
+ package_name = PKG_REQUIRE_NAME,
+ tsconfig = ":tsconfig",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "build_types",
+ srcs = [":npm_module_types"],
+ visibility = ["//visibility:public"],
+)
diff --git a/packages/core/lifecycle/core-lifecycle-server/README.md b/packages/core/lifecycle/core-lifecycle-server/README.md
new file mode 100644
index 0000000000000..5d06aa257f81f
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/README.md
@@ -0,0 +1,7 @@
+# @kbn/core-lifecycle-server
+
+This package contains the public types for core's server-side lifecycle contracts and services accessor:
+- `CorePreboot`
+- `CoreSetup`
+- `CoreStart`
+- `StartServicesAccessor`
diff --git a/packages/core/lifecycle/core-lifecycle-server/index.ts b/packages/core/lifecycle/core-lifecycle-server/index.ts
new file mode 100644
index 0000000000000..5e8b379724036
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/index.ts
@@ -0,0 +1,9 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export type { CorePreboot, CoreSetup, CoreStart, StartServicesAccessor } from './src';
diff --git a/packages/core/lifecycle/core-lifecycle-server/jest.config.js b/packages/core/lifecycle/core-lifecycle-server/jest.config.js
new file mode 100644
index 0000000000000..3d48a32bd7610
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/jest.config.js
@@ -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: ['/packages/core/lifecycle/core-lifecycle-server'],
+};
diff --git a/packages/core/lifecycle/core-lifecycle-server/kibana.jsonc b/packages/core/lifecycle/core-lifecycle-server/kibana.jsonc
new file mode 100644
index 0000000000000..867db6cc2dab0
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/kibana.jsonc
@@ -0,0 +1,7 @@
+{
+ "type": "shared-common",
+ "id": "@kbn/core-lifecycle-server",
+ "owner": "@elastic/kibana-core",
+ "runtimeDeps": [],
+ "typeDeps": [],
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server/package.json b/packages/core/lifecycle/core-lifecycle-server/package.json
new file mode 100644
index 0000000000000..da5e093f9c250
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@kbn/core-lifecycle-server",
+ "private": true,
+ "version": "1.0.0",
+ "main": "./target_node/index.js",
+ "author": "Kibana Core",
+ "license": "SSPL-1.0 OR Elastic License 2.0"
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server/src/core_preboot.ts b/packages/core/lifecycle/core-lifecycle-server/src/core_preboot.ts
new file mode 100644
index 0000000000000..893854149d7d2
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/src/core_preboot.ts
@@ -0,0 +1,28 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import type { AnalyticsServicePreboot } from '@kbn/core-analytics-server';
+import type { HttpServicePreboot } from '@kbn/core-http-server';
+import type { PrebootServicePreboot } from '@kbn/core-preboot-server';
+import type { ElasticsearchServicePreboot } from '@kbn/core-elasticsearch-server';
+import type { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
+
+/**
+ * Context passed to the `setup` method of `preboot` plugins.
+ * @public
+ */
+export interface CorePreboot {
+ /** {@link AnalyticsServicePreboot} */
+ analytics: AnalyticsServicePreboot;
+ /** {@link ElasticsearchServicePreboot} */
+ elasticsearch: ElasticsearchServicePreboot;
+ /** {@link HttpServicePreboot} */
+ http: HttpServicePreboot;
+ /** {@link PrebootServicePreboot} */
+ preboot: PrebootServicePreboot;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server/src/core_setup.ts b/packages/core/lifecycle/core-lifecycle-server/src/core_setup.ts
new file mode 100644
index 0000000000000..1565e11b13777
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/src/core_setup.ts
@@ -0,0 +1,83 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { AnalyticsServiceSetup } from '@kbn/core-analytics-server';
+import { CapabilitiesSetup } from '@kbn/core-capabilities-server';
+import { DeprecationsServiceSetup } from '@kbn/core-deprecations-server';
+import { DocLinksServiceSetup } from '@kbn/core-doc-links-server';
+import { ElasticsearchServiceSetup } from '@kbn/core-elasticsearch-server';
+import { ExecutionContextSetup } from '@kbn/core-execution-context-server';
+import { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
+import { HttpResources } from '@kbn/core-http-resources-server';
+import { HttpServiceSetup } from '@kbn/core-http-server';
+import { I18nServiceSetup } from '@kbn/core-i18n-server';
+import { LoggingServiceSetup } from '@kbn/core-logging-server';
+import { MetricsServiceSetup } from '@kbn/core-metrics-server';
+import { SavedObjectsServiceSetup } from '@kbn/core-saved-objects-server';
+import { StatusServiceSetup } from '@kbn/core-status-server';
+import { UiSettingsServiceSetup } from '@kbn/core-ui-settings-server';
+import { CoreUsageDataSetup } from '@kbn/core-usage-data-server';
+import { CoreStart } from './core_start';
+
+/**
+ * Context passed to the `setup` method of `standard` plugins.
+ *
+ * @typeParam TPluginsStart - the type of the consuming plugin's start dependencies. Should be the same
+ * as the consuming {@link Plugin}'s `TPluginsStart` type. Used by `getStartServices`.
+ * @typeParam TStart - the type of the consuming plugin's start contract. Should be the same as the
+ * consuming {@link Plugin}'s `TStart` type. Used by `getStartServices`.
+ * @public
+ */
+export interface CoreSetup {
+ /** {@link AnalyticsServiceSetup} */
+ analytics: AnalyticsServiceSetup;
+ /** {@link CapabilitiesSetup} */
+ capabilities: CapabilitiesSetup;
+ /** {@link DocLinksServiceSetup} */
+ docLinks: DocLinksServiceSetup;
+ /** {@link ElasticsearchServiceSetup} */
+ elasticsearch: ElasticsearchServiceSetup;
+ /** {@link ExecutionContextSetup} */
+ executionContext: ExecutionContextSetup;
+ /** {@link HttpServiceSetup} */
+ http: HttpServiceSetup & {
+ /** {@link HttpResources} */
+ resources: HttpResources;
+ };
+ /** {@link I18nServiceSetup} */
+ i18n: I18nServiceSetup;
+ /** {@link LoggingServiceSetup} */
+ logging: LoggingServiceSetup;
+ /** {@link MetricsServiceSetup} */
+ metrics: MetricsServiceSetup;
+ /** {@link SavedObjectsServiceSetup} */
+ savedObjects: SavedObjectsServiceSetup;
+ /** {@link StatusServiceSetup} */
+ status: StatusServiceSetup;
+ /** {@link UiSettingsServiceSetup} */
+ uiSettings: UiSettingsServiceSetup;
+ /** {@link DeprecationsServiceSetup} */
+ deprecations: DeprecationsServiceSetup;
+ /** {@link StartServicesAccessor} */
+ getStartServices: StartServicesAccessor;
+ /** @internal {@link CoreUsageDataSetup} */
+ coreUsageData: CoreUsageDataSetup;
+}
+
+/**
+ * Allows plugins to get access to APIs available in start inside async handlers.
+ * Promise will not resolve until Core and plugin dependencies have completed `start`.
+ * This should only be used inside handlers registered during `setup` that will only be executed
+ * after `start` lifecycle.
+ *
+ * @public
+ */
+export type StartServicesAccessor<
+ TPluginsStart extends object = object,
+ TStart = unknown
+> = () => Promise<[CoreStart, TPluginsStart, TStart]>;
diff --git a/packages/core/lifecycle/core-lifecycle-server/src/core_start.ts b/packages/core/lifecycle/core-lifecycle-server/src/core_start.ts
new file mode 100644
index 0000000000000..53c989154af08
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/src/core_start.ts
@@ -0,0 +1,46 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { AnalyticsServiceStart } from '@kbn/core-analytics-server';
+import { CapabilitiesStart } from '@kbn/core-capabilities-server';
+import { DocLinksServiceStart } from '@kbn/core-doc-links-server';
+import { ElasticsearchServiceStart } from '@kbn/core-elasticsearch-server';
+import { ExecutionContextStart } from '@kbn/core-execution-context-server';
+import { HttpServiceStart } from '@kbn/core-http-server';
+import { MetricsServiceStart } from '@kbn/core-metrics-server';
+import { SavedObjectsServiceStart } from '@kbn/core-saved-objects-server';
+import { UiSettingsServiceStart } from '@kbn/core-ui-settings-server';
+import { CoreUsageDataStart } from '@kbn/core-usage-data-server';
+
+/**
+ * Context passed to the plugins `start` method.
+ *
+ * @public
+ */
+export interface CoreStart {
+ /** {@link AnalyticsServiceStart} */
+ analytics: AnalyticsServiceStart;
+ /** {@link CapabilitiesStart} */
+ capabilities: CapabilitiesStart;
+ /** {@link DocLinksServiceStart} */
+ docLinks: DocLinksServiceStart;
+ /** {@link ElasticsearchServiceStart} */
+ elasticsearch: ElasticsearchServiceStart;
+ /** {@link ExecutionContextStart} */
+ executionContext: ExecutionContextStart;
+ /** {@link HttpServiceStart} */
+ http: HttpServiceStart;
+ /** {@link MetricsServiceStart} */
+ metrics: MetricsServiceStart;
+ /** {@link SavedObjectsServiceStart} */
+ savedObjects: SavedObjectsServiceStart;
+ /** {@link UiSettingsServiceStart} */
+ uiSettings: UiSettingsServiceStart;
+ /** @internal {@link CoreUsageDataStart} */
+ coreUsageData: CoreUsageDataStart;
+}
diff --git a/packages/core/lifecycle/core-lifecycle-server/src/index.ts b/packages/core/lifecycle/core-lifecycle-server/src/index.ts
new file mode 100644
index 0000000000000..37f4a6c60fd14
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/src/index.ts
@@ -0,0 +1,10 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+export type { CorePreboot } from './core_preboot';
+export type { CoreSetup, StartServicesAccessor } from './core_setup';
+export type { CoreStart } from './core_start';
diff --git a/packages/core/lifecycle/core-lifecycle-server/tsconfig.json b/packages/core/lifecycle/core-lifecycle-server/tsconfig.json
new file mode 100644
index 0000000000000..71bb40fe57f3f
--- /dev/null
+++ b/packages/core/lifecycle/core-lifecycle-server/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "extends": "../../../../tsconfig.bazel.json",
+ "compilerOptions": {
+ "declaration": true,
+ "declarationMap": true,
+ "emitDeclarationOnly": true,
+ "outDir": "target_types",
+ "stripInternal": false,
+ "types": [
+ "jest",
+ "node"
+ ]
+ },
+ "include": [
+ "**/*.ts",
+ ]
+}
diff --git a/packages/core/logging/core-logging-server-internal/src/logger.test.ts b/packages/core/logging/core-logging-server-internal/src/logger.test.ts
index c57ce2563ca3d..5c90118d7b1bb 100644
--- a/packages/core/logging/core-logging-server-internal/src/logger.test.ts
+++ b/packages/core/logging/core-logging-server-internal/src/logger.test.ts
@@ -429,3 +429,25 @@ test('passes log record to appenders only if log level is supported.', () => {
});
}
});
+
+describe('isLevelEnabled', () => {
+ const orderedLogLevels = [
+ LogLevel.Fatal,
+ LogLevel.Error,
+ LogLevel.Warn,
+ LogLevel.Info,
+ LogLevel.Debug,
+ LogLevel.Trace,
+ LogLevel.All,
+ ];
+
+ for (const logLevel of orderedLogLevels) {
+ it(`returns the correct value for a '${logLevel.id}' level logger`, () => {
+ const levelLogger = new BaseLogger(context, logLevel, appenderMocks, factory);
+ for (const level of orderedLogLevels) {
+ const levelEnabled = logLevel.supports(level);
+ expect(levelLogger.isLevelEnabled(level.id)).toEqual(levelEnabled);
+ }
+ });
+ }
+});
diff --git a/packages/core/logging/core-logging-server-internal/src/logger.ts b/packages/core/logging/core-logging-server-internal/src/logger.ts
index 2c9283da54897..7a18d9a74ebaa 100644
--- a/packages/core/logging/core-logging-server-internal/src/logger.ts
+++ b/packages/core/logging/core-logging-server-internal/src/logger.ts
@@ -6,7 +6,15 @@
* Side Public License, v 1.
*/
import apmAgent from 'elastic-apm-node';
-import { Appender, LogLevel, LogRecord, LoggerFactory, LogMeta, Logger } from '@kbn/logging';
+import {
+ Appender,
+ LogLevel,
+ LogLevelId,
+ LogRecord,
+ LoggerFactory,
+ LogMeta,
+ Logger,
+} from '@kbn/logging';
function isError(x: any): x is Error {
return x instanceof Error;
@@ -45,6 +53,10 @@ export class BaseLogger implements Logger {
this.log(this.createLogRecord(LogLevel.Fatal, errorOrMessage, meta));
}
+ public isLevelEnabled(levelId: LogLevelId): boolean {
+ return this.level.supports(LogLevel.fromId(levelId));
+ }
+
public log(record: LogRecord) {
if (!this.level.supports(record.level)) {
return;
diff --git a/packages/core/logging/core-logging-server-internal/src/logger_adapter.test.ts b/packages/core/logging/core-logging-server-internal/src/logger_adapter.test.ts
index 28f747ef3fcf6..5c6a64e7c10f4 100644
--- a/packages/core/logging/core-logging-server-internal/src/logger_adapter.test.ts
+++ b/packages/core/logging/core-logging-server-internal/src/logger_adapter.test.ts
@@ -7,11 +7,11 @@
*/
import type { Logger } from '@kbn/logging';
-import { loggerMock } from '@kbn/logging-mocks';
+import { loggerMock, type MockedLogger } from '@kbn/logging-mocks';
import { LoggerAdapter } from './logger_adapter';
describe('LoggerAdapter', () => {
- let internalLogger: Logger;
+ let internalLogger: MockedLogger;
beforeEach(() => {
internalLogger = loggerMock.create();
@@ -47,6 +47,11 @@ describe('LoggerAdapter', () => {
adapter.get('context');
expect(internalLogger.get).toHaveBeenCalledTimes(1);
expect(internalLogger.get).toHaveBeenCalledWith('context');
+
+ internalLogger.isLevelEnabled.mockReturnValue(false);
+ expect(adapter.isLevelEnabled('info')).toEqual(false);
+ expect(internalLogger.isLevelEnabled).toHaveBeenCalledTimes(1);
+ expect(internalLogger.isLevelEnabled).toHaveBeenCalledWith('info');
});
test('forwards all method calls to new internal logger if it is updated.', () => {
@@ -57,7 +62,7 @@ describe('LoggerAdapter', () => {
adapter.trace('trace-message');
expect(internalLogger.trace).toHaveBeenCalledTimes(1);
expect(internalLogger.trace).toHaveBeenCalledWith('trace-message', undefined);
- (internalLogger.trace as jest.Mock<() => void>).mockReset();
+ internalLogger.trace.mockReset();
adapter.updateLogger(newInternalLogger);
adapter.trace('trace-message');
diff --git a/packages/core/logging/core-logging-server-internal/src/logger_adapter.ts b/packages/core/logging/core-logging-server-internal/src/logger_adapter.ts
index 5439fe0205796..13ce292936e6c 100644
--- a/packages/core/logging/core-logging-server-internal/src/logger_adapter.ts
+++ b/packages/core/logging/core-logging-server-internal/src/logger_adapter.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { LogRecord, Logger, LogMeta } from '@kbn/logging';
+import { LogRecord, Logger, LogMeta, LogLevelId } from '@kbn/logging';
import { GlobalContext, mergeGlobalContext } from './global_context';
/** @internal */
@@ -65,6 +65,10 @@ export class LoggerAdapter implements Logger {
this.logger.log({ ...record, meta: mergeGlobalContext(this.globalContext, record.meta) });
}
+ public isLevelEnabled(level: LogLevelId): boolean {
+ return this.logger.isLevelEnabled(level);
+ }
+
public get(...contextParts: string[]): Logger {
return this.logger.get(...contextParts);
}
diff --git a/packages/core/plugins/core-plugins-server-internal/BUILD.bazel b/packages/core/plugins/core-plugins-server-internal/BUILD.bazel
new file mode 100644
index 0000000000000..61044f11d5b51
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-internal/BUILD.bazel
@@ -0,0 +1,155 @@
+load("@npm//@bazel/typescript:index.bzl", "ts_config")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
+
+PKG_DIRNAME = "core-plugins-server-internal"
+PKG_REQUIRE_NAME = "@kbn/core-plugins-server-internal"
+
+SOURCE_FILES = glob(
+ [
+ "**/*.ts",
+ ],
+ exclude = [
+ "**/*.config.js",
+ "**/*.test.*",
+ "**/*.stories.*",
+ "**/__snapshots__/**",
+ "**/integration_tests/**",
+ "**/mocks/**",
+ "**/scripts/**",
+ "**/storybook/**",
+ "**/test_fixtures/**",
+ "**/test_helpers/**",
+ ],
+)
+
+SRCS = SOURCE_FILES
+
+filegroup(
+ name = "srcs",
+ srcs = SRCS,
+)
+
+NPM_MODULE_EXTRA_FILES = [
+ "package.json",
+]
+
+RUNTIME_DEPS = [
+ "@npm//moment",
+ "@npm//rxjs",
+ "@npm//semver",
+ "@npm//type-detect",
+ "@npm//lodash",
+ "//packages/kbn-std",
+ "//packages/kbn-config",
+ "//packages/kbn-config-schema",
+ "//packages/kbn-logging",
+ "//packages/kbn-utils",
+ "//packages/core/base/core-base-common",
+ "//packages/core/base/core-base-server-internal",
+ "//packages/core/lifecycle/core-lifecycle-server-internal",
+ "//packages/core/elasticsearch/core-elasticsearch-server-internal",
+ "//packages/core/node/core-node-server",
+ "//packages/core/saved-objects/core-saved-objects-base-server-internal",
+ # test dependencies
+ "@npm//mock-fs",
+ "//packages/kbn-config-mocks",
+ "//packages/core/base/core-base-server-mocks",
+ "//packages/core/lifecycle/core-lifecycle-server-mocks",
+ "//packages/core/logging/core-logging-server-mocks",
+ "//packages/core/node/core-node-server-mocks",
+ "//packages/core/plugins/core-plugins-server",
+]
+
+TYPES_DEPS = [
+ "@npm//@types/node",
+ "@npm//@types/jest",
+ "@npm//moment",
+ "@npm//rxjs",
+ "@npm//semver",
+ "@npm//type-detect",
+ "@npm//lodash",
+ "//packages/kbn-std:npm_module_types",
+ "//packages/kbn-config:npm_module_types",
+ "//packages/kbn-config-schema:npm_module_types",
+ "//packages/kbn-logging:npm_module_types",
+ "//packages/kbn-utils:npm_module_types",
+ "//packages/core/base/core-base-common:npm_module_types",
+ "//packages/core/base/core-base-server-internal:npm_module_types",
+ "//packages/core/elasticsearch/core-elasticsearch-server-internal:npm_module_types",
+ "//packages/core/node/core-node-server:npm_module_types",
+ "//packages/core/saved-objects/core-saved-objects-base-server-internal:npm_module_types",
+ "//packages/core/http/core-http-server:npm_module_types",
+ "//packages/core/http/core-http-request-handler-context-server:npm_module_types",
+ "//packages/core/lifecycle/core-lifecycle-server:npm_module_types",
+ "//packages/core/lifecycle/core-lifecycle-server-internal:npm_module_types",
+ "//packages/core/plugins/core-plugins-server:npm_module_types",
+ # test dependencies' mocks
+ "@npm//mock-fs",
+ "//packages/kbn-config-mocks:npm_module_types",
+ "//packages/core/base/core-base-server-mocks:npm_module_types",
+ "//packages/core/lifecycle/core-lifecycle-server-mocks:npm_module_types",
+ "//packages/core/logging/core-logging-server-mocks:npm_module_types",
+ "//packages/core/node/core-node-server-mocks:npm_module_types",
+]
+
+jsts_transpiler(
+ name = "target_node",
+ srcs = SRCS,
+ build_pkg_name = package_name(),
+)
+
+ts_config(
+ name = "tsconfig",
+ src = "tsconfig.json",
+ deps = [
+ "//:tsconfig.base.json",
+ "//:tsconfig.bazel.json",
+ ],
+)
+
+ts_project(
+ name = "tsc_types",
+ args = ['--pretty'],
+ srcs = SRCS,
+ deps = TYPES_DEPS,
+ declaration = True,
+ declaration_map = True,
+ emit_declaration_only = True,
+ out_dir = "target_types",
+ tsconfig = ":tsconfig",
+)
+
+js_library(
+ name = PKG_DIRNAME,
+ srcs = NPM_MODULE_EXTRA_FILES,
+ deps = RUNTIME_DEPS + [":target_node"],
+ package_name = PKG_REQUIRE_NAME,
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm(
+ name = "npm_module",
+ deps = [":" + PKG_DIRNAME],
+)
+
+filegroup(
+ name = "build",
+ srcs = [":npm_module"],
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm_types(
+ name = "npm_module_types",
+ srcs = SRCS,
+ deps = [":tsc_types"],
+ package_name = PKG_REQUIRE_NAME,
+ tsconfig = ":tsconfig",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "build_types",
+ srcs = [":npm_module_types"],
+ visibility = ["//visibility:public"],
+)
diff --git a/packages/core/plugins/core-plugins-server-internal/README.md b/packages/core/plugins/core-plugins-server-internal/README.md
new file mode 100644
index 0000000000000..7ca4a5600877f
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-internal/README.md
@@ -0,0 +1,3 @@
+# @kbn/core-plugins-server-internal
+
+This package contains the internal types and implementation for Core's server-side `plugins` service.
diff --git a/packages/core/plugins/core-plugins-server-internal/index.ts b/packages/core/plugins/core-plugins-server-internal/index.ts
new file mode 100644
index 0000000000000..072ffda4b4421
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-internal/index.ts
@@ -0,0 +1,15 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export { PluginsService, PluginWrapper, config, isNewPlatformPlugin } from './src';
+export type {
+ PluginsServiceSetup,
+ PluginsServiceStart,
+ DiscoveredPlugins,
+ PluginDependencies,
+} from './src';
diff --git a/packages/core/plugins/core-plugins-server-internal/jest.config.js b/packages/core/plugins/core-plugins-server-internal/jest.config.js
new file mode 100644
index 0000000000000..08315583a6f6d
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-internal/jest.config.js
@@ -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: ['/packages/core/plugins/core-plugins-server-internal'],
+};
diff --git a/packages/core/plugins/core-plugins-server-internal/kibana.jsonc b/packages/core/plugins/core-plugins-server-internal/kibana.jsonc
new file mode 100644
index 0000000000000..2354b5ea2054e
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-internal/kibana.jsonc
@@ -0,0 +1,7 @@
+{
+ "type": "shared-common",
+ "id": "@kbn/core-plugins-server-internal",
+ "owner": "@elastic/kibana-core",
+ "runtimeDeps": [],
+ "typeDeps": [],
+}
diff --git a/packages/core/plugins/core-plugins-server-internal/package.json b/packages/core/plugins/core-plugins-server-internal/package.json
new file mode 100644
index 0000000000000..68adae5d08fed
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-internal/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@kbn/core-plugins-server-internal",
+ "private": true,
+ "version": "1.0.0",
+ "main": "./target_node/index.js",
+ "author": "Kibana Core",
+ "license": "SSPL-1.0 OR Elastic License 2.0"
+}
diff --git a/src/core/server/plugins/create_browser_config.test.ts b/packages/core/plugins/core-plugins-server-internal/src/create_browser_config.test.ts
similarity index 98%
rename from src/core/server/plugins/create_browser_config.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/create_browser_config.test.ts
index ca0366b7477fa..11f55d1bc1edb 100644
--- a/src/core/server/plugins/create_browser_config.test.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/create_browser_config.test.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import type { PluginConfigDescriptor } from './types';
+import type { PluginConfigDescriptor } from '@kbn/core-plugins-server';
import { createBrowserConfig } from './create_browser_config';
import { schema, TypeOf } from '@kbn/config-schema';
diff --git a/src/core/server/plugins/create_browser_config.ts b/packages/core/plugins/core-plugins-server-internal/src/create_browser_config.ts
similarity index 98%
rename from src/core/server/plugins/create_browser_config.ts
rename to packages/core/plugins/core-plugins-server-internal/src/create_browser_config.ts
index 0bf812d2e5cce..05844839934b2 100644
--- a/src/core/server/plugins/create_browser_config.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/create_browser_config.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { ExposedToBrowserDescriptor, PluginConfigDescriptor } from './types';
+import { ExposedToBrowserDescriptor, PluginConfigDescriptor } from '@kbn/core-plugins-server';
export const createBrowserConfig = (
config: T,
diff --git a/src/core/server/plugins/discovery/index.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/index.ts
similarity index 100%
rename from src/core/server/plugins/discovery/index.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/index.ts
diff --git a/src/core/server/plugins/discovery/is_camel_case.test.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/is_camel_case.test.ts
similarity index 100%
rename from src/core/server/plugins/discovery/is_camel_case.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/is_camel_case.test.ts
diff --git a/src/core/server/plugins/discovery/is_camel_case.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/is_camel_case.ts
similarity index 100%
rename from src/core/server/plugins/discovery/is_camel_case.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/is_camel_case.ts
diff --git a/src/core/server/plugins/discovery/plugin_discovery_error.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_discovery_error.ts
similarity index 100%
rename from src/core/server/plugins/discovery/plugin_discovery_error.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_discovery_error.ts
diff --git a/src/core/server/plugins/discovery/plugin_manifest_parser.test.mocks.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.test.mocks.ts
similarity index 100%
rename from src/core/server/plugins/discovery/plugin_manifest_parser.test.mocks.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.test.mocks.ts
diff --git a/src/core/server/plugins/discovery/plugin_manifest_parser.test.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.test.ts
similarity index 100%
rename from src/core/server/plugins/discovery/plugin_manifest_parser.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.test.ts
diff --git a/src/core/server/plugins/discovery/plugin_manifest_parser.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.ts
similarity index 99%
rename from src/core/server/plugins/discovery/plugin_manifest_parser.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.ts
index 0a54899856ac1..5402b9218620d 100644
--- a/src/core/server/plugins/discovery/plugin_manifest_parser.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.ts
@@ -13,7 +13,7 @@ import { promisify } from 'util';
import { snakeCase } from 'lodash';
import { isConfigPath, PackageInfo } from '@kbn/config';
import { PluginType } from '@kbn/core-base-common';
-import { PluginManifest } from '../types';
+import { PluginManifest } from '@kbn/core-plugins-server';
import { PluginDiscoveryError } from './plugin_discovery_error';
import { isCamelCase } from './is_camel_case';
diff --git a/src/core/server/plugins/discovery/plugins_discovery.test.mocks.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.test.mocks.ts
similarity index 100%
rename from src/core/server/plugins/discovery/plugins_discovery.test.mocks.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.test.mocks.ts
diff --git a/src/core/server/plugins/discovery/plugins_discovery.test.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.test.ts
similarity index 99%
rename from src/core/server/plugins/discovery/plugins_discovery.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.test.ts
index 03c86fb46b5eb..8c1c50e8a612c 100644
--- a/src/core/server/plugins/discovery/plugins_discovery.test.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.test.ts
@@ -22,7 +22,7 @@ import type { NodeInfo } from '@kbn/core-node-server';
import { PluginsConfig, PluginsConfigType, config } from '../plugins_config';
import type { InstanceInfo } from '../plugin_context';
import { discover } from './plugins_discovery';
-import { PluginType } from '../types';
+import { PluginType } from '@kbn/core-base-common';
const KIBANA_ROOT = process.cwd();
diff --git a/src/core/server/plugins/discovery/plugins_discovery.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.ts
similarity index 100%
rename from src/core/server/plugins/discovery/plugins_discovery.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.ts
diff --git a/src/core/server/plugins/discovery/scan_plugin_search_paths.test.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/scan_plugin_search_paths.test.ts
similarity index 100%
rename from src/core/server/plugins/discovery/scan_plugin_search_paths.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/scan_plugin_search_paths.test.ts
diff --git a/src/core/server/plugins/discovery/scan_plugin_search_paths.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/scan_plugin_search_paths.ts
similarity index 100%
rename from src/core/server/plugins/discovery/scan_plugin_search_paths.ts
rename to packages/core/plugins/core-plugins-server-internal/src/discovery/scan_plugin_search_paths.ts
diff --git a/src/core/server/plugins/index.ts b/packages/core/plugins/core-plugins-server-internal/src/index.ts
similarity index 87%
rename from src/core/server/plugins/index.ts
rename to packages/core/plugins/core-plugins-server-internal/src/index.ts
index 2111d467ef3c2..3eb852b641fcd 100644
--- a/src/core/server/plugins/index.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/index.ts
@@ -15,4 +15,5 @@ export type {
export { config } from './plugins_config';
/** @internal */
export { isNewPlatformPlugin } from './discovery';
-export * from './types';
+export type { PluginDependencies } from './types';
+export { PluginWrapper } from './plugin';
diff --git a/src/core/server/plugins/legacy_config.test.ts b/packages/core/plugins/core-plugins-server-internal/src/legacy_config.test.ts
similarity index 66%
rename from src/core/server/plugins/legacy_config.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/legacy_config.test.ts
index ca7a2d8a5454e..2bd50db020d0e 100644
--- a/src/core/server/plugins/legacy_config.test.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/legacy_config.test.ts
@@ -5,37 +5,17 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
-
import { take } from 'rxjs/operators';
-import { ConfigService, Env } from '@kbn/config';
-import { getEnvOptions, rawConfigServiceMock } from '@kbn/config-mocks';
import { getGlobalConfig, getGlobalConfig$ } from './legacy_config';
-import { REPO_ROOT } from '@kbn/utils';
-import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
import { duration } from 'moment';
import { fromRoot } from '@kbn/utils';
import { ByteSizeValue } from '@kbn/config-schema';
-import { Server } from '../server';
+import { createCoreContextConfigServiceMock } from './test_helpers';
describe('Legacy config', () => {
- let env: Env;
- let logger: ReturnType;
-
- beforeEach(() => {
- env = Env.createDefault(REPO_ROOT, getEnvOptions());
- logger = loggingSystemMock.create();
- });
-
- const createConfigService = (rawConfig: Record = {}): ConfigService => {
- const rawConfigService = rawConfigServiceMock.create({ rawConfig });
- const server = new Server(rawConfigService, env, logger);
- server.setupCoreConfig();
- return server.configService;
- };
-
describe('getGlobalConfig', () => {
it('should return the global config', async () => {
- const configService = createConfigService();
+ const configService = createCoreContextConfigServiceMock();
await configService.validate();
const legacyConfig = getGlobalConfig(configService);
@@ -54,7 +34,7 @@ describe('Legacy config', () => {
describe('getGlobalConfig$', () => {
it('should return an observable for the global config', async () => {
- const configService = createConfigService();
+ const configService = createCoreContextConfigServiceMock();
const legacyConfig = await getGlobalConfig$(configService).pipe(take(1)).toPromise();
diff --git a/src/core/server/plugins/legacy_config.ts b/packages/core/plugins/core-plugins-server-internal/src/legacy_config.ts
similarity index 96%
rename from src/core/server/plugins/legacy_config.ts
rename to packages/core/plugins/core-plugins-server-internal/src/legacy_config.ts
index de86345c5b7ba..46e792d6b226d 100644
--- a/src/core/server/plugins/legacy_config.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/legacy_config.ts
@@ -20,7 +20,7 @@ import {
type SavedObjectsConfigType,
savedObjectsConfig,
} from '@kbn/core-saved-objects-base-server-internal';
-import { SharedGlobalConfig, SharedGlobalConfigKeys } from './types';
+import { SharedGlobalConfig, SharedGlobalConfigKeys } from '@kbn/core-plugins-server';
const createGlobalConfig = ({
elasticsearch,
diff --git a/src/core/server/plugins/plugin.test.ts b/packages/core/plugins/core-plugins-server-internal/src/plugin.test.ts
similarity index 98%
rename from src/core/server/plugins/plugin.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugin.test.ts
index 538c9539b2a68..008b8eaf6665a 100644
--- a/src/core/server/plugins/plugin.test.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/plugin.test.ts
@@ -17,10 +17,11 @@ import type { CoreContext } from '@kbn/core-base-server-internal';
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
import type { NodeInfo } from '@kbn/core-node-server';
import { nodeServiceMock } from '@kbn/core-node-server-mocks';
-import { coreMock } from '../mocks';
-
+import type { PluginManifest } from '@kbn/core-plugins-server';
import { PluginWrapper } from './plugin';
-import { PluginManifest, PluginType } from './types';
+import { PluginType } from '@kbn/core-base-common';
+import { coreInternalLifecycleMock } from '@kbn/core-lifecycle-server-mocks';
+
import {
createPluginInitializerContext,
createPluginSetupContext,
@@ -72,7 +73,7 @@ let coreContext: CoreContext;
let instanceInfo: InstanceInfo;
let nodeInfo: NodeInfo;
-const setupDeps = coreMock.createInternalSetup();
+const setupDeps = coreInternalLifecycleMock.createInternalSetup();
beforeEach(() => {
coreId = Symbol('core');
diff --git a/src/core/server/plugins/plugin.ts b/packages/core/plugins/core-plugins-server-internal/src/plugin.ts
similarity index 97%
rename from src/core/server/plugins/plugin.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugin.ts
index 9ddab175d313a..5446e983676c0 100644
--- a/src/core/server/plugins/plugin.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/plugin.ts
@@ -12,18 +12,17 @@ import { firstValueFrom, Subject } from 'rxjs';
import { isPromise } from '@kbn/std';
import { isConfigSchema } from '@kbn/config-schema';
import type { Logger } from '@kbn/logging';
-import { PluginType } from '@kbn/core-base-common';
-import {
+import { type PluginOpaqueId, PluginType } from '@kbn/core-base-common';
+import type {
AsyncPlugin,
Plugin,
PluginConfigDescriptor,
PluginInitializer,
PluginInitializerContext,
PluginManifest,
- PluginOpaqueId,
PrebootPlugin,
-} from './types';
-import { CorePreboot, CoreSetup, CoreStart } from '..';
+} from '@kbn/core-plugins-server';
+import type { CorePreboot, CoreSetup, CoreStart } from '@kbn/core-lifecycle-server';
const OSS_PATH_REGEX = /[\/|\\]src[\/|\\]plugins[\/|\\]/; // Matches src/plugins directory on POSIX and Windows
const XPACK_PATH_REGEX = /[\/|\\]x-pack[\/|\\]plugins[\/|\\]/; // Matches x-pack/plugins directory on POSIX and Windows
diff --git a/src/core/server/plugins/plugin_context.test.ts b/packages/core/plugins/core-plugins-server-internal/src/plugin_context.test.ts
similarity index 90%
rename from src/core/server/plugins/plugin_context.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugin_context.test.ts
index 803c5ded6a545..978bf62222f07 100644
--- a/src/core/server/plugins/plugin_context.test.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/plugin_context.test.ts
@@ -8,8 +8,7 @@
import { duration } from 'moment';
import { first } from 'rxjs/operators';
-import { REPO_ROOT } from '@kbn/utils';
-import { fromRoot } from '@kbn/utils';
+import { REPO_ROOT, fromRoot } from '@kbn/utils';
import { rawConfigServiceMock, getEnvOptions, configServiceMock } from '@kbn/config-mocks';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
@@ -21,12 +20,15 @@ import {
InstanceInfo,
} from './plugin_context';
-import { PluginManifest, PluginType } from './types';
-import { Server } from '../server';
+import { PluginType } from '@kbn/core-base-common';
+import { PluginManifest } from '@kbn/core-plugins-server';
import { schema, ByteSizeValue } from '@kbn/config-schema';
import { ConfigService, Env } from '@kbn/config';
import { PluginWrapper } from './plugin';
-import { coreMock } from '../mocks';
+
+import { coreInternalLifecycleMock } from '@kbn/core-lifecycle-server-mocks';
+import { mockCoreContext } from '@kbn/core-base-server-mocks';
+import { createCoreContextConfigServiceMock } from './test_helpers';
function createPluginManifest(manifestProps: Partial = {}): PluginManifest {
return {
@@ -54,7 +56,6 @@ describe('createPluginInitializerContext', () => {
let opaqueId: symbol;
let env: Env;
let coreContext: CoreContext;
- let server: Server;
let instanceInfo: InstanceInfo;
let nodeInfo: NodeInfo;
@@ -67,10 +68,11 @@ describe('createPluginInitializerContext', () => {
};
nodeInfo = nodeServiceMock.createInternalPrebootContract();
env = Env.createDefault(REPO_ROOT, getEnvOptions());
- const config$ = rawConfigServiceMock.create({ rawConfig: {} });
- server = new Server(config$, env, logger);
- server.setupCoreConfig();
- coreContext = { coreId, env, logger, configService: server.configService };
+ coreContext = mockCoreContext.create({
+ env,
+ logger,
+ configService: configServiceMock.create(),
+ });
});
describe('context.config', () => {
@@ -115,7 +117,12 @@ describe('createPluginInitializerContext', () => {
});
it('config.globalConfig$ should be an observable for the global config', async () => {
+ const configService = createCoreContextConfigServiceMock();
+
+ coreContext = { coreId, env, logger, configService };
+
const manifest = createPluginManifest();
+
const pluginInitializerContext = createPluginInitializerContext({
coreContext,
opaqueId,
@@ -229,7 +236,7 @@ describe('createPluginPrebootSetupContext', () => {
}),
});
- const corePreboot = coreMock.createInternalPreboot();
+ const corePreboot = coreInternalLifecycleMock.createInternalPreboot();
const prebootSetupContext = createPluginPrebootSetupContext(coreContext, corePreboot, plugin);
const holdSetupPromise = Promise.resolve(undefined);
diff --git a/src/core/server/plugins/plugin_context.ts b/packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts
similarity index 97%
rename from src/core/server/plugins/plugin_context.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts
index 97b165617b68e..d1bec41373c9d 100644
--- a/src/core/server/plugins/plugin_context.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts
@@ -11,16 +11,16 @@ import type { CoreContext } from '@kbn/core-base-server-internal';
import type { PluginOpaqueId } from '@kbn/core-base-common';
import type { NodeInfo } from '@kbn/core-node-server';
import type { IRouter, IContextProvider } from '@kbn/core-http-server';
-import type { RequestHandlerContext } from '..';
+import { PluginInitializerContext, PluginManifest } from '@kbn/core-plugins-server';
+import { CorePreboot, CoreSetup, CoreStart } from '@kbn/core-lifecycle-server';
+import type { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
import { PluginWrapper } from './plugin';
import {
PluginsServicePrebootSetupDeps,
PluginsServiceSetupDeps,
PluginsServiceStartDeps,
} from './plugins_service';
-import { PluginInitializerContext, PluginManifest } from './types';
import { getGlobalConfig, getGlobalConfig$ } from './legacy_config';
-import { CorePreboot, CoreSetup, CoreStart } from '..';
/** @internal */
export interface InstanceInfo {
diff --git a/src/core/server/plugins/plugins_config.test.ts b/packages/core/plugins/core-plugins-server-internal/src/plugins_config.test.ts
similarity index 100%
rename from src/core/server/plugins/plugins_config.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugins_config.test.ts
diff --git a/src/core/server/plugins/plugins_config.ts b/packages/core/plugins/core-plugins-server-internal/src/plugins_config.ts
similarity index 100%
rename from src/core/server/plugins/plugins_config.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugins_config.ts
diff --git a/src/core/server/plugins/plugins_service.test.mocks.ts b/packages/core/plugins/core-plugins-server-internal/src/plugins_service.test.mocks.ts
similarity index 100%
rename from src/core/server/plugins/plugins_service.test.mocks.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugins_service.test.mocks.ts
diff --git a/src/core/server/plugins/plugins_service.test.ts b/packages/core/plugins/core-plugins-server-internal/src/plugins_service.test.ts
similarity index 99%
rename from src/core/server/plugins/plugins_service.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugins_service.test.ts
index 9e234b871d647..4664db6e710c7 100644
--- a/src/core/server/plugins/plugins_service.test.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/plugins_service.test.ts
@@ -19,14 +19,15 @@ import { rawConfigServiceMock, getEnvOptions } from '@kbn/config-mocks';
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
import { nodeServiceMock } from '@kbn/core-node-server-mocks';
-import { coreMock } from '../mocks';
+import { coreInternalLifecycleMock } from '@kbn/core-lifecycle-server-mocks';
import { PluginDiscoveryError } from './discovery';
import { PluginWrapper } from './plugin';
import { PluginsService } from './plugins_service';
import { PluginsSystem } from './plugins_system';
import { config } from './plugins_config';
import { take } from 'rxjs/operators';
-import { DiscoveredPlugin, PluginConfigDescriptor, PluginType } from './types';
+import type { PluginConfigDescriptor } from '@kbn/core-plugins-server';
+import { DiscoveredPlugin, PluginType } from '@kbn/core-base-common';
const MockPluginsSystem: jest.Mock> = PluginsSystem as any;
@@ -40,9 +41,9 @@ let standardMockPluginSystem: jest.Mocked>;
let environmentPreboot: ReturnType;
let nodePreboot: ReturnType;
-const prebootDeps = coreMock.createInternalPreboot();
-const setupDeps = coreMock.createInternalSetup();
-const startDeps = coreMock.createInternalStart();
+const prebootDeps = coreInternalLifecycleMock.createInternalPreboot();
+const setupDeps = coreInternalLifecycleMock.createInternalSetup();
+const startDeps = coreInternalLifecycleMock.createInternalStart();
const logger = loggingSystemMock.create();
expect.addSnapshotSerializer(createAbsolutePathSerializer());
diff --git a/src/core/server/plugins/plugins_service.ts b/packages/core/plugins/core-plugins-server-internal/src/plugins_service.ts
similarity index 97%
rename from src/core/server/plugins/plugins_service.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugins_service.ts
index 3305ff0a06b43..556cd8331b454 100644
--- a/src/core/server/plugins/plugins_service.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/plugins_service.ts
@@ -14,17 +14,24 @@ import { getFlattenedObject } from '@kbn/std';
import { Logger } from '@kbn/logging';
import type { IConfigService } from '@kbn/config';
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
-import type { PluginName } from '@kbn/core-base-common';
+import { type PluginName, PluginType } from '@kbn/core-base-common';
import type { InternalEnvironmentServicePreboot } from '@kbn/core-environment-server-internal';
import type { InternalNodeServicePreboot } from '@kbn/core-node-server-internal';
import type { InternalPluginInfo, UiPlugins } from '@kbn/core-plugins-base-server-internal';
+import {
+ InternalCorePreboot,
+ InternalCoreSetup,
+ InternalCoreStart,
+} from '@kbn/core-lifecycle-server-internal';
+import { PluginConfigDescriptor } from '@kbn/core-plugins-server';
+import type { DiscoveredPlugin } from '@kbn/core-base-common';
import { discover, PluginDiscoveryError, PluginDiscoveryErrorType } from './discovery';
import { PluginWrapper } from './plugin';
-import { DiscoveredPlugin, PluginConfigDescriptor, PluginDependencies, PluginType } from './types';
+
+import type { PluginDependencies } from './types';
import { PluginsConfig, PluginsConfigType } from './plugins_config';
import { PluginsSystem } from './plugins_system';
import { createBrowserConfig } from './create_browser_config';
-import { InternalCorePreboot, InternalCoreSetup, InternalCoreStart } from '../internal_types';
/** @internal */
export type DiscoveredPlugins = {
diff --git a/src/core/server/plugins/plugins_system.test.mocks.ts b/packages/core/plugins/core-plugins-server-internal/src/plugins_system.test.mocks.ts
similarity index 100%
rename from src/core/server/plugins/plugins_system.test.mocks.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugins_system.test.mocks.ts
diff --git a/src/core/server/plugins/plugins_system.test.ts b/packages/core/plugins/core-plugins-server-internal/src/plugins_system.test.ts
similarity index 98%
rename from src/core/server/plugins/plugins_system.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugins_system.test.ts
index 5dc8507302bc3..4010d548a6219 100644
--- a/src/core/server/plugins/plugins_system.test.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/plugins_system.test.ts
@@ -15,7 +15,7 @@ import {
import { BehaviorSubject } from 'rxjs';
import { REPO_ROOT } from '@kbn/utils';
-import type { PluginName } from '@kbn/core-base-common';
+import { type PluginName, PluginType } from '@kbn/core-base-common';
import type { CoreContext } from '@kbn/core-base-server-internal';
import { Logger } from '@kbn/logging';
import { Env } from '@kbn/config';
@@ -23,9 +23,8 @@ import { configServiceMock, getEnvOptions } from '@kbn/config-mocks';
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
import { PluginWrapper } from './plugin';
-import { PluginType } from './types';
import { PluginsSystem } from './plugins_system';
-import { coreMock } from '../mocks';
+import { coreInternalLifecycleMock } from '@kbn/core-lifecycle-server-mocks';
function createPlugin(
id: string,
@@ -63,9 +62,9 @@ function createPlugin(
});
}
-const prebootDeps = coreMock.createInternalPreboot();
-const setupDeps = coreMock.createInternalSetup();
-const startDeps = coreMock.createInternalStart();
+const prebootDeps = coreInternalLifecycleMock.createInternalPreboot();
+const setupDeps = coreInternalLifecycleMock.createInternalSetup();
+const startDeps = coreInternalLifecycleMock.createInternalStart();
let pluginsSystem: PluginsSystem;
let configService: ReturnType;
diff --git a/src/core/server/plugins/plugins_system.ts b/packages/core/plugins/core-plugins-server-internal/src/plugins_system.ts
similarity index 97%
rename from src/core/server/plugins/plugins_system.ts
rename to packages/core/plugins/core-plugins-server-internal/src/plugins_system.ts
index 57db8e7c70f49..d7c4df71dd4fc 100644
--- a/src/core/server/plugins/plugins_system.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/plugins_system.ts
@@ -7,17 +7,18 @@
*/
import { withTimeout, isPromise } from '@kbn/std';
-import type { PluginName } from '@kbn/core-base-common';
+import type { DiscoveredPlugin, PluginName } from '@kbn/core-base-common';
import type { CoreContext } from '@kbn/core-base-server-internal';
-import { Logger } from '@kbn/logging';
-import { PluginWrapper } from './plugin';
-import { DiscoveredPlugin, PluginDependencies, PluginType } from './types';
+import type { Logger } from '@kbn/logging';
+import { PluginType } from '@kbn/core-base-common';
+import type { PluginWrapper } from './plugin';
+import { type PluginDependencies } from './types';
import {
createPluginPrebootSetupContext,
createPluginSetupContext,
createPluginStartContext,
} from './plugin_context';
-import {
+import type {
PluginsServicePrebootSetupDeps,
PluginsServiceSetupDeps,
PluginsServiceStartDeps,
diff --git a/packages/core/plugins/core-plugins-server-internal/src/test_helpers/create_core_context_config_service.mock.ts b/packages/core/plugins/core-plugins-server-internal/src/test_helpers/create_core_context_config_service.mock.ts
new file mode 100644
index 0000000000000..399d45398eefb
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-internal/src/test_helpers/create_core_context_config_service.mock.ts
@@ -0,0 +1,43 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { IConfigService } from '@kbn/config';
+import { configServiceMock } from '@kbn/config-mocks';
+import { ByteSizeValue } from '@kbn/config-schema';
+import { fromRoot } from '@kbn/utils';
+import { duration } from 'moment';
+import { from } from 'rxjs';
+
+export const createCoreContextConfigServiceMock = (): IConfigService => {
+ const configService = configServiceMock.create();
+ const getPathConfig = (path: string | string[]) => {
+ switch (path) {
+ case 'elasticsearch':
+ return {
+ shardTimeout: duration(30, 's'),
+ requestTimeout: duration(30, 's'),
+ pingTimeout: duration(30, 's'),
+ someOtherProps: 'unused',
+ };
+ case 'path':
+ return { data: fromRoot('data'), someOtherProps: 'unused' };
+ case 'savedObjects':
+ return { maxImportPayloadBytes: new ByteSizeValue(26214400), someOtherProps: 'unused' };
+ default:
+ return {};
+ }
+ };
+ configService.atPath.mockImplementation((path) => {
+ return from([getPathConfig(path)]);
+ });
+ configService.atPathSync.mockImplementation((path) => {
+ return getPathConfig(path);
+ });
+
+ return configService;
+};
diff --git a/packages/core/plugins/core-plugins-server-internal/src/test_helpers/index.ts b/packages/core/plugins/core-plugins-server-internal/src/test_helpers/index.ts
new file mode 100644
index 0000000000000..86ffb0ec8f407
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-internal/src/test_helpers/index.ts
@@ -0,0 +1,9 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export { createCoreContextConfigServiceMock } from './create_core_context_config_service.mock';
diff --git a/src/core/server/plugins/types.test.ts b/packages/core/plugins/core-plugins-server-internal/src/types.test.ts
similarity index 96%
rename from src/core/server/plugins/types.test.ts
rename to packages/core/plugins/core-plugins-server-internal/src/types.test.ts
index 4a0e6052a9901..ea1537bf0649e 100644
--- a/src/core/server/plugins/types.test.ts
+++ b/packages/core/plugins/core-plugins-server-internal/src/types.test.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { ExposedToBrowserDescriptor } from './types';
+import type { ExposedToBrowserDescriptor } from '@kbn/core-plugins-server';
describe('ExposedToBrowserDescriptor', () => {
interface ConfigType {
diff --git a/packages/core/plugins/core-plugins-server-internal/src/types.ts b/packages/core/plugins/core-plugins-server-internal/src/types.ts
new file mode 100644
index 0000000000000..def1a27a4c26f
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-internal/src/types.ts
@@ -0,0 +1,15 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import type { PluginName, PluginOpaqueId } from '@kbn/core-base-common';
+
+/** @internal */
+export interface PluginDependencies {
+ asNames: ReadonlyMap;
+ asOpaqueIds: ReadonlyMap;
+}
diff --git a/packages/core/plugins/core-plugins-server-internal/tsconfig.json b/packages/core/plugins/core-plugins-server-internal/tsconfig.json
new file mode 100644
index 0000000000000..71bb40fe57f3f
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-internal/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "extends": "../../../../tsconfig.bazel.json",
+ "compilerOptions": {
+ "declaration": true,
+ "declarationMap": true,
+ "emitDeclarationOnly": true,
+ "outDir": "target_types",
+ "stripInternal": false,
+ "types": [
+ "jest",
+ "node"
+ ]
+ },
+ "include": [
+ "**/*.ts",
+ ]
+}
diff --git a/packages/core/plugins/core-plugins-server-mocks/BUILD.bazel b/packages/core/plugins/core-plugins-server-mocks/BUILD.bazel
new file mode 100644
index 0000000000000..39ca50e2b847c
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-mocks/BUILD.bazel
@@ -0,0 +1,106 @@
+load("@npm//@bazel/typescript:index.bzl", "ts_config")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
+
+PKG_DIRNAME = "core-plugins-server-mocks"
+PKG_REQUIRE_NAME = "@kbn/core-plugins-server-mocks"
+
+SOURCE_FILES = glob(
+ [
+ "**/*.ts",
+ ],
+ exclude = [
+ "**/*.config.js",
+ "**/*.test.*",
+ "**/*.stories.*",
+ "**/__snapshots__/**",
+ "**/integration_tests/**",
+ "**/scripts/**",
+ "**/storybook/**",
+ "**/test_fixtures/**",
+ "**/test_helpers/**",
+ ],
+)
+
+SRCS = SOURCE_FILES
+
+filegroup(
+ name = "srcs",
+ srcs = SRCS,
+)
+
+NPM_MODULE_EXTRA_FILES = [
+ "package.json",
+]
+
+RUNTIME_DEPS = [
+ "//packages/core/plugins/core-plugins-server-internal",
+]
+
+TYPES_DEPS = [
+ "@npm//@types/node",
+ "@npm//@types/jest",
+ "//packages/kbn-utility-types:npm_module_types",
+ "//packages/core/plugins/core-plugins-server-internal:npm_module_types",
+]
+
+jsts_transpiler(
+ name = "target_node",
+ srcs = SRCS,
+ build_pkg_name = package_name(),
+)
+
+ts_config(
+ name = "tsconfig",
+ src = "tsconfig.json",
+ deps = [
+ "//:tsconfig.base.json",
+ "//:tsconfig.bazel.json",
+ ],
+)
+
+ts_project(
+ name = "tsc_types",
+ args = ['--pretty'],
+ srcs = SRCS,
+ deps = TYPES_DEPS,
+ declaration = True,
+ declaration_map = True,
+ emit_declaration_only = True,
+ out_dir = "target_types",
+ tsconfig = ":tsconfig",
+)
+
+js_library(
+ name = PKG_DIRNAME,
+ srcs = NPM_MODULE_EXTRA_FILES,
+ deps = RUNTIME_DEPS + [":target_node"],
+ package_name = PKG_REQUIRE_NAME,
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm(
+ name = "npm_module",
+ deps = [":" + PKG_DIRNAME],
+)
+
+filegroup(
+ name = "build",
+ srcs = [":npm_module"],
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm_types(
+ name = "npm_module_types",
+ srcs = SRCS,
+ deps = [":tsc_types"],
+ package_name = PKG_REQUIRE_NAME,
+ tsconfig = ":tsconfig",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "build_types",
+ srcs = [":npm_module_types"],
+ visibility = ["//visibility:public"],
+)
diff --git a/packages/core/plugins/core-plugins-server-mocks/README.md b/packages/core/plugins/core-plugins-server-mocks/README.md
new file mode 100644
index 0000000000000..2ec4d6313919f
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-mocks/README.md
@@ -0,0 +1,4 @@
+# @kbn/core-plugins-server-mocks
+
+This package contains mocks for Core's server-side `plugins` service.
+- `pluginsServiceMock`
diff --git a/packages/core/plugins/core-plugins-server-mocks/index.ts b/packages/core/plugins/core-plugins-server-mocks/index.ts
new file mode 100644
index 0000000000000..ebf3e8864ef33
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-mocks/index.ts
@@ -0,0 +1,9 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export { pluginServiceMock } from './src';
diff --git a/packages/core/plugins/core-plugins-server-mocks/jest.config.js b/packages/core/plugins/core-plugins-server-mocks/jest.config.js
new file mode 100644
index 0000000000000..f7924be975ac9
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-mocks/jest.config.js
@@ -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: ['/packages/core/plugins/core-plugins-server-mocks'],
+};
diff --git a/packages/core/plugins/core-plugins-server-mocks/kibana.jsonc b/packages/core/plugins/core-plugins-server-mocks/kibana.jsonc
new file mode 100644
index 0000000000000..4a1b2c0bd2258
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-mocks/kibana.jsonc
@@ -0,0 +1,7 @@
+{
+ "type": "shared-common",
+ "id": "@kbn/core-plugins-server-mocks",
+ "owner": "@elastic/kibana-core",
+ "runtimeDeps": [],
+ "typeDeps": [],
+}
diff --git a/packages/core/plugins/core-plugins-server-mocks/package.json b/packages/core/plugins/core-plugins-server-mocks/package.json
new file mode 100644
index 0000000000000..0af107840be65
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-mocks/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@kbn/core-plugins-server-mocks",
+ "private": true,
+ "version": "1.0.0",
+ "main": "./target_node/index.js",
+ "author": "Kibana Core",
+ "license": "SSPL-1.0 OR Elastic License 2.0"
+}
diff --git a/packages/core/plugins/core-plugins-server-mocks/src/index.ts b/packages/core/plugins/core-plugins-server-mocks/src/index.ts
new file mode 100644
index 0000000000000..30b3d50c22b74
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-mocks/src/index.ts
@@ -0,0 +1,9 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export { pluginServiceMock } from './plugins_service.mock';
diff --git a/src/core/server/plugins/plugins_service.mock.ts b/packages/core/plugins/core-plugins-server-mocks/src/plugins_service.mock.ts
similarity index 93%
rename from src/core/server/plugins/plugins_service.mock.ts
rename to packages/core/plugins/core-plugins-server-mocks/src/plugins_service.mock.ts
index ee7b35a412e80..58c43a4c30eda 100644
--- a/src/core/server/plugins/plugins_service.mock.ts
+++ b/packages/core/plugins/core-plugins-server-mocks/src/plugins_service.mock.ts
@@ -7,7 +7,7 @@
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
-import type { PluginsService, PluginsServiceSetup } from './plugins_service';
+import { PluginsService, type PluginsServiceSetup } from '@kbn/core-plugins-server-internal';
type PluginsServiceMock = jest.Mocked>;
diff --git a/packages/core/plugins/core-plugins-server-mocks/tsconfig.json b/packages/core/plugins/core-plugins-server-mocks/tsconfig.json
new file mode 100644
index 0000000000000..71bb40fe57f3f
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server-mocks/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "extends": "../../../../tsconfig.bazel.json",
+ "compilerOptions": {
+ "declaration": true,
+ "declarationMap": true,
+ "emitDeclarationOnly": true,
+ "outDir": "target_types",
+ "stripInternal": false,
+ "types": [
+ "jest",
+ "node"
+ ]
+ },
+ "include": [
+ "**/*.ts",
+ ]
+}
diff --git a/packages/core/plugins/core-plugins-server/BUILD.bazel b/packages/core/plugins/core-plugins-server/BUILD.bazel
new file mode 100644
index 0000000000000..ec304498d123c
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server/BUILD.bazel
@@ -0,0 +1,119 @@
+load("@npm//@bazel/typescript:index.bzl", "ts_config")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
+
+PKG_DIRNAME = "core-plugins-server"
+PKG_REQUIRE_NAME = "@kbn/core-plugins-server"
+
+SOURCE_FILES = glob(
+ [
+ "**/*.ts",
+ ],
+ exclude = [
+ "**/*.config.js",
+ "**/*.mock.*",
+ "**/*.test.*",
+ "**/*.stories.*",
+ "**/__snapshots__/**",
+ "**/integration_tests/**",
+ "**/mocks/**",
+ "**/scripts/**",
+ "**/storybook/**",
+ "**/test_fixtures/**",
+ "**/test_helpers/**",
+ ],
+)
+
+SRCS = SOURCE_FILES
+
+filegroup(
+ name = "srcs",
+ srcs = SRCS,
+)
+
+NPM_MODULE_EXTRA_FILES = [
+ "package.json",
+]
+
+RUNTIME_DEPS = [
+ "@npm//rxjs",
+ "//packages/kbn-config-schema",
+]
+
+TYPES_DEPS = [
+ "@npm//@types/node",
+ "@npm//@types/jest",
+ "@npm//rxjs",
+ "//packages/kbn-config:npm_module_types",
+ "//packages/kbn-config-schema:npm_module_types",
+ "//packages/kbn-utility-types:npm_module_types",
+ "//packages/kbn-utils:npm_module_types",
+ "//packages/kbn-logging:npm_module_types",
+ "//packages/core/base/core-base-common:npm_module_types",
+ "//packages/core/node/core-node-server:npm_module_types",
+ "//packages/core/elasticsearch/core-elasticsearch-server-internal:npm_module_types",
+ "//packages/core/saved-objects/core-saved-objects-base-server-internal:npm_module_types",
+ "//packages/core/lifecycle/core-lifecycle-server:npm_module_types",
+
+]
+
+jsts_transpiler(
+ name = "target_node",
+ srcs = SRCS,
+ build_pkg_name = package_name(),
+)
+
+ts_config(
+ name = "tsconfig",
+ src = "tsconfig.json",
+ deps = [
+ "//:tsconfig.base.json",
+ "//:tsconfig.bazel.json",
+ ],
+)
+
+ts_project(
+ name = "tsc_types",
+ args = ['--pretty'],
+ srcs = SRCS,
+ deps = TYPES_DEPS,
+ declaration = True,
+ declaration_map = True,
+ emit_declaration_only = True,
+ out_dir = "target_types",
+ tsconfig = ":tsconfig",
+)
+
+js_library(
+ name = PKG_DIRNAME,
+ srcs = NPM_MODULE_EXTRA_FILES,
+ deps = RUNTIME_DEPS + [":target_node"],
+ package_name = PKG_REQUIRE_NAME,
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm(
+ name = "npm_module",
+ deps = [":" + PKG_DIRNAME],
+)
+
+filegroup(
+ name = "build",
+ srcs = [":npm_module"],
+ visibility = ["//visibility:public"],
+)
+
+pkg_npm_types(
+ name = "npm_module_types",
+ srcs = SRCS,
+ deps = [":tsc_types"],
+ package_name = PKG_REQUIRE_NAME,
+ tsconfig = ":tsconfig",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "build_types",
+ srcs = [":npm_module_types"],
+ visibility = ["//visibility:public"],
+)
diff --git a/packages/core/plugins/core-plugins-server/README.md b/packages/core/plugins/core-plugins-server/README.md
new file mode 100644
index 0000000000000..1add32cc3e1d4
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server/README.md
@@ -0,0 +1,3 @@
+# @kbn/core-plugins-server
+
+This package contains the public types for core's server-side plugins service.
diff --git a/packages/core/plugins/core-plugins-server/index.ts b/packages/core/plugins/core-plugins-server/index.ts
new file mode 100644
index 0000000000000..47aa0d04ac87c
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server/index.ts
@@ -0,0 +1,23 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export type {
+ PrebootPlugin,
+ Plugin,
+ AsyncPlugin,
+ PluginConfigDescriptor,
+ PluginConfigSchema,
+ PluginInitializer,
+ PluginInitializerContext,
+ PluginManifest,
+ SharedGlobalConfig,
+ MakeUsageFromSchema,
+ ExposedToBrowserDescriptor,
+} from './src';
+
+export { SharedGlobalConfigKeys } from './src';
diff --git a/packages/core/plugins/core-plugins-server/jest.config.js b/packages/core/plugins/core-plugins-server/jest.config.js
new file mode 100644
index 0000000000000..f03056c0495e2
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server/jest.config.js
@@ -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: ['/packages/core/plugins/core-plugins-server'],
+};
diff --git a/packages/core/plugins/core-plugins-server/kibana.jsonc b/packages/core/plugins/core-plugins-server/kibana.jsonc
new file mode 100644
index 0000000000000..708281a40646b
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server/kibana.jsonc
@@ -0,0 +1,7 @@
+{
+ "type": "shared-common",
+ "id": "@kbn/core-plugins-server",
+ "owner": "@elastic/kibana-core",
+ "runtimeDeps": [],
+ "typeDeps": [],
+}
diff --git a/packages/core/plugins/core-plugins-server/package.json b/packages/core/plugins/core-plugins-server/package.json
new file mode 100644
index 0000000000000..75fda3c2ef661
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@kbn/core-plugins-server",
+ "private": true,
+ "version": "1.0.0",
+ "main": "./target_node/index.js",
+ "author": "Kibana Core",
+ "license": "SSPL-1.0 OR Elastic License 2.0"
+}
diff --git a/packages/core/plugins/core-plugins-server/src/index.ts b/packages/core/plugins/core-plugins-server/src/index.ts
new file mode 100644
index 0000000000000..94ad27dedbf12
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server/src/index.ts
@@ -0,0 +1,23 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export type {
+ PrebootPlugin,
+ Plugin,
+ AsyncPlugin,
+ PluginConfigDescriptor,
+ PluginConfigSchema,
+ PluginInitializer,
+ PluginInitializerContext,
+ PluginManifest,
+ SharedGlobalConfig,
+ MakeUsageFromSchema,
+ ExposedToBrowserDescriptor,
+} from './types';
+
+export { SharedGlobalConfigKeys } from './shared_global_config';
diff --git a/packages/core/plugins/core-plugins-server/src/shared_global_config.ts b/packages/core/plugins/core-plugins-server/src/shared_global_config.ts
new file mode 100644
index 0000000000000..6329b2576ab21
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server/src/shared_global_config.ts
@@ -0,0 +1,14 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export const SharedGlobalConfigKeys = {
+ // We can add more if really needed
+ elasticsearch: ['shardTimeout', 'requestTimeout', 'pingTimeout'] as const,
+ path: ['data'] as const,
+ savedObjects: ['maxImportPayloadBytes'] as const,
+};
diff --git a/src/core/server/plugins/types.ts b/packages/core/plugins/core-plugins-server/src/types.ts
similarity index 94%
rename from src/core/server/plugins/types.ts
rename to packages/core/plugins/core-plugins-server/src/types.ts
index 699631bc4411e..46773971d35ef 100644
--- a/src/core/server/plugins/types.ts
+++ b/packages/core/plugins/core-plugins-server/src/types.ts
@@ -8,9 +8,9 @@
import { Observable } from 'rxjs';
import { Type } from '@kbn/config-schema';
-import { RecursiveReadonly } from '@kbn/utility-types';
-import { PathConfigType } from '@kbn/utils';
-import { LoggerFactory } from '@kbn/logging';
+import type { RecursiveReadonly } from '@kbn/utility-types';
+import type { PathConfigType } from '@kbn/utils';
+import type { LoggerFactory } from '@kbn/logging';
import type {
ConfigPath,
EnvironmentMode,
@@ -21,14 +21,10 @@ import type { PluginName, PluginOpaqueId, PluginType } from '@kbn/core-base-comm
import type { NodeInfo } from '@kbn/core-node-server';
import type { ElasticsearchConfigType } from '@kbn/core-elasticsearch-server-internal';
import type { SavedObjectsConfigType } from '@kbn/core-saved-objects-base-server-internal';
-import { CorePreboot, CoreSetup, CoreStart } from '..';
-
+import type { CorePreboot, CoreSetup, CoreStart } from '@kbn/core-lifecycle-server';
+import { SharedGlobalConfigKeys } from './shared_global_config';
type Maybe = T | undefined;
-// re-exporting for now to avoid adapting all imports, will be removed later on in the migration process
-export type { PluginName, PluginOpaqueId, DiscoveredPlugin } from '@kbn/core-base-common';
-export { PluginType } from '@kbn/core-base-common';
-
/**
* Dedicated type for plugin configuration schema.
*
@@ -131,12 +127,6 @@ export type MakeUsageFromSchema = {
: boolean;
};
-/** @internal */
-export interface PluginDependencies {
- asNames: ReadonlyMap;
- asOpaqueIds: ReadonlyMap;
-}
-
/**
* Describes the set of required and optional properties plugin can define in its
* mandatory JSON manifest file.
@@ -303,13 +293,6 @@ export interface AsyncPlugin<
stop?(): void;
}
-export const SharedGlobalConfigKeys = {
- // We can add more if really needed
- elasticsearch: ['shardTimeout', 'requestTimeout', 'pingTimeout'] as const,
- path: ['data'] as const,
- savedObjects: ['maxImportPayloadBytes'] as const,
-};
-
/**
* @public
*/
diff --git a/packages/core/plugins/core-plugins-server/tsconfig.json b/packages/core/plugins/core-plugins-server/tsconfig.json
new file mode 100644
index 0000000000000..71bb40fe57f3f
--- /dev/null
+++ b/packages/core/plugins/core-plugins-server/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "extends": "../../../../tsconfig.bazel.json",
+ "compilerOptions": {
+ "declaration": true,
+ "declarationMap": true,
+ "emitDeclarationOnly": true,
+ "outDir": "target_types",
+ "stripInternal": false,
+ "types": [
+ "jest",
+ "node"
+ ]
+ },
+ "include": [
+ "**/*.ts",
+ ]
+}
diff --git a/packages/kbn-ace/BUILD.bazel b/packages/kbn-ace/BUILD.bazel
index 91900928a6bca..7f30af32afa95 100644
--- a/packages/kbn-ace/BUILD.bazel
+++ b/packages/kbn-ace/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-ace"
+PKG_DIRNAME = "kbn-ace"
PKG_REQUIRE_NAME = "@kbn/ace"
SOURCE_FILES = glob(
@@ -97,7 +97,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -106,9 +106,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-alerts/BUILD.bazel b/packages/kbn-alerts/BUILD.bazel
index 86a23118abfe0..c9e52274d39f5 100644
--- a/packages/kbn-alerts/BUILD.bazel
+++ b/packages/kbn-alerts/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-alerts"
+PKG_DIRNAME = "kbn-alerts"
PKG_REQUIRE_NAME = "@kbn/alerts"
SOURCE_FILES = glob(
@@ -89,7 +89,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -98,9 +98,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-analytics/BUILD.bazel b/packages/kbn-analytics/BUILD.bazel
index 4c9065c836068..53d0cbf16ddee 100644
--- a/packages/kbn-analytics/BUILD.bazel
+++ b/packages/kbn-analytics/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-analytics"
+PKG_DIRNAME = "kbn-analytics"
PKG_REQUIRE_NAME = "@kbn/analytics"
SOURCE_FILES = glob(
@@ -92,7 +92,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -101,9 +101,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-apm-config-loader/BUILD.bazel b/packages/kbn-apm-config-loader/BUILD.bazel
index 8d83162d204bc..526193788cd92 100644
--- a/packages/kbn-apm-config-loader/BUILD.bazel
+++ b/packages/kbn-apm-config-loader/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-apm-config-loader"
+PKG_DIRNAME = "kbn-apm-config-loader"
PKG_REQUIRE_NAME = "@kbn/apm-config-loader"
SOURCE_FILES = glob(
@@ -82,7 +82,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -91,9 +91,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-apm-config-loader/index.ts b/packages/kbn-apm-config-loader/index.ts
index e2027b2e12c7c..24f46c01b4b3f 100644
--- a/packages/kbn-apm-config-loader/index.ts
+++ b/packages/kbn-apm-config-loader/index.ts
@@ -10,3 +10,4 @@ export { getConfiguration } from './src/config_loader';
export { initApm } from './src/init_apm';
export { shouldInstrumentClient } from './src/rum_agent_configuration';
export type { ApmConfiguration } from './src/config';
+export { apmConfigSchema } from './src/apm_config';
diff --git a/packages/kbn-apm-config-loader/src/apm_config.ts b/packages/kbn-apm-config-loader/src/apm_config.ts
new file mode 100644
index 0000000000000..2127d612d583b
--- /dev/null
+++ b/packages/kbn-apm-config-loader/src/apm_config.ts
@@ -0,0 +1,19 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { schema } from '@kbn/config-schema';
+
+export const apmConfigSchema = schema.object(
+ {
+ active: schema.maybe(schema.boolean()),
+ serverUrl: schema.maybe(schema.uri()),
+ secretToken: schema.maybe(schema.string()),
+ globalLabels: schema.object({}, { unknowns: 'allow' }),
+ },
+ { unknowns: 'allow' }
+);
diff --git a/packages/kbn-apm-synthtrace/BUILD.bazel b/packages/kbn-apm-synthtrace/BUILD.bazel
index 1160e8a7a1618..4107a948e27c8 100644
--- a/packages/kbn-apm-synthtrace/BUILD.bazel
+++ b/packages/kbn-apm-synthtrace/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-apm-synthtrace"
+PKG_DIRNAME = "kbn-apm-synthtrace"
PKG_REQUIRE_NAME = "@kbn/apm-synthtrace"
SOURCE_FILES = glob(
@@ -93,7 +93,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -102,9 +102,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-apm-synthtrace/index.ts b/packages/kbn-apm-synthtrace/index.ts
index 170c5ed6206c1..1ff59bdd7d16a 100644
--- a/packages/kbn-apm-synthtrace/index.ts
+++ b/packages/kbn-apm-synthtrace/index.ts
@@ -8,6 +8,7 @@
export { timerange } from './src/lib/timerange';
export { apm } from './src/lib/apm';
+export { dedot } from './src/lib/utils/dedot';
export { stackMonitoring } from './src/lib/stack_monitoring';
export { observer } from './src/lib/agent_config';
export { cleanWriteTargets } from './src/lib/utils/clean_write_targets';
diff --git a/packages/kbn-apm-synthtrace/src/lib/apm/apm_error.ts b/packages/kbn-apm-synthtrace/src/lib/apm/apm_error.ts
index 334c0f296851d..216397f1e1b40 100644
--- a/packages/kbn-apm-synthtrace/src/lib/apm/apm_error.ts
+++ b/packages/kbn-apm-synthtrace/src/lib/apm/apm_error.ts
@@ -27,4 +27,10 @@ export class ApmError extends Serializable {
);
return [data];
}
+
+ timestamp(value: number) {
+ const ret = super.timestamp(value);
+ this.fields['timestamp.us'] = value * 1000;
+ return ret;
+ }
}
diff --git a/packages/kbn-apm-synthtrace/src/lib/apm/base_span.ts b/packages/kbn-apm-synthtrace/src/lib/apm/base_span.ts
index 0cfe5940405a2..b74604c39c242 100644
--- a/packages/kbn-apm-synthtrace/src/lib/apm/base_span.ts
+++ b/packages/kbn-apm-synthtrace/src/lib/apm/base_span.ts
@@ -88,4 +88,10 @@ export class BaseSpan extends Serializable {
});
return this;
}
+
+ override timestamp(timestamp: number) {
+ const ret = super.timestamp(timestamp);
+ this.fields['timestamp.us'] = timestamp * 1000;
+ return ret;
+ }
}
diff --git a/packages/kbn-apm-synthtrace/src/lib/apm/instance.ts b/packages/kbn-apm-synthtrace/src/lib/apm/instance.ts
index f69e54b3e300b..9a7fff73b64a7 100644
--- a/packages/kbn-apm-synthtrace/src/lib/apm/instance.ts
+++ b/packages/kbn-apm-synthtrace/src/lib/apm/instance.ts
@@ -20,24 +20,49 @@ export type SpanParams = {
} & ApmFields;
export class Instance extends Entity {
- transaction({
- transactionName,
- transactionType = 'request',
- }: {
- transactionName: string;
- transactionType?: string;
- }) {
+ transaction(
+ ...options:
+ | [{ transactionName: string; transactionType?: string }]
+ | [string]
+ | [string, string]
+ ) {
+ let transactionName: string;
+ let transactionType: string | undefined;
+ if (options.length === 2) {
+ transactionName = options[0];
+ transactionType = options[1];
+ } else if (typeof options[0] === 'string') {
+ transactionName = options[0];
+ } else {
+ transactionName = options[0].transactionName;
+ transactionType = options[0].transactionType;
+ }
+
return new Transaction({
...this.fields,
'transaction.name': transactionName,
- 'transaction.type': transactionType,
+ 'transaction.type': transactionType || 'request',
});
}
- span({ spanName, spanType, spanSubtype, ...apmFields }: SpanParams) {
+ span(...options: [string, string] | [string, string, string] | [SpanParams]) {
+ let spanName: string;
+ let spanType: string;
+ let spanSubtype: string;
+ let fields: ApmFields;
+
+ if (options.length === 3 || options.length === 2) {
+ spanName = options[0];
+ spanType = options[1];
+ spanSubtype = options[2] || 'unknown';
+ fields = {};
+ } else {
+ ({ spanName, spanType, spanSubtype = 'unknown', ...fields } = options[0]);
+ }
+
return new Span({
...this.fields,
- ...apmFields,
+ ...fields,
'span.name': spanName,
'span.type': spanType,
'span.subtype': spanSubtype,
diff --git a/packages/kbn-apm-synthtrace/src/lib/apm/service.ts b/packages/kbn-apm-synthtrace/src/lib/apm/service.ts
index 0939535a87135..1925c0cdcfd13 100644
--- a/packages/kbn-apm-synthtrace/src/lib/apm/service.ts
+++ b/packages/kbn-apm-synthtrace/src/lib/apm/service.ts
@@ -20,17 +20,18 @@ export class Service extends Entity {
}
}
-export function service({
- name,
- environment,
- agentName,
-}: {
- name: string;
- environment: string;
- agentName: string;
-}) {
+export function service(name: string, environment: string, agentName: string): Service;
+
+export function service(options: { name: string; environment: string; agentName: string }): Service;
+
+export function service(
+ ...args: [{ name: string; environment: string; agentName: string }] | [string, string, string]
+) {
+ const [serviceName, environment, agentName] =
+ args.length === 1 ? [args[0].name, args[0].environment, args[0].agentName] : args;
+
return new Service({
- 'service.name': name,
+ 'service.name': serviceName,
'service.environment': environment,
'agent.name': agentName,
});
diff --git a/packages/kbn-apm-synthtrace/src/lib/stream_processor.ts b/packages/kbn-apm-synthtrace/src/lib/stream_processor.ts
index 0d7d0ff5dfa51..84f0dbb0a62bf 100644
--- a/packages/kbn-apm-synthtrace/src/lib/stream_processor.ts
+++ b/packages/kbn-apm-synthtrace/src/lib/stream_processor.ts
@@ -187,10 +187,7 @@ export class StreamProcessor {
document['service.node.name'] =
document['service.node.name'] || document['container.id'] || document['host.name'];
document['ecs.version'] = '1.4';
- // TODO this non standard field should not be enriched here
- if (document['processor.event'] !== 'metric') {
- document['timestamp.us'] = document['@timestamp']! * 1000;
- }
+
return document;
}
diff --git a/packages/kbn-apm-synthtrace/src/lib/utils/dedot.ts b/packages/kbn-apm-synthtrace/src/lib/utils/dedot.ts
index 4f38a7025f3b5..5d0f57fb5840b 100644
--- a/packages/kbn-apm-synthtrace/src/lib/utils/dedot.ts
+++ b/packages/kbn-apm-synthtrace/src/lib/utils/dedot.ts
@@ -13,4 +13,5 @@ export function dedot(source: Record, target: Record)
const val = source[key as keyof typeof source];
set(target, key, val);
}
+ return target;
}
diff --git a/packages/kbn-apm-synthtrace/src/test/apm_events_to_elasticsearch_output.test.ts b/packages/kbn-apm-synthtrace/src/test/apm_events_to_elasticsearch_output.test.ts
index afafcc0c49665..edb20c4768ee5 100644
--- a/packages/kbn-apm-synthtrace/src/test/apm_events_to_elasticsearch_output.test.ts
+++ b/packages/kbn-apm-synthtrace/src/test/apm_events_to_elasticsearch_output.test.ts
@@ -59,9 +59,6 @@ describe('output apm events to elasticsearch', () => {
"name": "instance-a",
},
},
- "timestamp": Object {
- "us": 1609455600000000,
- },
}
`);
});
diff --git a/packages/kbn-apm-synthtrace/src/test/scenarios/01_simple_trace.test.ts b/packages/kbn-apm-synthtrace/src/test/scenarios/01_simple_trace.test.ts
index a278997ecdf73..a14ae076e8186 100644
--- a/packages/kbn-apm-synthtrace/src/test/scenarios/01_simple_trace.test.ts
+++ b/packages/kbn-apm-synthtrace/src/test/scenarios/01_simple_trace.test.ts
@@ -84,6 +84,7 @@ describe('simple trace', () => {
'service.environment': 'production',
'service.name': 'opbeans-java',
'service.node.name': 'instance-1',
+ 'timestamp.us': 1609459200000000,
'trace.id': '00000000000000000000000000000241',
'transaction.duration.us': 1000000,
'transaction.id': '0000000000000240',
@@ -113,6 +114,7 @@ describe('simple trace', () => {
'span.name': 'GET apm-*/_search',
'span.subtype': 'elasticsearch',
'span.type': 'db',
+ 'timestamp.us': 1609459200050000,
'trace.id': '00000000000000000000000000000301',
'transaction.id': '0000000000000300',
});
diff --git a/packages/kbn-apm-synthtrace/src/test/scenarios/__snapshots__/01_simple_trace.test.ts.snap b/packages/kbn-apm-synthtrace/src/test/scenarios/__snapshots__/01_simple_trace.test.ts.snap
index 1a5fca39e9fd9..8b3306d2d3a4b 100644
--- a/packages/kbn-apm-synthtrace/src/test/scenarios/__snapshots__/01_simple_trace.test.ts.snap
+++ b/packages/kbn-apm-synthtrace/src/test/scenarios/__snapshots__/01_simple_trace.test.ts.snap
@@ -13,6 +13,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459200000000,
"trace.id": "00000000000000000000000000000001",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000000",
@@ -37,6 +38,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459200050000,
"trace.id": "00000000000000000000000000000001",
"transaction.id": "0000000000000000",
},
@@ -51,6 +53,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459260000000,
"trace.id": "00000000000000000000000000000005",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000004",
@@ -75,6 +78,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459260050000,
"trace.id": "00000000000000000000000000000005",
"transaction.id": "0000000000000004",
},
@@ -89,6 +93,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459320000000,
"trace.id": "00000000000000000000000000000009",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000008",
@@ -113,6 +118,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459320050000,
"trace.id": "00000000000000000000000000000009",
"transaction.id": "0000000000000008",
},
@@ -127,6 +133,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459380000000,
"trace.id": "00000000000000000000000000000013",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000012",
@@ -151,6 +158,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459380050000,
"trace.id": "00000000000000000000000000000013",
"transaction.id": "0000000000000012",
},
@@ -165,6 +173,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459440000000,
"trace.id": "00000000000000000000000000000017",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000016",
@@ -189,6 +198,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459440050000,
"trace.id": "00000000000000000000000000000017",
"transaction.id": "0000000000000016",
},
@@ -203,6 +213,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459500000000,
"trace.id": "00000000000000000000000000000021",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000020",
@@ -227,6 +238,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459500050000,
"trace.id": "00000000000000000000000000000021",
"transaction.id": "0000000000000020",
},
@@ -241,6 +253,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459560000000,
"trace.id": "00000000000000000000000000000025",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000024",
@@ -265,6 +278,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459560050000,
"trace.id": "00000000000000000000000000000025",
"transaction.id": "0000000000000024",
},
@@ -279,6 +293,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459620000000,
"trace.id": "00000000000000000000000000000029",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000028",
@@ -303,6 +318,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459620050000,
"trace.id": "00000000000000000000000000000029",
"transaction.id": "0000000000000028",
},
@@ -317,6 +333,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459680000000,
"trace.id": "00000000000000000000000000000033",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000032",
@@ -341,6 +358,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459680050000,
"trace.id": "00000000000000000000000000000033",
"transaction.id": "0000000000000032",
},
@@ -355,6 +373,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459740000000,
"trace.id": "00000000000000000000000000000037",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000036",
@@ -379,6 +398,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459740050000,
"trace.id": "00000000000000000000000000000037",
"transaction.id": "0000000000000036",
},
@@ -393,6 +413,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459800000000,
"trace.id": "00000000000000000000000000000041",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000040",
@@ -417,6 +438,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459800050000,
"trace.id": "00000000000000000000000000000041",
"transaction.id": "0000000000000040",
},
@@ -431,6 +453,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459860000000,
"trace.id": "00000000000000000000000000000045",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000044",
@@ -455,6 +478,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459860050000,
"trace.id": "00000000000000000000000000000045",
"transaction.id": "0000000000000044",
},
@@ -469,6 +493,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459920000000,
"trace.id": "00000000000000000000000000000049",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000048",
@@ -493,6 +518,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459920050000,
"trace.id": "00000000000000000000000000000049",
"transaction.id": "0000000000000048",
},
@@ -507,6 +533,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609459980000000,
"trace.id": "00000000000000000000000000000053",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000052",
@@ -531,6 +558,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609459980050000,
"trace.id": "00000000000000000000000000000053",
"transaction.id": "0000000000000052",
},
@@ -545,6 +573,7 @@ Array [
"service.environment": "production",
"service.name": "opbeans-java",
"service.node.name": "instance-1",
+ "timestamp.us": 1609460040000000,
"trace.id": "00000000000000000000000000000057",
"transaction.duration.us": 1000000,
"transaction.id": "0000000000000056",
@@ -569,6 +598,7 @@ Array [
"span.name": "GET apm-*/_search",
"span.subtype": "elasticsearch",
"span.type": "db",
+ "timestamp.us": 1609460040050000,
"trace.id": "00000000000000000000000000000057",
"transaction.id": "0000000000000056",
},
diff --git a/packages/kbn-apm-utils/BUILD.bazel b/packages/kbn-apm-utils/BUILD.bazel
index ab3004dc47d36..41b28d8c11cfc 100644
--- a/packages/kbn-apm-utils/BUILD.bazel
+++ b/packages/kbn-apm-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-apm-utils"
+PKG_DIRNAME = "kbn-apm-utils"
PKG_REQUIRE_NAME = "@kbn/apm-utils"
SOURCE_FILES = glob(
@@ -72,7 +72,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -81,9 +81,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-babel-plugin-synthetic-packages/BUILD.bazel b/packages/kbn-babel-plugin-synthetic-packages/BUILD.bazel
index da588dab2ce42..a1e6891f23ec5 100644
--- a/packages/kbn-babel-plugin-synthetic-packages/BUILD.bazel
+++ b/packages/kbn-babel-plugin-synthetic-packages/BUILD.bazel
@@ -44,9 +44,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_DIRNAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-babel-preset/BUILD.bazel b/packages/kbn-babel-preset/BUILD.bazel
index 54dc3bafd8ac8..7b4090ceac48e 100644
--- a/packages/kbn-babel-preset/BUILD.bazel
+++ b/packages/kbn-babel-preset/BUILD.bazel
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "pkg_npm")
-PKG_BASE_NAME = "kbn-babel-preset"
+PKG_DIRNAME = "kbn-babel-preset"
PKG_REQUIRE_NAME = "@kbn/babel-preset"
SOURCE_FILES = glob([
@@ -43,7 +43,7 @@ RUNTIME_DEPS = [
]
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
],
@@ -54,9 +54,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-cli-dev-mode/BUILD.bazel b/packages/kbn-cli-dev-mode/BUILD.bazel
index 9b03aaa956b54..90d11fdeb62bb 100644
--- a/packages/kbn-cli-dev-mode/BUILD.bazel
+++ b/packages/kbn-cli-dev-mode/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-cli-dev-mode"
+PKG_DIRNAME = "kbn-cli-dev-mode"
PKG_REQUIRE_NAME = "@kbn/cli-dev-mode"
SOURCE_FILES = glob(
@@ -110,7 +110,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -119,9 +119,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-cli-dev-mode/src/log_adapter.ts b/packages/kbn-cli-dev-mode/src/log_adapter.ts
index 65161fcc56e0e..58260939a6dae 100644
--- a/packages/kbn-cli-dev-mode/src/log_adapter.ts
+++ b/packages/kbn-cli-dev-mode/src/log_adapter.ts
@@ -22,6 +22,7 @@ export const convertToLogger = (cliLog: Log): Logger => {
error: (msgOrError) => cliLog.bad('error', getErrorMessage(msgOrError)),
fatal: (msgOrError) => cliLog.bad('fatal', getErrorMessage(msgOrError)),
log: (record) => cliLog.write(record.message),
+ isLevelEnabled: () => true,
get: () => adapter,
};
return adapter;
diff --git a/packages/kbn-config-schema/BUILD.bazel b/packages/kbn-config-schema/BUILD.bazel
index aebd34efa2f08..c14ba00345437 100644
--- a/packages/kbn-config-schema/BUILD.bazel
+++ b/packages/kbn-config-schema/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-config-schema"
+PKG_DIRNAME = "kbn-config-schema"
PKG_REQUIRE_NAME = "@kbn/config-schema"
SOURCE_FILES = glob(
@@ -82,7 +82,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -91,9 +91,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-config/BUILD.bazel b/packages/kbn-config/BUILD.bazel
index eef3d336b57dd..4e1066bd7a19b 100644
--- a/packages/kbn-config/BUILD.bazel
+++ b/packages/kbn-config/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-config"
+PKG_DIRNAME = "kbn-config"
PKG_REQUIRE_NAME = "@kbn/config"
SOURCE_FILES = glob(
@@ -101,7 +101,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -110,9 +110,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-crypto/BUILD.bazel b/packages/kbn-crypto/BUILD.bazel
index 4dade7bba6ca2..55ed47a64303a 100644
--- a/packages/kbn-crypto/BUILD.bazel
+++ b/packages/kbn-crypto/BUILD.bazel
@@ -3,7 +3,7 @@ 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_BASE_NAME = "kbn-crypto"
+PKG_DIRNAME = "kbn-crypto"
PKG_REQUIRE_NAME = "@kbn/crypto"
SOURCE_FILES = glob(
@@ -79,7 +79,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -88,9 +88,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-datemath/BUILD.bazel b/packages/kbn-datemath/BUILD.bazel
index ae4e19b9b7c8c..95e93f70e92e1 100644
--- a/packages/kbn-datemath/BUILD.bazel
+++ b/packages/kbn-datemath/BUILD.bazel
@@ -2,7 +2,7 @@ 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", "ts_project", "pkg_npm", "pkg_npm_types")
-PKG_BASE_NAME = "kbn-datemath"
+PKG_DIRNAME = "kbn-datemath"
PKG_REQUIRE_NAME = "@kbn/datemath"
SOURCE_FILES = glob(
@@ -71,7 +71,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -80,9 +80,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-dev-utils/BUILD.bazel b/packages/kbn-dev-utils/BUILD.bazel
index 42543650a1051..849ea8404f32c 100644
--- a/packages/kbn-dev-utils/BUILD.bazel
+++ b/packages/kbn-dev-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-dev-utils"
+PKG_DIRNAME = "kbn-dev-utils"
PKG_REQUIRE_NAME = "@kbn/dev-utils"
SOURCE_FILES = glob(
@@ -153,7 +153,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -162,9 +162,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-doc-links/BUILD.bazel b/packages/kbn-doc-links/BUILD.bazel
index c4849085c0ae2..292560832da85 100644
--- a/packages/kbn-doc-links/BUILD.bazel
+++ b/packages/kbn-doc-links/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-doc-links"
+PKG_DIRNAME = "kbn-doc-links"
PKG_REQUIRE_NAME = "@kbn/doc-links"
SOURCE_FILES = glob(
@@ -82,7 +82,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -91,9 +91,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-docs-utils/BUILD.bazel b/packages/kbn-docs-utils/BUILD.bazel
index 33687685100e1..5564b87e15f13 100644
--- a/packages/kbn-docs-utils/BUILD.bazel
+++ b/packages/kbn-docs-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-docs-utils"
+PKG_DIRNAME = "kbn-docs-utils"
PKG_REQUIRE_NAME = "@kbn/docs-utils"
SOURCE_FILES = glob(
@@ -86,7 +86,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -95,9 +95,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-ebt-tools/BUILD.bazel b/packages/kbn-ebt-tools/BUILD.bazel
index ca3591e936703..5b318045b9301 100644
--- a/packages/kbn-ebt-tools/BUILD.bazel
+++ b/packages/kbn-ebt-tools/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-ebt-tools"
+PKG_DIRNAME = "kbn-ebt-tools"
PKG_REQUIRE_NAME = "@kbn/ebt-tools"
SOURCE_FILES = glob(
@@ -72,7 +72,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
@@ -81,9 +81,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-es-archiver/BUILD.bazel b/packages/kbn-es-archiver/BUILD.bazel
index 7b0f9f0346630..7d214d913aeae 100644
--- a/packages/kbn-es-archiver/BUILD.bazel
+++ b/packages/kbn-es-archiver/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-es-archiver"
+PKG_DIRNAME = "kbn-es-archiver"
PKG_REQUIRE_NAME = "@kbn/es-archiver"
SOURCE_FILES = glob(
@@ -94,7 +94,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -103,9 +103,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel
index 2a7c445c32aac..a34b58155359d 100644
--- a/packages/kbn-es-query/BUILD.bazel
+++ b/packages/kbn-es-query/BUILD.bazel
@@ -3,7 +3,7 @@ load("@npm//peggy:index.bzl", "peggy")
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_BASE_NAME = "kbn-es-query"
+PKG_DIRNAME = "kbn-es-query"
PKG_REQUIRE_NAME = "@kbn/es-query"
SOURCE_FILES = glob(
@@ -109,7 +109,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [":grammar"],
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -118,9 +118,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-es/BUILD.bazel b/packages/kbn-es/BUILD.bazel
index 23ddda10f36e5..2aeaee4071d53 100644
--- a/packages/kbn-es/BUILD.bazel
+++ b/packages/kbn-es/BUILD.bazel
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm")
-PKG_BASE_NAME = "kbn-es"
+PKG_DIRNAME = "kbn-es"
PKG_REQUIRE_NAME = "@kbn/es"
SOURCE_FILES = glob(
@@ -57,7 +57,7 @@ jsts_transpiler(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -66,9 +66,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-eslint-config/BUILD.bazel b/packages/kbn-eslint-config/BUILD.bazel
index 73f834f7d5f63..708136256498d 100644
--- a/packages/kbn-eslint-config/BUILD.bazel
+++ b/packages/kbn-eslint-config/BUILD.bazel
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "pkg_npm")
-PKG_BASE_NAME = "kbn-eslint-config"
+PKG_DIRNAME = "kbn-eslint-config"
PKG_REQUIRE_NAME = "@kbn/eslint-config"
SOURCE_FILES = glob([
@@ -34,7 +34,7 @@ RUNTIME_DEPS = [
]
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
],
@@ -45,9 +45,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-eslint-plugin-eslint/BUILD.bazel b/packages/kbn-eslint-plugin-eslint/BUILD.bazel
index c043c4e468db9..0bb2ff549c9f9 100644
--- a/packages/kbn-eslint-plugin-eslint/BUILD.bazel
+++ b/packages/kbn-eslint-plugin-eslint/BUILD.bazel
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "pkg_npm")
-PKG_BASE_NAME = "kbn-eslint-plugin-eslint"
+PKG_DIRNAME = "kbn-eslint-plugin-eslint"
PKG_REQUIRE_NAME = "@kbn/eslint-plugin-eslint"
SOURCE_FILES = glob(
@@ -46,7 +46,7 @@ RUNTIME_DEPS = [
]
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
],
@@ -57,9 +57,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-expect/BUILD.bazel b/packages/kbn-expect/BUILD.bazel
index 415b402a3d05c..70ed34ad091ce 100644
--- a/packages/kbn-expect/BUILD.bazel
+++ b/packages/kbn-expect/BUILD.bazel
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "pkg_npm")
-PKG_BASE_NAME = "kbn-expect"
+PKG_DIRNAME = "kbn-expect"
PKG_REQUIRE_NAME = "@kbn/expect"
SOURCE_FILES = glob([
@@ -22,7 +22,7 @@ NPM_MODULE_EXTRA_FILES = [
]
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
],
@@ -32,9 +32,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-field-types/BUILD.bazel b/packages/kbn-field-types/BUILD.bazel
index 1d5ca19241bba..fa6bf48c39c88 100644
--- a/packages/kbn-field-types/BUILD.bazel
+++ b/packages/kbn-field-types/BUILD.bazel
@@ -3,7 +3,7 @@ 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_BASE_NAME = "kbn-field-types"
+PKG_DIRNAME = "kbn-field-types"
PKG_REQUIRE_NAME = "@kbn/field-types"
SOURCE_FILES = glob(
@@ -87,7 +87,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -96,9 +96,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-flot-charts/BUILD.bazel b/packages/kbn-flot-charts/BUILD.bazel
index d819fa05c7d16..ec2655bc2bbf1 100644
--- a/packages/kbn-flot-charts/BUILD.bazel
+++ b/packages/kbn-flot-charts/BUILD.bazel
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "pkg_npm")
-PKG_BASE_NAME = "kbn-flot-charts"
+PKG_DIRNAME = "kbn-flot-charts"
PKG_REQUIRE_NAME = "@kbn/flot-charts"
SOURCE_FILES = glob([
@@ -26,7 +26,7 @@ RUNTIME_DEPS = [
]
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
],
@@ -37,9 +37,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-generate/BUILD.bazel b/packages/kbn-generate/BUILD.bazel
index 098291d8a0877..e4afaec6069b9 100644
--- a/packages/kbn-generate/BUILD.bazel
+++ b/packages/kbn-generate/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-generate"
+PKG_DIRNAME = "kbn-generate"
PKG_REQUIRE_NAME = "@kbn/generate"
SOURCE_FILES = glob(
@@ -85,7 +85,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -94,9 +94,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/__snapshots__/guide_card_footer.test.tsx.snap b/packages/kbn-guided-onboarding/src/components/landing_page/__snapshots__/guide_card_footer.test.tsx.snap
index 9b18465e91be9..cbb21df42a054 100644
--- a/packages/kbn-guided-onboarding/src/components/landing_page/__snapshots__/guide_card_footer.test.tsx.snap
+++ b/packages/kbn-guided-onboarding/src/components/landing_page/__snapshots__/guide_card_footer.test.tsx.snap
@@ -44,6 +44,19 @@ exports[`guide card footer snapshots should render the footer when the guide is
diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/use_case_card.tsx b/packages/kbn-guided-onboarding/src/components/landing_page/use_case_card.tsx
index ef9373996297c..574b9b18bf2b3 100644
--- a/packages/kbn-guided-onboarding/src/components/landing_page/use_case_card.tsx
+++ b/packages/kbn-guided-onboarding/src/components/landing_page/use_case_card.tsx
@@ -9,7 +9,6 @@
import React, { ReactNode } from 'react';
import { EuiCard, EuiText, EuiImage } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
-import { GuideId } from '../../types';
type UseCaseConstants = {
[key in UseCase]: {
@@ -53,7 +52,7 @@ const constants: UseCaseConstants = {
export type UseCase = 'search' | 'observability' | 'security';
export interface UseCaseCardProps {
- useCase: GuideId;
+ useCase: UseCase;
title: string;
description: string;
footer: ReactNode;
@@ -84,18 +83,13 @@ export const UseCaseCard = ({
);
- const descriptionElement = (
-
- {description}
-
- );
+
return (
}
title={titleElement}
- description={descriptionElement}
+ description={description}
footer={footer}
betaBadgeProps={{
label: constants[useCase].betaBadgeLabel,
diff --git a/packages/kbn-guided-onboarding/src/types.ts b/packages/kbn-guided-onboarding/src/types.ts
index 9a307464cefb8..6b919835da2e7 100644
--- a/packages/kbn-guided-onboarding/src/types.ts
+++ b/packages/kbn-guided-onboarding/src/types.ts
@@ -6,13 +6,14 @@
* Side Public License, v 1.
*/
-export type GuideId = 'observability' | 'security' | 'search';
+export type GuideId = 'observability' | 'security' | 'search' | 'testGuide';
-export type ObservabilityStepIds = 'add_data' | 'view_dashboard' | 'tour_observability';
-export type SecurityStepIds = 'add_data' | 'rules' | 'alertsCases';
-export type SearchStepIds = 'add_data' | 'browse_docs' | 'search_experience';
+type ObservabilityStepIds = 'add_data' | 'view_dashboard' | 'tour_observability';
+type SecurityStepIds = 'add_data' | 'rules' | 'alertsCases';
+type SearchStepIds = 'add_data' | 'browse_docs' | 'search_experience';
+type TestGuideIds = 'step1' | 'step2' | 'step3';
-export type GuideStepIds = ObservabilityStepIds | SecurityStepIds | SearchStepIds;
+export type GuideStepIds = ObservabilityStepIds | SecurityStepIds | SearchStepIds | TestGuideIds;
export interface GuideState {
guideId: GuideId;
diff --git a/packages/kbn-handlebars/BUILD.bazel b/packages/kbn-handlebars/BUILD.bazel
index 4e3d283a0be8e..984366123bafb 100644
--- a/packages/kbn-handlebars/BUILD.bazel
+++ b/packages/kbn-handlebars/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-handlebars"
+PKG_DIRNAME = "kbn-handlebars"
PKG_REQUIRE_NAME = "@kbn/handlebars"
TYPES_PKG_REQUIRE_NAME = "@types/kbn__handlebars"
@@ -84,7 +84,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -93,9 +93,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-i18n-react/BUILD.bazel b/packages/kbn-i18n-react/BUILD.bazel
index efba43ef1cf34..cfcf823bec4a8 100644
--- a/packages/kbn-i18n-react/BUILD.bazel
+++ b/packages/kbn-i18n-react/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-i18n-react"
+PKG_DIRNAME = "kbn-i18n-react"
PKG_REQUIRE_NAME = "@kbn/i18n-react"
SOURCE_FILES = glob(
@@ -89,7 +89,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -98,9 +98,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-i18n/BUILD.bazel b/packages/kbn-i18n/BUILD.bazel
index 90079be18cab2..d58fdfc60df1e 100644
--- a/packages/kbn-i18n/BUILD.bazel
+++ b/packages/kbn-i18n/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-i18n"
+PKG_DIRNAME = "kbn-i18n"
PKG_REQUIRE_NAME = "@kbn/i18n"
SOURCE_FILES = glob(
@@ -89,7 +89,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -98,9 +98,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-interpreter/BUILD.bazel b/packages/kbn-interpreter/BUILD.bazel
index d711715d519c8..e2cd2103ddde9 100644
--- a/packages/kbn-interpreter/BUILD.bazel
+++ b/packages/kbn-interpreter/BUILD.bazel
@@ -3,7 +3,7 @@ load("@npm//peggy:index.bzl", "peggy")
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_BASE_NAME = "kbn-interpreter"
+PKG_DIRNAME = "kbn-interpreter"
PKG_REQUIRE_NAME = "@kbn/interpreter"
SOURCE_FILES = glob(
@@ -101,7 +101,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [":grammar"],
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -110,9 +110,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-io-ts-utils/BUILD.bazel b/packages/kbn-io-ts-utils/BUILD.bazel
index 48641035223e5..322c44f18a5b8 100644
--- a/packages/kbn-io-ts-utils/BUILD.bazel
+++ b/packages/kbn-io-ts-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-io-ts-utils"
+PKG_DIRNAME = "kbn-io-ts-utils"
PKG_REQUIRE_NAME = "@kbn/io-ts-utils"
SOURCE_FILES = glob(
@@ -88,7 +88,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -97,9 +97,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-language-documentation-popover/BUILD.bazel b/packages/kbn-language-documentation-popover/BUILD.bazel
index d596368bd91ee..2e2eaa3760abb 100644
--- a/packages/kbn-language-documentation-popover/BUILD.bazel
+++ b/packages/kbn-language-documentation-popover/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-language-documentation-popover"
+PKG_DIRNAME = "kbn-language-documentation-popover"
PKG_REQUIRE_NAME = "@kbn/language-documentation-popover"
SOURCE_FILES = glob(
@@ -101,7 +101,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_webpack"],
package_name = PKG_REQUIRE_NAME,
@@ -110,9 +110,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-logging-mocks/BUILD.bazel b/packages/kbn-logging-mocks/BUILD.bazel
index 1af99a6a62954..78d175af69dec 100644
--- a/packages/kbn-logging-mocks/BUILD.bazel
+++ b/packages/kbn-logging-mocks/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-logging-mocks"
+PKG_DIRNAME = "kbn-logging-mocks"
PKG_REQUIRE_NAME = "@kbn/logging-mocks"
SOURCE_FILES = glob(
@@ -72,7 +72,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -81,9 +81,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-logging-mocks/src/logger.mock.ts b/packages/kbn-logging-mocks/src/logger.mock.ts
index b5f1f409ee457..dd3303dda9410 100644
--- a/packages/kbn-logging-mocks/src/logger.mock.ts
+++ b/packages/kbn-logging-mocks/src/logger.mock.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { Logger } from '@kbn/logging';
+import type { Logger } from '@kbn/logging';
export type MockedLogger = jest.Mocked
& { context: string[] };
@@ -21,11 +21,13 @@ const createLoggerMock = (context: string[] = []) => {
trace: jest.fn(),
warn: jest.fn(),
get: jest.fn(),
+ isLevelEnabled: jest.fn(),
};
mockLog.get.mockImplementation((...ctx) => ({
ctx,
...mockLog,
}));
+ mockLog.isLevelEnabled.mockReturnValue(true);
return mockLog;
};
diff --git a/packages/kbn-logging/BUILD.bazel b/packages/kbn-logging/BUILD.bazel
index 4d7668cc09650..cf64d4247f328 100644
--- a/packages/kbn-logging/BUILD.bazel
+++ b/packages/kbn-logging/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-logging"
+PKG_DIRNAME = "kbn-logging"
PKG_REQUIRE_NAME = "@kbn/logging"
SOURCE_FILES = glob(
@@ -74,7 +74,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -83,9 +83,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-logging/src/logger.ts b/packages/kbn-logging/src/logger.ts
index fda3cf45b9d79..bd31d4c42f805 100644
--- a/packages/kbn-logging/src/logger.ts
+++ b/packages/kbn-logging/src/logger.ts
@@ -6,8 +6,9 @@
* Side Public License, v 1.
*/
-import { LogMeta } from './log_meta';
-import { LogRecord } from './log_record';
+import type { LogMeta } from './log_meta';
+import type { LogRecord } from './log_record';
+import type { LogLevelId } from './log_level';
/**
* Logger exposes all the necessary methods to log any type of information and
@@ -64,6 +65,22 @@ export interface Logger {
/** @internal */
log(record: LogRecord): void;
+ /**
+ * Checks if given level is currently enabled for this logger.
+ * Can be used to wrap expensive logging operations into conditional blocks
+ *
+ * @example
+ * ```ts
+ * if(logger.isLevelEnabled('info')) {
+ * const meta = await someExpensiveOperation();
+ * logger.info('some message', meta);
+ * }
+ * ```
+ *
+ * @param level The log level to check for.
+ */
+ isLevelEnabled(level: LogLevelId): boolean;
+
/**
* Returns a new {@link Logger} instance extending the current logger context.
*
diff --git a/packages/kbn-mapbox-gl/BUILD.bazel b/packages/kbn-mapbox-gl/BUILD.bazel
index a55f5f77897d7..e81aa132d1111 100644
--- a/packages/kbn-mapbox-gl/BUILD.bazel
+++ b/packages/kbn-mapbox-gl/BUILD.bazel
@@ -3,7 +3,7 @@ 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_BASE_NAME = "kbn-mapbox-gl"
+PKG_DIRNAME = "kbn-mapbox-gl"
PKG_REQUIRE_NAME = "@kbn/mapbox-gl"
SOURCE_FILES = glob(
@@ -84,7 +84,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -93,9 +93,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-monaco/BUILD.bazel b/packages/kbn-monaco/BUILD.bazel
index 2ed705e1c81c3..dbf1b3f0af065 100644
--- a/packages/kbn-monaco/BUILD.bazel
+++ b/packages/kbn-monaco/BUILD.bazel
@@ -3,7 +3,7 @@ load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
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_BASE_NAME = "kbn-monaco"
+PKG_DIRNAME = "kbn-monaco"
PKG_REQUIRE_NAME = "@kbn/monaco"
SOURCE_FILES = glob(
@@ -113,7 +113,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":target_workers"],
package_name = PKG_REQUIRE_NAME,
@@ -122,9 +122,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-optimizer/BUILD.bazel b/packages/kbn-optimizer/BUILD.bazel
index 0701fa141dd9a..530058c9f5d7e 100644
--- a/packages/kbn-optimizer/BUILD.bazel
+++ b/packages/kbn-optimizer/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-optimizer"
+PKG_DIRNAME = "kbn-optimizer"
PKG_REQUIRE_NAME = "@kbn/optimizer"
SOURCE_FILES = glob(
@@ -133,7 +133,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -142,9 +142,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-plugin-generator/BUILD.bazel b/packages/kbn-plugin-generator/BUILD.bazel
index 587cd546d50fb..d3ad237231c25 100644
--- a/packages/kbn-plugin-generator/BUILD.bazel
+++ b/packages/kbn-plugin-generator/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-plugin-generator"
+PKG_DIRNAME = "kbn-plugin-generator"
PKG_REQUIRE_NAME = "@kbn/plugin-generator"
SOURCE_FILES = glob(
@@ -102,7 +102,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -111,9 +111,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-plugin-helpers/BUILD.bazel b/packages/kbn-plugin-helpers/BUILD.bazel
index 32f8f0a3720db..c1793269c2fee 100644
--- a/packages/kbn-plugin-helpers/BUILD.bazel
+++ b/packages/kbn-plugin-helpers/BUILD.bazel
@@ -3,7 +3,7 @@ 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_BASE_NAME = "kbn-plugin-helpers"
+PKG_DIRNAME = "kbn-plugin-helpers"
PKG_REQUIRE_NAME = "@kbn/plugin-helpers"
SOURCE_FILES = glob(
@@ -95,7 +95,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -104,9 +104,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-react-field/BUILD.bazel b/packages/kbn-react-field/BUILD.bazel
index 7b4e78f9868f4..0a851c9a156cf 100644
--- a/packages/kbn-react-field/BUILD.bazel
+++ b/packages/kbn-react-field/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-react-field"
+PKG_DIRNAME = "kbn-react-field"
PKG_REQUIRE_NAME = "@kbn/react-field"
SOURCE_FILES = glob(
@@ -99,7 +99,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_webpack"],
package_name = PKG_REQUIRE_NAME,
@@ -108,9 +108,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-rule-data-utils/BUILD.bazel b/packages/kbn-rule-data-utils/BUILD.bazel
index 61146f0b5de31..788ef54533536 100644
--- a/packages/kbn-rule-data-utils/BUILD.bazel
+++ b/packages/kbn-rule-data-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-rule-data-utils"
+PKG_DIRNAME = "kbn-rule-data-utils"
PKG_REQUIRE_NAME = "@kbn/rule-data-utils"
SOURCE_FILES = glob(
@@ -86,7 +86,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -95,9 +95,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-safer-lodash-set/BUILD.bazel b/packages/kbn-safer-lodash-set/BUILD.bazel
index 893719c822859..3a5d07ab38904 100644
--- a/packages/kbn-safer-lodash-set/BUILD.bazel
+++ b/packages/kbn-safer-lodash-set/BUILD.bazel
@@ -1,6 +1,6 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
-PKG_BASE_NAME = "kbn-safer-lodash-set"
+PKG_DIRNAME = "kbn-safer-lodash-set"
PKG_REQUIRE_NAME = "@kbn/safer-lodash-set"
SOURCE_FILES = glob(
@@ -40,7 +40,7 @@ DEPS = [
]
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
],
@@ -51,9 +51,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
@@ -66,7 +64,7 @@ filegroup(
alias(
name = "npm_module_types",
- actual = PKG_BASE_NAME,
+ actual = PKG_DIRNAME,
visibility = ["//visibility:public"],
)
diff --git a/packages/kbn-securitysolution-autocomplete/BUILD.bazel b/packages/kbn-securitysolution-autocomplete/BUILD.bazel
index d09b4cf04c70a..ae396cfb7a18d 100644
--- a/packages/kbn-securitysolution-autocomplete/BUILD.bazel
+++ b/packages/kbn-securitysolution-autocomplete/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-autocomplete"
+PKG_DIRNAME = "kbn-securitysolution-autocomplete"
PKG_REQUIRE_NAME = "@kbn/securitysolution-autocomplete"
SOURCE_FILES = glob(
@@ -109,7 +109,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -118,9 +118,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-es-utils/BUILD.bazel b/packages/kbn-securitysolution-es-utils/BUILD.bazel
index 6eb3a84e83fce..59dbdb1fa63a6 100644
--- a/packages/kbn-securitysolution-es-utils/BUILD.bazel
+++ b/packages/kbn-securitysolution-es-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-es-utils"
+PKG_DIRNAME = "kbn-securitysolution-es-utils"
PKG_REQUIRE_NAME = "@kbn/securitysolution-es-utils"
SOURCE_FILES = glob(
@@ -80,7 +80,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -89,9 +89,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ],
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-hook-utils/BUILD.bazel b/packages/kbn-securitysolution-hook-utils/BUILD.bazel
index 6959bfcc69534..ab33e32a0ad4c 100644
--- a/packages/kbn-securitysolution-hook-utils/BUILD.bazel
+++ b/packages/kbn-securitysolution-hook-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-hook-utils"
+PKG_DIRNAME = "kbn-securitysolution-hook-utils"
PKG_REQUIRE_NAME = "@kbn/securitysolution-hook-utils"
SOURCE_FILES = glob(
@@ -87,7 +87,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -96,9 +96,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ],
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/BUILD.bazel b/packages/kbn-securitysolution-io-ts-alerting-types/BUILD.bazel
index 7ddd3ab480bfc..713f56917c19f 100644
--- a/packages/kbn-securitysolution-io-ts-alerting-types/BUILD.bazel
+++ b/packages/kbn-securitysolution-io-ts-alerting-types/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-io-ts-alerting-types"
+PKG_DIRNAME = "kbn-securitysolution-io-ts-alerting-types"
PKG_REQUIRE_NAME = "@kbn/securitysolution-io-ts-alerting-types"
SOURCE_FILES = glob(
@@ -90,7 +90,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -99,9 +99,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-io-ts-list-types/BUILD.bazel b/packages/kbn-securitysolution-io-ts-list-types/BUILD.bazel
index 7a4388b65053e..718ab4e75c9d8 100644
--- a/packages/kbn-securitysolution-io-ts-list-types/BUILD.bazel
+++ b/packages/kbn-securitysolution-io-ts-list-types/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-io-ts-list-types"
+PKG_DIRNAME = "kbn-securitysolution-io-ts-list-types"
PKG_REQUIRE_NAME = "@kbn/securitysolution-io-ts-list-types"
SOURCE_FILES = glob(
@@ -91,7 +91,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -100,9 +100,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-io-ts-types/BUILD.bazel b/packages/kbn-securitysolution-io-ts-types/BUILD.bazel
index 85f5a05ed6c44..f09e4139fccca 100644
--- a/packages/kbn-securitysolution-io-ts-types/BUILD.bazel
+++ b/packages/kbn-securitysolution-io-ts-types/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-io-ts-types"
+PKG_DIRNAME = "kbn-securitysolution-io-ts-types"
PKG_REQUIRE_NAME = "@kbn/securitysolution-io-ts-types"
SOURCE_FILES = glob(
@@ -88,7 +88,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -97,9 +97,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-io-ts-utils/BUILD.bazel b/packages/kbn-securitysolution-io-ts-utils/BUILD.bazel
index 6e8d4de3ccfde..eb30bfe8cc433 100644
--- a/packages/kbn-securitysolution-io-ts-utils/BUILD.bazel
+++ b/packages/kbn-securitysolution-io-ts-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-io-ts-utils"
+PKG_DIRNAME = "kbn-securitysolution-io-ts-utils"
PKG_REQUIRE_NAME = "@kbn/securitysolution-io-ts-utils"
SOURCE_FILES = glob(
@@ -91,7 +91,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -100,9 +100,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-list-api/BUILD.bazel b/packages/kbn-securitysolution-list-api/BUILD.bazel
index 9819e867e3194..39f3f797c569b 100644
--- a/packages/kbn-securitysolution-list-api/BUILD.bazel
+++ b/packages/kbn-securitysolution-list-api/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-list-api"
+PKG_DIRNAME = "kbn-securitysolution-list-api"
PKG_REQUIRE_NAME = "@kbn/securitysolution-list-api"
SOURCE_FILES = glob(
@@ -90,7 +90,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -99,9 +99,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ],
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-list-constants/BUILD.bazel b/packages/kbn-securitysolution-list-constants/BUILD.bazel
index 5d4a6c2ffb117..779eef5617de1 100644
--- a/packages/kbn-securitysolution-list-constants/BUILD.bazel
+++ b/packages/kbn-securitysolution-list-constants/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-list-constants"
+PKG_DIRNAME = "kbn-securitysolution-list-constants"
PKG_REQUIRE_NAME = "@kbn/securitysolution-list-constants"
SOURCE_FILES = glob(
@@ -78,7 +78,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -87,9 +87,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ],
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-list-hooks/BUILD.bazel b/packages/kbn-securitysolution-list-hooks/BUILD.bazel
index 93a3d0c683dd5..2487cf359d29e 100644
--- a/packages/kbn-securitysolution-list-hooks/BUILD.bazel
+++ b/packages/kbn-securitysolution-list-hooks/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-list-hooks"
+PKG_DIRNAME = "kbn-securitysolution-list-hooks"
PKG_REQUIRE_NAME = "@kbn/securitysolution-list-hooks"
SOURCE_FILES = glob(
@@ -97,7 +97,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -106,9 +106,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ],
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-list-utils/BUILD.bazel b/packages/kbn-securitysolution-list-utils/BUILD.bazel
index d1d1a9a3e326a..5155da63bfbc5 100644
--- a/packages/kbn-securitysolution-list-utils/BUILD.bazel
+++ b/packages/kbn-securitysolution-list-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-list-utils"
+PKG_DIRNAME = "kbn-securitysolution-list-utils"
PKG_REQUIRE_NAME = "@kbn/securitysolution-list-utils"
SOURCE_FILES = glob(
@@ -97,7 +97,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -107,9 +107,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ],
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-rules/BUILD.bazel b/packages/kbn-securitysolution-rules/BUILD.bazel
index e1da8501dffa1..280c7cd0dae50 100644
--- a/packages/kbn-securitysolution-rules/BUILD.bazel
+++ b/packages/kbn-securitysolution-rules/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-rules"
+PKG_DIRNAME = "kbn-securitysolution-rules"
PKG_REQUIRE_NAME = "@kbn/securitysolution-rules"
SOURCE_FILES = glob(
@@ -85,7 +85,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -94,9 +94,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ],
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-t-grid/BUILD.bazel b/packages/kbn-securitysolution-t-grid/BUILD.bazel
index 39c1aff010f88..d907afc660311 100644
--- a/packages/kbn-securitysolution-t-grid/BUILD.bazel
+++ b/packages/kbn-securitysolution-t-grid/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-t-grid"
+PKG_DIRNAME = "kbn-securitysolution-t-grid"
PKG_REQUIRE_NAME = "@kbn/securitysolution-t-grid"
SOURCE_FILES = glob(
@@ -86,7 +86,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -95,9 +95,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ],
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-securitysolution-utils/BUILD.bazel b/packages/kbn-securitysolution-utils/BUILD.bazel
index a76553e2fb2c5..68e9ab6dd597b 100644
--- a/packages/kbn-securitysolution-utils/BUILD.bazel
+++ b/packages/kbn-securitysolution-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-securitysolution-utils"
+PKG_DIRNAME = "kbn-securitysolution-utils"
PKG_REQUIRE_NAME = "@kbn/securitysolution-utils"
SOURCE_FILES = glob(
@@ -85,7 +85,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -94,9 +94,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ],
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-server-http-tools/BUILD.bazel b/packages/kbn-server-http-tools/BUILD.bazel
index 5c73a34ffe5e7..004cfb336f049 100644
--- a/packages/kbn-server-http-tools/BUILD.bazel
+++ b/packages/kbn-server-http-tools/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-server-http-tools"
+PKG_DIRNAME = "kbn-server-http-tools"
PKG_REQUIRE_NAME = "@kbn/server-http-tools"
SOURCE_FILES = glob(
@@ -89,7 +89,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -98,9 +98,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-server-route-repository/BUILD.bazel b/packages/kbn-server-route-repository/BUILD.bazel
index cbe6172e32e40..7ecc92bbe1a26 100644
--- a/packages/kbn-server-route-repository/BUILD.bazel
+++ b/packages/kbn-server-route-repository/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-server-route-repository"
+PKG_DIRNAME = "kbn-server-route-repository"
PKG_REQUIRE_NAME = "@kbn/server-route-repository"
SOURCE_FILES = glob(
@@ -96,7 +96,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -105,9 +105,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-spec-to-console/BUILD.bazel b/packages/kbn-spec-to-console/BUILD.bazel
index ee046c6194f7f..9d41b5762d470 100644
--- a/packages/kbn-spec-to-console/BUILD.bazel
+++ b/packages/kbn-spec-to-console/BUILD.bazel
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "pkg_npm")
-PKG_BASE_NAME = "kbn-spec-to-console"
+PKG_DIRNAME = "kbn-spec-to-console"
PKG_REQUIRE_NAME = "@kbn/spec-to-console"
SOURCE_FILES = glob(
@@ -33,7 +33,7 @@ RUNTIME_DEPS = [
]
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
],
@@ -44,9 +44,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-std/BUILD.bazel b/packages/kbn-std/BUILD.bazel
index fb59d13596ab7..f92779194187f 100644
--- a/packages/kbn-std/BUILD.bazel
+++ b/packages/kbn-std/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-std"
+PKG_DIRNAME = "kbn-std"
PKG_REQUIRE_NAME = "@kbn/std"
SOURCE_FILES = glob(
@@ -83,7 +83,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -92,9 +92,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-storybook/BUILD.bazel b/packages/kbn-storybook/BUILD.bazel
index c85352b8ac914..e58a4954fd44c 100644
--- a/packages/kbn-storybook/BUILD.bazel
+++ b/packages/kbn-storybook/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-storybook"
+PKG_DIRNAME = "kbn-storybook"
PKG_REQUIRE_NAME = "@kbn/storybook"
SOURCE_FILES = glob(
@@ -115,7 +115,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -124,9 +124,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-telemetry-tools/BUILD.bazel b/packages/kbn-telemetry-tools/BUILD.bazel
index b234f2dd6ea45..d4e2a87075782 100644
--- a/packages/kbn-telemetry-tools/BUILD.bazel
+++ b/packages/kbn-telemetry-tools/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-telemetry-tools"
+PKG_DIRNAME = "kbn-telemetry-tools"
PKG_REQUIRE_NAME = "@kbn/telemetry-tools"
SOURCE_FILES = glob(
@@ -89,7 +89,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -98,9 +98,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-test-jest-helpers/BUILD.bazel b/packages/kbn-test-jest-helpers/BUILD.bazel
index d31f9184cf2ac..6017936b06552 100644
--- a/packages/kbn-test-jest-helpers/BUILD.bazel
+++ b/packages/kbn-test-jest-helpers/BUILD.bazel
@@ -3,7 +3,7 @@ load("@npm//@babel/cli:index.bzl", "babel")
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_BASE_NAME = "kbn-test-jest-helpers"
+PKG_DIRNAME = "kbn-test-jest-helpers"
PKG_REQUIRE_NAME = "@kbn/test-jest-helpers"
SOURCE_FILES = glob(
@@ -148,7 +148,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -157,9 +157,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-test/BUILD.bazel b/packages/kbn-test/BUILD.bazel
index 1deca3a0f6d07..32eccf2963060 100644
--- a/packages/kbn-test/BUILD.bazel
+++ b/packages/kbn-test/BUILD.bazel
@@ -3,7 +3,7 @@ load("@npm//@babel/cli:index.bzl", "babel")
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_BASE_NAME = "kbn-test"
+PKG_DIRNAME = "kbn-test"
PKG_REQUIRE_NAME = "@kbn/test"
SOURCE_FILES = glob(
@@ -170,7 +170,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -179,9 +179,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-test/src/jest/integration_tests/junit_reporter.test.ts b/packages/kbn-test/src/jest/integration_tests/junit_reporter.test.ts
index 49b52a037e30c..f2bf25067a9bd 100644
--- a/packages/kbn-test/src/jest/integration_tests/junit_reporter.test.ts
+++ b/packages/kbn-test/src/jest/integration_tests/junit_reporter.test.ts
@@ -26,8 +26,7 @@ afterAll(async () => {
});
const parseXml = promisify(xml2js.parseString);
-// FLAKY https://github.com/elastic/kibana/issues/143993
-it.skip(
+it(
'produces a valid junit report for failures',
async () => {
const result = await execa(
diff --git a/packages/kbn-test/src/jest/junit_reporter.ts b/packages/kbn-test/src/jest/junit_reporter.ts
index eb5828120a57b..6a1ce9d51ded9 100644
--- a/packages/kbn-test/src/jest/junit_reporter.ts
+++ b/packages/kbn-test/src/jest/junit_reporter.ts
@@ -60,8 +60,9 @@ export default class JestJUnitReporter extends BaseReporter {
);
const msToIso = (ms: number | null | undefined) =>
- ms ? new Date(ms).toISOString().slice(0, -5) : undefined;
- const msToSec = (ms: number | null | undefined) => (ms ? (ms / 1000).toFixed(3) : undefined);
+ typeof ms === 'number' ? new Date(ms).toISOString().slice(0, -5) : undefined;
+ const msToSec = (ms: number | null | undefined) =>
+ typeof ms === 'number' ? (ms / 1000).toFixed(3) : undefined;
root.att({
name: 'jest',
diff --git a/packages/kbn-timelion-grammar/BUILD.bazel b/packages/kbn-timelion-grammar/BUILD.bazel
index c906223c2253b..3c7ea13cadf64 100644
--- a/packages/kbn-timelion-grammar/BUILD.bazel
+++ b/packages/kbn-timelion-grammar/BUILD.bazel
@@ -2,7 +2,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("@npm//peggy:index.bzl", "peggy")
load("//src/dev/bazel:index.bzl", "pkg_npm")
-PKG_BASE_NAME = "kbn-timelion-grammar"
+PKG_DIRNAME = "kbn-timelion-grammar"
PKG_REQUIRE_NAME = "@kbn/timelion-grammar"
NPM_MODULE_EXTRA_FILES = [
@@ -23,7 +23,7 @@ peggy(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":grammar"
],
@@ -33,9 +33,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-tinymath/BUILD.bazel b/packages/kbn-tinymath/BUILD.bazel
index ffbd74da2d02e..b8ee25a4973b8 100644
--- a/packages/kbn-tinymath/BUILD.bazel
+++ b/packages/kbn-tinymath/BUILD.bazel
@@ -2,7 +2,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("@npm//peggy:index.bzl", "peggy")
load("//src/dev/bazel:index.bzl", "pkg_npm")
-PKG_BASE_NAME = "kbn-tinymath"
+PKG_DIRNAME = "kbn-tinymath"
PKG_REQUIRE_NAME = "@kbn/tinymath"
SOURCE_FILES = glob(
@@ -45,7 +45,7 @@ peggy(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
":grammar"
@@ -57,9 +57,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-typed-react-router-config/BUILD.bazel b/packages/kbn-typed-react-router-config/BUILD.bazel
index c14f2b66b9870..e6f1587e537ed 100644
--- a/packages/kbn-typed-react-router-config/BUILD.bazel
+++ b/packages/kbn-typed-react-router-config/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-typed-react-router-config"
+PKG_DIRNAME = "kbn-typed-react-router-config"
PKG_REQUIRE_NAME = "@kbn/typed-react-router-config"
SOURCE_FILES = glob(
@@ -100,7 +100,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -109,9 +109,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-ui-framework/BUILD.bazel b/packages/kbn-ui-framework/BUILD.bazel
index f38e10eafeec7..2e801955a8524 100644
--- a/packages/kbn-ui-framework/BUILD.bazel
+++ b/packages/kbn-ui-framework/BUILD.bazel
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "pkg_npm")
-PKG_BASE_NAME = "kbn-ui-framework"
+PKG_DIRNAME = "kbn-ui-framework"
PKG_REQUIRE_NAME = "@kbn/ui-framework"
SOURCE_FILES = glob([
@@ -23,7 +23,7 @@ NPM_MODULE_EXTRA_FILES = [
RUNTIME_DEPS = []
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
],
@@ -34,9 +34,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-ui-shared-deps-npm/BUILD.bazel b/packages/kbn-ui-shared-deps-npm/BUILD.bazel
index c20613e128e49..7f589c7c0a842 100644
--- a/packages/kbn-ui-shared-deps-npm/BUILD.bazel
+++ b/packages/kbn-ui-shared-deps-npm/BUILD.bazel
@@ -3,7 +3,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
-PKG_BASE_NAME = "kbn-ui-shared-deps-npm"
+PKG_DIRNAME = "kbn-ui-shared-deps-npm"
PKG_REQUIRE_NAME = "@kbn/ui-shared-deps-npm"
SOURCE_FILES = glob(
@@ -154,7 +154,7 @@ webpack(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":shared_built_assets"],
package_name = PKG_REQUIRE_NAME,
@@ -163,9 +163,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-ui-shared-deps-src/BUILD.bazel b/packages/kbn-ui-shared-deps-src/BUILD.bazel
index 4979792e00ee5..0507f18756929 100644
--- a/packages/kbn-ui-shared-deps-src/BUILD.bazel
+++ b/packages/kbn-ui-shared-deps-src/BUILD.bazel
@@ -3,7 +3,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
-PKG_BASE_NAME = "kbn-ui-shared-deps-src"
+PKG_DIRNAME = "kbn-ui-shared-deps-src"
PKG_REQUIRE_NAME = "@kbn/ui-shared-deps-src"
SOURCE_FILES = glob(
@@ -111,7 +111,7 @@ webpack(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":shared_built_assets"],
package_name = PKG_REQUIRE_NAME,
@@ -120,9 +120,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-ui-theme/BUILD.bazel b/packages/kbn-ui-theme/BUILD.bazel
index a004975293a0b..0a890d07fba0f 100644
--- a/packages/kbn-ui-theme/BUILD.bazel
+++ b/packages/kbn-ui-theme/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-ui-theme"
+PKG_DIRNAME = "kbn-ui-theme"
PKG_REQUIRE_NAME = "@kbn/ui-theme"
SOURCE_FILES = glob(
@@ -80,7 +80,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -89,9 +89,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-user-profile-components/BUILD.bazel b/packages/kbn-user-profile-components/BUILD.bazel
index fff27d0f68c34..1037d47a79ad4 100644
--- a/packages/kbn-user-profile-components/BUILD.bazel
+++ b/packages/kbn-user-profile-components/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-user-profile-components"
+PKG_DIRNAME = "kbn-user-profile-components"
PKG_REQUIRE_NAME = "@kbn/user-profile-components"
SOURCE_FILES = glob(
@@ -87,7 +87,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web"],
package_name = PKG_REQUIRE_NAME,
@@ -96,9 +96,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-utility-types-jest/BUILD.bazel b/packages/kbn-utility-types-jest/BUILD.bazel
index 3b8985767b244..589d17734e55a 100644
--- a/packages/kbn-utility-types-jest/BUILD.bazel
+++ b/packages/kbn-utility-types-jest/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-utility-types-jest"
+PKG_DIRNAME = "kbn-utility-types-jest"
PKG_REQUIRE_NAME = "@kbn/utility-types-jest"
SOURCE_FILES = glob(
@@ -70,7 +70,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -79,9 +79,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-utility-types/BUILD.bazel b/packages/kbn-utility-types/BUILD.bazel
index ad463d9342580..20c640a4b2250 100644
--- a/packages/kbn-utility-types/BUILD.bazel
+++ b/packages/kbn-utility-types/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-utility-types"
+PKG_DIRNAME = "kbn-utility-types"
PKG_REQUIRE_NAME = "@kbn/utility-types"
SOURCE_FILES = glob(
@@ -74,7 +74,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
@@ -83,9 +83,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/packages/kbn-utils/BUILD.bazel b/packages/kbn-utils/BUILD.bazel
index b488b66303910..857ff523a3269 100644
--- a/packages/kbn-utils/BUILD.bazel
+++ b/packages/kbn-utils/BUILD.bazel
@@ -2,7 +2,7 @@ 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_BASE_NAME = "kbn-utils"
+PKG_DIRNAME = "kbn-utils"
PKG_REQUIRE_NAME = "@kbn/utils"
SOURCE_FILES = glob(
@@ -78,7 +78,7 @@ ts_project(
)
js_library(
- name = PKG_BASE_NAME,
+ name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
@@ -87,9 +87,7 @@ js_library(
pkg_npm(
name = "npm_module",
- deps = [
- ":%s" % PKG_BASE_NAME,
- ]
+ deps = [":" + PKG_DIRNAME],
)
filegroup(
diff --git a/src/cli_setup/utils.ts b/src/cli_setup/utils.ts
index 47b8199f16ea0..33efb2ff802b8 100644
--- a/src/cli_setup/utils.ts
+++ b/src/cli_setup/utils.ts
@@ -29,6 +29,7 @@ const logger: Logger = {
fatal: noop,
log: noop,
get: () => logger,
+ isLevelEnabled: () => true,
};
export const kibanaConfigWriter = new KibanaConfigWriter(getConfigPath(), getDataPath(), logger);
diff --git a/src/core/server/core_app/core_app.test.ts b/src/core/server/core_app/core_app.test.ts
index 1ea3eeef29a09..31e4b6176a889 100644
--- a/src/core/server/core_app/core_app.test.ts
+++ b/src/core/server/core_app/core_app.test.ts
@@ -13,7 +13,7 @@ import { mockRouter } from '@kbn/core-http-router-server-mocks';
import type { UiPlugins } from '@kbn/core-plugins-base-server-internal';
import { coreMock, httpServerMock } from '../mocks';
import { httpResourcesMock } from '@kbn/core-http-resources-server-mocks';
-import { PluginType } from '../plugins';
+import { PluginType } from '@kbn/core-base-common';
import { CoreApp } from './core_app';
import { RequestHandlerContext } from '..';
diff --git a/src/core/server/core_app/core_app.ts b/src/core/server/core_app/core_app.ts
index f0940f6abad50..83665512767e7 100644
--- a/src/core/server/core_app/core_app.ts
+++ b/src/core/server/core_app/core_app.ts
@@ -22,7 +22,7 @@ import type {
} from '@kbn/core-http-server';
import type { UiPlugins } from '@kbn/core-plugins-base-server-internal';
import type { HttpResources, HttpResourcesServiceToolkit } from '@kbn/core-http-resources-server';
-import { InternalCorePreboot, InternalCoreSetup } from '../internal_types';
+import { InternalCorePreboot, InternalCoreSetup } from '@kbn/core-lifecycle-server-internal';
import { registerBundleRoutes } from './bundle_routes';
import type { InternalCoreAppRequestHandlerContext } from './internal_types';
diff --git a/src/core/server/index.ts b/src/core/server/index.ts
index 6232a17eb6111..df770c8529ab8 100644
--- a/src/core/server/index.ts
+++ b/src/core/server/index.ts
@@ -29,14 +29,8 @@
*/
import { Type } from '@kbn/config-schema';
-import type { DocLinksServiceStart, DocLinksServiceSetup } from '@kbn/core-doc-links-server';
-import type { AppenderConfigType, LoggingServiceSetup } from '@kbn/core-logging-server';
+import type { AppenderConfigType } from '@kbn/core-logging-server';
import { appendersSchema } from '@kbn/core-logging-server-internal';
-import type {
- AnalyticsServiceSetup,
- AnalyticsServiceStart,
- AnalyticsServicePreboot,
-} from '@kbn/core-analytics-server';
import type {
ExecutionContextSetup,
ExecutionContextStart,
@@ -46,31 +40,13 @@ import type {
RequestHandler,
KibanaResponseFactory,
RouteMethod,
- HttpServicePreboot,
HttpServiceSetup,
- HttpServiceStart,
} from '@kbn/core-http-server';
-import type { PrebootServicePreboot } from '@kbn/core-preboot-server';
-import type { MetricsServiceSetup, MetricsServiceStart } from '@kbn/core-metrics-server';
-import {
- ElasticsearchServiceSetup,
- ElasticsearchServiceStart,
- ElasticsearchServicePreboot,
-} from '@kbn/core-elasticsearch-server';
import { configSchema as elasticsearchConfigSchema } from '@kbn/core-elasticsearch-server-internal';
import type { CapabilitiesSetup, CapabilitiesStart } from '@kbn/core-capabilities-server';
-import type {
- SavedObjectsServiceSetup,
- SavedObjectsServiceStart,
-} from '@kbn/core-saved-objects-server';
-import type { DeprecationsServiceSetup } from '@kbn/core-deprecations-server';
-import type { CoreUsageDataStart, CoreUsageDataSetup } from '@kbn/core-usage-data-server';
-import type { I18nServiceSetup } from '@kbn/core-i18n-server';
-import type { StatusServiceSetup } from '@kbn/core-status-server';
-import type { UiSettingsServiceSetup, UiSettingsServiceStart } from '@kbn/core-ui-settings-server';
import type { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
import type { HttpResources } from '@kbn/core-http-resources-server';
-import { PluginsServiceSetup, PluginsServiceStart } from './plugins';
+import type { PluginsServiceSetup, PluginsServiceStart } from '@kbn/core-plugins-server-internal';
export type { PluginOpaqueId } from '@kbn/core-base-common';
export type {
@@ -254,7 +230,6 @@ export type { NodeInfo, NodeRoles } from '@kbn/core-node-server';
export { PluginType } from '@kbn/core-base-common';
export type {
- DiscoveredPlugin,
PrebootPlugin,
Plugin,
AsyncPlugin,
@@ -263,11 +238,12 @@ export type {
PluginInitializer,
PluginInitializerContext,
PluginManifest,
- PluginName,
SharedGlobalConfig,
MakeUsageFromSchema,
ExposedToBrowserDescriptor,
-} from './plugins';
+} from '@kbn/core-plugins-server';
+
+export type { PluginName, DiscoveredPlugin } from '@kbn/core-base-common';
export type {
SavedObject,
@@ -467,106 +443,12 @@ export type {
PrebootCoreRequestHandlerContext,
} from '@kbn/core-http-request-handler-context-server';
-/**
- * Context passed to the `setup` method of `preboot` plugins.
- * @public
- */
-export interface CorePreboot {
- /** {@link AnalyticsServicePreboot} */
- analytics: AnalyticsServicePreboot;
- /** {@link ElasticsearchServicePreboot} */
- elasticsearch: ElasticsearchServicePreboot;
- /** {@link HttpServicePreboot} */
- http: HttpServicePreboot;
- /** {@link PrebootServicePreboot} */
- preboot: PrebootServicePreboot;
-}
-
-/**
- * Context passed to the `setup` method of `standard` plugins.
- *
- * @typeParam TPluginsStart - the type of the consuming plugin's start dependencies. Should be the same
- * as the consuming {@link Plugin}'s `TPluginsStart` type. Used by `getStartServices`.
- * @typeParam TStart - the type of the consuming plugin's start contract. Should be the same as the
- * consuming {@link Plugin}'s `TStart` type. Used by `getStartServices`.
- * @public
- */
-export interface CoreSetup {
- /** {@link AnalyticsServiceSetup} */
- analytics: AnalyticsServiceSetup;
- /** {@link CapabilitiesSetup} */
- capabilities: CapabilitiesSetup;
- /** {@link DocLinksServiceSetup} */
- docLinks: DocLinksServiceSetup;
- /** {@link ElasticsearchServiceSetup} */
- elasticsearch: ElasticsearchServiceSetup;
- /** {@link ExecutionContextSetup} */
- executionContext: ExecutionContextSetup;
- /** {@link HttpServiceSetup} */
- http: HttpServiceSetup & {
- /** {@link HttpResources} */
- resources: HttpResources;
- };
- /** {@link I18nServiceSetup} */
- i18n: I18nServiceSetup;
- /** {@link LoggingServiceSetup} */
- logging: LoggingServiceSetup;
- /** {@link MetricsServiceSetup} */
- metrics: MetricsServiceSetup;
- /** {@link SavedObjectsServiceSetup} */
- savedObjects: SavedObjectsServiceSetup;
- /** {@link StatusServiceSetup} */
- status: StatusServiceSetup;
- /** {@link UiSettingsServiceSetup} */
- uiSettings: UiSettingsServiceSetup;
- /** {@link DeprecationsServiceSetup} */
- deprecations: DeprecationsServiceSetup;
- /** {@link StartServicesAccessor} */
- getStartServices: StartServicesAccessor;
- /** @internal {@link CoreUsageDataSetup} */
- coreUsageData: CoreUsageDataSetup;
-}
-
-/**
- * Allows plugins to get access to APIs available in start inside async handlers.
- * Promise will not resolve until Core and plugin dependencies have completed `start`.
- * This should only be used inside handlers registered during `setup` that will only be executed
- * after `start` lifecycle.
- *
- * @public
- */
-export type StartServicesAccessor<
- TPluginsStart extends object = object,
- TStart = unknown
-> = () => Promise<[CoreStart, TPluginsStart, TStart]>;
-
-/**
- * Context passed to the plugins `start` method.
- *
- * @public
- */
-export interface CoreStart {
- /** {@link AnalyticsServiceStart} */
- analytics: AnalyticsServiceStart;
- /** {@link CapabilitiesStart} */
- capabilities: CapabilitiesStart;
- /** {@link DocLinksServiceStart} */
- docLinks: DocLinksServiceStart;
- /** {@link ElasticsearchServiceStart} */
- elasticsearch: ElasticsearchServiceStart;
- /** {@link ExecutionContextStart} */
- executionContext: ExecutionContextStart;
- /** {@link HttpServiceStart} */
- http: HttpServiceStart;
- /** {@link MetricsServiceStart} */
- metrics: MetricsServiceStart;
- /** {@link SavedObjectsServiceStart} */
- savedObjects: SavedObjectsServiceStart;
- /** {@link UiSettingsServiceStart} */
- uiSettings: UiSettingsServiceStart;
- /** @internal {@link CoreUsageDataStart} */
- coreUsageData: CoreUsageDataStart;
-}
+export type {
+ CorePreboot,
+ CoreSetup,
+ CoreStart,
+ StartServicesAccessor,
+} from '@kbn/core-lifecycle-server';
export type {
CapabilitiesSetup,
diff --git a/src/core/server/integration_tests/logging/logging.test.ts b/src/core/server/integration_tests/logging/logging.test.ts
index a56449550b3cb..09323239a0ce3 100644
--- a/src/core/server/integration_tests/logging/logging.test.ts
+++ b/src/core/server/integration_tests/logging/logging.test.ts
@@ -8,7 +8,7 @@
import type { LoggerContextConfigInput } from '@kbn/core-logging-server';
import * as kbnTestServer from '../../../test_helpers/kbn_server';
-import { InternalCoreSetup } from '../../internal_types';
+import { InternalCoreSetup } from '@kbn/core-lifecycle-server-internal';
import { Subject } from 'rxjs';
function createRoot() {
diff --git a/src/core/server/integration_tests/plugins/jest.integration.config.js b/src/core/server/integration_tests/plugins/jest.integration.config.js
deleted file mode 100644
index 55bbf66147bb8..0000000000000
--- a/src/core/server/integration_tests/plugins/jest.integration.config.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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 = {
- // TODO replace the line below with
- // preset: '@kbn/test/jest_integration_node
- // to do so, we must fix all integration tests first
- // see https://github.com/elastic/kibana/pull/130255/
- preset: '@kbn/test/jest_integration',
- rootDir: '../../../../..',
- roots: ['/src/core/server/integration_tests/plugins'],
- // must override to match all test given there is no `integration_tests` subfolder
- testMatch: ['**/*.test.{js,mjs,ts,tsx}'],
-};
diff --git a/src/core/server/integration_tests/plugins/plugins_service.test.ts b/src/core/server/integration_tests/plugins/plugins_service.test.ts
deleted file mode 100644
index 2d51b63921bad..0000000000000
--- a/src/core/server/integration_tests/plugins/plugins_service.test.ts
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.
- */
-
-// must be before mocks imports to avoid conflicting with `REPO_ROOT` accessor.
-import { REPO_ROOT } from '@kbn/utils';
-import { mockPackage, mockDiscover } from './plugins_service.test.mocks';
-
-import { join } from 'path';
-
-import { ConfigPath, ConfigService, Env } from '@kbn/config';
-import { getEnvOptions, rawConfigServiceMock } from '@kbn/config-mocks';
-import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
-import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
-import { nodeServiceMock } from '@kbn/core-node-server-mocks';
-import { PluginsService } from '../../plugins/plugins_service';
-import { BehaviorSubject, from } from 'rxjs';
-import { config } from '../../plugins/plugins_config';
-import { coreMock } from '../../mocks';
-import { AsyncPlugin, PluginType } from '../../plugins/types';
-import { PluginWrapper } from '../../plugins/plugin';
-
-describe('PluginsService', () => {
- const logger = loggingSystemMock.create();
- const environmentPreboot = environmentServiceMock.createPrebootContract();
- const nodePreboot = nodeServiceMock.createInternalPrebootContract();
- let pluginsService: PluginsService;
-
- const createPlugin = (
- id: string,
- {
- path = id,
- disabled = false,
- version = 'some-version',
- requiredPlugins = [],
- requiredBundles = [],
- optionalPlugins = [],
- kibanaVersion = '7.0.0',
- type = PluginType.standard,
- configPath = [path],
- server = true,
- ui = true,
- owner = { name: 'foo' },
- }: {
- path?: string;
- disabled?: boolean;
- version?: string;
- requiredPlugins?: string[];
- requiredBundles?: string[];
- optionalPlugins?: string[];
- kibanaVersion?: string;
- type?: PluginType;
- configPath?: ConfigPath;
- server?: boolean;
- ui?: boolean;
- owner?: { name: string };
- }
- ): PluginWrapper => {
- return new PluginWrapper({
- path,
- manifest: {
- id,
- version,
- configPath: `${configPath}${disabled ? '-disabled' : ''}`,
- kibanaVersion,
- type,
- requiredPlugins,
- requiredBundles,
- optionalPlugins,
- server,
- ui,
- owner,
- },
- opaqueId: Symbol(id),
- initializerContext: { logger } as any,
- });
- };
-
- beforeEach(async () => {
- mockPackage.raw = {
- branch: 'feature-v1',
- version: 'v1',
- build: {
- distributable: true,
- number: 100,
- sha: 'feature-v1-build-sha',
- },
- };
-
- const env = Env.createDefault(REPO_ROOT, getEnvOptions());
- const config$ = new BehaviorSubject>({
- plugins: {
- initialize: true,
- },
- });
- const rawConfigService = rawConfigServiceMock.create({ rawConfig$: config$ });
- const configService = new ConfigService(rawConfigService, env, logger);
- await configService.setSchema(config.path, config.schema);
-
- pluginsService = new PluginsService({
- coreId: Symbol('core'),
- env,
- logger,
- configService,
- });
- });
-
- it("properly resolves `getStartServices` in plugin's lifecycle", async () => {
- expect.assertions(6);
-
- const pluginPath = 'plugin-path';
-
- mockDiscover.mockReturnValue({
- error$: from([]),
- plugin$: from([
- createPlugin('plugin-id', {
- path: pluginPath,
- configPath: 'path',
- }),
- ]),
- });
-
- let startDependenciesResolved = false;
- let contextFromStart: any = null;
- let contextFromStartService: any = null;
-
- const pluginStartContract = {
- someApi: () => 'foo',
- };
-
- const pluginInitializer = () =>
- ({
- setup: async (coreSetup, deps) => {
- coreSetup.getStartServices().then(([core, plugins, pluginStart]) => {
- startDependenciesResolved = true;
- contextFromStartService = { core, plugins, pluginStart };
- });
- },
- start: async (core, plugins) => {
- contextFromStart = { core, plugins };
- await new Promise((resolve) => setTimeout(resolve, 10));
- expect(startDependenciesResolved).toBe(false);
- return pluginStartContract;
- },
- } as AsyncPlugin);
-
- jest.doMock(
- join(pluginPath, 'server'),
- () => ({
- plugin: pluginInitializer,
- }),
- {
- virtual: true,
- }
- );
-
- await pluginsService.discover({ environment: environmentPreboot, node: nodePreboot });
-
- const prebootDeps = coreMock.createInternalPreboot();
- await pluginsService.preboot(prebootDeps);
-
- const setupDeps = coreMock.createInternalSetup();
- await pluginsService.setup(setupDeps);
-
- expect(startDependenciesResolved).toBe(false);
-
- const startDeps = coreMock.createInternalStart();
- await pluginsService.start(startDeps);
-
- expect(startDependenciesResolved).toBe(true);
- expect(contextFromStart!.core).toEqual(contextFromStartService!.core);
- expect(contextFromStart!.plugins).toEqual(contextFromStartService!.plugins);
- expect(contextFromStartService!.pluginStart).toEqual(pluginStartContract);
- });
-});
diff --git a/src/core/server/integration_tests/saved_objects/migrations/7.7.2_xpack_100k.test.ts b/src/core/server/integration_tests/saved_objects/migrations/7.7.2_xpack_100k.test.ts
index 530a4b92ead6a..225faf5e2c275 100644
--- a/src/core/server/integration_tests/saved_objects/migrations/7.7.2_xpack_100k.test.ts
+++ b/src/core/server/integration_tests/saved_objects/migrations/7.7.2_xpack_100k.test.ts
@@ -13,7 +13,7 @@ import { Env } from '@kbn/config';
import { getEnvOptions } from '@kbn/config-mocks';
import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
-import { InternalCoreStart } from '../../../internal_types';
+import type { InternalCoreStart } from '@kbn/core-lifecycle-server-internal';
import { Root } from '../../../root';
const kibanaVersion = Env.createDefault(REPO_ROOT, getEnvOptions()).packageInfo.version;
diff --git a/src/core/server/integration_tests/saved_objects/migrations/actions/es_errors.test.ts b/src/core/server/integration_tests/saved_objects/migrations/actions/es_errors.test.ts
index 749be45b35cb7..164fdb19819db 100644
--- a/src/core/server/integration_tests/saved_objects/migrations/actions/es_errors.test.ts
+++ b/src/core/server/integration_tests/saved_objects/migrations/actions/es_errors.test.ts
@@ -7,7 +7,7 @@
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { ElasticsearchClient } from '../../../..';
-import { InternalCoreStart } from '../../../../internal_types';
+import { InternalCoreStart } from '@kbn/core-lifecycle-server-internal';
import * as kbnTestServer from '../../../../../test_helpers/kbn_server';
import { Root } from '../../../../root';
import {
diff --git a/src/core/server/integration_tests/saved_objects/migrations/migration_from_older_v1.test.ts b/src/core/server/integration_tests/saved_objects/migrations/migration_from_older_v1.test.ts
index b18d20deaa0e6..3663297058b0c 100644
--- a/src/core/server/integration_tests/saved_objects/migrations/migration_from_older_v1.test.ts
+++ b/src/core/server/integration_tests/saved_objects/migrations/migration_from_older_v1.test.ts
@@ -16,7 +16,7 @@ import { getEnvOptions } from '@kbn/config-mocks';
import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import type { SavedObjectsRawDoc } from '@kbn/core-saved-objects-server';
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
-import { InternalCoreStart } from '../../../internal_types';
+import { InternalCoreStart } from '@kbn/core-lifecycle-server-internal';
import { Root } from '../../../root';
const kibanaVersion = Env.createDefault(REPO_ROOT, getEnvOptions()).packageInfo.version;
diff --git a/src/core/server/integration_tests/saved_objects/migrations/migration_from_same_v1.test.ts b/src/core/server/integration_tests/saved_objects/migrations/migration_from_same_v1.test.ts
index f7c0cced08f0f..97369305591a6 100644
--- a/src/core/server/integration_tests/saved_objects/migrations/migration_from_same_v1.test.ts
+++ b/src/core/server/integration_tests/saved_objects/migrations/migration_from_same_v1.test.ts
@@ -16,7 +16,7 @@ import { getEnvOptions } from '@kbn/config-mocks';
import type { SavedObjectsRawDoc } from '@kbn/core-saved-objects-server';
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
-import { InternalCoreStart } from '../../../internal_types';
+import { InternalCoreStart } from '@kbn/core-lifecycle-server-internal';
import { Root } from '../../../root';
const kibanaVersion = Env.createDefault(REPO_ROOT, getEnvOptions()).packageInfo.version;
diff --git a/src/core/server/integration_tests/saved_objects/service/lib/repository.test.ts b/src/core/server/integration_tests/saved_objects/service/lib/repository.test.ts
index a8d77abd65baf..d8107b5162f2e 100644
--- a/src/core/server/integration_tests/saved_objects/service/lib/repository.test.ts
+++ b/src/core/server/integration_tests/saved_objects/service/lib/repository.test.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { InternalCoreStart } from '../../../../internal_types';
+import { InternalCoreStart } from '@kbn/core-lifecycle-server-internal';
import * as kbnTestServer from '../../../../../test_helpers/kbn_server';
import { Root } from '../../../../root';
diff --git a/src/core/server/integration_tests/saved_objects/service/lib/repository_with_proxy.test.ts b/src/core/server/integration_tests/saved_objects/service/lib/repository_with_proxy.test.ts
index f0fdc609d8915..6325d80e9588f 100644
--- a/src/core/server/integration_tests/saved_objects/service/lib/repository_with_proxy.test.ts
+++ b/src/core/server/integration_tests/saved_objects/service/lib/repository_with_proxy.test.ts
@@ -11,7 +11,7 @@ import h2o2 from '@hapi/h2o2';
import { URL } from 'url';
import type { SavedObject } from '@kbn/core-saved-objects-common';
import type { ISavedObjectsRepository } from '@kbn/core-saved-objects-api-server';
-import { InternalCoreSetup, InternalCoreStart } from '../../../../internal_types';
+import type { InternalCoreSetup, InternalCoreStart } from '@kbn/core-lifecycle-server-internal';
import { Root } from '../../../../root';
import * as kbnTestServer from '../../../../../test_helpers/kbn_server';
import {
diff --git a/src/core/server/integration_tests/saved_objects/validation/validator.test.ts b/src/core/server/integration_tests/saved_objects/validation/validator.test.ts
index 008bebdc5731f..1157bd6c7499b 100644
--- a/src/core/server/integration_tests/saved_objects/validation/validator.test.ts
+++ b/src/core/server/integration_tests/saved_objects/validation/validator.test.ts
@@ -15,7 +15,7 @@ import { REPO_ROOT } from '@kbn/utils';
import type { ISavedObjectsRepository } from '@kbn/core-saved-objects-api-server';
import type { SavedObjectsType } from '@kbn/core-saved-objects-server';
import { getEnvOptions } from '@kbn/config-mocks';
-import { InternalCoreSetup, InternalCoreStart } from '../../../internal_types';
+import type { InternalCoreSetup, InternalCoreStart } from '@kbn/core-lifecycle-server-internal';
import { Root } from '../../../root';
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
diff --git a/src/core/server/internal_types.ts b/src/core/server/internal_types.ts
deleted file mode 100644
index c66fdf9a968d2..0000000000000
--- a/src/core/server/internal_types.ts
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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 { DocLinksServiceStart, DocLinksServiceSetup } from '@kbn/core-doc-links-server';
-import {
- InternalLoggingServicePreboot,
- InternalLoggingServiceSetup,
-} from '@kbn/core-logging-server-internal';
-import type {
- AnalyticsServicePreboot,
- AnalyticsServiceSetup,
- AnalyticsServiceStart,
-} from '@kbn/core-analytics-server';
-import type { InternalEnvironmentServiceSetup } from '@kbn/core-environment-server-internal';
-import type {
- InternalExecutionContextSetup,
- InternalExecutionContextStart,
-} from '@kbn/core-execution-context-server-internal';
-import type { InternalPrebootServicePreboot } from '@kbn/core-preboot-server-internal';
-import type {
- InternalContextPreboot,
- InternalContextSetup,
-} from '@kbn/core-http-context-server-internal';
-import type {
- InternalHttpServicePreboot,
- InternalHttpServiceSetup,
- InternalHttpServiceStart,
-} from '@kbn/core-http-server-internal';
-import type {
- InternalMetricsServiceSetup,
- InternalMetricsServiceStart,
-} from '@kbn/core-metrics-server-internal';
-import {
- InternalElasticsearchServicePreboot,
- InternalElasticsearchServiceSetup,
- InternalElasticsearchServiceStart,
-} from '@kbn/core-elasticsearch-server-internal';
-import type { CapabilitiesSetup, CapabilitiesStart } from '@kbn/core-capabilities-server';
-import {
- InternalSavedObjectsServiceSetup,
- InternalSavedObjectsServiceStart,
-} from '@kbn/core-saved-objects-server-internal';
-import {
- InternalDeprecationsServiceSetup,
- InternalDeprecationsServiceStart,
-} from '@kbn/core-deprecations-server-internal';
-import type { CoreUsageDataStart } from '@kbn/core-usage-data-server';
-import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
-import type { I18nServiceSetup } from '@kbn/core-i18n-server';
-import type { InternalStatusServiceSetup } from '@kbn/core-status-server-internal';
-import type {
- InternalUiSettingsServicePreboot,
- InternalUiSettingsServiceSetup,
- InternalUiSettingsServiceStart,
-} from '@kbn/core-ui-settings-server-internal';
-import type { InternalRenderingServiceSetup } from '@kbn/core-rendering-server-internal';
-import type {
- InternalHttpResourcesPreboot,
- InternalHttpResourcesSetup,
-} from '@kbn/core-http-resources-server-internal';
-
-/** @internal */
-export interface InternalCorePreboot {
- analytics: AnalyticsServicePreboot;
- context: InternalContextPreboot;
- http: InternalHttpServicePreboot;
- elasticsearch: InternalElasticsearchServicePreboot;
- uiSettings: InternalUiSettingsServicePreboot;
- httpResources: InternalHttpResourcesPreboot;
- logging: InternalLoggingServicePreboot;
- preboot: InternalPrebootServicePreboot;
-}
-
-/** @internal */
-export interface InternalCoreSetup {
- analytics: AnalyticsServiceSetup;
- capabilities: CapabilitiesSetup;
- context: InternalContextSetup;
- docLinks: DocLinksServiceSetup;
- http: InternalHttpServiceSetup;
- elasticsearch: InternalElasticsearchServiceSetup;
- executionContext: InternalExecutionContextSetup;
- i18n: I18nServiceSetup;
- savedObjects: InternalSavedObjectsServiceSetup;
- status: InternalStatusServiceSetup;
- uiSettings: InternalUiSettingsServiceSetup;
- environment: InternalEnvironmentServiceSetup;
- rendering: InternalRenderingServiceSetup;
- httpResources: InternalHttpResourcesSetup;
- logging: InternalLoggingServiceSetup;
- metrics: InternalMetricsServiceSetup;
- deprecations: InternalDeprecationsServiceSetup;
- coreUsageData: InternalCoreUsageDataSetup;
-}
-
-/**
- * @internal
- */
-export interface InternalCoreStart {
- analytics: AnalyticsServiceStart;
- capabilities: CapabilitiesStart;
- elasticsearch: InternalElasticsearchServiceStart;
- docLinks: DocLinksServiceStart;
- http: InternalHttpServiceStart;
- metrics: InternalMetricsServiceStart;
- savedObjects: InternalSavedObjectsServiceStart;
- uiSettings: InternalUiSettingsServiceStart;
- coreUsageData: CoreUsageDataStart;
- executionContext: InternalExecutionContextStart;
- deprecations: InternalDeprecationsServiceStart;
-}
diff --git a/src/core/server/mocks.ts b/src/core/server/mocks.ts
index 356fd4deb44d6..028465ebfb8ac 100644
--- a/src/core/server/mocks.ts
+++ b/src/core/server/mocks.ts
@@ -10,38 +10,16 @@ import { of } from 'rxjs';
import { duration } from 'moment';
import { ByteSizeValue } from '@kbn/config-schema';
import { isPromise } from '@kbn/std';
-import type { MockedKeys } from '@kbn/utility-types-jest';
-import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks';
-import { loggingSystemMock, loggingServiceMock } from '@kbn/core-logging-server-mocks';
-import { analyticsServiceMock } from '@kbn/core-analytics-server-mocks';
-import { environmentServiceMock } from '@kbn/core-environment-server-mocks';
+import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
import { nodeServiceMock } from '@kbn/core-node-server-mocks';
-import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks';
-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 { metricsServiceMock } from '@kbn/core-metrics-server-mocks';
-import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks';
import { typeRegistryMock as savedObjectsTypeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks';
import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks';
import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks';
import { deprecationsServiceMock } from '@kbn/core-deprecations-server-mocks';
-import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
-import { i18nServiceMock } from '@kbn/core-i18n-server-mocks';
-import { statusServiceMock } from '@kbn/core-status-server-mocks';
import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
-import { renderingServiceMock } from '@kbn/core-rendering-server-mocks';
-import { httpResourcesMock } from '@kbn/core-http-resources-server-mocks';
-import type {
- PluginInitializerContext,
- CoreSetup,
- CoreStart,
- StartServicesAccessor,
- CorePreboot,
- RequestHandlerContext,
-} from '.';
-import { SharedGlobalConfig } from './plugins';
+import { coreLifecycleMock, coreInternalLifecycleMock } from '@kbn/core-lifecycle-server-mocks';
+import type { SharedGlobalConfig, PluginInitializerContext } from '@kbn/core-plugins-server';
export { configServiceMock, configDeprecationsMock } from '@kbn/config-mocks';
export { loggingSystemMock } from '@kbn/core-logging-server-mocks';
@@ -132,139 +110,6 @@ function pluginInitializerContextMock(config: T = {} as T) {
return mock;
}
-type CorePrebootMockType = MockedKeys & {
- elasticsearch: ReturnType;
-};
-
-function createCorePrebootMock() {
- const mock: CorePrebootMockType = {
- analytics: analyticsServiceMock.createAnalyticsServicePreboot(),
- elasticsearch: elasticsearchServiceMock.createPreboot(),
- http: httpServiceMock.createPrebootContract() as CorePrebootMockType['http'],
- preboot: prebootServiceMock.createPrebootContract(),
- };
-
- return mock;
-}
-
-type CoreSetupMockType = MockedKeys & {
- elasticsearch: ReturnType;
- getStartServices: jest.MockedFunction>;
-};
-
-function createCoreSetupMock({
- pluginStartDeps = {},
- pluginStartContract,
-}: {
- pluginStartDeps?: object;
- pluginStartContract?: any;
-} = {}) {
- const httpMock: jest.Mocked = {
- ...httpServiceMock.createSetupContract(),
- resources: httpResourcesMock.createRegistrar(),
- };
-
- const uiSettingsMock = {
- register: uiSettingsServiceMock.createSetupContract().register,
- };
-
- const mock: CoreSetupMockType = {
- analytics: analyticsServiceMock.createAnalyticsServiceSetup(),
- capabilities: capabilitiesServiceMock.createSetupContract(),
- docLinks: docLinksServiceMock.createSetupContract(),
- elasticsearch: elasticsearchServiceMock.createSetup(),
- http: httpMock,
- i18n: i18nServiceMock.createSetupContract(),
- savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
- status: statusServiceMock.createSetupContract(),
- uiSettings: uiSettingsMock,
- logging: loggingServiceMock.createSetupContract(),
- metrics: metricsServiceMock.createSetupContract(),
- deprecations: deprecationsServiceMock.createSetupContract(),
- executionContext: executionContextServiceMock.createInternalSetupContract(),
- coreUsageData: {
- registerUsageCounter: coreUsageDataServiceMock.createSetupContract().registerUsageCounter,
- },
- getStartServices: jest
- .fn, object, any]>, []>()
- .mockResolvedValue([createCoreStartMock(), pluginStartDeps, pluginStartContract]),
- };
-
- return mock;
-}
-
-function createCoreStartMock() {
- const mock: MockedKeys = {
- analytics: analyticsServiceMock.createAnalyticsServiceStart(),
- capabilities: capabilitiesServiceMock.createStartContract(),
- docLinks: docLinksServiceMock.createStartContract(),
- elasticsearch: elasticsearchServiceMock.createStart(),
- http: httpServiceMock.createStartContract(),
- metrics: metricsServiceMock.createStartContract(),
- savedObjects: savedObjectsServiceMock.createStartContract(),
- uiSettings: uiSettingsServiceMock.createStartContract(),
- coreUsageData: coreUsageDataServiceMock.createStartContract(),
- executionContext: executionContextServiceMock.createInternalStartContract(),
- };
-
- return mock;
-}
-
-function createInternalCorePrebootMock() {
- const prebootDeps = {
- analytics: analyticsServiceMock.createAnalyticsServicePreboot(),
- context: contextServiceMock.createPrebootContract(),
- elasticsearch: elasticsearchServiceMock.createInternalPreboot(),
- http: httpServiceMock.createInternalPrebootContract(),
- httpResources: httpResourcesMock.createPrebootContract(),
- uiSettings: uiSettingsServiceMock.createPrebootContract(),
- logging: loggingServiceMock.createInternalPrebootContract(),
- preboot: prebootServiceMock.createInternalPrebootContract(),
- };
- return prebootDeps;
-}
-
-function createInternalCoreSetupMock() {
- const setupDeps = {
- analytics: analyticsServiceMock.createAnalyticsServiceSetup(),
- capabilities: capabilitiesServiceMock.createSetupContract(),
- context: contextServiceMock.createSetupContract(),
- docLinks: docLinksServiceMock.createSetupContract(),
- elasticsearch: elasticsearchServiceMock.createInternalSetup(),
- http: httpServiceMock.createInternalSetupContract(),
- savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
- status: statusServiceMock.createInternalSetupContract(),
- environment: environmentServiceMock.createSetupContract(),
- i18n: i18nServiceMock.createSetupContract(),
- httpResources: httpResourcesMock.createSetupContract(),
- rendering: renderingServiceMock.createSetupContract(),
- uiSettings: uiSettingsServiceMock.createSetupContract(),
- logging: loggingServiceMock.createInternalSetupContract(),
- metrics: metricsServiceMock.createInternalSetupContract(),
- deprecations: deprecationsServiceMock.createInternalSetupContract(),
- executionContext: executionContextServiceMock.createInternalSetupContract(),
- coreUsageData: coreUsageDataServiceMock.createSetupContract(),
- };
- return setupDeps;
-}
-
-function createInternalCoreStartMock() {
- const startDeps = {
- analytics: analyticsServiceMock.createAnalyticsServiceStart(),
- capabilities: capabilitiesServiceMock.createStartContract(),
- docLinks: docLinksServiceMock.createStartContract(),
- elasticsearch: elasticsearchServiceMock.createInternalStart(),
- http: httpServiceMock.createInternalStartContract(),
- metrics: metricsServiceMock.createInternalStartContract(),
- savedObjects: savedObjectsServiceMock.createInternalStartContract(),
- uiSettings: uiSettingsServiceMock.createStartContract(),
- coreUsageData: coreUsageDataServiceMock.createStartContract(),
- executionContext: executionContextServiceMock.createInternalStartContract(),
- deprecations: deprecationsServiceMock.createInternalStartContract(),
- };
- return startDeps;
-}
-
function createCoreRequestHandlerContextMock() {
return {
savedObjects: {
@@ -321,12 +166,12 @@ const createCustomRequestHandlerContextMock = (contextParts: T): CustomReques
};
export const coreMock = {
- createPreboot: createCorePrebootMock,
- createSetup: createCoreSetupMock,
- createStart: createCoreStartMock,
- createInternalPreboot: createInternalCorePrebootMock,
- createInternalSetup: createInternalCoreSetupMock,
- createInternalStart: createInternalCoreStartMock,
+ createPreboot: coreLifecycleMock.createPreboot,
+ createSetup: coreLifecycleMock.createCoreSetup,
+ createStart: coreLifecycleMock.createCoreStart,
+ createInternalPreboot: coreInternalLifecycleMock.createInternalPreboot,
+ createInternalSetup: coreInternalLifecycleMock.createInternalSetup,
+ createInternalStart: coreInternalLifecycleMock.createInternalStart,
createPluginInitializerContext: pluginInitializerContextMock,
createRequestHandlerContext: createCoreRequestHandlerContextMock,
createCustomRequestHandlerContext: createCustomRequestHandlerContextMock,
diff --git a/src/core/server/root/elastic_config.ts b/src/core/server/root/elastic_config.ts
new file mode 100644
index 0000000000000..84b2ce394962a
--- /dev/null
+++ b/src/core/server/root/elastic_config.ts
@@ -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 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 { schema, TypeOf } from '@kbn/config-schema';
+import { apmConfigSchema } from '@kbn/apm-config-loader';
+import type { ServiceConfigDescriptor } from '@kbn/core-base-server-internal';
+
+const elasticConfig = schema.object({
+ apm: apmConfigSchema,
+});
+
+export type ElasticConfigType = TypeOf;
+
+export const elasticApmConfig: ServiceConfigDescriptor = {
+ path: 'elastic',
+ schema: elasticConfig,
+};
diff --git a/src/core/server/root/index.ts b/src/core/server/root/index.ts
index 2f3bcce039849..e4a129188ea6b 100644
--- a/src/core/server/root/index.ts
+++ b/src/core/server/root/index.ts
@@ -7,10 +7,20 @@
*/
import { ConnectableObservable, Subscription } from 'rxjs';
-import { first, publishReplay, switchMap, concatMap, tap } from 'rxjs/operators';
+import {
+ first,
+ publishReplay,
+ switchMap,
+ concatMap,
+ tap,
+ distinctUntilChanged,
+} from 'rxjs/operators';
import type { Logger, LoggerFactory } from '@kbn/logging';
import { Env, RawConfigurationProvider } from '@kbn/config';
import { LoggingConfigType, LoggingSystem } from '@kbn/core-logging-server-internal';
+import apm from 'elastic-apm-node';
+import { isEqual } from 'lodash';
+import type { ElasticConfigType } from './elastic_config';
import { Server } from '../server';
/**
@@ -22,6 +32,7 @@ export class Root {
private readonly loggingSystem: LoggingSystem;
private readonly server: Server;
private loggingConfigSubscription?: Subscription;
+ private apmConfigSubscription?: Subscription;
constructor(
rawConfigProvider: RawConfigurationProvider,
@@ -37,7 +48,9 @@ export class Root {
public async preboot() {
try {
this.server.setupCoreConfig();
+ this.setupApmLabelSync();
await this.setupLogging();
+
this.log.debug('prebooting root');
return await this.server.preboot();
} catch (e) {
@@ -85,6 +98,10 @@ export class Root {
this.loggingConfigSubscription.unsubscribe();
this.loggingConfigSubscription = undefined;
}
+ if (this.apmConfigSubscription !== undefined) {
+ this.apmConfigSubscription.unsubscribe();
+ this.apmConfigSubscription = undefined;
+ }
await this.loggingSystem.stop();
if (this.onShutdown !== undefined) {
@@ -92,6 +109,23 @@ export class Root {
}
}
+ private setupApmLabelSync() {
+ const { configService } = this.server;
+
+ // Update APM labels on config change
+ this.apmConfigSubscription = configService
+ .getConfig$()
+ .pipe(
+ switchMap(() => configService.atPath('elastic')),
+ distinctUntilChanged(isEqual),
+ tap((elasticConfig) => {
+ const labels = elasticConfig.apm?.globalLabels || {};
+ apm.addLabels(labels);
+ })
+ )
+ .subscribe();
+ }
+
private async setupLogging() {
const { configService } = this.server;
// Stream that maps config updates to logger updates, including update failures.
diff --git a/src/core/server/server.test.mocks.ts b/src/core/server/server.test.mocks.ts
index 3e1d5c0e3a28f..01f856f6b3a89 100644
--- a/src/core/server/server.test.mocks.ts
+++ b/src/core/server/server.test.mocks.ts
@@ -13,10 +13,10 @@ jest.doMock('@kbn/core-http-server-internal', () => ({
HttpService: jest.fn(() => mockHttpService),
}));
-import { pluginServiceMock } from './plugins/plugins_service.mock';
+import { pluginServiceMock } from '@kbn/core-plugins-server-mocks';
export const mockPluginsService = pluginServiceMock.create();
-jest.doMock('./plugins/plugins_service', () => ({
+jest.doMock('@kbn/core-plugins-server-internal', () => ({
PluginsService: jest.fn(() => mockPluginsService),
}));
diff --git a/src/core/server/server.ts b/src/core/server/server.ts
index 0949b9ee65f8a..1f60c3242215a 100644
--- a/src/core/server/server.ts
+++ b/src/core/server/server.ts
@@ -69,10 +69,18 @@ import type {
import { RenderingService } from '@kbn/core-rendering-server-internal';
import { HttpResourcesService } from '@kbn/core-http-resources-server-internal';
+import {
+ InternalCorePreboot,
+ InternalCoreSetup,
+ InternalCoreStart,
+} from '@kbn/core-lifecycle-server-internal';
+import {
+ DiscoveredPlugins,
+ PluginsService,
+ config as pluginsConfig,
+} from '@kbn/core-plugins-server-internal';
import { CoreApp } from './core_app';
-import { PluginsService, config as pluginsConfig } from './plugins';
-import { InternalCorePreboot, InternalCoreSetup, InternalCoreStart } from './internal_types';
-import { DiscoveredPlugins } from './plugins';
+import { elasticApmConfig } from './root/elastic_config';
const coreId = Symbol('core');
const rootConfigPath = '';
@@ -450,6 +458,7 @@ export class Server {
cspConfig,
deprecationConfig,
elasticsearchConfig,
+ elasticApmConfig,
executionContextConfig,
externalUrlConfig,
httpConfig,
diff --git a/src/core/test_helpers/kbn_server.ts b/src/core/test_helpers/kbn_server.ts
index faa45c52d84b8..64c32c47ca2a9 100644
--- a/src/core/test_helpers/kbn_server.ts
+++ b/src/core/test_helpers/kbn_server.ts
@@ -21,7 +21,7 @@ import {
} from '@kbn/test';
import { CliArgs, Env } from '@kbn/config';
-import { InternalCoreSetup, InternalCoreStart } from '../server/internal_types';
+import type { InternalCoreSetup, InternalCoreStart } from '@kbn/core-lifecycle-server-internal';
import { Root } from '../server/root';
export type HttpMethod = 'delete' | 'get' | 'head' | 'post' | 'put' | 'patch';
diff --git a/src/plugins/chart_expressions/expression_heatmap/common/expression_functions/__snapshots__/heatmap_function.test.ts.snap b/src/plugins/chart_expressions/expression_heatmap/common/expression_functions/__snapshots__/heatmap_function.test.ts.snap
index 96b70e33021f4..1b644ef0a4938 100644
--- a/src/plugins/chart_expressions/expression_heatmap/common/expression_functions/__snapshots__/heatmap_function.test.ts.snap
+++ b/src/plugins/chart_expressions/expression_heatmap/common/expression_functions/__snapshots__/heatmap_function.test.ts.snap
@@ -77,6 +77,7 @@ Object {
"xAccessor": "col-1-2",
"yAccessor": undefined,
},
+ "canNavigateToLens": false,
"data": Object {
"columns": Array [
Object {
diff --git a/src/plugins/chart_expressions/expression_heatmap/common/expression_functions/heatmap_function.ts b/src/plugins/chart_expressions/expression_heatmap/common/expression_functions/heatmap_function.ts
index 548d4ec0ab49e..f0c309de19236 100644
--- a/src/plugins/chart_expressions/expression_heatmap/common/expression_functions/heatmap_function.ts
+++ b/src/plugins/chart_expressions/expression_heatmap/common/expression_functions/heatmap_function.ts
@@ -232,6 +232,7 @@ export const heatmapFunction = (): HeatmapExpressionFunctionDefinition => ({
},
syncTooltips: handlers?.isSyncTooltipsEnabled?.() ?? false,
syncCursor: handlers?.isSyncCursorEnabled?.() ?? true,
+ canNavigateToLens: Boolean(handlers?.variables?.canNavigateToLens),
},
};
},
diff --git a/src/plugins/chart_expressions/expression_heatmap/common/types/expression_functions.ts b/src/plugins/chart_expressions/expression_heatmap/common/types/expression_functions.ts
index 5aa1507f30b03..1bf5fe3bbb36b 100644
--- a/src/plugins/chart_expressions/expression_heatmap/common/types/expression_functions.ts
+++ b/src/plugins/chart_expressions/expression_heatmap/common/types/expression_functions.ts
@@ -94,6 +94,7 @@ export interface HeatmapExpressionProps {
args: HeatmapArguments;
syncTooltips: boolean;
syncCursor: boolean;
+ canNavigateToLens?: boolean;
}
export interface HeatmapRender {
diff --git a/src/plugins/chart_expressions/expression_heatmap/public/expression_renderers/heatmap_renderer.tsx b/src/plugins/chart_expressions/expression_heatmap/public/expression_renderers/heatmap_renderer.tsx
index 4b813fb93416f..b14ee1382deb2 100644
--- a/src/plugins/chart_expressions/expression_heatmap/public/expression_renderers/heatmap_renderer.tsx
+++ b/src/plugins/chart_expressions/expression_heatmap/public/expression_renderers/heatmap_renderer.tsx
@@ -61,9 +61,14 @@ export const heatmapRenderer: (
const visualizationType = extractVisualizationType(executionContext);
if (containerType && visualizationType) {
- plugins.usageCollection?.reportUiCounter(containerType, METRIC_TYPE.COUNT, [
+ const events = [
`render_${visualizationType}_${EXPRESSION_HEATMAP_NAME}`,
- ]);
+ config.canNavigateToLens
+ ? `render_${visualizationType}_${EXPRESSION_HEATMAP_NAME}_convertable`
+ : undefined,
+ ].filter((event): event is string => Boolean(event));
+
+ plugins.usageCollection?.reportUiCounter(containerType, METRIC_TYPE.COUNT, events);
}
handlers.done();
diff --git a/src/plugins/custom_integrations/common/language_integrations.ts b/src/plugins/custom_integrations/common/language_integrations.ts
index 9ba914c02fd0d..8a24295096b40 100644
--- a/src/plugins/custom_integrations/common/language_integrations.ts
+++ b/src/plugins/custom_integrations/common/language_integrations.ts
@@ -37,9 +37,9 @@ export const languageIntegrations: LanguageIntegration[] = [
description: i18n.translate('customIntegrations.languageclients.JavascriptDescription', {
defaultMessage: 'Index data to Elasticsearch with the JavaScript client.',
}),
- docUrlTemplate: `${ELASTICSEARCH_CLIENT_URL}/javascript-api/{branch}/introduction.html`,
+ docUrlTemplate: '',
integrationsAppUrl: `/app/integrations/language_clients/javascript/overview`,
- exportLanguageUiComponent: false,
+ exportLanguageUiComponent: true,
},
{
id: 'ruby',
diff --git a/src/plugins/custom_integrations/public/components/fleet_integration/elasticsearch_js/elasticsearch_js_readme.tsx b/src/plugins/custom_integrations/public/components/fleet_integration/elasticsearch_js/elasticsearch_js_readme.tsx
new file mode 100644
index 0000000000000..0202782efe436
--- /dev/null
+++ b/src/plugins/custom_integrations/public/components/fleet_integration/elasticsearch_js/elasticsearch_js_readme.tsx
@@ -0,0 +1,204 @@
+/*
+ * 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 React, { useState } from 'react';
+
+// eslint-disable-next-line @kbn/eslint/module_migration
+import styled from 'styled-components';
+import cuid from 'cuid';
+
+import {
+ EuiButton,
+ EuiCode,
+ EuiCodeBlock,
+ EuiFlexGroup,
+ EuiFlexItem,
+ EuiPage,
+ EuiPageBody,
+ EuiPageHeader,
+ EuiPageSection,
+ EuiSpacer,
+ EuiText,
+ EuiTitle,
+ EuiPanel,
+ EuiImage,
+} from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n-react';
+import { euiThemeVars } from '@kbn/ui-theme';
+import icon from '../../../assets/language_clients/nodejs.svg';
+
+const CenterColumn = styled(EuiFlexItem)`
+ max-width: 740px;
+`;
+
+const FixedHeader = styled.div`
+ width: 100%;
+ height: 196px;
+ border-bottom: 1px solid ${euiThemeVars.euiColorLightShade};
+`;
+
+const IconPanel = styled(EuiPanel)`
+ padding: ${(props) => props.theme.eui.euiSizeXL};
+ width: ${(props) =>
+ parseFloat(props.theme.eui.euiSize) * 6 + parseFloat(props.theme.eui.euiSizeXL) * 2}px;
+ svg,
+ img {
+ height: ${(props) => parseFloat(props.theme.eui.euiSize) * 6}px;
+ width: ${(props) => parseFloat(props.theme.eui.euiSize) * 6}px;
+ }
+ .euiFlexItem {
+ height: ${(props) => parseFloat(props.theme.eui.euiSize) * 6}px;
+ justify-content: center;
+ }
+`;
+
+const TopFlexGroup = styled(EuiFlexGroup)`
+ max-width: 1150px;
+ margin-left: auto;
+ margin-right: auto;
+ padding: calc(${euiThemeVars.euiSizeXL} * 2) ${euiThemeVars.euiSizeM} 0 ${euiThemeVars.euiSizeM};
+`;
+
+export const ElasticsearchJsClientReadme = () => {
+ const [apiKey, setApiKey] = useState(null);
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ }
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+ {`# Grab the Elasticsearch JavaScript client from NPM and install it in your project \n`}
+ {`$ npm install @elastic/elasticsearch@`}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setApiKey(cuid())} disabled={!!apiKey}>
+ Generate API key
+
+
+
+ {apiKey && (
+
+
+ {apiKey}
+
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+ index.js,
+ }}
+ />
+
+
+
+
+
+ {`
+// Import the client
+const { Client } = require('@elastic/elasticsearch');
+
+// Instantiate the client with an API key
+const client = new Client({
+ auth: { apiKey: '${apiKey || 'YOUR_API_KEY'}' }
+})
+
+ `}
+
+
+
+
+
+
+ >
+ );
+};
diff --git a/src/plugins/custom_integrations/public/components/fleet_integration/sample/sample_client_readme.tsx b/src/plugins/custom_integrations/public/components/fleet_integration/sample/sample_client_readme.tsx
index c2ca0d62da689..7b932ca9c99f7 100644
--- a/src/plugins/custom_integrations/public/components/fleet_integration/sample/sample_client_readme.tsx
+++ b/src/plugins/custom_integrations/public/components/fleet_integration/sample/sample_client_readme.tsx
@@ -81,7 +81,7 @@ export const SampleClientReadme = () => {
diff --git a/src/plugins/custom_integrations/public/plugin.tsx b/src/plugins/custom_integrations/public/plugin.tsx
index 827d31ce3749d..e1e10f327075c 100755
--- a/src/plugins/custom_integrations/public/plugin.tsx
+++ b/src/plugins/custom_integrations/public/plugin.tsx
@@ -23,6 +23,7 @@ import {
import { CustomIntegrationsServicesProvider } from './services';
import { servicesFactory } from './services/kibana';
import { SampleClientReadme } from './components/fleet_integration/sample/sample_client_readme';
+import { ElasticsearchJsClientReadme } from './components/fleet_integration/elasticsearch_js/elasticsearch_js_readme';
export class CustomIntegrationsPlugin
implements Plugin
@@ -46,7 +47,10 @@ export class CustomIntegrationsPlugin
): CustomIntegrationsStart {
const services = servicesFactory({ coreStart, startPlugins });
- const languageClientsUiComponents = { sample: SampleClientReadme };
+ const languageClientsUiComponents = {
+ sample: SampleClientReadme,
+ javascript: ElasticsearchJsClientReadme,
+ };
const ContextProvider: React.FC = ({ children }) => (
diff --git a/src/plugins/custom_integrations/server/plugin.test.ts b/src/plugins/custom_integrations/server/plugin.test.ts
index 0bfc014ed5cdd..324522a383d83 100644
--- a/src/plugins/custom_integrations/server/plugin.test.ts
+++ b/src/plugins/custom_integrations/server/plugin.test.ts
@@ -37,8 +37,7 @@ describe('CustomIntegrationsPlugin', () => {
description: 'Index data to Elasticsearch with the JavaScript client.',
type: 'ui_link',
shipper: 'language_clients',
- uiInternalPath:
- 'https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/branch/introduction.html',
+ uiInternalPath: '/app/integrations/language_clients/javascript/overview',
isBeta: false,
icons: [{ type: 'svg', src: undefined }],
categories: ['elastic_stack', 'custom', 'language_client'],
@@ -150,7 +149,7 @@ describe('CustomIntegrationsPlugin', () => {
uiExternalLink:
'https://serverlessrepo.aws.amazon.com/applications/eu-central-1/267093732750/elastic-serverless-forwarder',
isBeta: false,
- icons: [{ type: 'svg' }],
+ icons: [{ type: 'svg', src: undefined }],
categories: ['aws', 'custom'],
},
]);
diff --git a/src/plugins/dashboard/public/application/hooks/use_dashboard_app_state.ts b/src/plugins/dashboard/public/application/hooks/use_dashboard_app_state.ts
index 850c6f575904c..6095598ae3788 100644
--- a/src/plugins/dashboard/public/application/hooks/use_dashboard_app_state.ts
+++ b/src/plugins/dashboard/public/application/hooks/use_dashboard_app_state.ts
@@ -13,6 +13,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
import { BehaviorSubject, combineLatest, Observable, Subject } from 'rxjs';
import { ViewMode } from '@kbn/embeddable-plugin/public';
+import type { DataView } from '@kbn/data-plugin/common';
import type { IKbnUrlStateStorage } from '@kbn/kibana-utils-plugin/public';
import {
@@ -225,7 +226,14 @@ export const useDashboardAppState = ({
dashboardContainer.controlGroup?.setRelevantDataViewId(newDataViewIds[0]);
}
// fetch all data views. These should be cached locally at this time so we will not need to query ES.
- const allDataViews = await Promise.all(newDataViewIds.map((id) => dataViews.get(id)));
+ const responses = await Promise.allSettled(newDataViewIds.map((id) => dataViews.get(id)));
+ // Keep only fullfilled ones as each panel will handle the rejected ones already on their own
+ const allDataViews = responses
+ .filter(
+ (response): response is PromiseFulfilledResult =>
+ response.status === 'fulfilled'
+ )
+ .map(({ value }) => value);
dashboardContainer.setAllDataViews(allDataViews);
setDashboardAppState((s) => ({ ...s, dataViews: allDataViews }));
},
diff --git a/src/plugins/expressions/public/plugin.ts b/src/plugins/expressions/public/plugin.ts
index d71a1457381ff..134b0a7c511ac 100644
--- a/src/plugins/expressions/public/plugin.ts
+++ b/src/plugins/expressions/public/plugin.ts
@@ -42,6 +42,7 @@ export class ExpressionsPublicPlugin implements Plugin true,
};
private readonly expressions: ExpressionsService = new ExpressionsService({
diff --git a/src/plugins/guided_onboarding/kibana.json b/src/plugins/guided_onboarding/kibana.json
index 22a54e8dd3278..a7c1c3d217c1b 100755
--- a/src/plugins/guided_onboarding/kibana.json
+++ b/src/plugins/guided_onboarding/kibana.json
@@ -10,5 +10,5 @@
"server": true,
"ui": true,
"requiredBundles": ["kibanaReact"],
- "optionalPlugins": []
+ "optionalPlugins": ["cloud"]
}
diff --git a/src/plugins/guided_onboarding/public/constants/guides_config/index.ts b/src/plugins/guided_onboarding/public/constants/guides_config/index.ts
index 9ce81cf9d4698..e2ab4f7e7747f 100644
--- a/src/plugins/guided_onboarding/public/constants/guides_config/index.ts
+++ b/src/plugins/guided_onboarding/public/constants/guides_config/index.ts
@@ -10,9 +10,11 @@ import type { GuidesConfig } from '../../types';
import { securityConfig } from './security';
import { observabilityConfig } from './observability';
import { searchConfig } from './search';
+import { testGuideConfig } from './test_guide';
export const guidesConfig: GuidesConfig = {
security: securityConfig,
observability: observabilityConfig,
search: searchConfig,
+ testGuide: testGuideConfig,
};
diff --git a/src/plugins/guided_onboarding/public/constants/guides_config/security.ts b/src/plugins/guided_onboarding/public/constants/guides_config/security.ts
index d2f9b352b9d81..3930ab66220f0 100644
--- a/src/plugins/guided_onboarding/public/constants/guides_config/security.ts
+++ b/src/plugins/guided_onboarding/public/constants/guides_config/security.ts
@@ -6,25 +6,34 @@
* Side Public License, v 1.
*/
+import { i18n } from '@kbn/i18n';
import type { GuideConfig } from '../../types';
export const securityConfig: GuideConfig = {
- title: 'Get started with SIEM',
+ title: i18n.translate('guidedOnboarding.securityGuide.title', {
+ defaultMessage: 'Elastic Security guided setup',
+ }),
guideName: 'Security',
completedGuideRedirectLocation: {
appID: 'security',
path: '/app/security/dashboards',
},
- description:
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ligula enim, malesuada a finibus vel, cursus sed risus. Vivamus pretium, elit dictum lacinia aliquet, libero nibh dictum enim, a rhoncus leo magna in sapien.',
+ description: i18n.translate('guidedOnboarding.securityGuide.description', {
+ defaultMessage: `We'll help you get set up quickly, using Elastic's out-of-the-box integrations.`,
+ }),
steps: [
{
id: 'add_data',
- title: 'Add and view your data',
+ title: i18n.translate('guidedOnboarding.securityGuide.addDataStep.title', {
+ defaultMessage: 'Add data with Elastic Defend',
+ }),
descriptionList: [
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
- 'Nullam ligula enim, malesuada a finibus vel, cursus sed risus.',
- 'Vivamus pretium, elit dictum lacinia aliquet, libero nibh dictum enim, a rhoncus leo magna in sapien.',
+ i18n.translate('guidedOnboarding.securityGuide.addDataStep.description1', {
+ defaultMessage: 'Select the Elastic Defend integration to add your data.',
+ }),
+ i18n.translate('guidedOnboarding.securityGuide.addDataStep.description2', {
+ defaultMessage: 'Make sure your data looks good.',
+ }),
],
integration: 'endpoint',
location: {
@@ -34,16 +43,27 @@ export const securityConfig: GuideConfig = {
},
{
id: 'rules',
- title: 'Turn on rules',
+ title: i18n.translate('guidedOnboarding.securityGuide.rulesStep.title', {
+ defaultMessage: 'Turn on rules',
+ }),
descriptionList: [
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
- 'Nullam ligula enim, malesuada a finibus vel, cursus sed risus.',
- 'Vivamus pretium, elit dictum lacinia aliquet, libero nibh dictum enim, a rhoncus leo magna in sapien.',
+ i18n.translate('guidedOnboarding.securityGuide.rulesStep.description1', {
+ defaultMessage: 'Load the prebuilt rules.',
+ }),
+ i18n.translate('guidedOnboarding.securityGuide.rulesStep.description2', {
+ defaultMessage: 'Select the rules that you want.',
+ }),
],
manualCompletion: {
- title: 'Manual completion step title',
- description:
- 'Mark the step complete by opening the panel and clicking the button "Mark done"',
+ title: i18n.translate('guidedOnboarding.securityGuide.rulesStep.manualCompletion.title', {
+ defaultMessage: 'Continue with the tour',
+ }),
+ description: i18n.translate(
+ 'guidedOnboarding.securityGuide.rulesStep.manualCompletion.description',
+ {
+ defaultMessage: 'After you’ve enabled the rules you want, click here to continue.',
+ }
+ ),
},
location: {
appID: 'securitySolutionUI',
@@ -52,11 +72,16 @@ export const securityConfig: GuideConfig = {
},
{
id: 'alertsCases',
- title: 'Alerts and cases',
+ title: i18n.translate('guidedOnboarding.securityGuide.alertsStep.title', {
+ defaultMessage: 'Manage alerts and cases',
+ }),
descriptionList: [
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
- 'Nullam ligula enim, malesuada a finibus vel, cursus sed risus.',
- 'Vivamus pretium, elit dictum lacinia aliquet, libero nibh dictum enim, a rhoncus leo magna in sapien.',
+ i18n.translate('guidedOnboarding.securityGuide.alertsStep.description1', {
+ defaultMessage: 'View and triage alerts.',
+ }),
+ i18n.translate('guidedOnboarding.securityGuide.alertsStep.description2', {
+ defaultMessage: 'Create a case.',
+ }),
],
location: {
appID: 'securitySolutionUI',
diff --git a/src/plugins/guided_onboarding/public/constants/guides_config/test_guide.ts b/src/plugins/guided_onboarding/public/constants/guides_config/test_guide.ts
new file mode 100644
index 0000000000000..b357ad497c6b4
--- /dev/null
+++ b/src/plugins/guided_onboarding/public/constants/guides_config/test_guide.ts
@@ -0,0 +1,68 @@
+/*
+ * 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 { GuideConfig } from '../../types';
+
+export const testGuideConfig: GuideConfig = {
+ title: 'Test guide for development',
+ description: `This guide is used to test the guided onboarding UI while in development and to run automated tests for the API and UI components.`,
+ guideName: 'Testing example',
+ docs: {
+ text: 'Testing example docs',
+ url: 'example.com',
+ },
+ steps: [
+ {
+ id: 'step1',
+ title: 'Step 1 (completed via an API request)',
+ descriptionList: [
+ `This step is directly completed by clicking the button that uses the API function 'completeGuideStep`,
+ 'Navigate to /guidedOnboardingExample/stepOne to complete the step.',
+ ],
+ location: {
+ appID: 'guidedOnboardingExample',
+ path: 'stepOne',
+ },
+ integration: 'testIntegration',
+ },
+ {
+ id: 'step2',
+ title: 'Step 2 (manual completion after navigation)',
+ descriptionList: [
+ 'This step is set to ready_to_complete on page navigation.',
+ 'After that click the popover on the guide button in the header and mark the step done',
+ ],
+ location: {
+ appID: 'guidedOnboardingExample',
+ path: 'stepTwo',
+ },
+ manualCompletion: {
+ title: 'Manual completion step title',
+ description:
+ 'Mark the step complete by opening the panel and clicking the button "Mark done"',
+ readyToCompleteOnNavigation: true,
+ },
+ },
+ {
+ id: 'step3',
+ title: 'Step 3 (manual completion after click)',
+ descriptionList: [
+ 'This step is completed by clicking a button on the page and then clicking the popover on the guide button in the header and marking the step done',
+ ],
+ manualCompletion: {
+ title: 'Manual completion step title',
+ description:
+ 'Mark the step complete by opening the panel and clicking the button "Mark done"',
+ },
+ location: {
+ appID: 'guidedOnboardingExample',
+ path: 'stepThree',
+ },
+ },
+ ],
+};
diff --git a/src/plugins/guided_onboarding/public/plugin.tsx b/src/plugins/guided_onboarding/public/plugin.tsx
index 5d18eab0ad223..4cf5fa9749a07 100755
--- a/src/plugins/guided_onboarding/public/plugin.tsx
+++ b/src/plugins/guided_onboarding/public/plugin.tsx
@@ -13,7 +13,11 @@ import { I18nProvider } from '@kbn/i18n-react';
import { CoreSetup, CoreStart, Plugin, CoreTheme, ApplicationStart } from '@kbn/core/public';
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
-import type { GuidedOnboardingPluginSetup, GuidedOnboardingPluginStart } from './types';
+import type {
+ AppPluginStartDependencies,
+ GuidedOnboardingPluginSetup,
+ GuidedOnboardingPluginStart,
+} from './types';
import { GuidePanel } from './components';
import { ApiService, apiService } from './services/api';
@@ -25,22 +29,28 @@ export class GuidedOnboardingPlugin
return {};
}
- public start(core: CoreStart): GuidedOnboardingPluginStart {
+ public start(
+ core: CoreStart,
+ { cloud }: AppPluginStartDependencies
+ ): GuidedOnboardingPluginStart {
const { chrome, http, theme, application } = core;
// Initialize services
apiService.setup(http);
- chrome.navControls.registerExtension({
- order: 1000,
- mount: (target) =>
- this.mount({
- targetDomElement: target,
- theme$: theme.theme$,
- api: apiService,
- application,
- }),
- });
+ // Guided onboarding UI is only available on cloud
+ if (cloud?.isCloudEnabled) {
+ chrome.navControls.registerExtension({
+ order: 1000,
+ mount: (target) =>
+ this.mount({
+ targetDomElement: target,
+ theme$: theme.theme$,
+ api: apiService,
+ application,
+ }),
+ });
+ }
// Return methods that should be available to other plugins
return {
diff --git a/src/plugins/guided_onboarding/public/services/api.mocks.ts b/src/plugins/guided_onboarding/public/services/api.mocks.ts
index 21bb257cad68f..2294607f91b38 100644
--- a/src/plugins/guided_onboarding/public/services/api.mocks.ts
+++ b/src/plugins/guided_onboarding/public/services/api.mocks.ts
@@ -6,84 +6,78 @@
* Side Public License, v 1.
*/
-import type { GuideState } from '@kbn/guided-onboarding';
+import type { GuideState, GuideId, GuideStepIds } from '@kbn/guided-onboarding';
-export const searchAddDataActiveState: GuideState = {
- guideId: 'search',
+export const testGuide: GuideId = 'testGuide';
+export const testGuideFirstStep: GuideStepIds = 'step1';
+export const testGuideManualCompletionStep = 'step2';
+export const testGuideLastStep: GuideStepIds = 'step3';
+export const testIntegration = 'testIntegration';
+export const wrongIntegration = 'notTestIntegration';
+
+export const testGuideStep1ActiveState: GuideState = {
+ guideId: 'testGuide',
isActive: true,
status: 'in_progress',
steps: [
{
- id: 'add_data',
+ id: 'step1',
status: 'active',
},
{
- id: 'browse_docs',
+ id: 'step2',
status: 'inactive',
},
{
- id: 'search_experience',
+ id: 'step3',
status: 'inactive',
},
],
};
-export const securityAddDataInProgressState: GuideState = {
- guideId: 'security',
- status: 'in_progress',
- isActive: true,
+export const testGuideStep1InProgressState: GuideState = {
+ ...testGuideStep1ActiveState,
steps: [
{
- id: 'add_data',
- status: 'in_progress',
- },
- {
- id: 'rules',
- status: 'inactive',
- },
- {
- id: 'alertsCases',
- status: 'inactive',
+ id: testGuideStep1ActiveState.steps[0].id,
+ status: 'in_progress', // update the first step status
},
+ testGuideStep1ActiveState.steps[1],
+ testGuideStep1ActiveState.steps[2],
],
};
-export const securityRulesActiveState: GuideState = {
- guideId: 'security',
- isActive: true,
- status: 'in_progress',
+export const testGuideStep2ActiveState: GuideState = {
+ ...testGuideStep1ActiveState,
steps: [
{
- id: 'add_data',
+ ...testGuideStep1ActiveState.steps[0],
status: 'complete',
},
{
- id: 'rules',
+ id: testGuideStep1ActiveState.steps[1].id,
status: 'active',
},
- {
- id: 'alertsCases',
- status: 'inactive',
- },
+ testGuideStep1ActiveState.steps[2],
],
};
-export const noGuideActiveState: GuideState = {
- guideId: 'security',
- status: 'in_progress',
- isActive: false,
+export const testGuideStep2InProgressState: GuideState = {
+ ...testGuideStep1ActiveState,
steps: [
{
- id: 'add_data',
- status: 'in_progress',
- },
- {
- id: 'rules',
- status: 'inactive',
+ ...testGuideStep1ActiveState.steps[0],
+ status: 'complete',
},
{
- id: 'alertsCases',
- status: 'inactive',
+ id: testGuideStep1ActiveState.steps[1].id,
+ status: 'in_progress',
},
+ testGuideStep1ActiveState.steps[2],
],
};
+
+export const testGuideNotActiveState: GuideState = {
+ ...testGuideStep1ActiveState,
+ isActive: false,
+};
diff --git a/src/plugins/guided_onboarding/public/services/api.test.ts b/src/plugins/guided_onboarding/public/services/api.test.ts
index 2296304166648..56a5755f0ee55 100644
--- a/src/plugins/guided_onboarding/public/services/api.test.ts
+++ b/src/plugins/guided_onboarding/public/services/api.test.ts
@@ -12,20 +12,20 @@ import type { GuideState } from '@kbn/guided-onboarding';
import { firstValueFrom, Subscription } from 'rxjs';
import { API_BASE_PATH } from '../../common/constants';
-import { guidesConfig } from '../constants/guides_config';
import { ApiService } from './api';
import {
- noGuideActiveState,
- searchAddDataActiveState,
- securityAddDataInProgressState,
- securityRulesActiveState,
+ testGuide,
+ testGuideFirstStep,
+ testGuideManualCompletionStep,
+ testGuideStep1ActiveState,
+ testGuideStep1InProgressState,
+ testGuideStep2ActiveState,
+ testGuideNotActiveState,
+ testIntegration,
+ wrongIntegration,
+ testGuideStep2InProgressState,
} from './api.mocks';
-const searchGuide = 'search';
-const firstStep = guidesConfig[searchGuide].steps[0].id;
-const endpointIntegration = 'endpoint';
-const kubernetesIntegration = 'kubernetes';
-
describe('GuidedOnboarding ApiService', () => {
let httpClient: jest.Mocked;
let apiService: ApiService;
@@ -34,7 +34,7 @@ describe('GuidedOnboarding ApiService', () => {
beforeEach(() => {
httpClient = httpServiceMock.createStartContract({ basePath: '/base/path' });
httpClient.get.mockResolvedValue({
- state: [securityAddDataInProgressState],
+ state: [testGuideStep1ActiveState],
});
apiService = new ApiService();
apiService.setup(httpClient);
@@ -57,10 +57,10 @@ describe('GuidedOnboarding ApiService', () => {
});
it('broadcasts the updated state', async () => {
- await apiService.activateGuide(searchGuide, searchAddDataActiveState);
+ await apiService.activateGuide(testGuide, testGuideStep1ActiveState);
const state = await firstValueFrom(apiService.fetchActiveGuideState$());
- expect(state).toEqual(searchAddDataActiveState);
+ expect(state).toEqual(testGuideStep1ActiveState);
});
});
@@ -74,12 +74,12 @@ describe('GuidedOnboarding ApiService', () => {
describe('deactivateGuide', () => {
it('deactivates an existing guide', async () => {
- await apiService.deactivateGuide(searchAddDataActiveState);
+ await apiService.deactivateGuide(testGuideStep1ActiveState);
expect(httpClient.put).toHaveBeenCalledTimes(1);
expect(httpClient.put).toHaveBeenCalledWith(`${API_BASE_PATH}/state`, {
body: JSON.stringify({
- ...searchAddDataActiveState,
+ ...testGuideStep1ActiveState,
isActive: false,
}),
});
@@ -88,17 +88,7 @@ describe('GuidedOnboarding ApiService', () => {
describe('updateGuideState', () => {
it('sends a request to the put API', async () => {
- const updatedState: GuideState = {
- ...searchAddDataActiveState,
- steps: [
- {
- id: searchAddDataActiveState.steps[0].id,
- status: 'in_progress', // update the first step status
- },
- searchAddDataActiveState.steps[1],
- searchAddDataActiveState.steps[2],
- ],
- };
+ const updatedState: GuideState = testGuideStep1InProgressState;
await apiService.updateGuideState(updatedState, false);
expect(httpClient.put).toHaveBeenCalledTimes(1);
expect(httpClient.put).toHaveBeenCalledWith(`${API_BASE_PATH}/state`, {
@@ -109,20 +99,11 @@ describe('GuidedOnboarding ApiService', () => {
describe('isGuideStepActive$', () => {
it('returns true if the step has been started', (done) => {
- const updatedState: GuideState = {
- ...searchAddDataActiveState,
- steps: [
- {
- id: searchAddDataActiveState.steps[0].id,
- status: 'in_progress',
- },
- searchAddDataActiveState.steps[1],
- searchAddDataActiveState.steps[2],
- ],
- };
+ const updatedState: GuideState = testGuideStep1InProgressState;
apiService.updateGuideState(updatedState, false);
+
subscription = apiService
- .isGuideStepActive$(searchGuide, firstStep)
+ .isGuideStepActive$(testGuide, testGuideFirstStep)
.subscribe((isStepActive) => {
if (isStepActive) {
done();
@@ -131,9 +112,8 @@ describe('GuidedOnboarding ApiService', () => {
});
it('returns false if the step is not been started', (done) => {
- apiService.updateGuideState(searchAddDataActiveState, false);
subscription = apiService
- .isGuideStepActive$(searchGuide, firstStep)
+ .isGuideStepActive$(testGuide, testGuideFirstStep)
.subscribe((isStepActive) => {
if (!isStepActive) {
done();
@@ -144,56 +124,44 @@ describe('GuidedOnboarding ApiService', () => {
describe('activateGuide', () => {
it('activates a new guide', async () => {
- await apiService.activateGuide(searchGuide);
+ // update the mock to no active guides
+ httpClient.get.mockResolvedValue({
+ state: [],
+ });
+ apiService.setup(httpClient);
+
+ await apiService.activateGuide(testGuide);
expect(httpClient.put).toHaveBeenCalledTimes(1);
expect(httpClient.put).toHaveBeenCalledWith(`${API_BASE_PATH}/state`, {
- body: JSON.stringify({
- isActive: true,
- status: 'not_started',
- steps: [
- {
- id: 'add_data',
- status: 'active',
- },
- {
- id: 'browse_docs',
- status: 'inactive',
- },
- {
- id: 'search_experience',
- status: 'inactive',
- },
- ],
- guideId: searchGuide,
- }),
+ body: JSON.stringify({ ...testGuideStep1ActiveState, status: 'not_started' }),
});
});
it('reactivates a guide that has already been started', async () => {
- await apiService.activateGuide(searchGuide, searchAddDataActiveState);
+ await apiService.activateGuide(testGuide, testGuideStep1ActiveState);
expect(httpClient.put).toHaveBeenCalledTimes(1);
expect(httpClient.put).toHaveBeenCalledWith(`${API_BASE_PATH}/state`, {
- body: JSON.stringify(searchAddDataActiveState),
+ body: JSON.stringify(testGuideStep1ActiveState),
});
});
});
describe('completeGuide', () => {
const readyToCompleteGuideState: GuideState = {
- ...searchAddDataActiveState,
+ ...testGuideStep1ActiveState,
steps: [
{
- id: 'add_data',
+ ...testGuideStep1ActiveState.steps[0],
status: 'complete',
},
{
- id: 'browse_docs',
+ ...testGuideStep1ActiveState.steps[1],
status: 'complete',
},
{
- id: 'search_experience',
+ ...testGuideStep1ActiveState.steps[2],
status: 'complete',
},
],
@@ -204,7 +172,7 @@ describe('GuidedOnboarding ApiService', () => {
});
it('updates the selected guide and marks it as complete', async () => {
- await apiService.completeGuide(searchGuide);
+ await apiService.completeGuide(testGuide);
expect(httpClient.put).toHaveBeenCalledWith(`${API_BASE_PATH}/state`, {
body: JSON.stringify({
@@ -222,51 +190,39 @@ describe('GuidedOnboarding ApiService', () => {
it('returns undefined if the selected guide has uncompleted steps', async () => {
const incompleteGuideState: GuideState = {
- ...searchAddDataActiveState,
+ ...testGuideStep1ActiveState,
steps: [
{
- id: 'add_data',
+ ...testGuideStep1ActiveState.steps[0],
status: 'complete',
},
{
- id: 'browse_docs',
+ ...testGuideStep1ActiveState.steps[1],
status: 'complete',
},
{
- id: 'search_experience',
+ ...testGuideStep1ActiveState.steps[2],
status: 'in_progress',
},
],
};
await apiService.updateGuideState(incompleteGuideState, false);
- const completedState = await apiService.completeGuide(searchGuide);
+ const completedState = await apiService.completeGuide(testGuide);
expect(completedState).not.toBeDefined();
});
});
describe('startGuideStep', () => {
beforeEach(async () => {
- await apiService.updateGuideState(searchAddDataActiveState, false);
+ await apiService.updateGuideState(testGuideStep1ActiveState, false);
});
it('updates the selected step and marks it as in_progress', async () => {
- await apiService.startGuideStep(searchGuide, firstStep);
+ await apiService.startGuideStep(testGuide, testGuideFirstStep);
expect(httpClient.put).toHaveBeenCalledWith(`${API_BASE_PATH}/state`, {
- body: JSON.stringify({
- ...searchAddDataActiveState,
- isActive: true,
- status: 'in_progress',
- steps: [
- {
- id: searchAddDataActiveState.steps[0].id,
- status: 'in_progress',
- },
- searchAddDataActiveState.steps[1],
- searchAddDataActiveState.steps[2],
- ],
- }),
+ body: JSON.stringify(testGuideStep1InProgressState),
});
});
@@ -278,76 +234,35 @@ describe('GuidedOnboarding ApiService', () => {
describe('completeGuideStep', () => {
it(`completes the step when it's in progress`, async () => {
- const updatedState: GuideState = {
- ...searchAddDataActiveState,
- steps: [
- {
- id: searchAddDataActiveState.steps[0].id,
- status: 'in_progress', // Mark a step as in_progress in order to test the "completeGuideStep" behavior
- },
- searchAddDataActiveState.steps[1],
- searchAddDataActiveState.steps[2],
- ],
- };
- await apiService.updateGuideState(updatedState, false);
+ await apiService.updateGuideState(testGuideStep1InProgressState, false);
- await apiService.completeGuideStep(searchGuide, firstStep);
+ await apiService.completeGuideStep(testGuide, testGuideFirstStep);
// Once on update, once on complete
expect(httpClient.put).toHaveBeenCalledTimes(2);
// Verify the completed step now has a "complete" status, and the subsequent step is "active"
expect(httpClient.put).toHaveBeenLastCalledWith(`${API_BASE_PATH}/state`, {
- body: JSON.stringify({
- ...updatedState,
- steps: [
- {
- id: searchAddDataActiveState.steps[0].id,
- status: 'complete',
- },
- {
- id: searchAddDataActiveState.steps[1].id,
- status: 'active',
- },
- searchAddDataActiveState.steps[2],
- ],
- }),
+ body: JSON.stringify({ ...testGuideStep2ActiveState }),
});
});
it(`marks the step as 'ready_to_complete' if it's configured for manual completion`, async () => {
- const securityRulesInProgressState = {
- ...securityRulesActiveState,
- steps: [
- securityRulesActiveState.steps[0],
- {
- id: securityRulesActiveState.steps[1].id,
- status: 'in_progress',
- },
- securityRulesActiveState.steps[2],
- ],
- };
httpClient.get.mockResolvedValue({
- state: [securityRulesInProgressState],
+ state: [testGuideStep2InProgressState],
});
apiService.setup(httpClient);
- await apiService.completeGuideStep('security', 'rules');
+ await apiService.completeGuideStep(testGuide, testGuideManualCompletionStep);
expect(httpClient.put).toHaveBeenCalledTimes(1);
// Verify the completed step now has a "ready_to_complete" status, and the subsequent step is "inactive"
expect(httpClient.put).toHaveBeenLastCalledWith(`${API_BASE_PATH}/state`, {
body: JSON.stringify({
- ...securityRulesInProgressState,
+ ...testGuideStep2InProgressState,
steps: [
- securityRulesInProgressState.steps[0],
- {
- id: securityRulesInProgressState.steps[1].id,
- status: 'ready_to_complete',
- },
- {
- id: securityRulesInProgressState.steps[2].id,
- status: 'inactive',
- },
+ testGuideStep2InProgressState.steps[0],
+ { ...testGuideStep2InProgressState.steps[1], status: 'ready_to_complete' },
+ testGuideStep2InProgressState.steps[2],
],
}),
});
@@ -359,12 +274,8 @@ describe('GuidedOnboarding ApiService', () => {
});
it('does nothing if the step is not in progress', async () => {
- httpClient.get.mockResolvedValue({
- state: [searchAddDataActiveState],
- });
- apiService.setup(httpClient);
-
- await apiService.completeGuideStep(searchGuide, firstStep);
+ // by default the state set in beforeEach is test guide, step 1 active
+ await apiService.completeGuideStep(testGuide, testGuideFirstStep);
expect(httpClient.put).toHaveBeenCalledTimes(0);
});
});
@@ -372,11 +283,11 @@ describe('GuidedOnboarding ApiService', () => {
describe('isGuidedOnboardingActiveForIntegration$', () => {
it('returns true if the integration is part of the active step', (done) => {
httpClient.get.mockResolvedValue({
- state: [securityAddDataInProgressState],
+ state: [testGuideStep1InProgressState],
});
apiService.setup(httpClient);
subscription = apiService
- .isGuidedOnboardingActiveForIntegration$(endpointIntegration)
+ .isGuidedOnboardingActiveForIntegration$(testIntegration)
.subscribe((isIntegrationInGuideStep) => {
if (isIntegrationInGuideStep) {
done();
@@ -384,13 +295,13 @@ describe('GuidedOnboarding ApiService', () => {
});
});
- it('returns false if another integration is part of the active step', (done) => {
+ it('returns false if the current step has a different integration', (done) => {
httpClient.get.mockResolvedValue({
- state: [securityAddDataInProgressState],
+ state: [testGuideStep1InProgressState],
});
apiService.setup(httpClient);
subscription = apiService
- .isGuidedOnboardingActiveForIntegration$(kubernetesIntegration)
+ .isGuidedOnboardingActiveForIntegration$(wrongIntegration)
.subscribe((isIntegrationInGuideStep) => {
if (!isIntegrationInGuideStep) {
done();
@@ -400,11 +311,11 @@ describe('GuidedOnboarding ApiService', () => {
it('returns false if no guide is active', (done) => {
httpClient.get.mockResolvedValue({
- state: [noGuideActiveState],
+ state: [testGuideNotActiveState],
});
apiService.setup(httpClient);
subscription = apiService
- .isGuidedOnboardingActiveForIntegration$(endpointIntegration)
+ .isGuidedOnboardingActiveForIntegration$(testIntegration)
.subscribe((isIntegrationInGuideStep) => {
if (!isIntegrationInGuideStep) {
done();
@@ -416,35 +327,35 @@ describe('GuidedOnboarding ApiService', () => {
describe('completeGuidedOnboardingForIntegration', () => {
it(`completes the step if it's active for the integration`, async () => {
httpClient.get.mockResolvedValue({
- state: [securityAddDataInProgressState],
+ state: [testGuideStep1InProgressState],
});
apiService.setup(httpClient);
- await apiService.completeGuidedOnboardingForIntegration(endpointIntegration);
+ await apiService.completeGuidedOnboardingForIntegration(testIntegration);
expect(httpClient.put).toHaveBeenCalledTimes(1);
// this assertion depends on the guides config
expect(httpClient.put).toHaveBeenCalledWith(`${API_BASE_PATH}/state`, {
- body: JSON.stringify(securityRulesActiveState),
+ body: JSON.stringify(testGuideStep2ActiveState),
});
});
it(`does nothing if the step has a different integration`, async () => {
httpClient.get.mockResolvedValue({
- state: [securityAddDataInProgressState],
+ state: [testGuideStep1InProgressState],
});
apiService.setup(httpClient);
- await apiService.completeGuidedOnboardingForIntegration(kubernetesIntegration);
+ await apiService.completeGuidedOnboardingForIntegration(wrongIntegration);
expect(httpClient.put).not.toHaveBeenCalled();
});
it(`does nothing if no guide is active`, async () => {
httpClient.get.mockResolvedValue({
- state: [noGuideActiveState],
+ state: [testGuideNotActiveState],
});
apiService.setup(httpClient);
- await apiService.completeGuidedOnboardingForIntegration(endpointIntegration);
+ await apiService.completeGuidedOnboardingForIntegration(testIntegration);
expect(httpClient.put).not.toHaveBeenCalled();
});
});
diff --git a/src/plugins/guided_onboarding/public/services/api.ts b/src/plugins/guided_onboarding/public/services/api.ts
index 688e72fa83243..cd33f9505c546 100644
--- a/src/plugins/guided_onboarding/public/services/api.ts
+++ b/src/plugins/guided_onboarding/public/services/api.ts
@@ -147,10 +147,10 @@ export class ApiService implements GuidedOnboardingApi {
});
const updatedGuide: GuideState = {
+ guideId,
isActive: true,
status: 'not_started',
steps: updatedSteps,
- guideId,
};
return await this.updateGuideState(updatedGuide, true);
diff --git a/src/plugins/guided_onboarding/public/services/helpers.test.ts b/src/plugins/guided_onboarding/public/services/helpers.test.ts
index 9dc7519a02019..82720c4f9d223 100644
--- a/src/plugins/guided_onboarding/public/services/helpers.test.ts
+++ b/src/plugins/guided_onboarding/public/services/helpers.test.ts
@@ -6,51 +6,50 @@
* Side Public License, v 1.
*/
-import { guidesConfig } from '../constants/guides_config';
import { isIntegrationInGuideStep, isLastStep } from './helpers';
import {
- noGuideActiveState,
- securityAddDataInProgressState,
- securityRulesActiveState,
+ testGuide,
+ testGuideFirstStep,
+ testGuideLastStep,
+ testGuideNotActiveState,
+ testGuideStep1InProgressState,
+ testGuideStep2InProgressState,
+ testIntegration,
+ wrongIntegration,
} from './api.mocks';
-const searchGuide = 'search';
-const firstStep = guidesConfig[searchGuide].steps[0].id;
-const lastStep = guidesConfig[searchGuide].steps[guidesConfig[searchGuide].steps.length - 1].id;
-
describe('GuidedOnboarding ApiService helpers', () => {
- // this test suite depends on the guides config
describe('isLastStepActive', () => {
it('returns true if the passed params are for the last step', () => {
- const result = isLastStep(searchGuide, lastStep);
+ const result = isLastStep(testGuide, testGuideLastStep);
expect(result).toBe(true);
});
it('returns false if the passed params are not for the last step', () => {
- const result = isLastStep(searchGuide, firstStep);
+ const result = isLastStep(testGuide, testGuideFirstStep);
expect(result).toBe(false);
});
});
describe('isIntegrationInGuideStep', () => {
it('return true if the integration is defined in the guide step config', () => {
- const result = isIntegrationInGuideStep(securityAddDataInProgressState, 'endpoint');
+ const result = isIntegrationInGuideStep(testGuideStep1InProgressState, testIntegration);
expect(result).toBe(true);
});
it('returns false if a different integration is defined in the guide step', () => {
- const result = isIntegrationInGuideStep(securityAddDataInProgressState, 'kubernetes');
+ const result = isIntegrationInGuideStep(testGuideStep1InProgressState, wrongIntegration);
expect(result).toBe(false);
});
it('returns false if no integration is defined in the guide step', () => {
- const result = isIntegrationInGuideStep(securityRulesActiveState, 'endpoint');
+ const result = isIntegrationInGuideStep(testGuideStep2InProgressState, testIntegration);
expect(result).toBe(false);
});
it('returns false if no guide is active', () => {
- const result = isIntegrationInGuideStep(noGuideActiveState, 'endpoint');
+ const result = isIntegrationInGuideStep(testGuideNotActiveState, testIntegration);
expect(result).toBe(false);
});
it('returns false if no integration passed', () => {
- const result = isIntegrationInGuideStep(securityAddDataInProgressState);
+ const result = isIntegrationInGuideStep(testGuideStep1InProgressState);
expect(result).toBe(false);
});
});
diff --git a/src/plugins/guided_onboarding/public/types.ts b/src/plugins/guided_onboarding/public/types.ts
index a6536e3caf114..3ff0507c494dc 100755
--- a/src/plugins/guided_onboarding/public/types.ts
+++ b/src/plugins/guided_onboarding/public/types.ts
@@ -9,6 +9,7 @@
import { Observable } from 'rxjs';
import { HttpSetup } from '@kbn/core/public';
import type { GuideState, GuideId, GuideStepIds, StepStatus } from '@kbn/guided-onboarding';
+import type { CloudStart } from '@kbn/cloud-plugin/public';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface GuidedOnboardingPluginSetup {}
@@ -17,6 +18,10 @@ export interface GuidedOnboardingPluginStart {
guidedOnboardingApi?: GuidedOnboardingApi;
}
+export interface AppPluginStartDependencies {
+ cloud?: CloudStart;
+}
+
export interface GuidedOnboardingApi {
setup: (httpClient: HttpSetup) => void;
fetchActiveGuideState$: () => Observable;
diff --git a/src/plugins/guided_onboarding/tsconfig.json b/src/plugins/guided_onboarding/tsconfig.json
index 4a024443419ad..2837b97459430 100644
--- a/src/plugins/guided_onboarding/tsconfig.json
+++ b/src/plugins/guided_onboarding/tsconfig.json
@@ -15,5 +15,6 @@
{
"path": "../kibana_react/tsconfig.json"
},
+ { "path": "../../../x-pack/plugins/cloud/tsconfig.json" },
]
}
diff --git a/src/plugins/home/public/application/components/__snapshots__/home.test.tsx.snap b/src/plugins/home/public/application/components/__snapshots__/home.test.tsx.snap
index 3cc05cb41c6f9..53df35833013f 100644
--- a/src/plugins/home/public/application/components/__snapshots__/home.test.tsx.snap
+++ b/src/plugins/home/public/application/components/__snapshots__/home.test.tsx.snap
@@ -28,8 +28,10 @@ exports[`home change home route should render a link to change the default route
"integrations": true,
},
},
+ "navigateToUrl": [MockFunction],
}
}
+ isCloudEnabled={false}
isDarkMode={false}
/>
@@ -37,8 +37,6 @@ exports[`AddData render 1`] = `
{
addBasePath={addBasePathMock}
application={applicationStartMock}
isDarkMode={false}
+ isCloudEnabled={false}
/>
);
expect(component).toMatchSnapshot();
diff --git a/src/plugins/home/public/application/components/add_data/add_data.tsx b/src/plugins/home/public/application/components/add_data/add_data.tsx
index 27f98a85ff4e8..a3cdbd9241020 100644
--- a/src/plugins/home/public/application/components/add_data/add_data.tsx
+++ b/src/plugins/home/public/application/components/add_data/add_data.tsx
@@ -29,9 +29,10 @@ interface Props {
addBasePath: (path: string) => string;
application: ApplicationStart;
isDarkMode: boolean;
+ isCloudEnabled: boolean;
}
-export const AddData: FC = ({ addBasePath, application, isDarkMode }) => {
+export const AddData: FC = ({ addBasePath, application, isDarkMode, isCloudEnabled }) => {
const { trackUiMetric } = getServices();
const canAccessIntegrations = application.capabilities.navLinks.integrations;
if (canAccessIntegrations) {
@@ -59,26 +60,47 @@ export const AddData: FC = ({ addBasePath, application, isDarkMode }) =>
-
+
+ {isCloudEnabled && (
+
+ {/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
+ {
+ trackUiMetric(METRIC_TYPE.CLICK, 'guided_onboarding_link');
+ }}
+ >
+
+
+
+ )}
{/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
{
trackUiMetric(METRIC_TYPE.CLICK, 'home_tutorial_directory');
createAppNavigationHandler('/app/integrations/browse')(event);
}}
+ fullWidth
>
-
+
-
+
-
+
-
+
{
const { chromeServiceMock, applicationServiceMock } =
jest.requireActual('@kbn/core/public/mocks');
const { uiSettingsServiceMock } = jest.requireActual('@kbn/core-ui-settings-browser-mocks');
+ const { cloudMock } = jest.requireActual('@kbn/cloud-plugin/public/mocks');
const uiSettingsMock = uiSettingsServiceMock.createSetupContract();
uiSettingsMock.get.mockReturnValue(false);
return {
getServices: () => ({
+ cloud: cloudMock.createSetup(),
chrome: chromeServiceMock.createStartContract(),
application: applicationServiceMock.createStartContract(),
trackUiMetric: jest.fn(),
diff --git a/src/plugins/home/public/application/components/guided_onboarding/getting_started.tsx b/src/plugins/home/public/application/components/guided_onboarding/getting_started.tsx
index e63676ca3ca72..c82b200dfb6bd 100644
--- a/src/plugins/home/public/application/components/guided_onboarding/getting_started.tsx
+++ b/src/plugins/home/public/application/components/guided_onboarding/getting_started.tsx
@@ -21,6 +21,7 @@ import {
} from '@elastic/eui';
import { css } from '@emotion/react';
+import { useHistory } from 'react-router-dom';
import { METRIC_TYPE } from '@kbn/analytics';
import { i18n } from '@kbn/i18n';
import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
@@ -45,9 +46,10 @@ const skipText = i18n.translate('home.guidedOnboarding.gettingStarted.skip.butto
});
export const GettingStarted = () => {
- const { application, trackUiMetric, chrome, guidedOnboardingService, http, uiSettings } =
+ const { application, trackUiMetric, chrome, guidedOnboardingService, http, uiSettings, cloud } =
getServices();
const [guidesState, setGuidesState] = useState([]);
+ const history = useHistory();
useEffect(() => {
chrome.setBreadcrumbs([
@@ -76,6 +78,12 @@ export const GettingStarted = () => {
fetchGuidesState();
}, [fetchGuidesState]);
+ useEffect(() => {
+ if (cloud?.isCloudEnabled === false) {
+ return history.push('/');
+ }
+ }, [cloud, history]);
+
const onSkip = () => {
trackUiMetric(METRIC_TYPE.CLICK, 'guided_onboarding__skipped');
// disable welcome screen on the home page
@@ -92,6 +100,7 @@ export const GettingStarted = () => {
await guidedOnboardingService?.activateGuide(useCase as GuideId, guideState);
// TODO error handling https://github.com/elastic/kibana/issues/139798
};
+
return (
@@ -109,7 +118,7 @@ export const GettingStarted = () => {
{['search', 'observability', 'observabilityLink', 'security'].map((useCase) => {
if (useCase === 'observabilityLink') {
return (
-
+
{
);
}
return (
-
+
({
getServices: () => ({
getBasePath: () => 'path',
@@ -23,6 +24,7 @@ jest.mock('../kibana_services', () => ({
setBreadcrumbs: () => {},
},
application: {
+ navigateToUrl: mockNavigateToUrl,
capabilities: {
navLinks: {
integrations: mockHasIntegrationsPermission,
@@ -59,6 +61,7 @@ describe('home', () => {
return `base_path/${url}`;
},
hasUserDataView: jest.fn(async () => true),
+ isCloudEnabled: false,
};
});
@@ -230,6 +233,16 @@ describe('home', () => {
expect(component.find(Welcome).exists()).toBe(false);
});
+
+ test('should redirect to guided onboarding on Cloud instead of welcome screen', async () => {
+ const isCloudEnabled = true;
+ const hasUserDataView = jest.fn(async () => false);
+
+ const component = await renderHome({ isCloudEnabled, hasUserDataView });
+
+ expect(component.find(Welcome).exists()).toBe(false);
+ expect(mockNavigateToUrl).toHaveBeenCalledTimes(1);
+ });
});
describe('isNewKibanaInstance', () => {
diff --git a/src/plugins/home/public/application/components/home.tsx b/src/plugins/home/public/application/components/home.tsx
index f6b579213d420..707ea99ad8af4 100644
--- a/src/plugins/home/public/application/components/home.tsx
+++ b/src/plugins/home/public/application/components/home.tsx
@@ -33,6 +33,7 @@ export interface HomeProps {
localStorage: Storage;
urlBasePath: string;
hasUserDataView: () => Promise;
+ isCloudEnabled: boolean;
}
interface State {
@@ -126,7 +127,7 @@ export class Home extends Component {
}
private renderNormal() {
- const { addBasePath, solutions } = this.props;
+ const { addBasePath, solutions, isCloudEnabled } = this.props;
const { application, trackUiMetric } = getServices();
const isDarkMode = getServices().uiSettings?.get('theme:darkMode') || false;
const devTools = this.findDirectoryById('console');
@@ -148,7 +149,12 @@ export class Home extends Component {
>
-
+
{
public render() {
const { isLoading, isWelcomeEnabled, isNewKibanaInstance } = this.state;
+ const { isCloudEnabled } = this.props;
+ const { application } = getServices();
if (isWelcomeEnabled) {
if (isLoading) {
return this.renderLoading();
}
if (isNewKibanaInstance) {
+ if (isCloudEnabled) {
+ application.navigateToUrl('./home#/getting_started');
+ return;
+ }
return this.renderWelcome();
}
}
diff --git a/src/plugins/home/public/application/components/home_app.js b/src/plugins/home/public/application/components/home_app.js
index af7b1dec48669..a6cdfec3b62e9 100644
--- a/src/plugins/home/public/application/components/home_app.js
+++ b/src/plugins/home/public/application/components/home_app.js
@@ -79,6 +79,7 @@ export function HomeApp({ directories, solutions }) {
localStorage={localStorage}
urlBasePath={getBasePath()}
hasUserDataView={() => dataViewsService.hasUserDataView()}
+ isCloudEnabled={isCloudEnabled}
/>
diff --git a/src/plugins/home/public/application/components/sample_data/index.tsx b/src/plugins/home/public/application/components/sample_data/index.tsx
index 8ce7a32b66e08..316ba615ce818 100644
--- a/src/plugins/home/public/application/components/sample_data/index.tsx
+++ b/src/plugins/home/public/application/components/sample_data/index.tsx
@@ -45,7 +45,7 @@ export function SampleDataCard({ urlBasePath, onDecline, onConfirm }: Props) {
description={
}
footer={
diff --git a/src/plugins/home/public/application/kibana_services.ts b/src/plugins/home/public/application/kibana_services.ts
index b622cf862f315..af0a94b232fe6 100644
--- a/src/plugins/home/public/application/kibana_services.ts
+++ b/src/plugins/home/public/application/kibana_services.ts
@@ -21,6 +21,7 @@ import { UrlForwardingStart } from '@kbn/url-forwarding-plugin/public';
import { DataViewsContract } from '@kbn/data-views-plugin/public';
import { SharePluginSetup } from '@kbn/share-plugin/public';
import { GuidedOnboardingApi } from '@kbn/guided-onboarding-plugin/public';
+import { CloudSetup } from '@kbn/cloud-plugin/public';
import { TutorialService } from '../services/tutorials';
import { AddDataService } from '../services/add_data';
import { FeatureCatalogueRegistry } from '../services/feature_catalogue';
@@ -51,6 +52,7 @@ export interface HomeKibanaServices {
addDataService: AddDataService;
welcomeService: WelcomeService;
guidedOnboardingService?: GuidedOnboardingApi;
+ cloud?: CloudSetup;
}
let services: HomeKibanaServices | null = null;
diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts
index c85f920fca6e1..b7270058aae6c 100644
--- a/src/plugins/home/public/plugin.ts
+++ b/src/plugins/home/public/plugin.ts
@@ -105,6 +105,7 @@ export class HomePublicPlugin
featureCatalogue: this.featuresCatalogueRegistry,
welcomeService: this.welcomeService,
guidedOnboardingService: guidedOnboarding.guidedOnboardingApi,
+ cloud,
});
coreStart.chrome.docTitle.change(
i18n.translate('home.pageTitle', { defaultMessage: 'Home' })
diff --git a/src/plugins/kibana_react/public/index.ts b/src/plugins/kibana_react/public/index.ts
index 3311f42bff55d..0d01bd9e0dcd2 100644
--- a/src/plugins/kibana_react/public/index.ts
+++ b/src/plugins/kibana_react/public/index.ts
@@ -72,6 +72,7 @@ export { ValidatedDualRange } from './validated_range';
export type { ToastInput, KibanaReactNotifications } from './notifications';
export { createNotifications } from './notifications';
+/** @deprecated use `Markdown` from `@kbn/shared-ux-markdown` */
export { Markdown, MarkdownSimple } from './markdown';
export { reactToUiComponent, uiToReactComponent } from './adapters';
diff --git a/src/plugins/kibana_react/public/markdown/index.tsx b/src/plugins/kibana_react/public/markdown/index.tsx
index 99da8a3c8898c..d0c72d8db8d76 100644
--- a/src/plugins/kibana_react/public/markdown/index.tsx
+++ b/src/plugins/kibana_react/public/markdown/index.tsx
@@ -17,6 +17,7 @@ const Fallback = () => (
);
+/** @deprecated use `Markdown` from `@kbn/shared-ux-markdown` */
const LazyMarkdownSimple = React.lazy(() => import('./markdown_simple'));
export const MarkdownSimple = (props: MarkdownSimpleProps) => (
}>
@@ -24,6 +25,7 @@ export const MarkdownSimple = (props: MarkdownSimpleProps) => (
);
+/** @deprecated use `Markdown` from `@kbn/shared-ux-markdown` */
const LazyMarkdown = React.lazy(() => import('./markdown'));
export const Markdown = (props: MarkdownProps) => (
}>
diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts
index 41df488839358..22b2a5de751f5 100644
--- a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts
+++ b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts
@@ -546,6 +546,10 @@ export const stackManagementSchema: MakeSchemaFrom = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
+ 'observability:apmEnableCriticalPath': {
+ type: 'boolean',
+ _meta: { description: 'Non-default value of setting.' },
+ },
'observability:enableInfrastructureHostsView': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts
index 2bd59dc69084f..6957323103545 100644
--- a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts
+++ b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts
@@ -147,6 +147,7 @@ export interface UsageStats {
'observability:apmServiceGroupMaxNumberOfServices': number;
'observability:apmServiceInventoryOptimizedSorting': boolean;
'observability:apmTraceExplorerTab': boolean;
+ 'observability:apmEnableCriticalPath': boolean;
'securitySolution:enableGroupedNav': boolean;
'securitySolution:showRelatedIntegrations': boolean;
'visualization:visualize:legacyGaugeChartsLibrary': boolean;
diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json
index 1a97586dffa62..14db4bca74d4a 100644
--- a/src/plugins/telemetry/schema/oss_plugins.json
+++ b/src/plugins/telemetry/schema/oss_plugins.json
@@ -8864,6 +8864,12 @@
"description": "Non-default value of setting."
}
},
+ "observability:apmEnableCriticalPath": {
+ "type": "boolean",
+ "_meta": {
+ "description": "Non-default value of setting."
+ }
+ },
"observability:enableInfrastructureHostsView": {
"type": "boolean",
"_meta": {
diff --git a/src/plugins/unified_field_list/public/components/field_stats/field_stats.tsx b/src/plugins/unified_field_list/public/components/field_stats/field_stats.tsx
index c70f1df820252..07d35b78b58a2 100755
--- a/src/plugins/unified_field_list/public/components/field_stats/field_stats.tsx
+++ b/src/plugins/unified_field_list/public/components/field_stats/field_stats.tsx
@@ -75,7 +75,7 @@ export interface FieldStatsProps {
'data-test-subj'?: string;
overrideMissingContent?: (params: {
element: JSX.Element;
- noDataFound?: boolean;
+ reason: 'no-data' | 'unsupported';
}) => JSX.Element | null;
overrideFooter?: (params: {
element: JSX.Element;
@@ -304,7 +304,7 @@ const FieldStatsComponent: React.FC = ({
return overrideMissingContent
? overrideMissingContent({
- noDataFound: false,
+ reason: 'unsupported',
element: messageNoAnalysis,
})
: messageNoAnalysis;
@@ -338,7 +338,7 @@ const FieldStatsComponent: React.FC = ({
return overrideMissingContent
? overrideMissingContent({
- noDataFound: true,
+ reason: 'no-data',
element: messageNoData,
})
: messageNoData;
@@ -358,12 +358,14 @@ const FieldStatsComponent: React.FC = ({
defaultMessage: 'Top values',
}),
id: 'topValues',
+ 'data-test-subj': `${dataTestSubject}-buttonGroup-topValuesButton`,
},
{
label: i18n.translate('unifiedFieldList.fieldStats.fieldDistributionLabel', {
defaultMessage: 'Distribution',
}),
id: 'histogram',
+ 'data-test-subj': `${dataTestSubject}-buttonGroup-distributionButton`,
},
]}
onChange={(optionId: string) => {
diff --git a/src/plugins/vis_types/heatmap/kibana.json b/src/plugins/vis_types/heatmap/kibana.json
index c8df98e2b343a..b7f4a3bacbb90 100644
--- a/src/plugins/vis_types/heatmap/kibana.json
+++ b/src/plugins/vis_types/heatmap/kibana.json
@@ -1,14 +1,27 @@
{
- "id": "visTypeHeatmap",
- "version": "kibana",
- "ui": true,
- "server": true,
- "requiredPlugins": ["charts", "data", "expressions", "visualizations", "usageCollection", "fieldFormats"],
- "requiredBundles": ["visDefaultEditor"],
- "extraPublicDirs": ["common/index"],
- "owner": {
- "name": "Vis Editors",
- "githubTeam": "kibana-vis-editors"
- },
- "description": "Contains the heatmap implementation using the elastic-charts library. The goal is to eventually deprecate the old implementation and keep only this. Until then, the library used is defined by the Legacy heatmap charts library advanced setting."
- }
+ "id": "visTypeHeatmap",
+ "version": "kibana",
+ "ui": true,
+ "server": true,
+ "requiredPlugins": [
+ "charts",
+ "data",
+ "expressions",
+ "visualizations",
+ "usageCollection",
+ "fieldFormats",
+ "dataViews"
+ ],
+ "requiredBundles": [
+ "visDefaultEditor",
+ "kibanaUtils"
+ ],
+ "extraPublicDirs": [
+ "common/index"
+ ],
+ "owner": {
+ "name": "Vis Editors",
+ "githubTeam": "kibana-vis-editors"
+ },
+ "description": "Contains the heatmap implementation using the elastic-charts library. The goal is to eventually deprecate the old implementation and keep only this. Until then, the library used is defined by the Legacy heatmap charts library advanced setting."
+}
\ No newline at end of file
diff --git a/src/plugins/vis_types/heatmap/public/convert_to_lens/configurations/index.test.ts b/src/plugins/vis_types/heatmap/public/convert_to_lens/configurations/index.test.ts
new file mode 100644
index 0000000000000..3f60b6fde0a94
--- /dev/null
+++ b/src/plugins/vis_types/heatmap/public/convert_to_lens/configurations/index.test.ts
@@ -0,0 +1,114 @@
+/*
+ * 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 { AvgColumn, DateHistogramColumn } from '@kbn/visualizations-plugin/common/convert_to_lens';
+import { Vis } from '@kbn/visualizations-plugin/public';
+import { getConfiguration } from '.';
+import { sampleHeatmapVis } from '../../sample_vis.test.mocks';
+import { HeatmapVisParams } from '../../types';
+
+describe('getConfiguration', () => {
+ const layerId = 'layer-id';
+ let vis: Vis;
+
+ const metric: AvgColumn = {
+ sourceField: 'price',
+ columnId: 'column-1',
+ operationType: 'average',
+ isBucketed: false,
+ isSplit: false,
+ dataType: 'string',
+ params: {},
+ };
+ const xColumn: DateHistogramColumn = {
+ sourceField: 'price',
+ columnId: 'column-2',
+ operationType: 'date_histogram',
+ isBucketed: true,
+ isSplit: false,
+ dataType: 'string',
+ params: {
+ interval: '1h',
+ },
+ };
+
+ const yColumn: DateHistogramColumn = {
+ sourceField: 'price',
+ columnId: 'column-3',
+ operationType: 'date_histogram',
+ isBucketed: true,
+ isSplit: true,
+ dataType: 'string',
+ params: {
+ interval: '1h',
+ },
+ };
+
+ beforeEach(() => {
+ vis = sampleHeatmapVis as unknown as Vis;
+ });
+
+ test('should return valid configuration', async () => {
+ const result = await getConfiguration(layerId, vis, {
+ metrics: [metric.columnId],
+ buckets: [xColumn.columnId, yColumn.columnId],
+ });
+ expect(result).toEqual({
+ gridConfig: {
+ isCellLabelVisible: true,
+ isXAxisLabelVisible: true,
+ isXAxisTitleVisible: true,
+ isYAxisLabelVisible: true,
+ isYAxisTitleVisible: true,
+ type: 'heatmap_grid',
+ },
+ layerId,
+ layerType: 'data',
+ legend: { isVisible: undefined, position: 'right', type: 'heatmap_legend' },
+ palette: {
+ accessor: 'column-1',
+ name: 'custom',
+ params: {
+ colorStops: [
+ { color: '#F7FBFF', stop: 0 },
+ { color: '#DEEBF7', stop: 12.5 },
+ { color: '#C3DBEE', stop: 25 },
+ { color: '#9CC8E2', stop: 37.5 },
+ { color: '#6DAED5', stop: 50 },
+ { color: '#4391C6', stop: 62.5 },
+ { color: '#2271B3', stop: 75 },
+ { color: '#0D5097', stop: 87.5 },
+ ],
+ continuity: 'none',
+ maxSteps: 5,
+ name: 'custom',
+ progression: 'fixed',
+ rangeMax: 100,
+ rangeMin: 0,
+ rangeType: 'number',
+ reverse: false,
+ stops: [
+ { color: '#F7FBFF', stop: 12.5 },
+ { color: '#DEEBF7', stop: 25 },
+ { color: '#C3DBEE', stop: 37.5 },
+ { color: '#9CC8E2', stop: 50 },
+ { color: '#6DAED5', stop: 62.5 },
+ { color: '#4391C6', stop: 75 },
+ { color: '#2271B3', stop: 87.5 },
+ { color: '#0D5097', stop: 100 },
+ ],
+ },
+ type: 'palette',
+ },
+ shape: 'heatmap',
+ valueAccessor: metric.columnId,
+ xAccessor: xColumn.columnId,
+ yAccessor: yColumn.columnId,
+ });
+ });
+});
diff --git a/src/plugins/vis_types/heatmap/public/convert_to_lens/configurations/index.ts b/src/plugins/vis_types/heatmap/public/convert_to_lens/configurations/index.ts
new file mode 100644
index 0000000000000..2e7a3f161514a
--- /dev/null
+++ b/src/plugins/vis_types/heatmap/public/convert_to_lens/configurations/index.ts
@@ -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 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 { HeatmapConfiguration } from '@kbn/visualizations-plugin/common';
+import { Vis } from '@kbn/visualizations-plugin/public';
+import { HeatmapVisParams } from '../../types';
+import { getPaletteForHeatmap } from './palette';
+
+export const getConfiguration = async (
+ layerId: string,
+ vis: Vis,
+ {
+ metrics,
+ buckets,
+ }: {
+ metrics: string[];
+ buckets: string[];
+ }
+): Promise => {
+ const [valueAccessor] = metrics;
+ const [xAccessor, yAccessor] = buckets;
+
+ const { params, uiState } = vis;
+ const state = uiState.get('vis', {}) ?? {};
+
+ const palette = await getPaletteForHeatmap(params);
+ return {
+ layerId,
+ layerType: 'data',
+ shape: 'heatmap',
+ legend: {
+ type: 'heatmap_legend',
+ isVisible: state.legendOpen,
+ position: params.legendPosition,
+ },
+ gridConfig: {
+ type: 'heatmap_grid',
+ isCellLabelVisible: params.valueAxes?.[0].labels.show ?? false,
+ isXAxisLabelVisible: true,
+ isYAxisLabelVisible: true,
+ isYAxisTitleVisible: true,
+ isXAxisTitleVisible: true,
+ },
+ valueAccessor,
+ xAccessor,
+ yAccessor,
+ palette: palette ? { ...palette, accessor: valueAccessor } : undefined,
+ };
+};
diff --git a/src/plugins/vis_types/heatmap/public/convert_to_lens/configurations/palette.ts b/src/plugins/vis_types/heatmap/public/convert_to_lens/configurations/palette.ts
new file mode 100644
index 0000000000000..32187e184d4ef
--- /dev/null
+++ b/src/plugins/vis_types/heatmap/public/convert_to_lens/configurations/palette.ts
@@ -0,0 +1,52 @@
+/*
+ * 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 { Range } from '@kbn/expressions-plugin/common';
+import { convertToLensModule } from '@kbn/visualizations-plugin/public';
+import { HeatmapVisParams } from '../../types';
+import { getStopsWithColorsFromColorsNumber } from '../../utils/palette';
+
+type HeatmapVisParamsWithRanges = Omit & {
+ colorsRange: Exclude;
+};
+
+const isHeatmapVisParamsWithRanges = (
+ params: HeatmapVisParams | HeatmapVisParamsWithRanges
+): params is HeatmapVisParamsWithRanges => {
+ return Boolean(params.setColorRange && params.colorsRange && params.colorsRange.length);
+};
+
+export const getPaletteForHeatmap = async (params: HeatmapVisParams) => {
+ const { getPalette, getPaletteFromStopsWithColors, getPercentageModeConfig } =
+ await convertToLensModule;
+
+ if (isHeatmapVisParamsWithRanges(params)) {
+ const percentageModeConfig = getPercentageModeConfig(params, false);
+ return getPalette(params, percentageModeConfig, params.percentageMode);
+ }
+
+ const { color, stop = [] } = getStopsWithColorsFromColorsNumber(
+ params.colorsNumber,
+ params.colorSchema,
+ params.invertColors,
+ true
+ );
+ const colorsRange: Range[] = [{ from: stop[0], to: stop[stop.length - 1], type: 'range' }];
+ const { colorSchema, invertColors, percentageMode } = params;
+ const percentageModeConfig = getPercentageModeConfig(
+ {
+ colorsRange,
+ colorSchema,
+ invertColors,
+ percentageMode,
+ },
+ false
+ );
+
+ return getPaletteFromStopsWithColors({ color, stop: stop ?? [] }, percentageModeConfig, true);
+};
diff --git a/src/plugins/vis_types/heatmap/public/convert_to_lens/index.test.ts b/src/plugins/vis_types/heatmap/public/convert_to_lens/index.test.ts
new file mode 100644
index 0000000000000..ef86b3829c248
--- /dev/null
+++ b/src/plugins/vis_types/heatmap/public/convert_to_lens/index.test.ts
@@ -0,0 +1,166 @@
+/*
+ * 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 { ColorSchemas } from '@kbn/charts-plugin/common';
+import { Vis } from '@kbn/visualizations-plugin/public';
+import { convertToLens } from '.';
+import { HeatmapVisParams } from '../types';
+
+const mockGetColumnsFromVis = jest.fn();
+const mockGetConfiguration = jest.fn().mockReturnValue({});
+const mockGetDataViewByIndexPatternId = jest.fn();
+const mockConvertToFiltersColumn = jest.fn();
+
+jest.mock('../services', () => ({
+ getDataViewsStart: jest.fn(() => ({ get: () => ({}), getDefault: () => ({}) })),
+}));
+
+jest.mock('@kbn/visualizations-plugin/public', () => ({
+ convertToLensModule: Promise.resolve({
+ getColumnsFromVis: jest.fn(() => mockGetColumnsFromVis()),
+ convertToFiltersColumn: jest.fn(() => mockConvertToFiltersColumn()),
+ }),
+ getDataViewByIndexPatternId: jest.fn(() => mockGetDataViewByIndexPatternId()),
+}));
+
+jest.mock('./configurations', () => ({
+ getConfiguration: jest.fn(() => mockGetConfiguration()),
+}));
+
+const params: HeatmapVisParams = {
+ addTooltip: false,
+ addLegend: false,
+ enableHover: true,
+ legendPosition: 'bottom',
+ lastRangeIsRightOpen: false,
+ percentageMode: false,
+ valueAxes: [],
+ colorSchema: ColorSchemas.Blues,
+ invertColors: false,
+ colorsNumber: 4,
+ setColorRange: true,
+};
+
+const vis = {
+ isHierarchical: () => false,
+ type: {},
+ params,
+ data: {},
+} as unknown as Vis;
+
+const timefilter = {
+ getAbsoluteTime: () => {},
+} as any;
+
+describe('convertToLens', () => {
+ beforeEach(() => {
+ mockGetDataViewByIndexPatternId.mockReturnValue({ id: 'index-pattern' });
+ mockConvertToFiltersColumn.mockReturnValue({ columnId: 'column-id-1' });
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+
+ test('should return null if timefilter is undefined', async () => {
+ const result = await convertToLens(vis);
+ expect(result).toBeNull();
+ });
+
+ test('should return null if mockGetDataViewByIndexPatternId returns null', async () => {
+ mockGetDataViewByIndexPatternId.mockReturnValue(null);
+ const result = await convertToLens(vis, timefilter);
+ expect(mockGetDataViewByIndexPatternId).toBeCalledTimes(1);
+ expect(mockGetColumnsFromVis).toBeCalledTimes(0);
+ expect(result).toBeNull();
+ });
+
+ test('should return null if getColumnsFromVis returns null', async () => {
+ mockGetColumnsFromVis.mockReturnValue(null);
+ const result = await convertToLens(vis, timefilter);
+ expect(mockGetColumnsFromVis).toBeCalledTimes(1);
+ expect(result).toBeNull();
+ });
+
+ test('should return null if metrics count is more than 1', async () => {
+ mockGetColumnsFromVis.mockReturnValue([
+ {
+ metrics: ['1', '2'],
+ buckets: { all: [] },
+ columns: [{ columnId: '2' }, { columnId: '1' }],
+ },
+ ]);
+ const result = await convertToLens(vis, timefilter);
+ expect(mockGetColumnsFromVis).toBeCalledTimes(1);
+ expect(result).toBeNull();
+ });
+
+ test('should return empty filters for x-axis if no buckets are specified', async () => {
+ mockGetColumnsFromVis.mockReturnValue([
+ {
+ metrics: ['1'],
+ buckets: { all: [] },
+ columns: [{ columnId: '1', dataType: 'number' }],
+ columnsWithoutReferenced: [
+ { columnId: '1', meta: { aggId: 'agg-1' } },
+ { columnId: '2', meta: { aggId: 'agg-2' } },
+ { columnId: 'column-id-1' },
+ ],
+ },
+ ]);
+ const result = await convertToLens(vis, timefilter);
+ expect(mockGetColumnsFromVis).toBeCalledTimes(1);
+ expect(result).toEqual(
+ expect.objectContaining({
+ configuration: {},
+ indexPatternIds: ['index-pattern'],
+ layers: [
+ expect.objectContaining({
+ columnOrder: [],
+ columns: [{ columnId: '1', dataType: 'number' }, { columnId: 'column-id-1' }],
+ indexPatternId: 'index-pattern',
+ }),
+ ],
+ type: 'lnsHeatmap',
+ })
+ );
+ });
+
+ test('should return correct state for valid vis', async () => {
+ const config = {
+ layerType: 'data',
+ };
+
+ mockGetColumnsFromVis.mockReturnValue([
+ {
+ metrics: ['1'],
+ buckets: { all: ['2'] },
+ columns: [{ columnId: '1', dataType: 'number' }],
+ columnsWithoutReferenced: [
+ { columnId: '1', meta: { aggId: 'agg-1' } },
+ { columnId: '2', meta: { aggId: 'agg-2' } },
+ ],
+ },
+ ]);
+ mockGetConfiguration.mockReturnValue(config);
+
+ const result = await convertToLens(vis, timefilter);
+ expect(mockGetColumnsFromVis).toBeCalledTimes(1);
+ expect(mockGetConfiguration).toBeCalledTimes(1);
+ expect(result?.type).toEqual('lnsHeatmap');
+ expect(result?.layers.length).toEqual(1);
+ expect(result?.layers[0]).toEqual(
+ expect.objectContaining({
+ columnOrder: [],
+ columns: [{ columnId: '1', dataType: 'number' }, { columnId: 'column-id-1' }],
+ indexPatternId: 'index-pattern',
+ })
+ );
+ expect(result?.configuration).toEqual(config);
+ });
+});
diff --git a/src/plugins/vis_types/heatmap/public/convert_to_lens/index.ts b/src/plugins/vis_types/heatmap/public/convert_to_lens/index.ts
new file mode 100644
index 0000000000000..546d497e80560
--- /dev/null
+++ b/src/plugins/vis_types/heatmap/public/convert_to_lens/index.ts
@@ -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 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 { Column, ColumnWithMeta } from '@kbn/visualizations-plugin/common';
+import {
+ convertToLensModule,
+ getDataViewByIndexPatternId,
+} from '@kbn/visualizations-plugin/public';
+import uuid from 'uuid';
+import { getDataViewsStart } from '../services';
+import { getConfiguration } from './configurations';
+import { ConvertHeatmapToLensVisualization } from './types';
+
+export const isColumnWithMeta = (column: Column): column is ColumnWithMeta => {
+ if ((column as ColumnWithMeta).meta) {
+ return true;
+ }
+ return false;
+};
+
+export const excludeMetaFromColumn = (column: Column) => {
+ if (isColumnWithMeta(column)) {
+ const { meta, ...rest } = column;
+ return rest;
+ }
+ return column;
+};
+
+export const convertToLens: ConvertHeatmapToLensVisualization = async (vis, timefilter) => {
+ if (!timefilter) {
+ return null;
+ }
+
+ const dataViews = getDataViewsStart();
+ const dataView = await getDataViewByIndexPatternId(vis.data.indexPattern?.id, dataViews);
+
+ if (!dataView) {
+ return null;
+ }
+
+ const { getColumnsFromVis, convertToFiltersColumn } = await convertToLensModule;
+ const layers = getColumnsFromVis(vis, timefilter, dataView, {
+ buckets: ['segment'],
+ splits: ['group'],
+ unsupported: ['split_row', 'split_column'],
+ });
+
+ if (layers === null) {
+ return null;
+ }
+
+ const [layerConfig] = layers;
+
+ const xColumn = layerConfig.columns.find(({ isBucketed, isSplit }) => isBucketed && !isSplit);
+ const xAxisColumn =
+ xColumn ??
+ convertToFiltersColumn(uuid(), { filters: [{ input: { language: 'lucene', query: '*' } }] })!;
+
+ if (xColumn?.columnId !== xAxisColumn?.columnId) {
+ layerConfig.buckets.all.push(xAxisColumn.columnId);
+ layerConfig.columns.push(xAxisColumn);
+ }
+ const yColumn = layerConfig.columns.find(({ isBucketed, isSplit }) => isBucketed && isSplit);
+
+ if (!layerConfig.buckets.all.length || layerConfig.metrics.length > 1) {
+ return null;
+ }
+
+ const layerId = uuid();
+
+ const indexPatternId = dataView.id!;
+ const configuration = await getConfiguration(layerId, vis, {
+ metrics: layerConfig.metrics,
+ buckets: [xAxisColumn.columnId, yColumn?.columnId].filter((c): c is string =>
+ Boolean(c)
+ ),
+ });
+
+ return {
+ type: 'lnsHeatmap',
+ layers: [
+ {
+ indexPatternId,
+ layerId,
+ columns: layerConfig.columns.map(excludeMetaFromColumn),
+ columnOrder: [],
+ },
+ ],
+ configuration,
+ indexPatternIds: [indexPatternId],
+ };
+};
diff --git a/src/plugins/vis_types/heatmap/public/convert_to_lens/types.ts b/src/plugins/vis_types/heatmap/public/convert_to_lens/types.ts
new file mode 100644
index 0000000000000..732b977dd7b59
--- /dev/null
+++ b/src/plugins/vis_types/heatmap/public/convert_to_lens/types.ts
@@ -0,0 +1,17 @@
+/*
+ * 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 { TimefilterContract } from '@kbn/data-plugin/public';
+import { NavigateToLensContext, HeatmapConfiguration } from '@kbn/visualizations-plugin/common';
+import { Vis } from '@kbn/visualizations-plugin/public';
+import { HeatmapVisParams } from '../types';
+
+export type ConvertHeatmapToLensVisualization = (
+ vis: Vis,
+ timefilter?: TimefilterContract
+) => Promise | null>;
diff --git a/src/plugins/vis_types/heatmap/public/plugin.ts b/src/plugins/vis_types/heatmap/public/plugin.ts
index 44357cceaa86b..ee7349145e7c6 100644
--- a/src/plugins/vis_types/heatmap/public/plugin.ts
+++ b/src/plugins/vis_types/heatmap/public/plugin.ts
@@ -6,14 +6,16 @@
* Side Public License, v 1.
*/
-import { CoreSetup } from '@kbn/core/public';
+import { CoreSetup, CoreStart } from '@kbn/core/public';
import type { VisualizationsSetup } from '@kbn/visualizations-plugin/public';
import type { ChartsPluginSetup } from '@kbn/charts-plugin/public';
+import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public';
import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import { LEGACY_HEATMAP_CHARTS_LIBRARY } from '../common';
import { heatmapVisType } from './vis_type';
+import { setDataViewsStart } from './services';
/** @internal */
export interface VisTypeHeatmapSetupDependencies {
@@ -28,6 +30,11 @@ export interface VisTypeHeatmapPluginStartDependencies {
fieldFormats: FieldFormatsStart;
}
+/** @internal */
+export interface VisTypeHeatmapStartDependencies {
+ dataViews: DataViewsPublicPluginStart;
+}
+
export class VisTypeHeatmapPlugin {
setup(
core: CoreSetup,
@@ -44,5 +51,7 @@ export class VisTypeHeatmapPlugin {
return {};
}
- start() {}
+ start(core: CoreStart, { dataViews }: VisTypeHeatmapStartDependencies) {
+ setDataViewsStart(dataViews);
+ }
}
diff --git a/src/plugins/vis_types/heatmap/public/sample_vis.test.mocks.ts b/src/plugins/vis_types/heatmap/public/sample_vis.test.mocks.ts
index 6a33feb853221..89ede55b951ef 100644
--- a/src/plugins/vis_types/heatmap/public/sample_vis.test.mocks.ts
+++ b/src/plugins/vis_types/heatmap/public/sample_vis.test.mocks.ts
@@ -5,7 +5,9 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
-export const sampleAreaVis = {
+
+const mockUiStateGet = jest.fn().mockReturnValue(() => {});
+export const sampleHeatmapVis = {
type: {
name: 'heatmap',
title: 'Heatmap',
@@ -1788,5 +1790,10 @@ export const sampleAreaVis = {
},
},
isHierarchical: () => false,
- uiState: {},
+ uiState: {
+ vis: {
+ legendOpen: false,
+ },
+ get: mockUiStateGet,
+ },
};
diff --git a/src/plugins/vis_types/heatmap/public/services.ts b/src/plugins/vis_types/heatmap/public/services.ts
new file mode 100644
index 0000000000000..736ad70d49419
--- /dev/null
+++ b/src/plugins/vis_types/heatmap/public/services.ts
@@ -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.
+ */
+
+import { createGetterSetter } from '@kbn/kibana-utils-plugin/public';
+import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
+
+export const [getDataViewsStart, setDataViewsStart] =
+ createGetterSetter('dataViews');
diff --git a/src/plugins/vis_types/heatmap/public/to_ast.test.ts b/src/plugins/vis_types/heatmap/public/to_ast.test.ts
index d1e312755cf49..07585d9f2332f 100644
--- a/src/plugins/vis_types/heatmap/public/to_ast.test.ts
+++ b/src/plugins/vis_types/heatmap/public/to_ast.test.ts
@@ -7,7 +7,7 @@
*/
import { Vis } from '@kbn/visualizations-plugin/public';
-import { sampleAreaVis } from './sample_vis.test.mocks';
+import { sampleHeatmapVis } from './sample_vis.test.mocks';
import { buildExpression } from '@kbn/expressions-plugin/public';
import { toExpressionAst } from './to_ast';
@@ -33,7 +33,7 @@ describe('heatmap vis toExpressionAst function', () => {
} as any;
beforeEach(() => {
- vis = sampleAreaVis as any;
+ vis = sampleHeatmapVis as any;
});
it('should match basic snapshot', () => {
diff --git a/src/plugins/vis_types/heatmap/public/utils/palette.ts b/src/plugins/vis_types/heatmap/public/utils/palette.ts
index aa978a2954e90..29109a55fd1e7 100644
--- a/src/plugins/vis_types/heatmap/public/utils/palette.ts
+++ b/src/plugins/vis_types/heatmap/public/utils/palette.ts
@@ -27,13 +27,20 @@ const getColor = (
export const getStopsWithColorsFromColorsNumber = (
colorsNumber: number | '',
colorSchema: ColorSchemas,
- invertColors: boolean = false
+ invertColors: boolean = false,
+ includeZeroElement: boolean = false
) => {
const colors = [];
const stops = [];
if (!colorsNumber) {
return { color: [] };
}
+
+ if (includeZeroElement) {
+ colors.push(TRANSPARENT);
+ stops.push(0);
+ }
+
const step = 100 / colorsNumber;
for (let i = 0; i < colorsNumber; i++) {
colors.push(getColor(i, colorsNumber, colorSchema, invertColors));
diff --git a/src/plugins/vis_types/heatmap/public/vis_type/heatmap.tsx b/src/plugins/vis_types/heatmap/public/vis_type/heatmap.tsx
index e5a92ca03f5cc..336da6e2d8041 100644
--- a/src/plugins/vis_types/heatmap/public/vis_type/heatmap.tsx
+++ b/src/plugins/vis_types/heatmap/public/vis_type/heatmap.tsx
@@ -16,6 +16,7 @@ import { HeatmapTypeProps, HeatmapVisParams, AxisType, ScaleType } from '../type
import { toExpressionAst } from '../to_ast';
import { getHeatmapOptions } from '../editor/components';
import { SplitTooltip } from './split_tooltip';
+import { convertToLens } from '../convert_to_lens';
export const getHeatmapVisTypeDefinition = ({
showElasticChartsOptions = false,
@@ -154,4 +155,10 @@ export const getHeatmapVisTypeDefinition = ({
],
},
requiresSearch: true,
+ navigateToLens: async (vis, timefilter) => (vis ? convertToLens(vis, timefilter) : null),
+ getExpressionVariables: async (vis, timeFilter) => {
+ return {
+ canNavigateToLens: Boolean(vis?.params ? await convertToLens(vis, timeFilter) : null),
+ };
+ },
});
diff --git a/src/plugins/vis_types/pie/kibana.json b/src/plugins/vis_types/pie/kibana.json
index 4c5ee6b50579e..d9dca861e33be 100644
--- a/src/plugins/vis_types/pie/kibana.json
+++ b/src/plugins/vis_types/pie/kibana.json
@@ -1,14 +1,27 @@
{
- "id": "visTypePie",
- "version": "kibana",
- "ui": true,
- "server": true,
- "requiredPlugins": ["charts", "data", "expressions", "visualizations", "usageCollection", "expressionPartitionVis", "dataViews"],
- "requiredBundles": ["visDefaultEditor", "kibanaUtils"],
- "extraPublicDirs": ["common/index"],
- "owner": {
- "name": "Vis Editors",
- "githubTeam": "kibana-vis-editors"
- },
- "description": "Contains the pie chart implementation using the elastic-charts library. The goal is to eventually deprecate the old implementation and keep only this. Until then, the library used is defined by the Legacy charts library advanced setting."
- }
+ "id": "visTypePie",
+ "version": "kibana",
+ "ui": true,
+ "server": true,
+ "requiredPlugins": [
+ "charts",
+ "data",
+ "expressions",
+ "visualizations",
+ "usageCollection",
+ "expressionPartitionVis",
+ "dataViews"
+ ],
+ "requiredBundles": [
+ "visDefaultEditor",
+ "kibanaUtils"
+ ],
+ "extraPublicDirs": [
+ "common/index"
+ ],
+ "owner": {
+ "name": "Vis Editors",
+ "githubTeam": "kibana-vis-editors"
+ },
+ "description": "Contains the pie chart implementation using the elastic-charts library. The goal is to eventually deprecate the old implementation and keep only this. Until then, the library used is defined by the Legacy charts library advanced setting."
+}
\ No newline at end of file
diff --git a/src/plugins/vis_types/table/public/convert_to_lens/index.ts b/src/plugins/vis_types/table/public/convert_to_lens/index.ts
index e69faccbfd7ec..ed23d612cb68c 100644
--- a/src/plugins/vis_types/table/public/convert_to_lens/index.ts
+++ b/src/plugins/vis_types/table/public/convert_to_lens/index.ts
@@ -73,6 +73,7 @@ export const convertToLens: ConvertTableToLensVisualization = async (vis, timefi
return null;
}
const percentageColumn = getPercentageColumnFormulaColumn({
+ visType: vis.type.name,
agg: metricAgg as SchemaConfig,
dataView,
aggs: visSchemas.metric as Array>,
diff --git a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/static_value.test.ts b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/static_value.test.ts
index 907fe458c6a64..5d6dc036a7bd0 100644
--- a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/static_value.test.ts
+++ b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/static_value.test.ts
@@ -47,6 +47,11 @@ describe('convertToStaticValueColumn', () => {
[{ series, metrics: [metric], dataView }, { visibleSeriesCount: 1 }],
null,
],
+ [
+ 'null if value is not specified',
+ [{ series, metrics: [metric], dataView }, { visibleSeriesCount: 2 }],
+ null,
+ ],
[
'static value column',
[{ series, metrics: [{ ...metric, value: 'some value' }], dataView }],
diff --git a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/static_value.ts b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/static_value.ts
index d3e6aef09b1cf..7990107bb5bf9 100644
--- a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/static_value.ts
+++ b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/static_value.ts
@@ -32,6 +32,9 @@ export const convertToStaticValueColumn = (
return null;
}
const currentMetric = metrics[metrics.length - 1];
+ if (!currentMetric.value) {
+ return null;
+ }
return {
operationType: 'static_value',
references: [],
@@ -68,7 +71,10 @@ export const convertStaticValueToFormulaColumn = (
return null;
}
const currentMetric = metrics[metrics.length - 1];
- return createFormulaColumn(currentMetric.value ?? '', {
+ if (!currentMetric.value) {
+ return null;
+ }
+ return createFormulaColumn(currentMetric.value, {
series,
metric: currentMetric,
dataView,
diff --git a/src/plugins/vis_types/timeseries/public/convert_to_lens/metric/index.ts b/src/plugins/vis_types/timeseries/public/convert_to_lens/metric/index.ts
index fbf04a2dcf779..8577623b8bd93 100644
--- a/src/plugins/vis_types/timeseries/public/convert_to_lens/metric/index.ts
+++ b/src/plugins/vis_types/timeseries/public/convert_to_lens/metric/index.ts
@@ -30,7 +30,8 @@ export const convertToLens: ConvertTsvbToLensVisualization = async (
const seriesNum = model.series.filter((series) => !series.hidden).length;
const indexPatternIds = new Set();
- const visibleSeries = model.series.filter(({ hidden }) => !hidden);
+ // we should get max only 2 series
+ const visibleSeries = model.series.filter(({ hidden }) => !hidden).slice(0, 2);
let currentIndexPattern: DataView | null = null;
for (const series of visibleSeries) {
const datasourceInfo = await getDataSourceInfo(
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/buckets/index.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/buckets/index.test.ts
index f0a8e4d32f7c3..02a6140625c07 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/buckets/index.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/buckets/index.test.ts
@@ -8,7 +8,7 @@
import { stubLogstashDataView } from '@kbn/data-views-plugin/common/data_view.stub';
import { BUCKET_TYPES, METRIC_TYPES } from '@kbn/data-plugin/common';
-import { convertBucketToColumns } from '.';
+import { BucketAggs, convertBucketToColumns } from '.';
import { DateHistogramColumn, FiltersColumn, RangeColumn, TermsColumn } from '../../types';
import { AggBasedColumn, SchemaConfig } from '../../..';
@@ -27,7 +27,7 @@ jest.mock('../convert', () => ({
describe('convertBucketToColumns', () => {
const field = stubLogstashDataView.fields[0].name;
const dateField = stubLogstashDataView.fields.find((f) => f.type === 'date')!.name;
- const bucketAggs: SchemaConfig[] = [
+ const bucketAggs: Array> = [
{
accessor: 0,
label: '',
@@ -152,6 +152,7 @@ describe('convertBucketToColumns', () => {
},
},
];
+ const visType = 'heatmap';
afterEach(() => {
jest.clearAllMocks();
@@ -167,7 +168,7 @@ describe('convertBucketToColumns', () => {
>([
[
'null if bucket agg type is not supported',
- [{ dataView: stubLogstashDataView, agg: bucketAggs[6], aggs, metricColumns }],
+ [{ dataView: stubLogstashDataView, agg: bucketAggs[6], aggs, metricColumns, visType }],
() => {},
null,
],
@@ -179,6 +180,7 @@ describe('convertBucketToColumns', () => {
agg: { ...bucketAggs[0], aggParams: undefined },
aggs,
metricColumns,
+ visType,
},
],
() => {},
@@ -186,7 +188,7 @@ describe('convertBucketToColumns', () => {
],
[
'filters column if bucket agg is valid filters agg',
- [{ dataView: stubLogstashDataView, agg: bucketAggs[0], aggs, metricColumns }],
+ [{ dataView: stubLogstashDataView, agg: bucketAggs[0], aggs, metricColumns, visType }],
() => {
mockConvertToFiltersColumn.mockReturnValue({
operationType: 'filters',
@@ -198,7 +200,7 @@ describe('convertBucketToColumns', () => {
],
[
'date histogram column if bucket agg is valid date histogram agg',
- [{ dataView: stubLogstashDataView, agg: bucketAggs[1], aggs, metricColumns }],
+ [{ dataView: stubLogstashDataView, agg: bucketAggs[1], aggs, metricColumns, visType }],
() => {
mockConvertToDateHistogramColumn.mockReturnValue({
operationType: 'date_histogram',
@@ -210,7 +212,7 @@ describe('convertBucketToColumns', () => {
],
[
'date histogram column if bucket agg is valid terms agg with date field',
- [{ dataView: stubLogstashDataView, agg: bucketAggs[3], aggs, metricColumns }],
+ [{ dataView: stubLogstashDataView, agg: bucketAggs[3], aggs, metricColumns, visType }],
() => {
mockConvertToDateHistogramColumn.mockReturnValue({
operationType: 'date_histogram',
@@ -222,7 +224,7 @@ describe('convertBucketToColumns', () => {
],
[
'terms column if bucket agg is valid terms agg with no date field',
- [{ dataView: stubLogstashDataView, agg: bucketAggs[2], aggs, metricColumns }],
+ [{ dataView: stubLogstashDataView, agg: bucketAggs[2], aggs, metricColumns, visType }],
() => {
mockConvertToTermsColumn.mockReturnValue({
operationType: 'terms',
@@ -234,7 +236,7 @@ describe('convertBucketToColumns', () => {
],
[
'range column if bucket agg is valid histogram agg',
- [{ dataView: stubLogstashDataView, agg: bucketAggs[4], aggs, metricColumns }],
+ [{ dataView: stubLogstashDataView, agg: bucketAggs[4], aggs, metricColumns, visType }],
() => {
mockConvertToRangeColumn.mockReturnValue({
operationType: 'range',
@@ -246,7 +248,7 @@ describe('convertBucketToColumns', () => {
],
[
'range column if bucket agg is valid range agg',
- [{ dataView: stubLogstashDataView, agg: bucketAggs[5], aggs, metricColumns }],
+ [{ dataView: stubLogstashDataView, agg: bucketAggs[5], aggs, metricColumns, visType }],
() => {
mockConvertToRangeColumn.mockReturnValue({
operationType: 'range',
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/buckets/index.ts b/src/plugins/visualizations/common/convert_to_lens/lib/buckets/index.ts
index 0f929189f3369..db02b1e09fdce 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/buckets/index.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/buckets/index.ts
@@ -9,9 +9,8 @@
import { BUCKET_TYPES, IAggConfig, METRIC_TYPES } from '@kbn/data-plugin/common';
import type { DataView } from '@kbn/data-views-plugin/common';
import { convertToSchemaConfig } from '../../../vis_schemas';
-import { SchemaConfig } from '../../..';
+import { AggBasedColumn, SchemaConfig } from '../../..';
import {
- AggBasedColumn,
CommonBucketConverterArgs,
convertToDateHistogramColumn,
convertToFiltersColumn,
@@ -26,6 +25,7 @@ export type BucketAggs =
| BUCKET_TYPES.FILTERS
| BUCKET_TYPES.RANGE
| BUCKET_TYPES.HISTOGRAM;
+
const SUPPORTED_BUCKETS: string[] = [
BUCKET_TYPES.TERMS,
BUCKET_TYPES.DATE_HISTOGRAM,
@@ -39,7 +39,7 @@ const isSupportedBucketAgg = (agg: SchemaConfig): agg is SchemaConfig,
+ { agg, dataView, metricColumns, aggs, visType }: CommonBucketConverterArgs,
{
label,
isSplit = false,
@@ -76,7 +76,7 @@ export const getBucketColumns = (
if (field.type !== 'date') {
return convertToTermsColumn(
agg.aggId ?? '',
- { agg, dataView, metricColumns, aggs },
+ { agg, dataView, metricColumns, aggs, visType },
label,
isSplit
);
@@ -102,7 +102,9 @@ export const convertBucketToColumns = (
dataView,
metricColumns,
aggs,
+ visType,
}: {
+ visType: string;
agg: SchemaConfig | IAggConfig;
dataView: DataView;
metricColumns: AggBasedColumn[];
@@ -116,7 +118,7 @@ export const convertBucketToColumns = (
return null;
}
return getBucketColumns(
- { agg: currentAgg, dataView, metricColumns, aggs },
+ { agg: currentAgg, dataView, metricColumns, aggs, visType },
{
label: getLabel(currentAgg),
isSplit,
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/configurations/index.ts b/src/plugins/visualizations/common/convert_to_lens/lib/configurations/index.ts
index c4592f50836c5..b4934d0bb0c85 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/configurations/index.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/configurations/index.ts
@@ -6,5 +6,5 @@
* Side Public License, v 1.
*/
-export { getPalette } from './palette';
+export { getPalette, getPaletteFromStopsWithColors } from './palette';
export { getPercentageModeConfig } from './percentage_mode';
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/configurations/palette.ts b/src/plugins/visualizations/common/convert_to_lens/lib/configurations/palette.ts
index a89177c914996..3f81291fab201 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/configurations/palette.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/configurations/palette.ts
@@ -74,6 +74,21 @@ const convertToPercentColorStops = (
return { ...colorStops, stop };
};
+export const getPaletteFromStopsWithColors = (
+ config: PaletteConfig,
+ percentageModeConfig: PercentageModeConfig,
+ isPercentPaletteSupported: boolean = false
+) => {
+ const percentStopsWithColors = percentageModeConfig.isPercentageMode
+ ? convertToPercentColorStops(config, percentageModeConfig, isPercentPaletteSupported)
+ : config;
+
+ return buildCustomPalette(
+ buildPaletteParams(percentStopsWithColors),
+ isPercentPaletteSupported && percentageModeConfig.isPercentageMode
+ );
+};
+
export const getPalette = (
params: PaletteParams,
percentageModeConfig: PercentageModeConfig,
@@ -86,12 +101,10 @@ export const getPalette = (
}
const stopsWithColors = getStopsWithColorsFromRanges(colorsRange, colorSchema, invertColors);
- const percentStopsWithColors = percentageModeConfig.isPercentageMode
- ? convertToPercentColorStops(stopsWithColors, percentageModeConfig, isPercentPaletteSupported)
- : stopsWithColors;
- return buildCustomPalette(
- buildPaletteParams(percentStopsWithColors),
- isPercentPaletteSupported && percentageModeConfig.isPercentageMode
+ return getPaletteFromStopsWithColors(
+ stopsWithColors,
+ percentageModeConfig,
+ isPercentPaletteSupported
);
};
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/formula.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/formula.ts
index 0ad2a4072e19d..e79be2ba51516 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/formula.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/formula.ts
@@ -21,6 +21,7 @@ export const createFormulaColumn = (formula: string, agg: SchemaConfig): Formula
operationType: 'formula',
...createColumn(agg),
references: [],
+ dataType: 'number',
params: { ...params, ...getFormat() },
timeShift: agg.aggParams?.timeShift,
meta: { aggId: createAggregationId(agg) },
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/last_value.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/last_value.test.ts
index 55ba1e8b5e09d..c46055ca6a9ab 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/last_value.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/last_value.test.ts
@@ -22,6 +22,7 @@ jest.mock('../utils', () => ({
}));
describe('convertToLastValueColumn', () => {
+ const visType = 'heatmap';
const dataView = stubLogstashDataView;
const sortField = dataView.fields[0];
@@ -59,7 +60,13 @@ describe('convertToLastValueColumn', () => {
test.each<[string, Parameters, Partial | null]>([
[
'null if top hits size is more than 1',
- [{ agg: { ...topHitAgg, aggParams: { ...topHitAgg.aggParams!, size: 2 } }, dataView }],
+ [
+ {
+ agg: { ...topHitAgg, aggParams: { ...topHitAgg.aggParams!, size: 2 } },
+ dataView,
+ visType,
+ },
+ ],
null,
],
[
@@ -74,6 +81,7 @@ describe('convertToLastValueColumn', () => {
},
},
dataView,
+ visType,
},
],
null,
@@ -88,7 +96,7 @@ describe('convertToLastValueColumn', () => {
test('should skip if top hit field is not specified', () => {
mockGetFieldNameFromField.mockReturnValue(null);
- expect(convertToLastValueColumn({ agg: topHitAgg, dataView })).toBeNull();
+ expect(convertToLastValueColumn({ agg: topHitAgg, dataView, visType })).toBeNull();
expect(mockGetFieldNameFromField).toBeCalledTimes(1);
expect(dataView.getFieldByName).toBeCalledTimes(0);
});
@@ -97,14 +105,14 @@ describe('convertToLastValueColumn', () => {
mockGetFieldByName.mockReturnValue(null);
dataView.getFieldByName = mockGetFieldByName;
- expect(convertToLastValueColumn({ agg: topHitAgg, dataView })).toBeNull();
+ expect(convertToLastValueColumn({ agg: topHitAgg, dataView, visType })).toBeNull();
expect(mockGetFieldNameFromField).toBeCalledTimes(1);
expect(dataView.getFieldByName).toBeCalledTimes(1);
expect(mockGetLabel).toBeCalledTimes(0);
});
test('should return top hit column if top hit field is not present in index pattern', () => {
- expect(convertToLastValueColumn({ agg: topHitAgg, dataView })).toEqual(
+ expect(convertToLastValueColumn({ agg: topHitAgg, dataView, visType })).toEqual(
expect.objectContaining({
dataType: 'number',
label: 'someLabel',
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/last_value.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/last_value.ts
index 3162cf14e71c3..9525f4b41b7eb 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/last_value.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/last_value.ts
@@ -25,7 +25,11 @@ const convertToLastValueParams = (
};
export const convertToLastValueColumn = (
- { agg, dataView }: CommonColumnConverterArgs,
+ {
+ visType,
+ agg,
+ dataView,
+ }: CommonColumnConverterArgs,
reducedTimeRange?: string
): LastValueColumn | null => {
const { aggParams } = agg;
@@ -43,7 +47,7 @@ export const convertToLastValueColumn = (
}
const field = dataView.getFieldByName(fieldName);
- if (!isFieldValid(field, SUPPORTED_METRICS[agg.aggType])) {
+ if (!isFieldValid(visType, field, SUPPORTED_METRICS[agg.aggType])) {
return null;
}
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/metric.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/metric.test.ts
index 3be17abc46ac1..a0419d46df6b5 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/metric.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/metric.test.ts
@@ -16,6 +16,7 @@ const mockGetFieldByName = jest.fn();
describe('convertToLastValueColumn', () => {
const dataView = stubLogstashDataView;
+ const visType = 'heatmap';
const agg: SchemaConfig = {
accessor: 0,
@@ -42,6 +43,7 @@ describe('convertToLastValueColumn', () => {
convertMetricAggregationColumnWithoutSpecialParams(SUPPORTED_METRICS[METRIC_TYPES.TOP_HITS], {
agg,
dataView,
+ visType,
})
).toBeNull();
});
@@ -54,6 +56,7 @@ describe('convertToLastValueColumn', () => {
convertMetricAggregationColumnWithoutSpecialParams(SUPPORTED_METRICS[METRIC_TYPES.AVG], {
agg,
dataView,
+ visType,
})
).toBeNull();
expect(dataView.getFieldByName).toBeCalledTimes(1);
@@ -67,6 +70,7 @@ describe('convertToLastValueColumn', () => {
convertMetricAggregationColumnWithoutSpecialParams(SUPPORTED_METRICS[METRIC_TYPES.COUNT], {
agg,
dataView,
+ visType,
})
).toEqual(expect.objectContaining({ operationType: 'count' }));
expect(dataView.getFieldByName).toBeCalledTimes(1);
@@ -80,6 +84,7 @@ describe('convertToLastValueColumn', () => {
convertMetricAggregationColumnWithoutSpecialParams(SUPPORTED_METRICS[METRIC_TYPES.AVG], {
agg,
dataView,
+ visType,
})
).toEqual(
expect.objectContaining({
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/metric.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/metric.ts
index eb21b9f0fe91d..dd6c8b02687b0 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/metric.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/metric.ts
@@ -78,7 +78,7 @@ export const isMetricWithField = (
export const convertMetricAggregationColumnWithoutSpecialParams = (
aggregation: SupportedMetric,
- { agg, dataView }: CommonColumnConverterArgs,
+ { visType, agg, dataView }: CommonColumnConverterArgs,
reducedTimeRange?: string
): MetricAggregationColumnWithoutSpecialParams | null => {
if (!isSupportedAggregationWithoutParams(aggregation.name)) {
@@ -94,7 +94,7 @@ export const convertMetricAggregationColumnWithoutSpecialParams = (
}
const field = dataView.getFieldByName(sourceField);
- if (!isFieldValid(field, aggregation)) {
+ if (!isFieldValid(visType, field, aggregation)) {
return null;
}
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/parent_pipeline.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/parent_pipeline.test.ts
index c28324533c837..65dd1cf40aaef 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/parent_pipeline.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/parent_pipeline.test.ts
@@ -40,6 +40,7 @@ jest.mock('../metrics', () => ({
}));
describe('convertToOtherParentPipelineAggColumns', () => {
+ const visType = 'heatmap';
const field = stubLogstashDataView.fields[0].name;
const aggs: Array> = [
{
@@ -81,6 +82,7 @@ describe('convertToOtherParentPipelineAggColumns', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -95,6 +97,7 @@ describe('convertToOtherParentPipelineAggColumns', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -112,6 +115,7 @@ describe('convertToOtherParentPipelineAggColumns', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -129,6 +133,7 @@ describe('convertToOtherParentPipelineAggColumns', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -147,6 +152,7 @@ describe('convertToOtherParentPipelineAggColumns', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -170,6 +176,7 @@ describe('convertToOtherParentPipelineAggColumns', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -188,6 +195,7 @@ describe('convertToOtherParentPipelineAggColumns', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -229,6 +237,7 @@ describe('convertToOtherParentPipelineAggColumns', () => {
});
describe('convertToCumulativeSumAggColumn', () => {
+ const visType = 'heatmap';
const field = stubLogstashDataView.fields[0].name;
const aggs: Array> = [
{
@@ -280,6 +289,7 @@ describe('convertToCumulativeSumAggColumn', () => {
dataView: stubLogstashDataView,
aggs,
agg: { ...aggs[1], aggParams: undefined } as SchemaConfig,
+ visType,
},
],
() => {
@@ -294,6 +304,7 @@ describe('convertToCumulativeSumAggColumn', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -308,6 +319,7 @@ describe('convertToCumulativeSumAggColumn', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -325,6 +337,7 @@ describe('convertToCumulativeSumAggColumn', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -342,6 +355,7 @@ describe('convertToCumulativeSumAggColumn', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -360,6 +374,7 @@ describe('convertToCumulativeSumAggColumn', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -383,6 +398,7 @@ describe('convertToCumulativeSumAggColumn', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
@@ -401,6 +417,7 @@ describe('convertToCumulativeSumAggColumn', () => {
dataView: stubLogstashDataView,
aggs,
agg: aggs[1] as SchemaConfig,
+ visType,
},
],
() => {
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/parent_pipeline.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/parent_pipeline.ts
index ab41ceb259adb..0e0aef11316b2 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/parent_pipeline.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/parent_pipeline.ts
@@ -38,7 +38,7 @@ export const convertToMovingAverageParams = (
});
export const convertToOtherParentPipelineAggColumns = (
- { agg, dataView, aggs }: ExtendedColumnConverterArgs,
+ { agg, dataView, aggs, visType }: ExtendedColumnConverterArgs,
reducedTimeRange?: string
): FormulaColumn | [ParentPipelineAggColumn, AggBasedColumn] | null => {
const { aggType } = agg;
@@ -63,7 +63,7 @@ export const convertToOtherParentPipelineAggColumns = (
}
if (PIPELINE_AGGS.includes(metric.aggType)) {
- const formula = getFormulaForPipelineAgg({ agg, aggs, dataView });
+ const formula = getFormulaForPipelineAgg({ agg, aggs, dataView, visType });
if (!formula) {
return null;
}
@@ -71,7 +71,7 @@ export const convertToOtherParentPipelineAggColumns = (
return createFormulaColumn(formula, agg);
}
- const subMetric = convertMetricToColumns(metric, dataView, aggs);
+ const subMetric = convertMetricToColumns({ agg: metric, dataView, aggs, visType });
if (subMetric === null) {
return null;
@@ -90,7 +90,7 @@ export const convertToOtherParentPipelineAggColumns = (
};
export const convertToCumulativeSumAggColumn = (
- { agg, dataView, aggs }: ExtendedColumnConverterArgs,
+ { agg, dataView, aggs, visType }: ExtendedColumnConverterArgs,
reducedTimeRange?: string
):
| FormulaColumn
@@ -119,7 +119,7 @@ export const convertToCumulativeSumAggColumn = (
// create column for sum or count
const subMetric = convertMetricAggregationColumnWithoutSpecialParams(
subAgg,
- { agg: metric as SchemaConfig, dataView },
+ { agg: metric as SchemaConfig, dataView, visType },
reducedTimeRange
);
@@ -144,7 +144,7 @@ export const convertToCumulativeSumAggColumn = (
subMetric,
];
} else {
- const formula = getFormulaForPipelineAgg({ agg, aggs, dataView });
+ const formula = getFormulaForPipelineAgg({ agg, aggs, dataView, visType });
if (!formula) {
return null;
}
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentage_mode.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentage_mode.test.ts
index 3b7e8ad7e797f..0ef5d07236d60 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentage_mode.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentage_mode.test.ts
@@ -18,6 +18,7 @@ jest.mock('../metrics/formula', () => ({
}));
describe('convertToColumnInPercentageMode', () => {
+ const visType = 'heatmap';
const formula = 'average(some_field)';
const dataView = stubLogstashDataView;
@@ -42,7 +43,7 @@ describe('convertToColumnInPercentageMode', () => {
test('should return null if it is not possible to build the valid formula', () => {
mockGetFormulaForAgg.mockReturnValue(null);
- expect(convertToColumnInPercentageMode({ agg, dataView, aggs: [agg] }, {})).toBeNull();
+ expect(convertToColumnInPercentageMode({ agg, dataView, aggs: [agg], visType }, {})).toBeNull();
});
test('should return percentage mode over range formula if min and max was passed', () => {
@@ -51,7 +52,7 @@ describe('convertToColumnInPercentageMode', () => {
params: { format: { id: 'percent' }, formula: `((${formula}) - 0) / (100 - 0)` },
};
expect(
- convertToColumnInPercentageMode({ agg, dataView, aggs: [agg] }, { min: 0, max: 100 })
+ convertToColumnInPercentageMode({ agg, dataView, aggs: [agg], visType }, { min: 0, max: 100 })
).toEqual(expect.objectContaining(formulaColumn));
});
@@ -60,7 +61,7 @@ describe('convertToColumnInPercentageMode', () => {
operationType: 'formula',
params: { format: { id: 'percent' }, formula: `(${formula}) / 10000` },
};
- expect(convertToColumnInPercentageMode({ agg, dataView, aggs: [agg] }, {})).toEqual(
+ expect(convertToColumnInPercentageMode({ agg, dataView, aggs: [agg], visType }, {})).toEqual(
expect.objectContaining(formulaColumn)
);
});
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile.test.ts
index b4cf7f141e928..adfab7f55d1c4 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile.test.ts
@@ -24,6 +24,7 @@ jest.mock('../utils', () => ({
}));
describe('convertToPercentileColumn', () => {
+ const visType = 'heatmap';
const dataView = stubLogstashDataView;
const field = dataView.fields[0].displayName;
const aggId = 'pr.10';
@@ -67,23 +68,27 @@ describe('convertToPercentileColumn', () => {
test.each<
[string, Parameters, Partial | null]
>([
- ['null if no percents', [{ agg: { ...agg, aggId: 'pr' }, dataView }], null],
+ ['null if no percents', [{ agg: { ...agg, aggId: 'pr' }, dataView, visType }], null],
[
'null if no value',
- [{ agg: { ...singlePercentileRankAgg, aggParams: undefined }, dataView }],
+ [{ agg: { ...singlePercentileRankAgg, aggParams: undefined }, dataView, visType }],
+ null,
+ ],
+ ['null if no aggId', [{ agg: { ...agg, aggId: undefined }, dataView, visType }], null],
+ ['null if no aggParams', [{ agg: { ...agg, aggParams: undefined }, dataView, visType }], null],
+ [
+ 'null if aggId is invalid',
+ [{ agg: { ...agg, aggId: 'pr.invalid' }, dataView, visType }],
null,
],
- ['null if no aggId', [{ agg: { ...agg, aggId: undefined }, dataView }], null],
- ['null if no aggParams', [{ agg: { ...agg, aggParams: undefined }, dataView }], null],
- ['null if aggId is invalid', [{ agg: { ...agg, aggId: 'pr.invalid' }, dataView }], null],
[
'null if values are undefined',
- [{ agg: { ...agg, aggParams: { percents: undefined, field } }, dataView }],
+ [{ agg: { ...agg, aggParams: { percents: undefined, field } }, dataView, visType }],
null,
],
[
'null if values are empty',
- [{ agg: { ...agg, aggParams: { percents: [], field } }, dataView }],
+ [{ agg: { ...agg, aggParams: { percents: [], field } }, dataView, visType }],
null,
],
])('should return %s', (_, input, expected) => {
@@ -96,7 +101,7 @@ describe('convertToPercentileColumn', () => {
test('should return null if field is not specified', () => {
mockGetFieldNameFromField.mockReturnValue(null);
- expect(convertToPercentileColumn({ agg, dataView })).toBeNull();
+ expect(convertToPercentileColumn({ agg, dataView, visType })).toBeNull();
expect(mockGetFieldNameFromField).toBeCalledTimes(1);
expect(dataView.getFieldByName).toBeCalledTimes(0);
});
@@ -105,13 +110,13 @@ describe('convertToPercentileColumn', () => {
mockGetFieldByName.mockReturnValueOnce(null);
dataView.getFieldByName = mockGetFieldByName;
- expect(convertToPercentileColumn({ agg, dataView })).toBeNull();
+ expect(convertToPercentileColumn({ agg, dataView, visType })).toBeNull();
expect(mockGetFieldNameFromField).toBeCalledTimes(1);
expect(dataView.getFieldByName).toBeCalledTimes(1);
});
test('should return percentile rank column for percentiles', () => {
- expect(convertToPercentileColumn({ agg, dataView })).toEqual(
+ expect(convertToPercentileColumn({ agg, dataView, visType })).toEqual(
expect.objectContaining({
dataType: 'number',
label: 'someOtherLabel',
@@ -126,7 +131,7 @@ describe('convertToPercentileColumn', () => {
});
test('should return percentile rank column for single percentile', () => {
- expect(convertToPercentileColumn({ agg: singlePercentileRankAgg, dataView })).toEqual(
+ expect(convertToPercentileColumn({ agg: singlePercentileRankAgg, dataView, visType })).toEqual(
expect.objectContaining({
dataType: 'number',
label: 'someOtherLabel',
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile.ts
index de9d4e088b636..9989db1c5dda7 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile.ts
@@ -51,6 +51,7 @@ const getPercent = (
export const convertToPercentileColumn = (
{
+ visType,
agg,
dataView,
}: CommonColumnConverterArgs,
@@ -74,7 +75,7 @@ export const convertToPercentileColumn = (
}
const field = dataView.getFieldByName(fieldName);
- if (!isFieldValid(field, SUPPORTED_METRICS[agg.aggType])) {
+ if (!isFieldValid(visType, field, SUPPORTED_METRICS[agg.aggType])) {
return null;
}
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile_rank.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile_rank.test.ts
index 8a696d51d871b..afeaa9899d107 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile_rank.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile_rank.test.ts
@@ -24,6 +24,7 @@ jest.mock('../utils', () => ({
}));
describe('convertToPercentileRankColumn', () => {
+ const visType = 'heatmap';
const dataView = stubLogstashDataView;
const field = dataView.fields[0].displayName;
const aggId = 'pr.10';
@@ -71,23 +72,27 @@ describe('convertToPercentileRankColumn', () => {
Partial | null
]
>([
- ['null if no percents', [{ agg: { ...agg, aggId: 'pr' }, dataView }], null],
+ ['null if no percents', [{ agg: { ...agg, aggId: 'pr' }, dataView, visType }], null],
[
'null if no value',
- [{ agg: { ...singlePercentileRankAgg, aggParams: undefined }, dataView }],
+ [{ agg: { ...singlePercentileRankAgg, aggParams: undefined }, dataView, visType }],
+ null,
+ ],
+ ['null if no aggId', [{ agg: { ...agg, aggId: undefined }, dataView, visType }], null],
+ ['null if no aggParams', [{ agg: { ...agg, aggParams: undefined }, dataView, visType }], null],
+ [
+ 'null if aggId is invalid',
+ [{ agg: { ...agg, aggId: 'pr.invalid' }, dataView, visType }],
null,
],
- ['null if no aggId', [{ agg: { ...agg, aggId: undefined }, dataView }], null],
- ['null if no aggParams', [{ agg: { ...agg, aggParams: undefined }, dataView }], null],
- ['null if aggId is invalid', [{ agg: { ...agg, aggId: 'pr.invalid' }, dataView }], null],
[
'null if values are undefined',
- [{ agg: { ...agg, aggParams: { values: undefined, field } }, dataView }],
+ [{ agg: { ...agg, aggParams: { values: undefined, field } }, dataView, visType }],
null,
],
[
'null if values are empty',
- [{ agg: { ...agg, aggParams: { values: [], field } }, dataView }],
+ [{ agg: { ...agg, aggParams: { values: [], field } }, dataView, visType }],
null,
],
])('should return %s', (_, input, expected) => {
@@ -100,7 +105,7 @@ describe('convertToPercentileRankColumn', () => {
test('should return null if field is not specified', () => {
mockGetFieldNameFromField.mockReturnValue(null);
- expect(convertToPercentileRankColumn({ agg, dataView })).toBeNull();
+ expect(convertToPercentileRankColumn({ agg, dataView, visType })).toBeNull();
expect(mockGetFieldNameFromField).toBeCalledTimes(1);
expect(dataView.getFieldByName).toBeCalledTimes(0);
});
@@ -109,13 +114,13 @@ describe('convertToPercentileRankColumn', () => {
mockGetFieldByName.mockReturnValueOnce(null);
dataView.getFieldByName = mockGetFieldByName;
- expect(convertToPercentileRankColumn({ agg, dataView })).toBeNull();
+ expect(convertToPercentileRankColumn({ agg, dataView, visType })).toBeNull();
expect(mockGetFieldNameFromField).toBeCalledTimes(1);
expect(dataView.getFieldByName).toBeCalledTimes(1);
});
test('should return percentile rank column for percentile ranks', () => {
- expect(convertToPercentileRankColumn({ agg, dataView })).toEqual(
+ expect(convertToPercentileRankColumn({ agg, dataView, visType })).toEqual(
expect.objectContaining({
dataType: 'number',
label: 'someOtherLabel',
@@ -130,7 +135,9 @@ describe('convertToPercentileRankColumn', () => {
});
test('should return percentile rank column for single percentile rank', () => {
- expect(convertToPercentileRankColumn({ agg: singlePercentileRankAgg, dataView })).toEqual(
+ expect(
+ convertToPercentileRankColumn({ agg: singlePercentileRankAgg, dataView, visType })
+ ).toEqual(
expect.objectContaining({
dataType: 'number',
label: 'someOtherLabel',
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile_rank.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile_rank.ts
index 5124a26543552..8fb55789dd6a7 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile_rank.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/percentile_rank.ts
@@ -50,6 +50,7 @@ const getPercent = (
export const convertToPercentileRankColumn = (
{
+ visType,
agg,
dataView,
}: CommonColumnConverterArgs,
@@ -69,7 +70,7 @@ export const convertToPercentileRankColumn = (
}
const field = dataView.getFieldByName(fieldName);
- if (!isFieldValid(field, SUPPORTED_METRICS[agg.aggType])) {
+ if (!isFieldValid(visType, field, SUPPORTED_METRICS[agg.aggType])) {
return null;
}
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/range.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/range.test.ts
index 8f535c28c8264..5a754fd1c9466 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/range.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/range.test.ts
@@ -60,7 +60,6 @@ describe('convertToRangeColumn', () => {
params: {
type: RANGE_MODES.Histogram,
maxBars: 'auto',
- ranges: [],
},
},
],
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/range.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/range.ts
index 6a9f96fd5ad1e..98200c321935c 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/range.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/range.ts
@@ -27,18 +27,17 @@ export const convertToRangeParams = (
return {
type: RANGE_MODES.Histogram,
maxBars: aggParams.maxBars ?? 'auto',
- ranges: [],
+ includeEmptyRows: aggParams.min_doc_count,
};
} else {
return {
type: RANGE_MODES.Range,
maxBars: 'auto',
- ranges:
- aggParams.ranges?.map((range) => ({
- label: range.label,
- from: range.from ?? null,
- to: range.to ?? null,
- })) ?? [],
+ ranges: aggParams.ranges?.map((range) => ({
+ label: range.label,
+ from: range.from ?? null,
+ to: range.to ?? null,
+ })),
};
}
};
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/sibling_pipeline.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/sibling_pipeline.test.ts
index 759620650b8a6..6adde7004b69a 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/sibling_pipeline.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/sibling_pipeline.test.ts
@@ -23,6 +23,7 @@ jest.mock('../../../vis_schemas', () => ({
}));
describe('convertToSiblingPipelineColumns', () => {
+ const visType = 'heatmap';
const dataView = stubLogstashDataView;
const aggId = 'agg-id-1';
const agg: SchemaConfig = {
@@ -46,7 +47,12 @@ describe('convertToSiblingPipelineColumns', () => {
test('should return null if aggParams are not defined', () => {
expect(
- convertToSiblingPipelineColumns({ agg: { ...agg, aggParams: undefined }, aggs: [], dataView })
+ convertToSiblingPipelineColumns({
+ agg: { ...agg, aggParams: undefined },
+ aggs: [],
+ dataView,
+ visType,
+ })
).toBeNull();
expect(mockConvertMetricToColumns).toBeCalledTimes(0);
});
@@ -57,6 +63,7 @@ describe('convertToSiblingPipelineColumns', () => {
agg: { ...agg, aggParams: { customMetric: undefined } },
aggs: [],
dataView,
+ visType,
})
).toBeNull();
expect(mockConvertMetricToColumns).toBeCalledTimes(0);
@@ -64,7 +71,7 @@ describe('convertToSiblingPipelineColumns', () => {
test('should return null if sibling agg is not supported', () => {
mockConvertMetricToColumns.mockReturnValue(null);
- expect(convertToSiblingPipelineColumns({ agg, aggs: [], dataView })).toBeNull();
+ expect(convertToSiblingPipelineColumns({ agg, aggs: [], dataView, visType })).toBeNull();
expect(mockConvertToSchemaConfig).toBeCalledTimes(1);
expect(mockConvertMetricToColumns).toBeCalledTimes(1);
});
@@ -72,7 +79,7 @@ describe('convertToSiblingPipelineColumns', () => {
test('should return column', () => {
const column = { operationType: 'formula' };
mockConvertMetricToColumns.mockReturnValue([column]);
- expect(convertToSiblingPipelineColumns({ agg, aggs: [], dataView })).toEqual(column);
+ expect(convertToSiblingPipelineColumns({ agg, aggs: [], dataView, visType })).toEqual(column);
expect(mockConvertToSchemaConfig).toBeCalledTimes(1);
expect(mockConvertMetricToColumns).toBeCalledTimes(1);
});
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/sibling_pipeline.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/sibling_pipeline.ts
index a8389cb8601e4..c77500a55d5d1 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/sibling_pipeline.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/sibling_pipeline.ts
@@ -22,11 +22,12 @@ export const convertToSiblingPipelineColumns = (
return null;
}
- const customMetricColumn = convertMetricToColumns(
- { ...convertToSchemaConfig(aggParams.customMetric), label, aggId },
- columnConverterArgs.dataView,
- columnConverterArgs.aggs
- );
+ const customMetricColumn = convertMetricToColumns({
+ agg: { ...convertToSchemaConfig(aggParams.customMetric), label, aggId },
+ dataView: columnConverterArgs.dataView,
+ aggs: columnConverterArgs.aggs,
+ visType: columnConverterArgs.visType,
+ });
if (!customMetricColumn) {
return null;
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/std_deviation.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/std_deviation.test.ts
index cbb1f03a6dc2e..c786d6b8c3a6f 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/std_deviation.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/std_deviation.test.ts
@@ -22,6 +22,7 @@ jest.mock('../utils', () => ({
}));
describe('convertToStdDeviationFormulaColumns', () => {
+ const visType = 'heatmap';
const dataView = stubLogstashDataView;
const stdLowerAggId = 'agg-id.std_lower';
const stdUpperAggId = 'agg-id.std_upper';
@@ -51,22 +52,25 @@ describe('convertToStdDeviationFormulaColumns', () => {
test.each<
[string, Parameters, Partial | null]
- >([['null if no aggId is passed', [{ agg: { ...agg, aggId: undefined }, dataView }], null]])(
- 'should return %s',
- (_, input, expected) => {
- if (expected === null) {
- expect(convertToStdDeviationFormulaColumns(...input)).toBeNull();
- } else {
- expect(convertToStdDeviationFormulaColumns(...input)).toEqual(
- expect.objectContaining(expected)
- );
- }
+ >([
+ [
+ 'null if no aggId is passed',
+ [{ agg: { ...agg, aggId: undefined }, dataView, visType }],
+ null,
+ ],
+ ])('should return %s', (_, input, expected) => {
+ if (expected === null) {
+ expect(convertToStdDeviationFormulaColumns(...input)).toBeNull();
+ } else {
+ expect(convertToStdDeviationFormulaColumns(...input)).toEqual(
+ expect.objectContaining(expected)
+ );
}
- );
+ });
test('should return null if field is not present', () => {
mockGetFieldNameFromField.mockReturnValue(null);
- expect(convertToStdDeviationFormulaColumns({ agg, dataView })).toBeNull();
+ expect(convertToStdDeviationFormulaColumns({ agg, dataView, visType })).toBeNull();
expect(mockGetFieldNameFromField).toBeCalledTimes(1);
expect(dataView.getFieldByName).toBeCalledTimes(0);
});
@@ -74,14 +78,14 @@ describe('convertToStdDeviationFormulaColumns', () => {
test("should return null if field doesn't exist in dataView", () => {
mockGetFieldByName.mockReturnValue(null);
dataView.getFieldByName = mockGetFieldByName;
- expect(convertToStdDeviationFormulaColumns({ agg, dataView })).toBeNull();
+ expect(convertToStdDeviationFormulaColumns({ agg, dataView, visType })).toBeNull();
expect(mockGetFieldNameFromField).toBeCalledTimes(1);
expect(dataView.getFieldByName).toBeCalledTimes(1);
});
test('should return null if agg id is invalid', () => {
expect(
- convertToStdDeviationFormulaColumns({ agg: { ...agg, aggId: 'some-id' }, dataView })
+ convertToStdDeviationFormulaColumns({ agg: { ...agg, aggId: 'some-id' }, dataView, visType })
).toBeNull();
expect(mockGetFieldNameFromField).toBeCalledTimes(1);
expect(dataView.getFieldByName).toBeCalledTimes(1);
@@ -89,7 +93,11 @@ describe('convertToStdDeviationFormulaColumns', () => {
test('should return formula column for lower std deviation', () => {
expect(
- convertToStdDeviationFormulaColumns({ agg: { ...agg, aggId: stdLowerAggId }, dataView })
+ convertToStdDeviationFormulaColumns({
+ agg: { ...agg, aggId: stdLowerAggId },
+ dataView,
+ visType,
+ })
).toEqual(
expect.objectContaining({
label,
@@ -102,7 +110,11 @@ describe('convertToStdDeviationFormulaColumns', () => {
test('should return formula column for upper std deviation', () => {
expect(
- convertToStdDeviationFormulaColumns({ agg: { ...agg, aggId: stdUpperAggId }, dataView })
+ convertToStdDeviationFormulaColumns({
+ agg: { ...agg, aggId: stdUpperAggId },
+ dataView,
+ visType,
+ })
).toEqual(
expect.objectContaining({
label,
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/std_deviation.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/std_deviation.ts
index f2c218d429bdf..fe4e854759d8f 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/std_deviation.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/std_deviation.ts
@@ -50,7 +50,7 @@ export const getStdDeviationFormula = (
};
export const convertToStdDeviationFormulaColumns = (
- { agg, dataView }: CommonColumnConverterArgs,
+ { visType, agg, dataView }: CommonColumnConverterArgs,
reducedTimeRange?: string
) => {
const { aggId } = agg;
@@ -64,7 +64,7 @@ export const convertToStdDeviationFormulaColumns = (
return null;
}
const field = dataView.getFieldByName(fieldName);
- if (!isFieldValid(field, SUPPORTED_METRICS[agg.aggType])) {
+ if (!isFieldValid(visType, field, SUPPORTED_METRICS[agg.aggType])) {
return null;
}
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/supported_metrics.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/supported_metrics.ts
index 17a8ccf26c369..61f3f3961b6dc 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/supported_metrics.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/supported_metrics.ts
@@ -18,10 +18,12 @@ interface AggWithFormula {
formula: string;
}
+type SupportedDataTypes = { [key: string]: readonly string[] } & { default: readonly string[] };
+
export type AggOptions = {
isFullReference: boolean;
isFieldRequired: boolean;
- supportedDataTypes: readonly string[];
+ supportedDataTypes: SupportedDataTypes;
} & (T extends Exclude ? Agg : AggWithFormula);
// list of supported TSVB aggregation types in Lens
@@ -62,9 +64,9 @@ export type SupportedMetrics = LocalSupportedMetrics & {
[Key in UnsupportedSupportedMetrics]?: null;
};
-const supportedDataTypesWithDate = ['number', 'date', 'histogram'] as const;
-const supportedDataTypes = ['number', 'histogram'] as const;
-const extendedSupportedDataTypes = [
+const supportedDataTypesWithDate: readonly string[] = ['number', 'date', 'histogram'];
+const supportedDataTypes: readonly string[] = ['number', 'histogram'];
+const extendedSupportedDataTypes: readonly string[] = [
'string',
'boolean',
'number',
@@ -74,44 +76,44 @@ const extendedSupportedDataTypes = [
'date',
'date_range',
'murmur3',
-] as const;
+];
export const SUPPORTED_METRICS: SupportedMetrics = {
avg: {
name: 'average',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes: ['number'],
+ supportedDataTypes: { default: ['number'] },
},
cardinality: {
name: 'unique_count',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes: extendedSupportedDataTypes,
+ supportedDataTypes: { default: extendedSupportedDataTypes },
},
count: {
name: 'count',
isFullReference: false,
isFieldRequired: false,
- supportedDataTypes: [],
+ supportedDataTypes: { default: ['number'] },
},
moving_avg: {
name: 'moving_average',
isFullReference: true,
isFieldRequired: true,
- supportedDataTypes: ['number'],
+ supportedDataTypes: { default: ['number'] },
},
derivative: {
name: 'differences',
isFullReference: true,
isFieldRequired: true,
- supportedDataTypes: ['number'],
+ supportedDataTypes: { default: ['number'] },
},
cumulative_sum: {
name: 'cumulative_sum',
isFullReference: true,
isFieldRequired: true,
- supportedDataTypes: ['number'],
+ supportedDataTypes: { default: ['number'] },
},
avg_bucket: {
name: 'formula',
@@ -119,7 +121,7 @@ export const SUPPORTED_METRICS: SupportedMetrics = {
isFieldRequired: true,
isFormula: true,
formula: 'overall_average',
- supportedDataTypes: ['number'],
+ supportedDataTypes: { default: ['number'] },
},
max_bucket: {
name: 'formula',
@@ -127,7 +129,7 @@ export const SUPPORTED_METRICS: SupportedMetrics = {
isFieldRequired: true,
isFormula: true,
formula: 'overall_max',
- supportedDataTypes: ['number'],
+ supportedDataTypes: { default: ['number'] },
},
min_bucket: {
name: 'formula',
@@ -135,7 +137,7 @@ export const SUPPORTED_METRICS: SupportedMetrics = {
isFieldRequired: true,
isFormula: true,
formula: 'overall_min',
- supportedDataTypes: ['number'],
+ supportedDataTypes: { default: ['number'] },
},
sum_bucket: {
name: 'formula',
@@ -143,79 +145,91 @@ export const SUPPORTED_METRICS: SupportedMetrics = {
isFieldRequired: true,
isFormula: true,
formula: 'overall_sum',
- supportedDataTypes: ['number'],
+ supportedDataTypes: { default: ['number'] },
},
max: {
name: 'max',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes: supportedDataTypesWithDate,
+ supportedDataTypes: {
+ default: ['number'],
+ heatmap: ['number'],
+ line: ['number'],
+ area: ['number'],
+ histogram: ['number'],
+ },
},
min: {
name: 'min',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes: supportedDataTypesWithDate,
+ supportedDataTypes: {
+ default: supportedDataTypesWithDate,
+ heatmap: ['number'],
+ line: ['number'],
+ area: ['number'],
+ histogram: ['number'],
+ },
},
percentiles: {
name: 'percentile',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes,
+ supportedDataTypes: { default: supportedDataTypes },
},
single_percentile: {
name: 'percentile',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes,
+ supportedDataTypes: { default: supportedDataTypes },
},
percentile_ranks: {
name: 'percentile_rank',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes,
+ supportedDataTypes: { default: supportedDataTypes },
},
single_percentile_rank: {
name: 'percentile_rank',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes,
+ supportedDataTypes: { default: supportedDataTypes },
},
sum: {
name: 'sum',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes,
+ supportedDataTypes: { default: supportedDataTypes },
},
top_hits: {
name: 'last_value',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes: extendedSupportedDataTypes,
+ supportedDataTypes: { default: extendedSupportedDataTypes },
},
top_metrics: {
name: 'last_value',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes: extendedSupportedDataTypes,
+ supportedDataTypes: { default: extendedSupportedDataTypes },
},
value_count: {
name: 'count',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes: extendedSupportedDataTypes,
+ supportedDataTypes: { default: extendedSupportedDataTypes },
},
std_dev: {
name: 'standard_deviation',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes,
+ supportedDataTypes: { default: supportedDataTypes },
},
median: {
name: 'median',
isFullReference: false,
isFieldRequired: true,
- supportedDataTypes,
+ supportedDataTypes: { default: supportedDataTypes },
},
} as const;
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/terms.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/terms.test.ts
index d214ec74b09b1..516ad6b196095 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/terms.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/terms.test.ts
@@ -23,6 +23,7 @@ jest.mock('../../../vis_schemas', () => ({
}));
describe('convertToDateHistogramColumn', () => {
+ const visType = 'heatmap';
const aggId = `some-id`;
const aggParams: AggParamsTerms = {
field: stubLogstashDataView.fields[0].name,
@@ -79,6 +80,7 @@ describe('convertToDateHistogramColumn', () => {
dataView: stubLogstashDataView,
aggs,
metricColumns,
+ visType,
},
'',
false,
@@ -95,6 +97,7 @@ describe('convertToDateHistogramColumn', () => {
dataView: stubLogstashDataView,
aggs,
metricColumns,
+ visType,
},
'',
false,
@@ -107,6 +110,8 @@ describe('convertToDateHistogramColumn', () => {
size: 5,
include: [],
exclude: [],
+ includeIsRegex: false,
+ excludeIsRegex: false,
parentFormat: { id: 'terms' },
orderBy: { type: 'alphabetical' },
orderDirection: 'asc',
@@ -123,6 +128,7 @@ describe('convertToDateHistogramColumn', () => {
dataView: stubLogstashDataView,
aggs,
metricColumns,
+ visType,
},
'',
false,
@@ -135,6 +141,8 @@ describe('convertToDateHistogramColumn', () => {
size: 5,
include: [],
exclude: [],
+ includeIsRegex: false,
+ excludeIsRegex: false,
parentFormat: { id: 'terms' },
orderBy: { type: 'column', columnId: metricColumns[0].columnId },
orderAgg: metricColumns[0],
@@ -152,6 +160,7 @@ describe('convertToDateHistogramColumn', () => {
dataView: stubLogstashDataView,
aggs,
metricColumns,
+ visType,
},
'',
false,
@@ -170,6 +179,7 @@ describe('convertToDateHistogramColumn', () => {
dataView: stubLogstashDataView,
aggs,
metricColumns,
+ visType,
},
'',
false,
@@ -188,6 +198,7 @@ describe('convertToDateHistogramColumn', () => {
dataView: stubLogstashDataView,
aggs,
metricColumns,
+ visType,
},
'',
false,
@@ -208,6 +219,7 @@ describe('convertToDateHistogramColumn', () => {
dataView: stubLogstashDataView,
aggs,
metricColumns,
+ visType,
},
'',
false,
@@ -220,6 +232,8 @@ describe('convertToDateHistogramColumn', () => {
size: 5,
include: [],
exclude: [],
+ includeIsRegex: false,
+ excludeIsRegex: false,
parentFormat: { id: 'terms' },
orderBy: { type: 'custom' },
orderAgg: metricColumns[0],
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/terms.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/terms.ts
index 0a50390ec469e..a54a3857e20f6 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/terms.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/terms.ts
@@ -23,6 +23,7 @@ const getOrderByWithAgg = ({
agg,
dataView,
aggs,
+ visType,
metricColumns,
}: CommonBucketConverterArgs): OrderByWithAgg | null => {
if (!agg.aggParams) {
@@ -37,11 +38,12 @@ const getOrderByWithAgg = ({
if (!agg.aggParams.orderAgg) {
return null;
}
- const orderMetricColumn = convertMetricToColumns(
- convertToSchemaConfig(agg.aggParams.orderAgg),
+ const orderMetricColumn = convertMetricToColumns({
+ agg: convertToSchemaConfig(agg.aggParams.orderAgg),
dataView,
- aggs
- );
+ aggs,
+ visType,
+ });
if (!orderMetricColumn) {
return null;
}
@@ -68,35 +70,43 @@ const getOrderByWithAgg = ({
};
};
+const filterOutEmptyValues = (values: string | Array): number[] | string[] => {
+ if (typeof values === 'string') {
+ return Boolean(values) ? [values] : [];
+ }
+
+ return values.filter((v): v is string | number => {
+ if (typeof v === 'string') {
+ return Boolean(v);
+ }
+ return true;
+ }) as string[] | number[];
+};
+
export const convertToTermsParams = ({
agg,
dataView,
aggs,
metricColumns,
+ visType,
}: CommonBucketConverterArgs): TermsParams | null => {
if (!agg.aggParams) {
return null;
}
- const orderByWithAgg = getOrderByWithAgg({ agg, dataView, aggs, metricColumns });
+ const orderByWithAgg = getOrderByWithAgg({ agg, dataView, aggs, metricColumns, visType });
if (orderByWithAgg === null) {
return null;
}
+ const exclude = agg.aggParams.exclude ? filterOutEmptyValues(agg.aggParams.exclude) : [];
+ const include = agg.aggParams.include ? filterOutEmptyValues(agg.aggParams.include) : [];
return {
size: agg.aggParams.size ?? 10,
- include: agg.aggParams.include
- ? Array.isArray(agg.aggParams.include)
- ? agg.aggParams.include
- : [agg.aggParams.include]
- : [],
- includeIsRegex: agg.aggParams.includeIsRegex,
- exclude: agg.aggParams.exclude
- ? Array.isArray(agg.aggParams.exclude)
- ? agg.aggParams.exclude
- : [agg.aggParams.exclude]
- : [],
- excludeIsRegex: agg.aggParams.excludeIsRegex,
+ include,
+ exclude,
+ includeIsRegex: Boolean(include.length && agg.aggParams.includeIsRegex),
+ excludeIsRegex: Boolean(exclude.length && agg.aggParams.excludeIsRegex),
otherBucket: agg.aggParams.otherBucket,
orderDirection: agg.aggParams.order?.value ?? 'desc',
parentFormat: { id: 'terms' },
@@ -107,7 +117,7 @@ export const convertToTermsParams = ({
export const convertToTermsColumn = (
aggId: string,
- { agg, dataView, aggs, metricColumns }: CommonBucketConverterArgs,
+ { agg, dataView, aggs, metricColumns, visType }: CommonBucketConverterArgs,
label: string,
isSplit: boolean
): TermsColumn | null => {
@@ -121,7 +131,7 @@ export const convertToTermsColumn = (
return null;
}
- const params = convertToTermsParams({ agg, dataView, aggs, metricColumns });
+ const params = convertToTermsParams({ agg, dataView, aggs, metricColumns, visType });
if (!params) {
return null;
}
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/convert/types.ts b/src/plugins/visualizations/common/convert_to_lens/lib/convert/types.ts
index 8e6f9ec9443bb..97ccba39303fc 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/convert/types.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/convert/types.ts
@@ -64,6 +64,7 @@ export interface CommonColumnConverterArgs<
> {
agg: SchemaConfig;
dataView: DataView;
+ visType: string;
}
export interface ExtendedColumnConverterArgs<
@@ -75,6 +76,7 @@ export interface ExtendedColumnConverterArgs<
export interface CommonBucketConverterArgs<
Agg extends SupportedAggregation = SupportedAggregation
> {
+ visType: string;
agg: SchemaConfig;
dataView: DataView;
metricColumns: AggBasedColumn[];
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/metrics/formula.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/metrics/formula.test.ts
index 95e128e22b092..72cd07ba03f7c 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/metrics/formula.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/metrics/formula.test.ts
@@ -29,7 +29,7 @@ jest.mock('../utils', () => ({
}));
const dataView = stubLogstashDataView;
-
+const visType = 'heatmap';
const field = stubLogstashDataView.fields[0].name;
const aggs: Array> = [
{
@@ -97,7 +97,7 @@ describe('getFormulaForPipelineAgg', () => {
test.each<[string, Parameters, () => void, string | null]>([
[
'null if custom metric is invalid',
- [{ agg: aggs[0] as SchemaConfig, aggs, dataView }],
+ [{ agg: aggs[0] as SchemaConfig, aggs, dataView, visType }],
() => {
mockGetMetricFromParentPipelineAgg.mockReturnValue(null);
},
@@ -105,7 +105,7 @@ describe('getFormulaForPipelineAgg', () => {
],
[
'null if custom metric type is not supported',
- [{ agg: aggs[0] as SchemaConfig, aggs, dataView }],
+ [{ agg: aggs[0] as SchemaConfig, aggs, dataView, visType }],
() => {
mockGetMetricFromParentPipelineAgg.mockReturnValue({
aggType: METRIC_TYPES.GEO_BOUNDS,
@@ -115,7 +115,7 @@ describe('getFormulaForPipelineAgg', () => {
],
[
'correct formula if agg is parent pipeline agg and custom metric is valid and supported pipeline agg',
- [{ agg: aggs[0] as SchemaConfig, aggs, dataView }],
+ [{ agg: aggs[0] as SchemaConfig, aggs, dataView, visType }],
() => {
mockGetMetricFromParentPipelineAgg
.mockReturnValueOnce({
@@ -135,7 +135,7 @@ describe('getFormulaForPipelineAgg', () => {
],
[
'correct formula if agg is parent pipeline agg and custom metric is valid and supported not pipeline agg',
- [{ agg: aggs[0] as SchemaConfig, aggs, dataView }],
+ [{ agg: aggs[0] as SchemaConfig, aggs, dataView, visType }],
() => {
mockGetMetricFromParentPipelineAgg.mockReturnValueOnce({
aggType: METRIC_TYPES.AVG,
@@ -149,7 +149,7 @@ describe('getFormulaForPipelineAgg', () => {
],
[
'correct formula if agg is parent pipeline agg and custom metric is valid and supported percentile rank agg',
- [{ agg: aggs[0] as SchemaConfig, aggs, dataView }],
+ [{ agg: aggs[0] as SchemaConfig, aggs, dataView, visType }],
() => {
mockGetMetricFromParentPipelineAgg.mockReturnValueOnce({
aggType: METRIC_TYPES.PERCENTILE_RANKS,
@@ -163,7 +163,7 @@ describe('getFormulaForPipelineAgg', () => {
],
[
'correct formula if agg is sibling pipeline agg and custom metric is valid and supported agg',
- [{ agg: aggs[1] as SchemaConfig, aggs, dataView }],
+ [{ agg: aggs[1] as SchemaConfig, aggs, dataView, visType }],
() => {
mockGetMetricFromParentPipelineAgg.mockReturnValueOnce({
aggType: METRIC_TYPES.AVG,
@@ -212,6 +212,7 @@ describe('getFormulaForPipelineAgg', () => {
agg: aggs[1] as SchemaConfig,
aggs,
dataView,
+ visType,
});
expect(agg).toBeNull();
});
@@ -244,6 +245,7 @@ describe('getFormulaForPipelineAgg', () => {
agg: aggs[1] as SchemaConfig,
aggs,
dataView,
+ visType,
});
expect(agg).toBeNull();
});
@@ -270,6 +272,7 @@ describe('getFormulaForAgg', () => {
agg: { ...aggs[0], aggType: METRIC_TYPES.GEO_BOUNDS, aggParams: { field } },
aggs,
dataView,
+ visType,
},
],
() => {},
@@ -277,7 +280,7 @@ describe('getFormulaForAgg', () => {
],
[
'correct pipeline formula if agg is valid pipeline agg',
- [{ agg: aggs[0], aggs, dataView }],
+ [{ agg: aggs[0], aggs, dataView, visType }],
() => {
mockIsPipeline.mockReturnValue(true);
mockGetMetricFromParentPipelineAgg.mockReturnValueOnce({
@@ -292,7 +295,7 @@ describe('getFormulaForAgg', () => {
],
[
'correct percentile formula if agg is valid percentile agg',
- [{ agg: aggs[2], aggs, dataView }],
+ [{ agg: aggs[2], aggs, dataView, visType }],
() => {
mockIsPercentileAgg.mockReturnValue(true);
},
@@ -300,7 +303,7 @@ describe('getFormulaForAgg', () => {
],
[
'correct percentile rank formula if agg is valid percentile rank agg',
- [{ agg: aggs[3], aggs, dataView }],
+ [{ agg: aggs[3], aggs, dataView, visType }],
() => {
mockIsPercentileRankAgg.mockReturnValue(true);
},
@@ -308,7 +311,7 @@ describe('getFormulaForAgg', () => {
],
[
'correct standart deviation formula if agg is valid standart deviation agg',
- [{ agg: aggs[4], aggs, dataView }],
+ [{ agg: aggs[4], aggs, dataView, visType }],
() => {
mockIsStdDevAgg.mockReturnValue(true);
},
@@ -316,7 +319,7 @@ describe('getFormulaForAgg', () => {
],
[
'correct metric formula if agg is valid other metric agg',
- [{ agg: aggs[5], aggs, dataView }],
+ [{ agg: aggs[5], aggs, dataView, visType }],
() => {},
'average(bytes)',
],
@@ -395,6 +398,7 @@ describe('getFormulaForAgg', () => {
>,
aggs,
dataView,
+ visType,
});
expect(result).toBeNull();
});
@@ -467,6 +471,7 @@ describe('getFormulaForAgg', () => {
>,
aggs,
dataView,
+ visType,
});
expect(result).toBeNull();
}
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/metrics/formula.ts b/src/plugins/visualizations/common/convert_to_lens/lib/metrics/formula.ts
index 276ac54e2fc3d..4492cd58ac230 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/metrics/formula.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/metrics/formula.ts
@@ -66,7 +66,7 @@ const isDataViewField = (field: string | DataViewField): field is DataViewField
return false;
};
-const isValidAgg = (agg: SchemaConfig, dataView: DataView) => {
+const isValidAgg = (visType: string, agg: SchemaConfig, dataView: DataView) => {
const aggregation = SUPPORTED_METRICS[agg.aggType];
if (!aggregation) {
return false;
@@ -77,7 +77,7 @@ const isValidAgg = (agg: SchemaConfig, dataView: DataView) => {
}
const sourceField = getFieldNameFromField(agg.aggParams?.field);
const field = dataView.getFieldByName(sourceField!);
- if (!isFieldValid(field, aggregation)) {
+ if (!isFieldValid(visType, field, aggregation)) {
return false;
}
}
@@ -86,13 +86,14 @@ const isValidAgg = (agg: SchemaConfig, dataView: DataView) => {
};
const getFormulaForAggsWithoutParams = (
+ visType: string,
agg: SchemaConfig,
dataView: DataView,
selector: string | undefined,
reducedTimeRange?: string
) => {
const op = SUPPORTED_METRICS[agg.aggType];
- if (!isValidAgg(agg, dataView) || !op) {
+ if (!isValidAgg(visType, agg, dataView) || !op) {
return null;
}
@@ -101,6 +102,7 @@ const getFormulaForAggsWithoutParams = (
};
const getFormulaForPercentileRanks = (
+ visType: string,
agg: SchemaConfig,
dataView: DataView,
selector: string | undefined,
@@ -108,7 +110,7 @@ const getFormulaForPercentileRanks = (
) => {
const value = Number(agg.aggId?.split('.')[1]);
const op = SUPPORTED_METRICS[agg.aggType];
- if (!isValidAgg(agg, dataView) || !op) {
+ if (!isValidAgg(visType, agg, dataView) || !op) {
return null;
}
@@ -117,6 +119,7 @@ const getFormulaForPercentileRanks = (
};
const getFormulaForPercentile = (
+ visType: string,
agg: SchemaConfig,
dataView: DataView,
selector: string,
@@ -124,7 +127,7 @@ const getFormulaForPercentile = (
) => {
const percentile = Number(agg.aggId?.split('.')[1]);
const op = SUPPORTED_METRICS[agg.aggType];
- if (!isValidAgg(agg, dataView) || !op) {
+ if (!isValidAgg(visType, agg, dataView) || !op) {
return null;
}
@@ -138,6 +141,7 @@ const getFormulaForSubMetric = ({
agg,
dataView,
aggs,
+ visType,
}: ExtendedColumnConverterArgs): string | null => {
const op = SUPPORTED_METRICS[agg.aggType];
if (!op) {
@@ -148,12 +152,13 @@ const getFormulaForSubMetric = ({
PARENT_PIPELINE_OPS.includes(op.name) ||
SIBLING_PIPELINE_AGGS.includes(agg.aggType as METRIC_TYPES)
) {
- return getFormulaForPipelineAgg({ agg: agg as PipelineAggs, aggs, dataView });
+ return getFormulaForPipelineAgg({ agg: agg as PipelineAggs, aggs, dataView, visType });
}
if (METRIC_OPS_WITHOUT_PARAMS.includes(op.name)) {
const metricAgg = agg as MetricAggsWithoutParams;
return getFormulaForAggsWithoutParams(
+ visType,
metricAgg,
dataView,
metricAgg.aggParams && 'field' in metricAgg.aggParams
@@ -168,6 +173,7 @@ const getFormulaForSubMetric = ({
const percentileRanksAgg = agg as SchemaConfig;
return getFormulaForPercentileRanks(
+ visType,
percentileRanksAgg,
dataView,
percentileRanksAgg.aggParams?.field
@@ -181,6 +187,7 @@ export const getFormulaForPipelineAgg = ({
agg,
dataView,
aggs,
+ visType,
}: ExtendedColumnConverterArgs<
| METRIC_TYPES.CUMULATIVE_SUM
| METRIC_TYPES.DERIVATIVE
@@ -205,6 +212,7 @@ export const getFormulaForPipelineAgg = ({
agg: metricAgg,
aggs,
dataView,
+ visType,
});
if (subFormula === null) {
return null;
@@ -222,13 +230,15 @@ export const getFormulaForAgg = ({
agg,
aggs,
dataView,
+ visType,
}: ExtendedColumnConverterArgs) => {
if (isPipeline(agg)) {
- return getFormulaForPipelineAgg({ agg, aggs, dataView });
+ return getFormulaForPipelineAgg({ agg, aggs, dataView, visType });
}
if (isPercentileAgg(agg)) {
return getFormulaForPercentile(
+ visType,
agg,
dataView,
getFieldNameFromField(agg.aggParams?.field) ?? ''
@@ -237,6 +247,7 @@ export const getFormulaForAgg = ({
if (isPercentileRankAgg(agg)) {
return getFormulaForPercentileRanks(
+ visType,
agg,
dataView,
getFieldNameFromField(agg.aggParams?.field) ?? ''
@@ -244,13 +255,14 @@ export const getFormulaForAgg = ({
}
if (isStdDevAgg(agg) && agg.aggId) {
- if (!isValidAgg(agg, dataView)) {
+ if (!isValidAgg(visType, agg, dataView)) {
return null;
}
return getStdDeviationFormula(agg.aggId, getFieldNameFromField(agg.aggParams?.field) ?? '');
}
return getFormulaForAggsWithoutParams(
+ visType,
agg,
dataView,
isMetricWithField(agg) ? getFieldNameFromField(agg.aggParams?.field) ?? '' : ''
diff --git a/src/plugins/visualizations/common/convert_to_lens/lib/metrics/metrics.test.ts b/src/plugins/visualizations/common/convert_to_lens/lib/metrics/metrics.test.ts
index 1cf3ff0b84064..c7674bf6603c0 100644
--- a/src/plugins/visualizations/common/convert_to_lens/lib/metrics/metrics.test.ts
+++ b/src/plugins/visualizations/common/convert_to_lens/lib/metrics/metrics.test.ts
@@ -9,6 +9,7 @@
import { METRIC_TYPES } from '@kbn/data-plugin/common';
import { stubLogstashDataView } from '@kbn/data-views-plugin/common/data_view.stub';
import { SchemaConfig } from '../../..';
+import { ExtendedColumnConverterArgs } from '../convert';
import { convertMetricToColumns } from './metrics';
const mockConvertMetricAggregationColumnWithoutSpecialParams = jest.fn();
@@ -37,6 +38,8 @@ jest.mock('../convert', () => ({
convertToColumnInPercentageMode: jest.fn(() => mockConvertToColumnInPercentageMode()),
}));
+const visType = 'heatmap';
+
describe('convertMetricToColumns invalid cases', () => {
const dataView = stubLogstashDataView;
@@ -55,13 +58,18 @@ describe('convertMetricToColumns invalid cases', () => {
mockConvertToCumulativeSumAggColumn.mockReturnValue(null);
});
+ const aggs: ExtendedColumnConverterArgs['aggs'] = [];
+
test.each<[string, Parameters, null, jest.Mock | undefined]>([
[
'null if agg is not supported',
[
- { aggType: METRIC_TYPES.GEO_BOUNDS } as unknown as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.GEO_BOUNDS } as unknown as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -70,9 +78,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg AVG is not valid',
[
- { aggType: METRIC_TYPES.AVG } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.AVG } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -81,9 +92,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg MIN is not valid',
[
- { aggType: METRIC_TYPES.MIN } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.MIN } as SchemaConfig,
+ dataView,
+ aggs: [],
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -92,9 +106,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg MAX is not valid',
[
- { aggType: METRIC_TYPES.MAX } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.MAX } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -103,9 +120,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg SUM is not valid',
[
- { aggType: METRIC_TYPES.SUM } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.SUM } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -114,9 +134,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg COUNT is not valid',
[
- { aggType: METRIC_TYPES.COUNT } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.COUNT } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -125,9 +148,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg CARDINALITY is not valid',
[
- { aggType: METRIC_TYPES.CARDINALITY } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.CARDINALITY } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -136,9 +162,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg VALUE_COUNT is not valid',
[
- { aggType: METRIC_TYPES.VALUE_COUNT } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.VALUE_COUNT } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -147,9 +176,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg MEDIAN is not valid',
[
- { aggType: METRIC_TYPES.MEDIAN } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.MEDIAN } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -158,9 +190,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg STD_DEV is not valid',
[
- { aggType: METRIC_TYPES.STD_DEV } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.STD_DEV } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -169,9 +204,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg PERCENTILES is not valid',
[
- { aggType: METRIC_TYPES.PERCENTILES } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.PERCENTILES } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -180,9 +218,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg SINGLE_PERCENTILE is not valid',
[
- { aggType: METRIC_TYPES.SINGLE_PERCENTILE } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.SINGLE_PERCENTILE } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -191,9 +232,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg PERCENTILE_RANKS is not valid',
[
- { aggType: METRIC_TYPES.PERCENTILE_RANKS } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.PERCENTILE_RANKS } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -202,9 +246,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg SINGLE_PERCENTILE_RANK is not valid',
[
- { aggType: METRIC_TYPES.SINGLE_PERCENTILE_RANK } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.SINGLE_PERCENTILE_RANK } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -213,9 +260,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg TOP_HITS is not valid',
[
- { aggType: METRIC_TYPES.TOP_HITS } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.TOP_HITS } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -224,9 +274,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg TOP_METRICS is not valid',
[
- { aggType: METRIC_TYPES.TOP_METRICS } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.TOP_METRICS } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -235,9 +288,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg CUMULATIVE_SUM is not valid',
[
- { aggType: METRIC_TYPES.CUMULATIVE_SUM } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.CUMULATIVE_SUM } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -246,9 +302,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg DERIVATIVE is not valid',
[
- { aggType: METRIC_TYPES.DERIVATIVE } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.DERIVATIVE } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -257,9 +316,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg MOVING_FN is not valid',
[
- { aggType: METRIC_TYPES.MOVING_FN } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.MOVING_FN } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -268,9 +330,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg SUM_BUCKET is not valid',
[
- { aggType: METRIC_TYPES.SUM_BUCKET } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.SUM_BUCKET } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -279,9 +344,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg MIN_BUCKET is not valid',
[
- { aggType: METRIC_TYPES.MIN_BUCKET } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.MIN_BUCKET } as SchemaConfig,
+ dataView,
+ aggs,
+ visType,
+ },
{ isPercentageMode: false },
],
null,
@@ -290,9 +358,12 @@ describe('convertMetricToColumns invalid cases', () => {
[
'null if supported agg MAX_BUCKET is not valid',
[
- { aggType: METRIC_TYPES.MAX_BUCKET } as SchemaConfig,
- dataView,
- [],
+ {
+ agg: { aggType: METRIC_TYPES.MAX_BUCKET } as SchemaConfig