From c68eab62986e68a0859995f18bb4e6264cdd1e2b Mon Sep 17 00:00:00 2001 From: Shahzad Date: Thu, 15 Apr 2021 11:55:57 +0200 Subject: [PATCH 01/68] [Exploratory view] Improve/Polish components usage (#96782) --- .../app/RumDashboard/ux_overview_fetchers.ts | 18 +-- .../plugins/apm/server/routes/rum_client.ts | 2 +- .../components/filter_label.test.tsx | 4 +- .../components/filter_label.tsx | 4 +- .../configurations/apm/field_formats.ts | 24 ++++ .../apm/service_latency_config.ts | 3 +- .../apm/service_throughput_config.ts | 3 +- .../configurations/constants/constants.ts | 12 +- .../configurations/lens_attributes.test.ts | 6 +- .../configurations/lens_attributes.ts | 74 ++++++----- .../configurations/rum/kpi_trends_config.ts | 5 + .../rum/performance_dist_config.ts | 5 + .../synthetics/monitor_duration_config.ts | 2 +- .../exploratory_view.test.tsx | 4 +- .../exploratory_view/exploratory_view.tsx | 12 +- .../hooks/use_app_index_pattern.tsx | 115 ++++++++++++++++++ .../hooks/use_default_index_pattern.tsx | 62 ---------- .../hooks/use_init_exploratory_view.ts | 47 ------- .../hooks/use_lens_attributes.ts | 4 +- .../hooks/use_url_storage.tsx | 2 +- .../shared/exploratory_view/index.tsx | 17 +-- .../shared/exploratory_view/rtl_helpers.tsx | 18 ++- .../series_builder/columns/chart_types.tsx | 3 +- .../columns/data_types_col.test.tsx | 13 +- .../series_builder/columns/data_types_col.tsx | 30 ++--- .../columns/date_picker_col.tsx | 20 +++ .../columns/operation_type_select.tsx | 5 +- .../columns/report_breakdowns.test.tsx | 4 +- .../columns/report_definition_col.test.tsx | 16 ++- .../columns/report_definition_col.tsx | 49 ++++++-- .../columns/report_types_col.test.tsx | 13 +- .../columns/report_types_col.tsx | 26 +++- .../series_builder/custom_report_field.tsx | 10 +- .../series_builder/series_builder.tsx | 82 +++++++++---- .../{actions_col.tsx => chart_options.tsx} | 2 +- .../series_editor/columns/filter_expanded.tsx | 41 ++++--- .../columns/filter_value_btn.tsx | 4 +- .../series_editor/columns/remove_series.tsx | 7 +- .../series_editor/columns/series_actions.tsx | 43 +++++++ .../series_editor/columns/series_filter.tsx | 12 +- .../series_editor/selected_filters.test.tsx | 4 +- .../series_editor/selected_filters.tsx | 8 +- .../series_editor/series_editor.tsx | 49 ++++---- .../shared/exploratory_view/types.ts | 4 +- .../observability_index_patterns.test.ts | 14 +-- .../utils/observability_index_patterns.ts | 43 ++++--- .../field_value_selection.stories.tsx | 3 +- .../field_value_selection.tsx | 40 +++--- .../shared/field_value_suggestions/index.tsx | 22 +--- .../shared/field_value_suggestions/types.ts | 37 ++++++ .../public/components/shared/index.tsx | 2 +- .../typings/fetch_overview_data/index.ts | 2 + .../plugins/observability/typings/common.ts | 2 + 53 files changed, 664 insertions(+), 389 deletions(-) create mode 100644 x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/field_formats.ts create mode 100644 x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx delete mode 100644 x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_default_index_pattern.tsx delete mode 100644 x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_init_exploratory_view.ts create mode 100644 x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/date_picker_col.tsx rename x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/{actions_col.tsx => chart_options.tsx} (95%) create mode 100644 x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/series_actions.tsx create mode 100644 x-pack/plugins/observability/public/components/shared/field_value_suggestions/types.ts diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/ux_overview_fetchers.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/ux_overview_fetchers.ts index ca2ad09cb4469..34dd2d53daf8e 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/ux_overview_fetchers.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/ux_overview_fetchers.ts @@ -38,18 +38,20 @@ export const fetchUxOverviewDate = async ({ }; }; -export async function hasRumData({ - absoluteTime, -}: HasDataParams): Promise { +export async function hasRumData( + params: HasDataParams +): Promise { return await callApmApi({ endpoint: 'GET /api/apm/observability_overview/has_rum_data', signal: null, params: { - query: { - start: new Date(absoluteTime.start).toISOString(), - end: new Date(absoluteTime.end).toISOString(), - uiFilters: '', - }, + query: params?.absoluteTime + ? { + start: new Date(params.absoluteTime.start).toISOString(), + end: new Date(params.absoluteTime.end).toISOString(), + uiFilters: '', + } + : undefined, }, }); } diff --git a/x-pack/plugins/apm/server/routes/rum_client.ts b/x-pack/plugins/apm/server/routes/rum_client.ts index d7f91adc0d683..c723f2c266ca9 100644 --- a/x-pack/plugins/apm/server/routes/rum_client.ts +++ b/x-pack/plugins/apm/server/routes/rum_client.ts @@ -263,7 +263,7 @@ const rumJSErrors = createApmServerRoute({ const rumHasDataRoute = createApmServerRoute({ endpoint: 'GET /api/apm/observability_overview/has_rum_data', - params: t.type({ + params: t.partial({ query: t.intersection([uiFiltersRt, rangeRt]), }), options: { tags: ['access:apm'] }, diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/components/filter_label.test.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/components/filter_label.test.tsx index 37597e0ce513f..c042ba9d0bcf8 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/components/filter_label.test.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/components/filter_label.test.tsx @@ -7,11 +7,13 @@ import React from 'react'; import { fireEvent, screen, waitFor } from '@testing-library/react'; -import { mockIndexPattern, render } from '../rtl_helpers'; +import { mockAppIndexPattern, mockIndexPattern, render } from '../rtl_helpers'; import { buildFilterLabel, FilterLabel } from './filter_label'; import * as useSeriesHook from '../hooks/use_series_filters'; describe('FilterLabel', function () { + mockAppIndexPattern(); + const invertFilter = jest.fn(); jest.spyOn(useSeriesHook, 'useSeriesFilters').mockReturnValue({ invertFilter, diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/components/filter_label.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/components/filter_label.tsx index 3d6dc5b3f2bf5..d67c93146b152 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/components/filter_label.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/components/filter_label.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { injectI18n } from '@kbn/i18n/react'; import { esFilters, Filter, IndexPattern } from '../../../../../../../../src/plugins/data/public'; -import { useIndexPatternContext } from '../hooks/use_default_index_pattern'; +import { useAppIndexPatternContext } from '../hooks/use_app_index_pattern'; import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; import { useSeriesFilters } from '../hooks/use_series_filters'; @@ -58,7 +58,7 @@ export function FilterLabel({ }: Props) { const FilterItem = injectI18n(esFilters.FilterItem); - const { indexPattern } = useIndexPatternContext(); + const { indexPattern } = useAppIndexPatternContext(); const filter = buildFilterLabel({ field, value, label, indexPattern, negate }); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/field_formats.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/field_formats.ts new file mode 100644 index 0000000000000..8d33dfbab2c62 --- /dev/null +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/field_formats.ts @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FieldFormat } from '../../types'; +import { TRANSACTION_DURATION } from '../constants/elasticsearch_fieldnames'; + +export const apmFieldFormats: FieldFormat[] = [ + { + field: TRANSACTION_DURATION, + format: { + id: 'duration', + params: { + inputFormat: 'microseconds', + outputFormat: 'asMilliseconds', + outputPrecision: 0, + showSuffix: true, + }, + }, + }, +]; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_latency_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_latency_config.ts index 7af3252584819..3959860b9c53c 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_latency_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_latency_config.ts @@ -8,6 +8,7 @@ import { ConfigProps, DataSeries } from '../../types'; import { FieldLabels } from '../constants'; import { buildPhraseFilter } from '../utils'; +import { TRANSACTION_DURATION } from '../constants/elasticsearch_fieldnames'; export function getServiceLatencyLensConfig({ seriesId, indexPattern }: ConfigProps): DataSeries { return { @@ -37,7 +38,7 @@ export function getServiceLatencyLensConfig({ seriesId, indexPattern }: ConfigPr 'user_agent.device.name', ], filters: buildPhraseFilter('transaction.type', 'request', indexPattern), - labels: { ...FieldLabels }, + labels: { ...FieldLabels, [TRANSACTION_DURATION]: 'Latency' }, reportDefinitions: [ { field: 'service.name', diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_throughput_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_throughput_config.ts index 7b1d472ac8bbf..d4a44a5c95a0b 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_throughput_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_throughput_config.ts @@ -8,6 +8,7 @@ import { ConfigProps, DataSeries } from '../../types'; import { FieldLabels } from '../constants/constants'; import { buildPhraseFilter } from '../utils'; +import { TRANSACTION_DURATION } from '../constants/elasticsearch_fieldnames'; export function getServiceThroughputLensConfig({ seriesId, @@ -40,7 +41,7 @@ export function getServiceThroughputLensConfig({ 'user_agent.device.name', ], filters: buildPhraseFilter('transaction.type', 'request', indexPattern), - labels: { ...FieldLabels }, + labels: { ...FieldLabels, [TRANSACTION_DURATION]: 'Throughput' }, reportDefinitions: [ { field: 'service.name', diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/constants/constants.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/constants/constants.ts index 14cd24c42e6a2..5c09dbcff2d91 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/constants/constants.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/constants/constants.ts @@ -61,10 +61,10 @@ export const ReportToDataTypeMap: Record = { upp: 'synthetics', tpt: 'apm', svl: 'apm', - kpi: 'rum', - pld: 'rum', - nwk: 'metrics', - mem: 'metrics', - logs: 'logs', - cpu: 'metrics', + kpi: 'ux', + pld: 'ux', + nwk: 'infra_metrics', + mem: 'infra_metrics', + logs: 'infra_logs', + cpu: 'infra_metrics', }; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts index 0de78c45041d4..56c20289669f4 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts @@ -6,12 +6,14 @@ */ import { LensAttributes } from './lens_attributes'; -import { mockIndexPattern } from '../rtl_helpers'; +import { mockAppIndexPattern, mockIndexPattern } from '../rtl_helpers'; import { getDefaultConfigs } from './default_configs'; import { sampleAttribute } from './test_data/sample_attribute'; import { LCP_FIELD, SERVICE_NAME, USER_AGENT_NAME } from './constants/elasticsearch_fieldnames'; describe('Lens Attribute', () => { + mockAppIndexPattern(); + const reportViewConfig = getDefaultConfigs({ reportType: 'pld', indexPattern: mockIndexPattern, @@ -53,7 +55,6 @@ describe('Lens Attribute', () => { readFromDocValues: true, }, fieldName: 'transaction.type', - columnType: null, }) ); }); @@ -72,7 +73,6 @@ describe('Lens Attribute', () => { readFromDocValues: true, }, fieldName: 'transaction.duration.us', - columnType: null, }) ); }); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts index 12a5b19fb02fc..01d74dc2ac36b 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts @@ -45,6 +45,34 @@ function buildNumberColumn(sourceField: string) { }; } +export const parseCustomFieldName = ( + sourceField: string, + reportViewConfig: DataSeries, + selectedDefinitions: Record +) => { + let fieldName = sourceField; + let columnType; + + const rdf = reportViewConfig.reportDefinitions ?? []; + + const customField = rdf.find(({ field }) => field === fieldName); + + if (customField) { + if (selectedDefinitions[fieldName]) { + fieldName = selectedDefinitions[fieldName]; + if (customField?.options) + columnType = customField?.options?.find(({ field }) => field === fieldName)?.columnType; + } else if (customField.defaultValue) { + fieldName = customField.defaultValue; + } else if (customField.options?.[0].field) { + fieldName = customField.options?.[0].field; + columnType = customField.options?.[0].columnType; + } + } + + return { fieldName, columnType }; +}; + export class LensAttributes { indexPattern: IndexPattern; layers: Record; @@ -124,6 +152,18 @@ export class LensAttributes { }; } + getNumberColumn(sourceField: string, columnType?: string, operationType?: string) { + if (columnType === 'operation' || operationType) { + if (operationType === 'median' || operationType === 'average') { + return this.getNumberOperationColumn(sourceField, operationType); + } + if (operationType?.includes('th')) { + return this.getPercentileNumberColumn(sourceField, operationType); + } + } + return this.getNumberRangeColumn(sourceField); + } + getNumberOperationColumn( sourceField: string, operationType: 'average' | 'median' @@ -149,7 +189,7 @@ export class LensAttributes { ...buildNumberColumn(sourceField), label: i18n.translate('xpack.observability.expView.columns.label', { defaultMessage: '{percentileValue} percentile of {sourceField}', - values: { sourceField, percentileValue }, + values: { sourceField: this.reportViewConfig.labels[sourceField], percentileValue }, }), operationType: 'percentile', params: { percentile: Number(percentileValue.split('th')[0]) }, @@ -186,15 +226,7 @@ export class LensAttributes { return this.getDateHistogramColumn(fieldName); } if (fieldType === 'number') { - if (columnType === 'operation' || operationType) { - if (operationType === 'median' || operationType === 'average') { - return this.getNumberOperationColumn(fieldName, operationType); - } - if (operationType?.includes('th')) { - return this.getPercentileNumberColumn(sourceField, operationType); - } - } - return this.getNumberRangeColumn(fieldName); + return this.getNumberColumn(fieldName, columnType, operationType); } // FIXME review my approach again @@ -202,27 +234,7 @@ export class LensAttributes { } getCustomFieldName(sourceField: string) { - let fieldName = sourceField; - let columnType = null; - - const rdf = this.reportViewConfig.reportDefinitions ?? []; - - const customField = rdf.find(({ field }) => field === fieldName); - - if (customField) { - if (this.reportDefinitions[fieldName]) { - fieldName = this.reportDefinitions[fieldName]; - if (customField?.options) - columnType = customField?.options?.find(({ field }) => field === fieldName)?.columnType; - } else if (customField.defaultValue) { - fieldName = customField.defaultValue; - } else if (customField.options?.[0].field) { - fieldName = customField.options?.[0].field; - columnType = customField.options?.[0].columnType; - } - } - - return { fieldName, columnType }; + return parseCustomFieldName(sourceField, this.reportViewConfig, this.reportDefinitions); } getFieldMeta(sourceField: string) { diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/kpi_trends_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/kpi_trends_config.ts index cd38d912850cf..6e8413b342ce5 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/kpi_trends_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/kpi_trends_config.ts @@ -25,6 +25,7 @@ import { USER_AGENT_OS, USER_AGENT_VERSION, TRANSACTION_TIME_TO_FIRST_BYTE, + TRANSACTION_URL, } from '../constants/elasticsearch_fieldnames'; export function getKPITrendsLensConfig({ seriesId, indexPattern }: ConfigProps): DataSeries { @@ -42,6 +43,10 @@ export function getKPITrendsLensConfig({ seriesId, indexPattern }: ConfigProps): }, hasOperationType: false, defaultFilters: [ + { + field: TRANSACTION_URL, + isNegated: false, + }, USER_AGENT_OS, CLIENT_GEO_COUNTRY_NAME, USER_AGENT_DEVICE, diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/performance_dist_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/performance_dist_config.ts index 4b6d5dd6e741b..847e7db18757f 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/performance_dist_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/performance_dist_config.ts @@ -21,6 +21,7 @@ import { TRANSACTION_DURATION, TRANSACTION_TIME_TO_FIRST_BYTE, TRANSACTION_TYPE, + TRANSACTION_URL, USER_AGENT_DEVICE, USER_AGENT_NAME, USER_AGENT_OS, @@ -42,6 +43,10 @@ export function getPerformanceDistLensConfig({ seriesId, indexPattern }: ConfigP }, hasOperationType: false, defaultFilters: [ + { + field: TRANSACTION_URL, + isNegated: false, + }, USER_AGENT_OS, CLIENT_GEO_COUNTRY_NAME, USER_AGENT_DEVICE, diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_duration_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_duration_config.ts index efbc3d14441c2..3b55f5b8eabc9 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_duration_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_duration_config.ts @@ -42,6 +42,6 @@ export function getMonitorDurationConfig({ seriesId }: Props): DataSeries { field: 'monitor.id', }, ], - labels: { ...FieldLabels }, + labels: { ...FieldLabels, 'monitor.duration.us': 'Monitor duration' }, }; } diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.test.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.test.tsx index 257eb3a739f0f..375c021bc9b56 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.test.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.test.tsx @@ -7,12 +7,14 @@ import React from 'react'; import { fireEvent, screen, waitFor } from '@testing-library/dom'; -import { render, mockUrlStorage, mockCore } from './rtl_helpers'; +import { render, mockUrlStorage, mockCore, mockAppIndexPattern } from './rtl_helpers'; import { ExploratoryView } from './exploratory_view'; import { getStubIndexPattern } from '../../../../../../../src/plugins/data/public/test_utils'; import * as obsvInd from './utils/observability_index_patterns'; describe('ExploratoryView', () => { + mockAppIndexPattern(); + beforeEach(() => { const indexPattern = getStubIndexPattern( 'apm-*', diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.tsx index 6bc069aafa5b8..7b5dde852cf90 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.tsx @@ -15,6 +15,8 @@ import { useUrlStorage } from './hooks/use_url_storage'; import { useLensAttributes } from './hooks/use_lens_attributes'; import { EmptyView } from './components/empty_view'; import { TypedLensByValueInput } from '../../../../../lens/public'; +import { useAppIndexPatternContext } from './hooks/use_app_index_pattern'; +import { ReportToDataTypeMap } from './configurations/constants'; export function ExploratoryView() { const { @@ -25,6 +27,8 @@ export function ExploratoryView() { null ); + const { loadIndexPattern } = useAppIndexPatternContext(); + const LensComponent = lens?.EmbeddableComponent; const { firstSeriesId: seriesId, firstSeries: series } = useUrlStorage(); @@ -33,13 +37,19 @@ export function ExploratoryView() { seriesId, }); + useEffect(() => { + if (series?.reportType || series?.dataType) { + loadIndexPattern({ dataType: series?.dataType ?? ReportToDataTypeMap[series?.reportType] }); + } + }, [series?.reportType, series?.dataType, loadIndexPattern]); + useEffect(() => { setLensAttributes(lensAttributesT); // eslint-disable-next-line react-hooks/exhaustive-deps }, [JSON.stringify(lensAttributesT ?? {}), series?.reportType, series?.time?.from]); return ( - + {lens ? ( <> diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx new file mode 100644 index 0000000000000..77d0d54ec5a7a --- /dev/null +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx @@ -0,0 +1,115 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { createContext, useContext, Context, useState, useCallback, useMemo } from 'react'; +import { IndexPattern } from '../../../../../../../../src/plugins/data/common'; +import { AppDataType } from '../types'; +import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; +import { ObservabilityPublicPluginsStart } from '../../../../plugin'; +import { ObservabilityIndexPatterns } from '../utils/observability_index_patterns'; +import { getDataHandler } from '../../../../data_handler'; +import { UXHasDataResponse } from '../../../../typings/fetch_overview_data'; + +export interface IIndexPatternContext { + loading: boolean; + selectedApp: AppDataType; + indexPatterns: IndexPatternState; + hasAppData: HasAppDataState; + loadIndexPattern: (params: { dataType: AppDataType }) => void; +} + +export const IndexPatternContext = createContext>({}); + +interface ProviderProps { + children: JSX.Element; +} + +type HasAppDataState = Record; +type IndexPatternState = Record; + +export function IndexPatternContextProvider({ children }: ProviderProps) { + const [loading, setLoading] = useState(false); + const [selectedApp, setSelectedApp] = useState(); + const [indexPatterns, setIndexPatterns] = useState({} as IndexPatternState); + const [hasAppData, setHasAppData] = useState({ + infra_metrics: null, + infra_logs: null, + synthetics: null, + ux: null, + apm: null, + } as HasAppDataState); + + const { + services: { data }, + } = useKibana(); + + const checkIfAppHasData = async (dataType: AppDataType) => { + const handler = getDataHandler(dataType === 'synthetics' ? 'uptime' : dataType); + return handler?.hasData(); + }; + + const loadIndexPattern: IIndexPatternContext['loadIndexPattern'] = useCallback( + async ({ dataType }) => { + setSelectedApp(dataType); + + if (hasAppData[dataType] === null) { + setLoading(true); + try { + let hasDataT = await checkIfAppHasData(dataType); + + if (dataType === 'ux') { + hasDataT = (hasDataT as UXHasDataResponse).hasData as boolean; + } + + setHasAppData((prevState) => ({ ...prevState, [dataType]: hasDataT })); + + if (hasDataT || hasAppData?.[dataType]) { + const obsvIndexP = new ObservabilityIndexPatterns(data); + const indPattern = await obsvIndexP.getIndexPattern(dataType); + + setIndexPatterns((prevState) => ({ ...prevState, [dataType]: indPattern })); + } + setLoading(false); + } catch (e) { + setLoading(false); + } + } + }, + [data, hasAppData] + ); + + return ( + + {children} + + ); +} + +export const useAppIndexPatternContext = () => { + const { selectedApp, loading, hasAppData, loadIndexPattern, indexPatterns } = useContext( + (IndexPatternContext as unknown) as Context + ); + + return useMemo(() => { + return { + hasAppData, + selectedApp, + loading, + indexPattern: indexPatterns?.[selectedApp], + hasData: hasAppData?.[selectedApp], + loadIndexPattern, + }; + }, [hasAppData, indexPatterns, loadIndexPattern, loading, selectedApp]); +}; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_default_index_pattern.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_default_index_pattern.tsx deleted file mode 100644 index c5a4d02492662..0000000000000 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_default_index_pattern.tsx +++ /dev/null @@ -1,62 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { createContext, useContext, Context, useState, useEffect } from 'react'; -import { IndexPattern } from '../../../../../../../../src/plugins/data/common'; -import { AppDataType } from '../types'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; -import { ObservabilityPublicPluginsStart } from '../../../../plugin'; -import { ObservabilityIndexPatterns } from '../utils/observability_index_patterns'; - -export interface IIndexPatternContext { - indexPattern: IndexPattern; - loadIndexPattern: (dataType: AppDataType) => void; -} - -export const IndexPatternContext = createContext>({}); - -interface ProviderProps { - indexPattern?: IndexPattern; - children: JSX.Element; -} - -export function IndexPatternContextProvider({ - children, - indexPattern: initialIndexPattern, -}: ProviderProps) { - const [indexPattern, setIndexPattern] = useState(initialIndexPattern); - - useEffect(() => { - setIndexPattern(initialIndexPattern); - }, [initialIndexPattern]); - - const { - services: { data }, - } = useKibana(); - - const loadIndexPattern = async (dataType: AppDataType) => { - setIndexPattern(undefined); - const obsvIndexP = new ObservabilityIndexPatterns(data); - const indPattern = await obsvIndexP.getIndexPattern(dataType); - setIndexPattern(indPattern!); - }; - - return ( - - {children} - - ); -} - -export const useIndexPatternContext = () => { - return useContext((IndexPatternContext as unknown) as Context); -}; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_init_exploratory_view.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_init_exploratory_view.ts deleted file mode 100644 index de4343b290118..0000000000000 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_init_exploratory_view.ts +++ /dev/null @@ -1,47 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { useFetcher } from '../../../..'; -import { IKbnUrlStateStorage } from '../../../../../../../../src/plugins/kibana_utils/public'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; -import { ObservabilityPublicPluginsStart } from '../../../../plugin'; -import { AllShortSeries } from './use_url_storage'; -import { ReportToDataTypeMap } from '../configurations/constants'; -import { DataType, ObservabilityIndexPatterns } from '../utils/observability_index_patterns'; - -export const useInitExploratoryView = (storage: IKbnUrlStateStorage) => { - const { - services: { data }, - } = useKibana(); - - const allSeriesKey = 'sr'; - - const allSeries = storage.get(allSeriesKey) ?? {}; - - const allSeriesIds = Object.keys(allSeries); - - const firstSeriesId = allSeriesIds?.[0]; - - const firstSeries = allSeries[firstSeriesId]; - - let dataType: DataType = firstSeries?.dataType ?? 'rum'; - - if (firstSeries?.rt) { - dataType = ReportToDataTypeMap[firstSeries?.rt]; - } - - const { data: indexPattern, error } = useFetcher(() => { - const obsvIndexP = new ObservabilityIndexPatterns(data); - - return obsvIndexP.getIndexPattern(dataType); - }, [dataType, data]); - - if (error) { - throw error; - } - - return indexPattern; -}; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_lens_attributes.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_lens_attributes.ts index 555b21618c4b2..a5fce74c4a2f6 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_lens_attributes.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_lens_attributes.ts @@ -12,7 +12,7 @@ import { useUrlStorage } from './use_url_storage'; import { getDefaultConfigs } from '../configurations/default_configs'; import { DataSeries, SeriesUrl, UrlFilter } from '../types'; -import { useIndexPatternContext } from './use_default_index_pattern'; +import { useAppIndexPatternContext } from './use_app_index_pattern'; interface Props { seriesId: string; @@ -43,7 +43,7 @@ export const useLensAttributes = ({ const { breakdown, seriesType, operationType, reportType, reportDefinitions = {} } = series ?? {}; - const { indexPattern } = useIndexPatternContext(); + const { indexPattern } = useAppIndexPatternContext(); return useMemo(() => { if (!indexPattern || !reportType) { diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_url_storage.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_url_storage.tsx index a4fe15025245a..139b7faac4a37 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_url_storage.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_url_storage.tsx @@ -56,7 +56,7 @@ interface ShortUrlSeries { export type AllShortSeries = Record; export type AllSeries = Record; -export const NEW_SERIES_KEY = 'newSeriesKey'; +export const NEW_SERIES_KEY = 'new-series-key'; export function useUrlStorage(seriesId?: string) { const allSeriesKey = 'sr'; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/index.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/index.tsx index f903c4d7d44fb..9fe133098549c 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/index.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/index.tsx @@ -13,13 +13,12 @@ import { ExploratoryView } from './exploratory_view'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { ObservabilityPublicPluginsStart } from '../../../plugin'; import { useBreadcrumbs } from '../../../hooks/use_breadcrumbs'; -import { IndexPatternContextProvider } from './hooks/use_default_index_pattern'; +import { IndexPatternContextProvider } from './hooks/use_app_index_pattern'; import { createKbnUrlStateStorage, withNotifyOnErrors, } from '../../../../../../../src/plugins/kibana_utils/public/'; import { UrlStorageContextProvider } from './hooks/use_url_storage'; -import { useInitExploratoryView } from './hooks/use_init_exploratory_view'; import { WithHeaderLayout } from '../../app/layout/with_header'; export function ExploratoryViewPage() { @@ -45,20 +44,16 @@ export function ExploratoryViewPage() { ...withNotifyOnErrors(notifications!.toasts), }); - const indexPattern = useInitExploratoryView(kbnUrlStateStorage); - return ( - {indexPattern ? ( - - - - - - ) : null} + + + + + ); } diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/rtl_helpers.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/rtl_helpers.tsx index b826409dd9e3a..7763e8ad71222 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/rtl_helpers.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/rtl_helpers.tsx @@ -22,7 +22,7 @@ import { import { ObservabilityPublicPluginsStart } from '../../../plugin'; import { EuiThemeProvider } from '../../../../../../../src/plugins/kibana_react/common'; import { lensPluginMock } from '../../../../../lens/public/mocks'; -import { IndexPatternContextProvider } from './hooks/use_default_index_pattern'; +import { IndexPatternContextProvider } from './hooks/use_app_index_pattern'; import { AllSeries, UrlStorageContextProvider } from './hooks/use_url_storage'; import { withNotifyOnErrors, @@ -33,6 +33,7 @@ import * as useUrlHook from './hooks/use_url_storage'; import * as useSeriesFilterHook from './hooks/use_series_filters'; import * as useHasDataHook from '../../../hooks/use_has_data'; import * as useValuesListHook from '../../../hooks/use_values_list'; +import * as useAppIndexPatternHook from './hooks/use_app_index_pattern'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getStubIndexPattern } from '../../../../../../../src/plugins/data/public/index_patterns/index_pattern.stub'; @@ -148,7 +149,7 @@ export function MockKibanaProvider>({ - + {children} @@ -234,6 +235,19 @@ export const mockUseHasData = () => { return { spy, onRefreshTimeRange }; }; +export const mockAppIndexPattern = () => { + const loadIndexPattern = jest.fn(); + const spy = jest.spyOn(useAppIndexPatternHook, 'useAppIndexPatternContext').mockReturnValue({ + indexPattern: mockIndexPattern, + selectedApp: 'ux', + hasData: true, + loading: false, + hasAppData: { ux: true } as any, + loadIndexPattern, + }); + return { spy, loadIndexPattern }; +}; + export const mockUseValuesList = (values?: string[]) => { const onRefreshTimeRange = jest.fn(); const spy = jest.spyOn(useValuesListHook, 'useValuesList').mockReturnValue({ diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/chart_types.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/chart_types.tsx index 029c39df13aad..df5b57124f0e7 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/chart_types.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/chart_types.tsx @@ -66,7 +66,7 @@ export function XYChartTypesSelect({ const { data = [], loading } = useFetcher(() => lens.getXyVisTypes(), [lens]); - let vizTypes = data ?? []; + let vizTypes = data; if ((excludeChartTypes ?? []).length > 0) { vizTypes = vizTypes.filter(({ id }) => !excludeChartTypes?.includes(id as SeriesType)); @@ -95,6 +95,7 @@ export function XYChartTypesSelect({ return ( ); @@ -28,11 +30,11 @@ describe('DataTypesCol', function () { fireEvent.click(screen.getByText(/user experience\(rum\)/i)); expect(setSeries).toHaveBeenCalledTimes(1); - expect(setSeries).toHaveBeenCalledWith('newSeriesKey', { dataType: 'rum' }); + expect(setSeries).toHaveBeenCalledWith(NEW_SERIES_KEY, { dataType: 'ux' }); }); it('should set series on change on already selected', function () { - const { removeSeries } = mockUrlStorage({ + mockUrlStorage({ data: { [NEW_SERIES_KEY]: { dataType: 'synthetics', @@ -50,10 +52,5 @@ describe('DataTypesCol', function () { }); expect(button.classList).toContain('euiButton--fill'); - - fireEvent.click(button); - - // undefined on click selected - expect(removeSeries).toHaveBeenCalledWith('newSeriesKey'); }); }); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/data_types_col.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/data_types_col.tsx index d7e90d34a2596..79008d91b294d 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/data_types_col.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/data_types_col.tsx @@ -7,27 +7,25 @@ import React from 'react'; import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import styled from 'styled-components'; import { AppDataType } from '../../types'; -import { useIndexPatternContext } from '../../hooks/use_default_index_pattern'; +import { useAppIndexPatternContext } from '../../hooks/use_app_index_pattern'; import { NEW_SERIES_KEY, useUrlStorage } from '../../hooks/use_url_storage'; export const dataTypes: Array<{ id: AppDataType; label: string }> = [ { id: 'synthetics', label: 'Synthetic Monitoring' }, - { id: 'rum', label: 'User Experience(RUM)' }, - { id: 'logs', label: 'Logs' }, - { id: 'metrics', label: 'Metrics' }, - { id: 'apm', label: 'APM' }, + { id: 'ux', label: 'User Experience(RUM)' }, + // { id: 'infra_logs', label: 'Logs' }, + // { id: 'infra_metrics', label: 'Metrics' }, + // { id: 'apm', label: 'APM' }, ]; export function DataTypesCol() { const { series, setSeries, removeSeries } = useUrlStorage(NEW_SERIES_KEY); - const { loadIndexPattern, indexPattern } = useIndexPatternContext(); + const { loading } = useAppIndexPatternContext(); const onDataTypeChange = (dataType?: AppDataType) => { - if (dataType) { - loadIndexPattern(dataType); - } if (!dataType) { removeSeries(NEW_SERIES_KEY); } else { @@ -38,7 +36,7 @@ export function DataTypesCol() { const selectedDataType = series.dataType; return ( - + {dataTypes.map(({ id: dataTypeId, label }) => ( { - onDataTypeChange(dataTypeId === selectedDataType ? undefined : dataTypeId); + onDataTypeChange(dataTypeId); }} > {label} ))} - + ); } + +const FlexGroup = styled(EuiFlexGroup)` + width: 100%; +`; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/date_picker_col.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/date_picker_col.tsx new file mode 100644 index 0000000000000..a245d39cee089 --- /dev/null +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/date_picker_col.tsx @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { SeriesDatePicker } from '../../series_date_picker'; + +interface Props { + seriesId: string; +} +export function DatePickerCol({ seriesId }: Props) { + return ( +
+ +
+ ); +} diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/operation_type_select.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/operation_type_select.tsx index 46167af0b244a..b33671f78bfe9 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/operation_type_select.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/operation_type_select.tsx @@ -29,7 +29,9 @@ export function OperationTypeSelect({ useEffect(() => { setSeries(seriesId, { ...series, operationType: operationType || defaultOperationType }); - }, [defaultOperationType, seriesId, operationType, setSeries, series]); + // We only want to call this when defaultOperationType changes + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [defaultOperationType]); const options = [ { @@ -72,6 +74,7 @@ export function OperationTypeSelect({ return ( ) { + const { reportDefinitions } = dataView; + const customColumn = reportDefinitions.find((item) => item.custom); + if (customColumn?.field && selectedDefinition[customColumn?.field]) { + const { columnType } = parseCustomFieldName(customColumn.field, dataView, selectedDefinition); + + return columnType; + } + return null; +} + +const MaxWidthStyle = { maxWidth: 250 }; export function ReportDefinitionCol({ dataViewSeries }: { dataViewSeries: DataSeries }) { - const { indexPattern } = useIndexPatternContext(); + const { indexPattern } = useAppIndexPatternContext(); const { series, setSeries } = useUrlStorage(NEW_SERIES_KEY); @@ -54,14 +70,19 @@ export function ReportDefinitionCol({ dataViewSeries }: { dataViewSeries: DataSe }); }; + const columnType = getColumnType(dataViewSeries, rtd); + return ( - + + + + {indexPattern && reportDefinitions.map(({ field, custom, options, defaultValue }) => ( {!custom ? ( - - + + onChange(field, val)} filters={(filters ?? []).map(({ query }) => query)} time={series.time} - width={200} + fullWidth={true} /> {rtd?.[field] && ( @@ -100,17 +121,21 @@ export function ReportDefinitionCol({ dataViewSeries }: { dataViewSeries: DataSe )} ))} - - - - {hasOperationType && ( - + {(hasOperationType || columnType === 'operation') && ( + )} - + + + + ); } + +const FlexGroup = styled(EuiFlexGroup)` + width: 100%; +`; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_types_col.test.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_types_col.test.tsx index f845bf9885af9..c5b8f1147af54 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_types_col.test.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_types_col.test.tsx @@ -7,14 +7,17 @@ import React from 'react'; import { fireEvent, screen } from '@testing-library/react'; -import { mockUrlStorage, render } from '../../rtl_helpers'; +import { mockAppIndexPattern, mockUrlStorage, render } from '../../rtl_helpers'; import { ReportTypesCol, SELECTED_DATA_TYPE_FOR_REPORT } from './report_types_col'; import { ReportTypes } from '../series_builder'; import { DEFAULT_TIME } from '../../configurations/constants'; +import { NEW_SERIES_KEY } from '../../hooks/use_url_storage'; describe('ReportTypesCol', function () { + mockAppIndexPattern(); + it('should render properly', function () { - render(); + render(); screen.getByText('Performance distribution'); screen.getByText('KPI over time'); }); @@ -30,7 +33,7 @@ describe('ReportTypesCol', function () { fireEvent.click(screen.getByText(/monitor duration/i)); - expect(setSeries).toHaveBeenCalledWith('newSeriesKey', { + expect(setSeries).toHaveBeenCalledWith(NEW_SERIES_KEY, { breakdown: 'user_agent.name', reportDefinitions: {}, reportType: 'upd', @@ -42,7 +45,7 @@ describe('ReportTypesCol', function () { it('should set selected as filled', function () { const { setSeries } = mockUrlStorage({ data: { - newSeriesKey: { + [NEW_SERIES_KEY]: { dataType: 'synthetics', reportType: 'upp', breakdown: 'monitor.status', @@ -61,7 +64,7 @@ describe('ReportTypesCol', function () { fireEvent.click(button); // undefined on click selected - expect(setSeries).toHaveBeenCalledWith('newSeriesKey', { + expect(setSeries).toHaveBeenCalledWith(NEW_SERIES_KEY, { dataType: 'synthetics', time: DEFAULT_TIME, }); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_types_col.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_types_col.tsx index a8f98b98026b6..b8ab1c80009d9 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_types_col.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_types_col.tsx @@ -7,11 +7,13 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; +import styled from 'styled-components'; import { ReportViewTypeId, SeriesUrl } from '../../types'; import { NEW_SERIES_KEY, useUrlStorage } from '../../hooks/use_url_storage'; import { DEFAULT_TIME } from '../../configurations/constants'; -import { useIndexPatternContext } from '../../hooks/use_default_index_pattern'; +import { useAppIndexPatternContext } from '../../hooks/use_app_index_pattern'; interface Props { reportTypes: Array<{ id: ReportViewTypeId; label: string }>; @@ -23,19 +25,29 @@ export function ReportTypesCol({ reportTypes }: Props) { setSeries, } = useUrlStorage(NEW_SERIES_KEY); - const { indexPattern } = useIndexPatternContext(); + const { loading, hasData, selectedApp } = useAppIndexPatternContext(); + + if (!loading && !hasData && selectedApp) { + return ( + + ); + } return reportTypes?.length > 0 ? ( - + {reportTypes.map(({ id: reportType, label }) => ( { if (reportType === selectedReportType) { setSeries(NEW_SERIES_KEY, { @@ -56,7 +68,7 @@ export function ReportTypesCol({ reportTypes }: Props) { ))} - + ) : ( {SELECTED_DATA_TYPE_FOR_REPORT} ); @@ -66,3 +78,7 @@ export const SELECTED_DATA_TYPE_FOR_REPORT = i18n.translate( 'xpack.observability.expView.reportType.noDataType', { defaultMessage: 'Select a data type to start building a series.' } ); + +const FlexGroup = styled(EuiFlexGroup)` + width: 100%; +`; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/custom_report_field.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/custom_report_field.tsx index 4d5033eca241b..b630ee55b5780 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/custom_report_field.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/custom_report_field.tsx @@ -28,18 +28,18 @@ export function CustomReportField({ field, seriesId, options: opts, defaultValue const { reportDefinitions } = series; - const NO_SELECT = 'no_select'; - - const options = [{ label: 'Select metric', field: NO_SELECT }, ...(opts ?? [])]; + const options = opts ?? []; return ( -
+
({ value: fd, inputDisplay: label, }))} - valueOfSelected={reportDefinitions?.[field] || defaultValue || NO_SELECT} + valueOfSelected={reportDefinitions?.[field] || defaultValue || options?.[0].field} onChange={(value) => onChange(value)} />
diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/series_builder.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/series_builder.tsx index 2280109fdacdf..5831b8be04c38 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/series_builder.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/series_builder.tsx @@ -5,11 +5,10 @@ * 2.0. */ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButton, EuiBasicTable, EuiSpacer, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import styled from 'styled-components'; import { AppDataType, ReportViewTypeId, ReportViewTypes, SeriesUrl } from '../types'; import { DataTypesCol } from './columns/data_types_col'; import { ReportTypesCol } from './columns/report_types_col'; @@ -17,7 +16,7 @@ import { ReportDefinitionCol } from './columns/report_definition_col'; import { ReportFilters } from './columns/report_filters'; import { ReportBreakdowns } from './columns/report_breakdowns'; import { NEW_SERIES_KEY, useUrlStorage } from '../hooks/use_url_storage'; -import { useIndexPatternContext } from '../hooks/use_default_index_pattern'; +import { useAppIndexPatternContext } from '../hooks/use_app_index_pattern'; import { getDefaultConfigs } from '../configurations/default_configs'; export const ReportTypes: Record> = { @@ -25,7 +24,7 @@ export const ReportTypes: Record { return getDefaultConfigs({ @@ -70,19 +71,23 @@ export function SeriesBuilder() { }); }; + useEffect(() => { + setIsFlyoutVisible(!!series.dataType); + }, [series.dataType]); + const columns = [ { name: i18n.translate('xpack.observability.expView.seriesBuilder.dataType', { defaultMessage: 'Data Type', }), - width: '20%', + width: '15%', render: (val: string) => , }, { name: i18n.translate('xpack.observability.expView.seriesBuilder.report', { defaultMessage: 'Report', }), - width: '20%', + width: '15%', render: (val: string) => ( ), @@ -92,16 +97,25 @@ export function SeriesBuilder() { defaultMessage: 'Definition', }), width: '30%', - render: (val: string) => - reportType && indexPattern ? ( - - ) : null, + render: (val: string) => { + if (dataType && hasData) { + return loading ? ( + INITIATING_VIEW + ) : reportType ? ( + + ) : ( + SELECT_REPORT_TYPE + ); + } + + return null; + }, }, { name: i18n.translate('xpack.observability.expView.seriesBuilder.filters', { defaultMessage: 'Filters', }), - width: '25%', + width: '20%', render: (val: string) => reportType && indexPattern ? : null, }, @@ -109,7 +123,7 @@ export function SeriesBuilder() { name: i18n.translate('xpack.observability.expView.seriesBuilder.breakdown', { defaultMessage: 'Breakdowns', }), - width: '25%', + width: '20%', field: 'id', render: (val: string) => reportType && indexPattern ? ( @@ -126,14 +140,15 @@ export function SeriesBuilder() { ReportViewTypes[reportType] }`; - const newSeriesN = { + const newSeriesN: SeriesUrl = { + time, + filters, + breakdown, reportType, seriesType, - filters, - reportDefinitions, operationType, - time: { from: 'now-30m', to: 'now' }, - } as SeriesUrl; + reportDefinitions, + }; setSeries(newSeriesId, newSeriesN).then(() => { removeSeries(NEW_SERIES_KEY); @@ -148,7 +163,7 @@ export function SeriesBuilder() { if (isFlyoutVisible) { flyout = ( - + <> - + {i18n.translate('xpack.observability.expView.seriesBuilder.add', { defaultMessage: 'Add', })} @@ -165,6 +187,7 @@ export function SeriesBuilder() { { @@ -178,7 +201,7 @@ export function SeriesBuilder() { - + ); } @@ -205,6 +228,13 @@ export function SeriesBuilder() { ); } -const BottomFlyout = styled.div` - height: 300px; -`; +const INITIATING_VIEW = i18n.translate('xpack.observability.expView.seriesBuilder.initView', { + defaultMessage: 'Initiating view ...', +}); + +const SELECT_REPORT_TYPE = i18n.translate( + 'xpack.observability.expView.seriesBuilder.selectReportType', + { + defaultMessage: 'Select a report type to define visualization.', + } +); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/actions_col.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/chart_options.tsx similarity index 95% rename from x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/actions_col.tsx rename to x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/chart_options.tsx index fe54262e13844..975817a8417de 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/actions_col.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/chart_options.tsx @@ -15,7 +15,7 @@ interface Props { series: DataSeries; } -export function ActionsCol({ series }: Props) { +export function ChartOptions({ series }: Props) { return ( diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_expanded.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_expanded.tsx index 3e6d7890f4c81..5f5c99ca796c7 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_expanded.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_expanded.tsx @@ -13,7 +13,8 @@ import { EuiLoadingSpinner, EuiFilterGroup, } from '@elastic/eui'; -import { useIndexPatternContext } from '../../hooks/use_default_index_pattern'; +import styled from 'styled-components'; +import { useAppIndexPatternContext } from '../../hooks/use_app_index_pattern'; import { useUrlStorage } from '../../hooks/use_url_storage'; import { UrlFilter } from '../../types'; import { FilterValueButton } from './filter_value_btn'; @@ -23,12 +24,13 @@ interface Props { seriesId: string; label: string; field: string; + isNegated?: boolean; goBack: () => void; nestedField?: string; } -export function FilterExpanded({ seriesId, field, label, goBack, nestedField }: Props) { - const { indexPattern } = useIndexPatternContext(); +export function FilterExpanded({ seriesId, field, label, goBack, nestedField, isNegated }: Props) { + const { indexPattern } = useAppIndexPatternContext(); const [value, setValue] = useState(''); @@ -37,9 +39,10 @@ export function FilterExpanded({ seriesId, field, label, goBack, nestedField }: const { series } = useUrlStorage(seriesId); const { values, loading } = useValuesList({ + query: value, + indexPattern, sourceField: field, time: series.time, - indexPattern, }); const filters = series?.filters ?? []; @@ -51,7 +54,7 @@ export function FilterExpanded({ seriesId, field, label, goBack, nestedField }: ); return ( - <> + goBack()}> {label} @@ -71,16 +74,18 @@ export function FilterExpanded({ seriesId, field, label, goBack, nestedField }: {displayValues.map((opt) => ( - + {isNegated !== false && ( + + )} ))} - + ); } + +const Wrapper = styled.div` + max-width: 400px; +`; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_value_btn.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_value_btn.tsx index efccb351c2619..849fb8ffa66ba 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_value_btn.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_value_btn.tsx @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import React, { useMemo } from 'react'; import { EuiFilterButton, hexToRgb } from '@elastic/eui'; -import { useIndexPatternContext } from '../../hooks/use_default_index_pattern'; +import { useAppIndexPatternContext } from '../../hooks/use_app_index_pattern'; import { useUrlStorage } from '../../hooks/use_url_storage'; import { useSeriesFilters } from '../../hooks/use_series_filters'; import { euiStyled } from '../../../../../../../../../src/plugins/kibana_react/common'; @@ -39,7 +39,7 @@ export function FilterValueButton({ }: Props) { const { series } = useUrlStorage(seriesId); - const { indexPattern } = useIndexPatternContext(); + const { indexPattern } = useAppIndexPatternContext(); const { setFilter, removeFilter } = useSeriesFilters({ seriesId }); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/remove_series.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/remove_series.tsx index aaaa02c7c5697..ba2cdc545fbef 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/remove_series.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/remove_series.tsx @@ -8,18 +8,17 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { EuiButtonIcon } from '@elastic/eui'; -import { DataSeries } from '../../types'; import { useUrlStorage } from '../../hooks/use_url_storage'; interface Props { - series: DataSeries; + seriesId: string; } -export function RemoveSeries({ series }: Props) { +export function RemoveSeries({ seriesId }: Props) { const { removeSeries } = useUrlStorage(); const onClick = () => { - removeSeries(series.id); + removeSeries(seriesId); }; return ( { + removeSeries(seriesId); + setSeries(NEW_SERIES_KEY, { ...series, dataType: ReportToDataTypeMap[series.reportType] }); + }; + + return ( + + + + + + + + + ); +} diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/series_filter.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/series_filter.tsx index c9bb44cfd8cca..88cb538263419 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/series_filter.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/series_filter.tsx @@ -32,6 +32,7 @@ export interface Field { label: string; field: string; nested?: string; + isNegated?: boolean; } export function SeriesFilter({ series, isNew, seriesId, defaultFilters = [] }: Props) { @@ -39,11 +40,17 @@ export function SeriesFilter({ series, isNew, seriesId, defaultFilters = [] }: P const [selectedField, setSelectedField] = useState(); - const options = defaultFilters.map((field) => { + const options: Field[] = defaultFilters.map((field) => { if (typeof field === 'string') { return { label: FieldLabels[field], field }; } - return { label: FieldLabels[field.field], field: field.field, nested: field.nested }; + + return { + label: FieldLabels[field.field], + field: field.field, + nested: field.nested, + isNegated: field.isNegated, + }; }); const disabled = seriesId === NEW_SERIES_KEY && !isNew; @@ -92,6 +99,7 @@ export function SeriesFilter({ series, isNew, seriesId, defaultFilters = [] }: P field={selectedField.field} label={selectedField.label} nestedField={selectedField.nested} + isNegated={selectedField.isNegated} goBack={() => { setSelectedField(undefined); }} diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/selected_filters.test.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/selected_filters.test.tsx index a38b50d610c75..30844a3f78a76 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/selected_filters.test.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/selected_filters.test.tsx @@ -7,13 +7,15 @@ import React from 'react'; import { screen, waitFor } from '@testing-library/react'; -import { mockIndexPattern, mockUrlStorage, render } from '../rtl_helpers'; +import { mockAppIndexPattern, mockIndexPattern, mockUrlStorage, render } from '../rtl_helpers'; import { SelectedFilters } from './selected_filters'; import { getDefaultConfigs } from '../configurations/default_configs'; import { NEW_SERIES_KEY } from '../hooks/use_url_storage'; import { USER_AGENT_NAME } from '../configurations/constants/elasticsearch_fieldnames'; describe('SelectedFilters', function () { + mockAppIndexPattern(); + const dataViewSeries = getDefaultConfigs({ reportType: 'pld', indexPattern: mockIndexPattern, diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/selected_filters.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/selected_filters.tsx index 34e69f688eaaf..4055a592c75d2 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/selected_filters.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/selected_filters.tsx @@ -10,7 +10,7 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { NEW_SERIES_KEY, useUrlStorage } from '../hooks/use_url_storage'; import { FilterLabel } from '../components/filter_label'; import { DataSeries, UrlFilter } from '../types'; -import { useIndexPatternContext } from '../hooks/use_default_index_pattern'; +import { useAppIndexPatternContext } from '../hooks/use_app_index_pattern'; import { useSeriesFilters } from '../hooks/use_series_filters'; import { getFiltersFromDefs } from '../hooks/use_lens_attributes'; @@ -37,7 +37,7 @@ export function SelectedFilters({ seriesId, isNew, series: dataSeries }: Props) const { removeFilter } = useSeriesFilters({ seriesId }); - const { indexPattern } = useIndexPatternContext(); + const { indexPattern } = useAppIndexPatternContext(); return (filters.length > 0 || definitionFilters.length > 0) && indexPattern ? ( @@ -45,7 +45,7 @@ export function SelectedFilters({ seriesId, isNew, series: dataSeries }: Props) {filters.map(({ field, values, notValues }) => ( {(values ?? []).map((val) => ( - + ))} {(notValues ?? []).map((val) => ( - + ( {' '} - {val === NEW_SERIES_KEY ? 'new-series-preview' : val} + {val === NEW_SERIES_KEY ? 'series-preview' : val} ), }, @@ -63,34 +64,30 @@ export function SeriesEditor() { align: 'center' as const, width: '15%', field: 'id', - render: (val: string, item: DataSeries) => , + render: (val: string, item: DataSeries) => , + }, + { + name: ( +
+ +
+ ), + width: '20%', + field: 'id', + align: 'right' as const, + render: (val: string, item: DataSeries) => , }, - ] - : []), - { - name: ( -
- {i18n.translate('xpack.observability.expView.seriesEditor.time', { - defaultMessage: 'Time', - })} -
- ), - width: '20%', - field: 'id', - align: 'right' as const, - render: (val: string, item: DataSeries) => , - }, - - ...(firstSeriesId !== NEW_SERIES_KEY - ? [ { name: i18n.translate('xpack.observability.expView.seriesEditor.actions', { defaultMessage: 'Actions', }), align: 'center' as const, - width: '5%', + width: '8%', field: 'id', - render: (val: string, item: DataSeries) => , + render: (val: string, item: DataSeries) => , }, ] : []), @@ -100,7 +97,7 @@ export function SeriesEditor() { const items: DataSeries[] = []; - const { indexPattern } = useIndexPatternContext(); + const { indexPattern } = useAppIndexPatternContext(); allSeriesKeys.forEach((seriesKey) => { const series = allSeries[seriesKey]; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts index 141dcecd0ba5b..bd908661365c0 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts @@ -57,7 +57,7 @@ export interface DataSeries { breakdowns: string[]; defaultSeriesType: SeriesType; - defaultFilters: Array; + defaultFilters: Array; seriesTypes: SeriesType[]; filters?: PersistableFilter[]; reportDefinitions: ReportDefinition[]; @@ -91,7 +91,7 @@ export interface ConfigProps { indexPattern: IIndexPattern; } -export type AppDataType = 'synthetics' | 'rum' | 'logs' | 'metrics' | 'apm'; +export type AppDataType = 'synthetics' | 'ux' | 'infra_logs' | 'infra_metrics' | 'apm'; type FormatType = 'duration' | 'number'; type InputFormat = 'microseconds' | 'milliseconds' | 'seconds'; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.test.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.test.ts index b6f544db2a319..f1347e1d21cc3 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.test.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.test.ts @@ -40,17 +40,17 @@ const fieldFormats = { describe('ObservabilityIndexPatterns', function () { const { data } = mockCore(); data!.indexPatterns.get = jest.fn().mockReturnValue({ title: 'index-*' }); - data!.indexPatterns.createAndSave = jest.fn().mockReturnValue({ id: indexPatternList.rum }); + data!.indexPatterns.createAndSave = jest.fn().mockReturnValue({ id: indexPatternList.ux }); data!.indexPatterns.updateSavedObject = jest.fn(); it('should return index pattern for app', async function () { const obsv = new ObservabilityIndexPatterns(data!); - const indexP = await obsv.getIndexPattern('rum'); + const indexP = await obsv.getIndexPattern('ux'); expect(indexP).toEqual({ title: 'index-*' }); - expect(data?.indexPatterns.get).toHaveBeenCalledWith(indexPatternList.rum); + expect(data?.indexPatterns.get).toHaveBeenCalledWith(indexPatternList.ux); expect(data?.indexPatterns.get).toHaveBeenCalledTimes(1); }); @@ -61,9 +61,9 @@ describe('ObservabilityIndexPatterns', function () { const obsv = new ObservabilityIndexPatterns(data!); - const indexP = await obsv.getIndexPattern('rum'); + const indexP = await obsv.getIndexPattern('ux'); - expect(indexP).toEqual({ id: indexPatternList.rum }); + expect(indexP).toEqual({ id: indexPatternList.ux }); expect(data?.indexPatterns.createAndSave).toHaveBeenCalledWith({ fieldFormats, @@ -77,7 +77,7 @@ describe('ObservabilityIndexPatterns', function () { it('should return getFieldFormats', function () { const obsv = new ObservabilityIndexPatterns(data!); - expect(obsv.getFieldFormats('rum')).toEqual(fieldFormats); + expect(obsv.getFieldFormats('ux')).toEqual(fieldFormats); }); it('should validate field formats', async function () { @@ -85,7 +85,7 @@ describe('ObservabilityIndexPatterns', function () { const obsv = new ObservabilityIndexPatterns(data!); - await obsv.validateFieldFormats('rum', mockIndexPattern); + await obsv.validateFieldFormats('ux', mockIndexPattern); expect(data?.indexPatterns.updateSavedObject).toHaveBeenCalledTimes(1); expect(data?.indexPatterns.updateSavedObject).toHaveBeenCalledWith( diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.ts index 527ef48364d22..b890df69d9936 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.ts @@ -14,36 +14,35 @@ import { } from '../../../../../../../../src/plugins/data/public'; import { rumFieldFormats } from '../configurations/rum/field_formats'; import { syntheticsFieldFormats } from '../configurations/synthetics/field_formats'; -import { FieldFormat, FieldFormatParams } from '../types'; - -const appFieldFormats: Record = { - rum: rumFieldFormats, - apm: null, - logs: null, - metrics: null, +import { AppDataType, FieldFormat, FieldFormatParams } from '../types'; +import { apmFieldFormats } from '../configurations/apm/field_formats'; + +const appFieldFormats: Record = { + infra_logs: null, + infra_metrics: null, + ux: rumFieldFormats, + apm: apmFieldFormats, synthetics: syntheticsFieldFormats, }; -function getFieldFormatsForApp(app: DataType) { +function getFieldFormatsForApp(app: AppDataType) { return appFieldFormats[app]; } -export type DataType = 'synthetics' | 'apm' | 'logs' | 'metrics' | 'rum'; - -export const indexPatternList: Record = { +export const indexPatternList: Record = { synthetics: 'synthetics_static_index_pattern_id', apm: 'apm_static_index_pattern_id', - rum: 'rum_static_index_pattern_id', - logs: 'logs_static_index_pattern_id', - metrics: 'metrics_static_index_pattern_id', + ux: 'rum_static_index_pattern_id', + infra_logs: 'infra_logs_static_index_pattern_id', + infra_metrics: 'infra_metrics_static_index_pattern_id', }; -const appToPatternMap: Record = { +const appToPatternMap: Record = { synthetics: '(synthetics-data-view)*,heartbeat-*,synthetics-*', apm: 'apm-*', - rum: '(rum-data-view)*,apm-*', - logs: 'logs-*,filebeat-*', - metrics: 'metrics-*,metricbeat-*', + ux: '(rum-data-view)*,apm-*', + infra_logs: 'logs-*,filebeat-*', + infra_metrics: 'metrics-*,metricbeat-*', }; export function isParamsSame(param1: IFieldFormat['_params'], param2: FieldFormatParams) { @@ -66,7 +65,7 @@ export class ObservabilityIndexPatterns { this.data = data; } - async createIndexPattern(app: DataType) { + async createIndexPattern(app: AppDataType) { if (!this.data) { throw new Error('data is not defined'); } @@ -81,7 +80,7 @@ export class ObservabilityIndexPatterns { }); } // we want to make sure field formats remain same - async validateFieldFormats(app: DataType, indexPattern: IndexPattern) { + async validateFieldFormats(app: AppDataType, indexPattern: IndexPattern) { const defaultFieldFormats = getFieldFormatsForApp(app); if (defaultFieldFormats && defaultFieldFormats.length > 0) { let isParamsDifferent = false; @@ -99,7 +98,7 @@ export class ObservabilityIndexPatterns { } } - getFieldFormats(app: DataType) { + getFieldFormats(app: AppDataType) { const fieldFormatMap: IndexPatternSpec['fieldFormats'] = {}; (appFieldFormats?.[app] ?? []).forEach(({ field, format }) => { @@ -109,7 +108,7 @@ export class ObservabilityIndexPatterns { return fieldFormatMap; } - async getIndexPattern(app: DataType): Promise { + async getIndexPattern(app: AppDataType): Promise { if (!this.data) { throw new Error('data is not defined'); } diff --git a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/__stories__/field_value_selection.stories.tsx b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/__stories__/field_value_selection.stories.tsx index 8e95d8e711ad0..ae91e1a439188 100644 --- a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/__stories__/field_value_selection.stories.tsx +++ b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/__stories__/field_value_selection.stories.tsx @@ -12,7 +12,8 @@ import { CoreStart } from 'src/core/public'; import { text } from '@storybook/addon-knobs'; import { EuiThemeProvider } from '../../../../../../../../src/plugins/kibana_react/common'; import { createKibanaReactContext } from '../../../../../../../../src/plugins/kibana_react/public'; -import { FieldValueSelection, FieldValueSelectionProps } from '../field_value_selection'; +import { FieldValueSelectionProps } from '../types'; +import { FieldValueSelection } from '../field_value_selection'; const KibanaReactContext = createKibanaReactContext(({ uiSettings: { get: () => {}, get$: () => new Observable() }, diff --git a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/field_value_selection.tsx b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/field_value_selection.tsx index d14039ba173ac..d7e075d7fc3f2 100644 --- a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/field_value_selection.tsx +++ b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/field_value_selection.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { FormEvent, Fragment, useEffect, useState, Dispatch, SetStateAction } from 'react'; +import React, { FormEvent, useEffect, useState } from 'react'; import { EuiButton, EuiPopover, @@ -15,20 +15,8 @@ import { EuiSelectableOption, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { PopoverAnchorPosition } from '@elastic/eui/src/components/popover/popover'; - -export interface FieldValueSelectionProps { - value?: string; - label: string; - loading?: boolean; - onChange: (val?: string) => void; - values?: string[]; - setQuery: Dispatch>; - anchorPosition?: PopoverAnchorPosition; - forceOpen?: boolean; - button?: JSX.Element; - width?: number; -} +import styled from 'styled-components'; +import { FieldValueSelectionProps } from './types'; const formatOptions = (values?: string[], value?: string): EuiSelectableOption[] => { return (values ?? []).map((val) => ({ @@ -38,6 +26,7 @@ const formatOptions = (values?: string[], value?: string): EuiSelectableOption[] }; export function FieldValueSelection({ + fullWidth, label, value, loading, @@ -47,6 +36,7 @@ export function FieldValueSelection({ width, forceOpen, anchorPosition, + singleSelection, onChange: onSelectionChange, }: FieldValueSelectionProps) { const [options, setOptions] = useState(formatOptions(values, value)); @@ -81,13 +71,14 @@ export function FieldValueSelection({ iconSide="right" onClick={onButtonClick} data-test-subj={'fieldValueSelectionBtn'} + fullWidth={fullWidth} > {label} ); return ( - + - + ); } + +const Wrapper = styled.div` + &&& { + div.euiPopover__anchor { + width: 100%; + max-width: 250px; + .euiButton { + width: 100%; + } + } + } +`; diff --git a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.tsx b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.tsx index 9ffe2584c8d75..a3bfd8daac7dc 100644 --- a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.tsx +++ b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.tsx @@ -8,27 +8,12 @@ import React, { useState } from 'react'; import { useDebounce } from 'react-use'; -import { PopoverAnchorPosition } from '@elastic/eui/src/components/popover/popover'; import { useValuesList } from '../../../hooks/use_values_list'; -import { IndexPattern } from '../../../../../../../src/plugins/data/common'; import { FieldValueSelection } from './field_value_selection'; -import { ESFilter } from '../../../../../../../typings/elasticsearch'; - -export interface FieldValueSuggestionsProps { - value?: string; - label: string; - indexPattern: IndexPattern; - sourceField: string; - onChange: (val?: string) => void; - filters: ESFilter[]; - anchorPosition?: PopoverAnchorPosition; - time?: { from: string; to: string }; - forceOpen?: boolean; - button?: JSX.Element; - width?: number; -} +import { FieldValueSuggestionsProps } from './types'; export function FieldValueSuggestions({ + fullWidth, sourceField, label, indexPattern, @@ -39,6 +24,7 @@ export function FieldValueSuggestions({ width, forceOpen, anchorPosition, + singleSelection, onChange: onSelectionChange, }: FieldValueSuggestionsProps) { const [query, setQuery] = useState(''); @@ -56,6 +42,8 @@ export function FieldValueSuggestions({ return ( void; + filters: ESFilter[]; + time?: { from: string; to: string }; +}; + +export type FieldValueSelectionProps = CommonProps & { + loading?: boolean; + onChange: (val?: string) => void; + values?: string[]; + setQuery: Dispatch>; +}; diff --git a/x-pack/plugins/observability/public/components/shared/index.tsx b/x-pack/plugins/observability/public/components/shared/index.tsx index 976139fdc1217..d4d7521a6b096 100644 --- a/x-pack/plugins/observability/public/components/shared/index.tsx +++ b/x-pack/plugins/observability/public/components/shared/index.tsx @@ -7,7 +7,7 @@ import React, { lazy, Suspense } from 'react'; import type { CoreVitalProps, HeaderMenuPortalProps } from './types'; -import type { FieldValueSuggestionsProps } from './field_value_suggestions'; +import type { FieldValueSuggestionsProps } from './field_value_suggestions/types'; const CoreVitalsLazy = lazy(() => import('./core_web_vitals/index')); diff --git a/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts b/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts index 726c83d0c2256..ae3e2eb8c270d 100644 --- a/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts +++ b/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts @@ -125,6 +125,7 @@ export interface ObservabilityFetchDataResponse { apm: ApmFetchDataResponse; infra_metrics: MetricsFetchDataResponse; infra_logs: LogsFetchDataResponse; + synthetics: UptimeFetchDataResponse; uptime: UptimeFetchDataResponse; ux: UxFetchDataResponse; } @@ -134,5 +135,6 @@ export interface ObservabilityHasDataResponse { infra_metrics: boolean; infra_logs: boolean; uptime: boolean; + synthetics: boolean; ux: UXHasDataResponse; } diff --git a/x-pack/plugins/observability/typings/common.ts b/x-pack/plugins/observability/typings/common.ts index 0d0b2af85170a..81477d0a7f815 100644 --- a/x-pack/plugins/observability/typings/common.ts +++ b/x-pack/plugins/observability/typings/common.ts @@ -9,7 +9,9 @@ export type ObservabilityApp = | 'infra_metrics' | 'infra_logs' | 'apm' + // we will remove uptime in future to replace to be replace by synthetics | 'uptime' + | 'synthetics' | 'observability-overview' | 'stack_monitoring' | 'ux'; From 5686ec9b2468a5e46341053df9b3b9ef63eda8b0 Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Thu, 15 Apr 2021 13:31:48 +0300 Subject: [PATCH 02/68] [TSVB] Fix error handling issue for KQL queries (#97088) * [TSVB] Fix error handling issue for KQL queries * remove KQLSyntaxError Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../vis_type_timeseries/server/lib/vis_data/get_series_data.ts | 2 +- .../vis_type_timeseries/server/lib/vis_data/get_table_data.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.ts index 13dc1207f51de..6d165d3343eaa 100644 --- a/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.ts +++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.ts @@ -97,7 +97,7 @@ export async function getSeriesData( }, }; } catch (err) { - if (err.body || err.name === 'KQLSyntaxError') { + if (err.body) { err.response = err.body; return { diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.ts index b50fdb6b8226d..00d23ee45e6da 100644 --- a/src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.ts +++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.ts @@ -107,7 +107,7 @@ export async function getTableData( series, }; } catch (err) { - if (err.body || err.name === 'KQLSyntaxError') { + if (err.body) { err.response = err.body; return { From 6501b393a27c7d613764912cddc224fe5f71cdbf Mon Sep 17 00:00:00 2001 From: Maja Grubic Date: Thu, 15 Apr 2021 12:03:57 +0100 Subject: [PATCH 03/68] [Discover] Runtime Fields Editor integration: Add + Delete operation (#96762) * [Discover] Updating a functional test * [Discover] Support for edit operation * Fix unit tests * Fix typescript * Fixing failing functional test * Fixing wrongly commented line * Uncomment accidentally commented line * Reintroducing accidnetally removed unit test * Trigger data refetch onSave * Remove refreshAppState variable * Bundling observers together * Clean state before refetch * Update formatting in data grid * [Discover] Runtime fields editor : add operation * [Discover] Updating a functional test * Adding a functional test * Fixing package.json * Reset fieldCount after data fetch * [Discover] Updating a functional test * Don't allow editing of unmapped fields * Add functionality * Fix issues with mobile display * Allow editing if it's a runtime field * Add a functional test * [Discover] Updating a functional test * Add functional test * Remove unnecessary debugger statement * Add more tests * Add delete functionality * Include runtimeFields in doc search * Add another functional test * [Discover] Updating a functional test * Fix failing i18n check * Fix package.json * Addressing PR comments * Addressing design input Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../components/doc/use_es_doc_search.test.tsx | 50 +++++++ .../components/doc/use_es_doc_search.ts | 3 +- .../components/sidebar/discover_field.tsx | 45 +++++- .../components/sidebar/discover_sidebar.scss | 4 + .../components/sidebar/discover_sidebar.tsx | 128 ++++++++++++++++-- .../apps/discover/_runtime_fields_editor.ts | 76 +++++++++++ test/functional/page_objects/discover_page.ts | 20 +++ 7 files changed, 310 insertions(+), 16 deletions(-) diff --git a/src/plugins/discover/public/application/components/doc/use_es_doc_search.test.tsx b/src/plugins/discover/public/application/components/doc/use_es_doc_search.test.tsx index dc0b6416a7f57..b5cdc7db6c6c9 100644 --- a/src/plugins/discover/public/application/components/doc/use_es_doc_search.test.tsx +++ b/src/plugins/discover/public/application/components/doc/use_es_doc_search.test.tsx @@ -51,6 +51,7 @@ describe('Test of helper / hook', () => { ], }, }, + "runtime_mappings": Object {}, "script_fields": Array [], "stored_fields": Array [], } @@ -79,6 +80,55 @@ describe('Test of helper / hook', () => { ], }, }, + "runtime_mappings": Object {}, + "script_fields": Array [], + "stored_fields": Array [], + } + `); + }); + + test('buildSearchBody with runtime fields', () => { + const indexPattern = { + getComputedFields: () => ({ + storedFields: [], + scriptFields: [], + docvalueFields: [], + runtimeFields: { + myRuntimeField: { + type: 'double', + script: { + source: 'emit(10.0)', + }, + }, + }, + }), + } as any; + const actual = buildSearchBody('1', indexPattern, true); + expect(actual).toMatchInlineSnapshot(` + Object { + "_source": false, + "docvalue_fields": Array [], + "fields": Array [ + Object { + "field": "*", + "include_unmapped": "true", + }, + ], + "query": Object { + "ids": Object { + "values": Array [ + "1", + ], + }, + }, + "runtime_mappings": Object { + "myRuntimeField": Object { + "script": Object { + "source": "emit(10.0)", + }, + "type": "double", + }, + }, "script_fields": Array [], "stored_fields": Array [], } diff --git a/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts b/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts index 703a1e557e801..0dcf828048a07 100644 --- a/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts +++ b/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts @@ -30,7 +30,7 @@ export function buildSearchBody( useNewFieldsApi: boolean ): Record { const computedFields = indexPattern.getComputedFields(); - + const runtimeFields = indexPattern.getComputedFields().runtimeFields; return { query: { ids: { @@ -42,6 +42,7 @@ export function buildSearchBody( fields: useNewFieldsApi ? [{ field: '*', include_unmapped: 'true' }] : undefined, script_fields: computedFields.scriptFields, docvalue_fields: computedFields.docvalueFields, + runtime_mappings: useNewFieldsApi && runtimeFields ? runtimeFields : {}, // needed for index pattern runtime fields in a single doc view }; } diff --git a/src/plugins/discover/public/application/components/sidebar/discover_field.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field.tsx index a630ddda40f30..a53809cfa2c7e 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_field.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field.tsx @@ -72,7 +72,17 @@ export interface DiscoverFieldProps { multiFields?: Array<{ field: IndexPatternField; isSelected: boolean }>; + /** + * Callback to edit a runtime field from index pattern + * @param fieldName name of the field to edit + */ onEditField?: (fieldName: string) => void; + + /** + * Callback to delete a runtime field from index pattern + * @param fieldName name of the field to delete + */ + onDeleteField?: (fieldName: string) => void; } export function DiscoverField({ @@ -87,6 +97,7 @@ export function DiscoverField({ trackUiMetric, multiFields, onEditField, + onDeleteField, }: DiscoverFieldProps) { const addLabelAria = i18n.translate('discover.fieldChooser.discoverField.addButtonAriaLabel', { defaultMessage: 'Add {field} to table', @@ -255,6 +266,7 @@ export function DiscoverField({ }; const fieldInfoIcon = getFieldInfoIcon(); + const shouldRenderMultiFields = !!multiFields; const renderMultiFields = () => { if (!multiFields) { @@ -289,13 +301,15 @@ export function DiscoverField({ const isRuntimeField = Boolean(indexPattern.getFieldByName(field.name)?.runtimeField); const isUnknownField = field.type === 'unknown' || field.type === 'unknown_selected'; const canEditField = onEditField && (!isUnknownField || isRuntimeField); - const displayNameGrow = canEditField ? 9 : 10; + const canDeleteField = onDeleteField && isRuntimeField; const popoverTitle = ( - - {field.displayName} + + +
{field.displayName}
+
{canEditField && ( - + { if (onEditField) { @@ -311,6 +325,29 @@ export function DiscoverField({ /> )} + {canDeleteField && ( + + + { + if (onDeleteField) { + onDeleteField(field.name); + } + }} + iconType="trash" + data-test-subj={`discoverFieldListPanelDelete-${field.name}`} + color="danger" + aria-label={i18n.translate('discover.fieldChooser.discoverField.deleteFieldLabel', { + defaultMessage: 'Delete index pattern field', + })} + /> + + + )}
); diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.scss b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.scss index aaf1743653d7d..4540a945d4884 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.scss +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.scss @@ -69,3 +69,7 @@ opacity: 1; /* 2 */ } } + +.dscSidebar__indexPatternSwitcher { + min-width: 0; +} diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx index a3bf2e150d088..d97f98b9e054f 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx @@ -19,6 +19,10 @@ import { EuiSpacer, EuiNotificationBadge, EuiPageSideBar, + EuiContextMenuPanel, + EuiContextMenuItem, + EuiPopover, + EuiButtonIcon, useResizeObserver, } from '@elastic/eui'; @@ -51,7 +55,7 @@ export interface DiscoverSidebarProps extends DiscoverSidebarResponsiveProps { setFieldFilter: (next: FieldFilterState) => void; /** - * Callback to close the flyout sidebar rendered in a flyout, close flyout + * Callback to close the flyout if sidebar is rendered in a flyout */ closeFlyout?: () => void; @@ -88,7 +92,8 @@ export function DiscoverSidebar({ closeFlyout, }: DiscoverSidebarProps) { const [fields, setFields] = useState(null); - const { indexPatternFieldEditor } = services; + const [isAddIndexPatternFieldPopoverOpen, setIsAddIndexPatternFieldPopoverOpen] = useState(false); + const { indexPatternFieldEditor, core } = services; const indexPatternFieldEditPermission = indexPatternFieldEditor?.userPermissions.editIndexPattern(); const canEditIndexPatternField = !!indexPatternFieldEditPermission && useNewFieldsApi; const [scrollContainer, setScrollContainer] = useState(null); @@ -224,6 +229,37 @@ export function DiscoverSidebar({ return map; }, [fields, useNewFieldsApi, selectedFields]); + const deleteField = useMemo( + () => + canEditIndexPatternField && selectedIndexPattern + ? async (fieldName: string) => { + const ref = indexPatternFieldEditor.openDeleteModal({ + ctx: { + indexPattern: selectedIndexPattern, + }, + fieldName, + onDelete: async () => { + onEditRuntimeField(); + }, + }); + if (setFieldEditorRef) { + setFieldEditorRef(ref); + } + if (closeFlyout) { + closeFlyout(); + } + } + : undefined, + [ + selectedIndexPattern, + canEditIndexPatternField, + setFieldEditorRef, + closeFlyout, + onEditRuntimeField, + indexPatternFieldEditor, + ] + ); + const getPaginated = useCallback( (list) => { return list.slice(0, fieldsToRender); @@ -237,7 +273,7 @@ export function DiscoverSidebar({ return null; } - const editField = (fieldName: string) => { + const editField = (fieldName?: string) => { if (!canEditIndexPatternField) { return; } @@ -258,6 +294,10 @@ export function DiscoverSidebar({ } }; + const addField = () => { + editField(undefined); + }; + if (useFlyout) { return (
{ + setIsAddIndexPatternFieldPopoverOpen(false); + }} + ownFocus + data-test-subj="discover-addRuntimeField-popover" + button={ + { + setIsAddIndexPatternFieldPopoverOpen(!isAddIndexPatternFieldPopoverOpen); + }} + /> + } + > + { + setIsAddIndexPatternFieldPopoverOpen(false); + addField(); + }} + > + {i18n.translate('discover.fieldChooser.indexPatterns.addFieldButton', { + defaultMessage: 'Add field to index pattern', + })} + , + { + setIsAddIndexPatternFieldPopoverOpen(false); + core.application.navigateToApp('management', { + path: `/kibana/indexPatterns/patterns/${selectedIndexPattern.id}`, + }); + }} + > + {i18n.translate('discover.fieldChooser.indexPatterns.manageFieldButton', { + defaultMessage: 'Manage index pattern fields', + })} + , + ]} + /> + + ); + return ( - o.attributes.title)} - indexPatterns={indexPatterns} - state={state} - setAppState={setAppState} - /> + + + o.attributes.title)} + indexPatterns={indexPatterns} + state={state} + setAppState={setAppState} + /> + + {useNewFieldsApi && {indexPatternActions}} +
@@ -370,6 +473,7 @@ export function DiscoverSidebar({ trackUiMetric={trackUiMetric} multiFields={multiFields?.get(field.name)} onEditField={canEditIndexPatternField ? editField : undefined} + onDeleteField={canEditIndexPatternField ? deleteField : undefined} /> ); @@ -428,6 +532,7 @@ export function DiscoverSidebar({ trackUiMetric={trackUiMetric} multiFields={multiFields?.get(field.name)} onEditField={canEditIndexPatternField ? editField : undefined} + onDeleteField={canEditIndexPatternField ? deleteField : undefined} /> ); @@ -455,6 +560,7 @@ export function DiscoverSidebar({ trackUiMetric={trackUiMetric} multiFields={multiFields?.get(field.name)} onEditField={canEditIndexPatternField ? editField : undefined} + onDeleteField={canEditIndexPatternField ? deleteField : undefined} /> ); diff --git a/test/functional/apps/discover/_runtime_fields_editor.ts b/test/functional/apps/discover/_runtime_fields_editor.ts index 729ad08db81aa..7df697a2e7a3a 100644 --- a/test/functional/apps/discover/_runtime_fields_editor.ts +++ b/test/functional/apps/discover/_runtime_fields_editor.ts @@ -11,6 +11,9 @@ import { FtrProviderContext } from './ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const log = getService('log'); + const retry = getService('retry'); + const docTable = getService('docTable'); + const testSubjects = getService('testSubjects'); const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); const fieldEditor = getService('fieldEditor'); @@ -19,6 +22,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { defaultIndex: 'logstash-*', 'discover:searchFieldsFromSource': false, }; + + const createRuntimeField = async (fieldName: string) => { + await PageObjects.discover.clickIndexPatternActions(); + await PageObjects.discover.clickAddNewField(); + await fieldEditor.setName(fieldName); + await fieldEditor.enableValue(); + await fieldEditor.typeScript("emit('abc')"); + await fieldEditor.save(); + }; + describe('discover integration with runtime fields editor', function describeIndexTests() { before(async function () { await esArchiver.load('discover'); @@ -43,5 +56,68 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(await PageObjects.discover.getDocHeader()).to.have.string('megabytes'); expect((await PageObjects.discover.getAllFieldNames()).includes('megabytes')).to.be(true); }); + + it('allows creation of a new field', async function () { + await createRuntimeField('runtimefield'); + await PageObjects.header.waitUntilLoadingHasFinished(); + expect((await PageObjects.discover.getAllFieldNames()).includes('runtimefield')).to.be(true); + }); + + it('allows editing of a newly created field', async function () { + await PageObjects.discover.editField('runtimefield'); + await fieldEditor.setName('runtimefield edited'); + await fieldEditor.save(); + await fieldEditor.confirmSave(); + await PageObjects.header.waitUntilLoadingHasFinished(); + expect((await PageObjects.discover.getAllFieldNames()).includes('runtimefield')).to.be(false); + expect((await PageObjects.discover.getAllFieldNames()).includes('runtimefield edited')).to.be( + true + ); + }); + + it('allows creation of a new field and use it in a saved search', async function () { + await createRuntimeField('discover runtimefield'); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.clickFieldListItemAdd('discover runtimefield'); + expect(await PageObjects.discover.getDocHeader()).to.have.string('discover runtimefield'); + expect(await PageObjects.discover.saveSearch('Saved Search with runtimefield')); + await PageObjects.header.waitUntilLoadingHasFinished(); + + await PageObjects.discover.clickNewSearchButton(); + await PageObjects.header.waitUntilLoadingHasFinished(); + + await PageObjects.discover.loadSavedSearch('Saved Search with runtimefield'); + await PageObjects.header.waitUntilLoadingHasFinished(); + expect(await PageObjects.discover.getDocHeader()).to.have.string('discover runtimefield'); + }); + + it('deletes a runtime field', async function () { + await createRuntimeField('delete'); + await PageObjects.header.waitUntilLoadingHasFinished(); + + await PageObjects.discover.removeField('delete'); + await fieldEditor.confirmDelete(); + await PageObjects.header.waitUntilLoadingHasFinished(); + expect((await PageObjects.discover.getAllFieldNames()).includes('delete')).to.be(false); + }); + + it('doc view includes runtime fields', async function () { + // navigate to doc view + await docTable.clickRowToggle({ rowIndex: 0 }); + + // click the open action + await retry.try(async () => { + const rowActions = await docTable.getRowActions({ rowIndex: 0 }); + if (!rowActions.length) { + throw new Error('row actions empty, trying again'); + } + await rowActions[1].click(); + }); + + const hasDocHit = await testSubjects.exists('doc-hit'); + expect(hasDocHit).to.be(true); + const runtimeFieldsRow = await testSubjects.exists('tableDocViewRow-discover runtimefield'); + expect(runtimeFieldsRow).to.be(true); + }); }); } diff --git a/test/functional/page_objects/discover_page.ts b/test/functional/page_objects/discover_page.ts index b4042e7072d7f..62375a39dd7d3 100644 --- a/test/functional/page_objects/discover_page.ts +++ b/test/functional/page_objects/discover_page.ts @@ -263,6 +263,26 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider }); } + public async removeField(field: string) { + await testSubjects.click(`field-${field}`); + await testSubjects.click(`discoverFieldListPanelDelete-${field}`); + await testSubjects.existOrFail('runtimeFieldDeleteConfirmModal'); + } + + public async clickIndexPatternActions() { + await retry.try(async () => { + await testSubjects.click('discoverIndexPatternActions'); + await testSubjects.existOrFail('discover-addRuntimeField-popover'); + }); + } + + public async clickAddNewField() { + await retry.try(async () => { + await testSubjects.click('indexPattern-add-field'); + await find.byClassName('indexPatternFieldEditor__form'); + }); + } + public async hasNoResults() { return await testSubjects.exists('discoverNoResults'); } From 1a7095365ac5662be69641832b8bc89a7e798ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 15 Apr 2021 13:28:26 +0200 Subject: [PATCH 04/68] [Logs UI] Allow for missing properties on ES shard failure responses (#96768) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../infra/common/search_strategies/common/errors.ts | 8 ++++---- .../server/utils/elasticsearch_runtime_types.ts | 12 ++++++------ .../infra/server/utils/typed_search_strategy.ts | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/infra/common/search_strategies/common/errors.ts b/x-pack/plugins/infra/common/search_strategies/common/errors.ts index 6cc8f0d4242f3..4114af07619dc 100644 --- a/x-pack/plugins/infra/common/search_strategies/common/errors.ts +++ b/x-pack/plugins/infra/common/search_strategies/common/errors.ts @@ -25,11 +25,11 @@ export type GenericSearchStrategyError = rt.TypeOf; diff --git a/x-pack/plugins/infra/server/utils/elasticsearch_runtime_types.ts b/x-pack/plugins/infra/server/utils/elasticsearch_runtime_types.ts index b0e4685f5b923..e2dbf02ae2d06 100644 --- a/x-pack/plugins/infra/server/utils/elasticsearch_runtime_types.ts +++ b/x-pack/plugins/infra/server/utils/elasticsearch_runtime_types.ts @@ -7,12 +7,12 @@ import * as rt from 'io-ts'; -export const shardFailureRT = rt.type({ - index: rt.string, - node: rt.string, - reason: rt.type({ - reason: rt.string, - type: rt.string, +export const shardFailureRT = rt.partial({ + index: rt.union([rt.string, rt.null]), + node: rt.union([rt.string, rt.null]), + reason: rt.partial({ + reason: rt.union([rt.string, rt.null]), + type: rt.union([rt.string, rt.null]), }), shard: rt.number, }); diff --git a/x-pack/plugins/infra/server/utils/typed_search_strategy.ts b/x-pack/plugins/infra/server/utils/typed_search_strategy.ts index 358eda6375f1d..546fd90a2da50 100644 --- a/x-pack/plugins/infra/server/utils/typed_search_strategy.ts +++ b/x-pack/plugins/infra/server/utils/typed_search_strategy.ts @@ -51,9 +51,9 @@ export const createAsyncRequestRTs = ({ type: 'shardFailure' as const, shardInfo: { - index: failure.index, - node: failure.node, - shard: failure.shard, + index: failure.index ?? null, + node: failure.node ?? null, + shard: failure.shard ?? null, }, - message: failure.reason.reason, + message: failure.reason?.reason ?? null, }); From 198be4cb8cdab2b97ccaa026e94bb059744b061e Mon Sep 17 00:00:00 2001 From: Dmitry Tomashevich <39378793+Dmitriynj@users.noreply.github.com> Date: Thu, 15 Apr 2021 15:11:16 +0300 Subject: [PATCH 05/68] [TSVB] fix not populating fields list if "Auto apply" is off (#96298) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../application/components/vis_editor.tsx | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/plugins/vis_type_timeseries/public/application/components/vis_editor.tsx b/src/plugins/vis_type_timeseries/public/application/components/vis_editor.tsx index 90b7ccaa14d86..c809a4d4a21f0 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/vis_editor.tsx +++ b/src/plugins/vis_type_timeseries/public/application/components/vis_editor.tsx @@ -97,19 +97,6 @@ export class VisEditor extends Component { - this.setState({ - visFields, - extractedIndexPatterns, - }); - }); - } }, VIS_STATE_DEBOUNCE_DELAY); abortableFetchFields = (extractedIndexPatterns: IndexPatternValue[]) => { @@ -124,10 +111,6 @@ export class VisEditor extends Component { + this.setState({ + visFields, + extractedIndexPatterns, + }); + }); + } + this.setState({ dirty, model: nextModel, From d5a4a708f9450eef38291defb6df75c6a0d5210b Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Thu, 15 Apr 2021 14:15:10 +0200 Subject: [PATCH 06/68] [ML] Functional tests - stabilize swim lane pagination test (#97214) This PR stabilizes the swim lane pagination test by adding a retry to the assertion. --- .../apps/ml/anomaly_detection/anomaly_explorer.ts | 4 +--- x-pack/test/functional/services/ml/swim_lane.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts b/x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts index c86a875be6416..66d45c801b81a 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts @@ -5,7 +5,6 @@ * 2.0. */ -import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { Job, Datafeed } from '../../../../../plugins/ml/common/types/anomaly_detection_jobs'; @@ -235,8 +234,7 @@ export default function ({ getService }: FtrProviderContext) { await ml.testExecution.logTestStep('updates pagination'); await ml.swimLane.setPageSize(viewBySwimLaneTestSubj, 5); - const axisLabels = await ml.swimLane.getAxisLabels(viewBySwimLaneTestSubj, 'y'); - expect(axisLabels.length).to.eql(5); + await ml.swimLane.assertAxisLabelCount(viewBySwimLaneTestSubj, 'y', 5); await ml.swimLane.selectPage(viewBySwimLaneTestSubj, 3); diff --git a/x-pack/test/functional/services/ml/swim_lane.ts b/x-pack/test/functional/services/ml/swim_lane.ts index 29918b83cd276..ac9568987286b 100644 --- a/x-pack/test/functional/services/ml/swim_lane.ts +++ b/x-pack/test/functional/services/ml/swim_lane.ts @@ -17,6 +17,7 @@ export function SwimLaneProvider({ getService }: FtrProviderContext) { const elasticChart = getService('elasticChart'); const browser = getService('browser'); const testSubjects = getService('testSubjects'); + const retry = getService('retry'); /** * Y axis labels width + padding @@ -90,6 +91,16 @@ export function SwimLaneProvider({ getService }: FtrProviderContext) { ); }, + async assertAxisLabelCount(testSubj: string, axis: 'x' | 'y', expectedCount: number) { + await retry.tryForTime(5000, async () => { + const actualValues = await this.getAxisLabels(testSubj, axis); + expect(actualValues.length).to.eql( + expectedCount, + `Expected swim lane ${axis} label count to be ${expectedCount}, got ${actualValues}` + ); + }); + }, + async getCells(testSubj: string): Promise { const state = await this.getDebugState(testSubj); return state.heatmap.cells; From dd142b92ae1176a09cf8773b22fe407ca47d002c Mon Sep 17 00:00:00 2001 From: Marco Liberati Date: Thu, 15 Apr 2021 14:29:40 +0200 Subject: [PATCH 07/68] [Lens] Close dimension panel on escape key (#96783) * :sparkles: Close panel on escape key * :ok_hand: Stabilize callback ref Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../config_panel/dimension_container.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/dimension_container.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/dimension_container.tsx index 574cd4029223c..f66e8ba87e8e8 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/dimension_container.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/dimension_container.tsx @@ -7,7 +7,7 @@ import './dimension_container.scss'; -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useCallback } from 'react'; import { EuiFlyoutHeader, EuiFlyoutFooter, @@ -18,6 +18,8 @@ import { EuiFlexItem, EuiFocusTrap, EuiOutsideClickDetector, + EuiWindowEvent, + keys, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -35,10 +37,10 @@ export function DimensionContainer({ }) { const [focusTrapIsEnabled, setFocusTrapIsEnabled] = useState(false); - const closeFlyout = () => { + const closeFlyout = useCallback(() => { handleClose(); setFocusTrapIsEnabled(false); - }; + }, [handleClose]); useEffect(() => { if (isOpen) { @@ -49,8 +51,19 @@ export function DimensionContainer({ } }, [isOpen]); + const closeOnEscape = useCallback( + (event: KeyboardEvent) => { + if (event.key === keys.ESCAPE) { + event.preventDefault(); + closeFlyout(); + } + }, + [closeFlyout] + ); + return isOpen ? ( +
Date: Thu, 15 Apr 2021 08:34:19 -0400 Subject: [PATCH 08/68] [Metrics UI] handle ES query errors in snapshot endpoint, improve UI error messaging (#96871) * handle es errors in snapshot api, show error message as toast danger in UI * use err.message if no err.body.message * use updated handleEsError --- .../infra/public/hooks/use_http_request.tsx | 12 ++++++--- .../plugins/infra/server/lib/infra_types.ts | 2 ++ x-pack/plugins/infra/server/plugin.ts | 2 ++ .../infra/server/routes/snapshot/index.ts | 27 ++++++++++--------- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/infra/public/hooks/use_http_request.tsx b/x-pack/plugins/infra/public/hooks/use_http_request.tsx index 52ca5f09a4e03..7e72865214618 100644 --- a/x-pack/plugins/infra/public/hooks/use_http_request.tsx +++ b/x-pack/plugins/infra/public/hooks/use_http_request.tsx @@ -19,11 +19,11 @@ export function useHTTPRequest( body?: string | null, decode: (response: any) => Response = (response) => response, fetch?: HttpHandler, - toastWarning?: (input: ToastInput) => void + toastDanger?: (input: ToastInput) => void ) { const kibana = useKibana(); const fetchService = fetch ? fetch : kibana.services.http?.fetch; - const toast = toastWarning ? toastWarning : kibana.notifications.toasts.warning; + const toast = toastDanger ? toastDanger : kibana.notifications.toasts.danger; const [response, setResponse] = useState(null); const [error, setError] = useState(null); const [request, makeRequest] = useTrackedPromise( @@ -66,9 +66,15 @@ export function useHTTPRequest( })} {err.response?.url} +
+ {i18n.translate('xpack.infra.useHTTPRequest.error.body.message', { + defaultMessage: `Message`, + })} +
+ {err.body?.message || err.message} ) : ( -
{err.message}
+
{err.body?.message || err.message}
)}
), diff --git a/x-pack/plugins/infra/server/lib/infra_types.ts b/x-pack/plugins/infra/server/lib/infra_types.ts index f338d7957a343..0c57ff2e05847 100644 --- a/x-pack/plugins/infra/server/lib/infra_types.ts +++ b/x-pack/plugins/infra/server/lib/infra_types.ts @@ -13,6 +13,7 @@ import { InfraSourceStatus } from './source_status'; import { InfraConfig } from '../plugin'; import { KibanaFramework } from './adapters/framework/kibana_framework_adapter'; import { GetLogQueryFields } from '../services/log_queries/get_log_query_fields'; +import { handleEsError } from '../../../../../src/plugins/es_ui_shared/server'; export interface InfraDomainLibs { fields: InfraFieldsDomain; @@ -26,4 +27,5 @@ export interface InfraBackendLibs extends InfraDomainLibs { sources: InfraSources; sourceStatus: InfraSourceStatus; getLogQueryFields: GetLogQueryFields; + handleEsError: typeof handleEsError; } diff --git a/x-pack/plugins/infra/server/plugin.ts b/x-pack/plugins/infra/server/plugin.ts index f818776fdf82c..cbffa0a11eae5 100644 --- a/x-pack/plugins/infra/server/plugin.ts +++ b/x-pack/plugins/infra/server/plugin.ts @@ -31,6 +31,7 @@ import { LogEntriesService } from './services/log_entries'; import { InfraPluginRequestHandlerContext } from './types'; import { UsageCollector } from './usage/usage_collector'; import { createGetLogQueryFields } from './services/log_queries/get_log_query_fields'; +import { handleEsError } from '../../../../src/plugins/es_ui_shared/server'; export const config = { schema: schema.object({ @@ -124,6 +125,7 @@ export class InfraServerPlugin implements Plugin { sourceStatus, ...domainLibs, getLogQueryFields: createGetLogQueryFields(sources), + handleEsError, }; plugins.features.registerKibanaFeature(METRICS_FEATURE); diff --git a/x-pack/plugins/infra/server/routes/snapshot/index.ts b/x-pack/plugins/infra/server/routes/snapshot/index.ts index c5394a02c1d04..0adb35bbfbf67 100644 --- a/x-pack/plugins/infra/server/routes/snapshot/index.ts +++ b/x-pack/plugins/infra/server/routes/snapshot/index.ts @@ -20,7 +20,7 @@ import { getNodes } from './lib/get_nodes'; const escapeHatch = schema.object({}, { unknowns: 'allow' }); export const initSnapshotRoute = (libs: InfraBackendLibs) => { - const { framework } = libs; + const { framework, handleEsError } = libs; framework.registerRoute( { @@ -49,17 +49,20 @@ export const initSnapshotRoute = (libs: InfraBackendLibs) => { UsageCollector.countNode(snapshotRequest.nodeType); const client = createSearchClient(requestContext, framework); - const snapshotResponse = await getNodes( - client, - snapshotRequest, - source, - logQueryFields, - compositeSize - ); - - return response.ok({ - body: SnapshotNodeResponseRT.encode(snapshotResponse), - }); + try { + const snapshotResponse = await getNodes( + client, + snapshotRequest, + source, + logQueryFields, + compositeSize + ); + return response.ok({ + body: SnapshotNodeResponseRT.encode(snapshotResponse), + }); + } catch (err) { + return handleEsError({ error: err, response }); + } } ); }; From 1bd951cfa9b288cf8e947b7327022ce01cf10ae3 Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Thu, 15 Apr 2021 08:42:07 -0400 Subject: [PATCH 09/68] [Uptime] - Synthetics add transfer size, resource size, and status to waterfall flyout (#97042) --- .../translations/translations/ja-JP.json | 3 +-- .../translations/translations/zh-CN.json | 3 +-- .../common/runtime_types/network_events.ts | 3 ++- .../waterfall/data_formatting.test.ts | 17 +++++++++++--- .../step_detail/waterfall/data_formatting.ts | 16 +++++++++++--- .../synthetics/step_detail/waterfall/types.ts | 22 +++++++++++++++---- .../lib/requests/get_network_events.test.ts | 5 ++++- .../server/lib/requests/get_network_events.ts | 3 ++- 8 files changed, 55 insertions(+), 17 deletions(-) diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 4aefde08931bb..b567d9effe1b7 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -23079,7 +23079,6 @@ "xpack.uptime.synthetics.waterfall.resource.externalLink": "新しいタブでリソースを開く", "xpack.uptime.synthetics.waterfall.searchBox.placeholder": "ネットワーク要求をフィルター", "xpack.uptime.synthetics.waterfall.sidebar.filterMatchesScreenReaderLabel": "リソースがフィルターと一致します", - "xpack.uptime.synthetics.waterfallChart.labels.metadata.bytesDownloadedCompressed": "ダウンロードバイト数 (圧縮) ", "xpack.uptime.synthetics.waterfallChart.labels.metadata.certificateExpiryDate": "有効期限:", "xpack.uptime.synthetics.waterfallChart.labels.metadata.certificateIssueDate": "有効期間の開始", "xpack.uptime.synthetics.waterfallChart.labels.metadata.certificateIssuer": "発行者", @@ -23485,4 +23484,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "フィールドを選択してください。", "xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。" } -} +} \ No newline at end of file diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 05a05aab64900..c9c653e33b905 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -23437,7 +23437,6 @@ "xpack.uptime.synthetics.waterfall.resource.externalLink": "在新选项卡中打开资源", "xpack.uptime.synthetics.waterfall.searchBox.placeholder": "筛选网络请求", "xpack.uptime.synthetics.waterfall.sidebar.filterMatchesScreenReaderLabel": "资源匹配筛选", - "xpack.uptime.synthetics.waterfallChart.labels.metadata.bytesDownloadedCompressed": "已下载字节 (压缩) ", "xpack.uptime.synthetics.waterfallChart.labels.metadata.certificateExpiryDate": "失效日期", "xpack.uptime.synthetics.waterfallChart.labels.metadata.certificateIssueDate": "有效起始日期", "xpack.uptime.synthetics.waterfallChart.labels.metadata.certificateIssuer": "颁发者", @@ -23853,4 +23852,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "此字段必填。", "xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。" } -} +} \ No newline at end of file diff --git a/x-pack/plugins/uptime/common/runtime_types/network_events.ts b/x-pack/plugins/uptime/common/runtime_types/network_events.ts index e896a165916fc..d24014aec8eab 100644 --- a/x-pack/plugins/uptime/common/runtime_types/network_events.ts +++ b/x-pack/plugins/uptime/common/runtime_types/network_events.ts @@ -35,7 +35,6 @@ const NetworkEventType = t.intersection([ url: t.string, }), t.partial({ - bytesDownloadedCompressed: t.number, certificates: CertificateDataType, ip: t.string, method: t.string, @@ -44,6 +43,8 @@ const NetworkEventType = t.intersection([ responseHeaders: t.record(t.string, t.string), requestHeaders: t.record(t.string, t.string), timings: NetworkTimingsType, + transferSize: t.number, + resourceSize: t.number, }), ]); diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts b/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts index 23270b1a8dd5b..ebb6eb6bdc989 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts @@ -43,7 +43,8 @@ export const networkItems: NetworkItems = [ ssl: 55.38700000033714, dns: 3.559999997378327, }, - bytesDownloadedCompressed: 1000, + resourceSize: 1000, + transferSize: 1000, requestHeaders: { sample_request_header: 'sample request header', }, @@ -544,6 +545,10 @@ describe('getSeriesAndDomain', () => { Object { "certificates": undefined, "details": Array [ + Object { + "name": "Status", + "value": undefined, + }, Object { "name": "Content type", "value": "text/javascript", @@ -573,7 +578,11 @@ describe('getSeriesAndDomain', () => { "value": undefined, }, Object { - "name": "Bytes downloaded (compressed)", + "name": "Resource size", + "value": undefined, + }, + Object { + "name": "Transfer size", "value": undefined, }, Object { @@ -640,6 +649,7 @@ describe('getSeriesAndDomain', () => { }); it.each([ + [FriendlyFlyoutLabels[Metadata.Status], '200'], [FriendlyFlyoutLabels[Metadata.MimeType], 'text/css'], [FriendlyFlyoutLabels[Metadata.RequestStart], '0.000 ms'], [FriendlyTimingLabels[Timings.Dns], '3.560 ms'], @@ -647,7 +657,8 @@ describe('getSeriesAndDomain', () => { [FriendlyTimingLabels[Timings.Ssl], '55.387 ms'], [FriendlyTimingLabels[Timings.Wait], '34.578 ms'], [FriendlyTimingLabels[Timings.Receive], '0.552 ms'], - [FriendlyFlyoutLabels[Metadata.BytesDownloadedCompressed], '1.000 KB'], + [FriendlyFlyoutLabels[Metadata.TransferSize], '1.000 KB'], + [FriendlyFlyoutLabels[Metadata.ResourceSize], '1.000 KB'], [FriendlyFlyoutLabels[Metadata.IP], '104.18.8.22'], ])('handles metadata details formatting', (name, value) => { const { metadata } = getSeriesAndDomain(networkItems); diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts b/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts index 23d9b2d8563ae..f497bf1ea7b35 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts @@ -239,13 +239,15 @@ const formatMetadata = ({ requestStart: number; }) => { const { - bytesDownloadedCompressed, certificates, ip, mimeType, requestHeaders, responseHeaders, url, + resourceSize, + transferSize, + status, } = item; const { dns, connect, ssl, wait, receive, total } = item.timings || {}; const contentDownloaded = receive && receive > 0 ? receive : total; @@ -277,6 +279,7 @@ const formatMetadata = ({ ] : undefined, details: [ + { name: FriendlyFlyoutLabels[Metadata.Status], value: status ? `${status}` : undefined }, { name: FriendlyFlyoutLabels[Metadata.MimeType], value: mimeType }, { name: FriendlyFlyoutLabels[Metadata.RequestStart], @@ -306,9 +309,16 @@ const formatMetadata = ({ }), }, { - name: FriendlyFlyoutLabels[Metadata.BytesDownloadedCompressed], + name: FriendlyFlyoutLabels[Metadata.ResourceSize], value: getFriendlyMetadataValue({ - value: bytesDownloadedCompressed ? bytesDownloadedCompressed / 1000 : undefined, + value: resourceSize ? resourceSize / 1000 : undefined, + postFix: 'KB', + }), + }, + { + name: FriendlyFlyoutLabels[Metadata.TransferSize], + value: getFriendlyMetadataValue({ + value: transferSize ? transferSize / 1000 : undefined, postFix: 'KB', }), }, diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/types.ts b/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/types.ts index cedf9c667d0f2..e356297fdae38 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/types.ts +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/types.ts @@ -19,7 +19,9 @@ export enum Timings { } export enum Metadata { - BytesDownloadedCompressed = 'bytesDownloadedCompressed', + Status = 'status', + ResourceSize = 'resourceSize', + TransferSize = 'transferSize', CertificateIssuer = 'certificateIssuer', CertificateIssueDate = 'certificateIssueDate', CertificateExpiryDate = 'certificateExpiryDate', @@ -63,6 +65,12 @@ export const FriendlyTimingLabels = { }; export const FriendlyFlyoutLabels = { + [Metadata.Status]: i18n.translate( + 'xpack.uptime.synthetics.waterfallChart.labels.metadata.status', + { + defaultMessage: 'Status', + } + ), [Metadata.MimeType]: i18n.translate( 'xpack.uptime.synthetics.waterfallChart.labels.metadata.contentType', { @@ -75,10 +83,16 @@ export const FriendlyFlyoutLabels = { defaultMessage: 'Request start', } ), - [Metadata.BytesDownloadedCompressed]: i18n.translate( - 'xpack.uptime.synthetics.waterfallChart.labels.metadata.bytesDownloadedCompressed', + [Metadata.ResourceSize]: i18n.translate( + 'xpack.uptime.synthetics.waterfallChart.labels.metadata.resourceSize', + { + defaultMessage: 'Resource size', + } + ), + [Metadata.TransferSize]: i18n.translate( + 'xpack.uptime.synthetics.waterfallChart.labels.metadata.transferSize', { - defaultMessage: 'Bytes downloaded (compressed)', + defaultMessage: 'Transfer size', } ), [Metadata.CertificateIssuer]: i18n.translate( diff --git a/x-pack/plugins/uptime/server/lib/requests/get_network_events.test.ts b/x-pack/plugins/uptime/server/lib/requests/get_network_events.test.ts index d806606abcb13..b7f417168fd3a 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_network_events.test.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_network_events.test.ts @@ -66,6 +66,8 @@ describe('getNetworkEvents', () => { }, is_navigation_request: false, timestamp: 1607942799183375, + transfer_size: 1000, + resource_size: 1000, }, }, http: { @@ -242,7 +244,6 @@ describe('getNetworkEvents', () => { Object { "events": Array [ Object { - "bytesDownloadedCompressed": 337, "certificates": Object { "issuer": "DigiCert TLS RSA SHA256 2020 CA1", "subjectName": "syndication.twitter.com", @@ -258,6 +259,7 @@ describe('getNetworkEvents', () => { "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/88.0.4324.0 Safari/537.36", }, "requestSentTime": 3287154.973, + "resourceSize": 1000, "responseHeaders": Object { "cache_control": "no-cache, no-store, must-revalidate, pre-check=0, post-check=0", "content_encoding": "gzip", @@ -292,6 +294,7 @@ describe('getNetworkEvents', () => { "total": 143.27800000000934, "wait": 141.81299999972907, }, + "transferSize": 1000, "url": "www.test.com", }, ], diff --git a/x-pack/plugins/uptime/server/lib/requests/get_network_events.ts b/x-pack/plugins/uptime/server/lib/requests/get_network_events.ts index 2741062cc4038..2f45f633ba971 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_network_events.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_network_events.ts @@ -58,7 +58,8 @@ export const getNetworkEvents: UMElasticsearchQueryFn< requestSentTime, loadEndTime, timings: event._source.synthetics.payload.timings, - bytesDownloadedCompressed: event._source.http?.response?.encoded_data_length, + transferSize: event._source.synthetics.payload.transfer_size, + resourceSize: event._source.synthetics.payload.resource_size, certificates: securityDetails ? { issuer: securityDetails.issuer?.common_name, From fa959c9d239a01a7a72b74342ac2f17d141660e5 Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Thu, 15 Apr 2021 07:47:57 -0500 Subject: [PATCH 10/68] Index pattern management - fix runtime fields icon (#95117) * account for fields from saved object * use correct icon for runtime fields --- .../__snapshots__/indexed_fields_table.test.tsx.snap | 5 +++++ .../components/table/__snapshots__/table.test.tsx.snap | 6 +++++- .../indexed_fields_table/components/table/table.test.tsx | 6 ++++++ .../indexed_fields_table/components/table/table.tsx | 4 ++-- .../indexed_fields_table/indexed_fields_table.tsx | 1 + .../edit_index_pattern/indexed_fields_table/types.ts | 1 + 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/__snapshots__/indexed_fields_table.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/__snapshots__/indexed_fields_table.test.tsx.snap index 6e5e652b8d0eb..32a2b936edd00 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/__snapshots__/indexed_fields_table.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/__snapshots__/indexed_fields_table.test.tsx.snap @@ -20,6 +20,7 @@ exports[`IndexedFieldsTable should filter based on the query bar 1`] = ` ], "excluded": false, "format": "", + "hasRuntime": false, "info": Array [], "isMapped": false, "kbnType": undefined, @@ -53,6 +54,7 @@ exports[`IndexedFieldsTable should filter based on the type filter 1`] = ` ], "excluded": false, "format": "", + "hasRuntime": false, "info": Array [], "isMapped": false, "kbnType": undefined, @@ -85,6 +87,7 @@ exports[`IndexedFieldsTable should render normally 1`] = ` ], "excluded": false, "format": "", + "hasRuntime": false, "info": Array [], "isMapped": false, "kbnType": undefined, @@ -99,6 +102,7 @@ exports[`IndexedFieldsTable should render normally 1`] = ` ], "excluded": false, "format": "", + "hasRuntime": false, "info": Array [], "isMapped": false, "kbnType": undefined, @@ -113,6 +117,7 @@ exports[`IndexedFieldsTable should render normally 1`] = ` ], "excluded": false, "format": "", + "hasRuntime": false, "info": Array [], "isMapped": false, "kbnType": undefined, diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/__snapshots__/table.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/__snapshots__/table.test.tsx.snap index bd6af083675ea..fc436faa6c755 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/__snapshots__/table.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/__snapshots__/table.test.tsx.snap @@ -18,7 +18,7 @@ exports[`Table render name 2`] = ` } title="Runtime field" - type="indexSettings" + type="indexRuntime" /> @@ -139,6 +139,7 @@ exports[`Table should render normally 1`] = ` "displayName": "Elastic", "excluded": false, "format": "", + "hasRuntime": false, "info": Array [], "isMapped": true, "kbnType": "string", @@ -150,6 +151,7 @@ exports[`Table should render normally 1`] = ` "displayName": "timestamp", "excluded": false, "format": "YYYY-MM-DD", + "hasRuntime": false, "info": Array [], "isMapped": true, "kbnType": "date", @@ -160,6 +162,7 @@ exports[`Table should render normally 1`] = ` "displayName": "conflictingField", "excluded": false, "format": "", + "hasRuntime": false, "info": Array [], "isMapped": true, "kbnType": "conflict", @@ -169,6 +172,7 @@ exports[`Table should render normally 1`] = ` Object { "displayName": "customer", "excluded": false, + "hasRuntime": true, "info": Array [], "isMapped": false, "kbnType": "text", diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.test.tsx index 76ffe61234e34..b9957534d8c69 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.test.tsx @@ -27,6 +27,7 @@ const items: IndexedFieldItem[] = [ excluded: false, format: '', isMapped: true, + hasRuntime: false, }, { name: 'timestamp', @@ -37,6 +38,7 @@ const items: IndexedFieldItem[] = [ excluded: false, format: 'YYYY-MM-DD', isMapped: true, + hasRuntime: false, }, { name: 'conflictingField', @@ -47,6 +49,7 @@ const items: IndexedFieldItem[] = [ excluded: false, format: '', isMapped: true, + hasRuntime: false, }, { name: 'customer', @@ -56,6 +59,7 @@ const items: IndexedFieldItem[] = [ info: [], excluded: false, isMapped: false, + hasRuntime: true, }, ]; @@ -121,6 +125,7 @@ describe('Table', () => { kbnType: 'string', type: 'keyword', isMapped: true, + hasRuntime: false, }; expect(renderFieldName(mappedField)).toMatchSnapshot(); @@ -132,6 +137,7 @@ describe('Table', () => { kbnType: 'string', type: 'keyword', isMapped: false, + hasRuntime: true, }; expect(renderFieldName(runtimeField)).toMatchSnapshot(); diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.tsx index 2b8a18cc67c64..9448571facd43 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/components/table/table.tsx @@ -201,11 +201,11 @@ export const renderFieldName = (field: IndexedFieldItem, timeFieldName?: string) /> ) : null} - {!field.isMapped ? ( + {!field.isMapped && field.hasRuntime ? (   {runtimeIconTipText}} /> diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx index c703a882d38d6..ee1147997079f 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx @@ -68,6 +68,7 @@ export class IndexedFieldsTable extends Component< excluded: fieldWildcardMatch ? fieldWildcardMatch(field.name) : false, info: helpers.getFieldInfo && helpers.getFieldInfo(indexPattern, field), isMapped: !!field.isMapped, + hasRuntime: !!field.runtimeField, }; })) || [] diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts index 47ae84b4d2fd8..4454651eff30a 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts @@ -13,4 +13,5 @@ export interface IndexedFieldItem extends IFieldType { excluded: boolean; kbnType: string; isMapped: boolean; + hasRuntime: boolean; } From cbf24cd640b84c736e05e7caa48a05f089ee4949 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Thu, 15 Apr 2021 14:49:55 +0200 Subject: [PATCH 11/68] [Lens] Open lens in new tab via state transfer (#96723) --- ...plugin-core-public.navigatetoappoptions.md | 1 + ...mbeddablestatetransfer.navigatetoeditor.md | 3 +- .../application/application_service.tsx | 15 ++++++++-- src/core/public/application/types.ts | 5 ++++ src/core/public/public.api.md | 1 + .../embeddable_state_transfer.ts | 5 ++-- src/plugins/embeddable/public/public.api.md | 1 + .../embedded_lens_example/public/app.tsx | 14 +++++---- x-pack/plugins/lens/common/constants.test.ts | 30 +++++++++++++++++++ x-pack/plugins/lens/common/constants.ts | 17 +++++++++-- x-pack/plugins/lens/public/plugin.ts | 10 ++++--- .../exploratory_view/header/header.test.tsx | 17 ++++++----- .../shared/exploratory_view/header/header.tsx | 13 ++++---- 13 files changed, 104 insertions(+), 28 deletions(-) create mode 100644 x-pack/plugins/lens/common/constants.test.ts diff --git a/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.md b/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.md index b7c01fae4314f..79b59a19508e7 100644 --- a/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.md @@ -16,6 +16,7 @@ export interface NavigateToAppOptions | Property | Type | Description | | --- | --- | --- | +| [openInNewTab](./kibana-plugin-core-public.navigatetoappoptions.openinnewtab.md) | boolean | if true, will open the app in new tab, will share session information via window.open if base | | [path](./kibana-plugin-core-public.navigatetoappoptions.path.md) | string | optional path inside application to deep link to. If undefined, will use [the app's default path](./kibana-plugin-core-public.app.defaultpath.md)\` as default. | | [replace](./kibana-plugin-core-public.navigatetoappoptions.replace.md) | boolean | if true, will not create a new history entry when navigating (using replace instead of push) | | [state](./kibana-plugin-core-public.navigatetoappoptions.state.md) | unknown | optional state to forward to the application | diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablestatetransfer.navigatetoeditor.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablestatetransfer.navigatetoeditor.md index 4bd5f44084a33..fe7eac0915419 100644 --- a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablestatetransfer.navigatetoeditor.md +++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablestatetransfer.navigatetoeditor.md @@ -11,6 +11,7 @@ A wrapper around the method which navigates to the specified appId with [embedd ```typescript navigateToEditor(appId: string, options?: { path?: string; + openInNewTab?: boolean; state: EmbeddableEditorState; }): Promise; ``` @@ -20,7 +21,7 @@ navigateToEditor(appId: string, options?: { | Parameter | Type | Description | | --- | --- | --- | | appId | string | | -| options | {
path?: string;
state: EmbeddableEditorState;
} | | +| options | {
path?: string;
openInNewTab?: boolean;
state: EmbeddableEditorState;
} | | Returns: diff --git a/src/core/public/application/application_service.tsx b/src/core/public/application/application_service.tsx index 5e999ff94b9ce..4a93c98205b84 100644 --- a/src/core/public/application/application_service.tsx +++ b/src/core/public/application/application_service.tsx @@ -92,6 +92,7 @@ export class ApplicationService { private registrationClosed = false; private history?: History; private navigate?: (url: string, state: unknown, replace: boolean) => void; + private openInNewTab?: (url: string) => void; private redirectTo?: (url: string) => void; private overlayStart$ = new Subject(); @@ -117,6 +118,11 @@ export class ApplicationService { return replace ? this.history!.replace(url, state) : this.history!.push(url, state); }; + this.openInNewTab = (url) => { + // window.open shares session information if base url is same + return window.open(appendAppPath(basename, url), '_blank'); + }; + this.redirectTo = redirectTo; const registerStatusUpdater = (application: string, updater$: Observable) => { @@ -218,7 +224,7 @@ export class ApplicationService { const navigateToApp: InternalApplicationStart['navigateToApp'] = async ( appId, - { path, state, replace = false }: NavigateToAppOptions = {} + { path, state, replace = false, openInNewTab = false }: NavigateToAppOptions = {} ) => { const currentAppId = this.currentAppId$.value; const navigatingToSameApp = currentAppId === appId; @@ -233,7 +239,12 @@ export class ApplicationService { if (!navigatingToSameApp) { this.appInternalStates.delete(this.currentAppId$.value!); } - this.navigate!(getAppUrl(availableMounters, appId, path), state, replace); + if (openInNewTab) { + this.openInNewTab!(getAppUrl(availableMounters, appId, path)); + } else { + this.navigate!(getAppUrl(availableMounters, appId, path), state, replace); + } + this.currentAppId$.next(appId); } }; diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index 3e5a255f9ecde..24f46752f28e5 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -685,6 +685,11 @@ export interface NavigateToAppOptions { * if true, will not create a new history entry when navigating (using `replace` instead of `push`) */ replace?: boolean; + + /** + * if true, will open the app in new tab, will share session information via window.open if base + */ + openInNewTab?: boolean; } /** @public */ diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 661ac51c4983c..8c1753c2cabab 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -932,6 +932,7 @@ export type MountPoint = (element: T) => Un // // @public export interface NavigateToAppOptions { + openInNewTab?: boolean; path?: string; replace?: boolean; state?: unknown; diff --git a/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts b/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts index 52a5eccac9910..26d366bb8dabe 100644 --- a/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts +++ b/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts @@ -115,6 +115,7 @@ export class EmbeddableStateTransfer { appId: string, options?: { path?: string; + openInNewTab?: boolean; state: EmbeddableEditorState; } ): Promise { @@ -162,7 +163,7 @@ export class EmbeddableStateTransfer { private async navigateToWithState( appId: string, key: string, - options?: { path?: string; state?: OutgoingStateType } + options?: { path?: string; state?: OutgoingStateType; openInNewTab?: boolean } ): Promise { const existingAppState = this.storage.get(EMBEDDABLE_STATE_TRANSFER_STORAGE_KEY)?.[key] || {}; const stateObject = { @@ -173,6 +174,6 @@ export class EmbeddableStateTransfer { }, }; this.storage.set(EMBEDDABLE_STATE_TRANSFER_STORAGE_KEY, stateObject); - await this.navigateToApp(appId, { path: options?.path }); + await this.navigateToApp(appId, { path: options?.path, openInNewTab: options?.openInNewTab }); } } diff --git a/src/plugins/embeddable/public/public.api.md b/src/plugins/embeddable/public/public.api.md index 3f0907acabdfa..220039de2f34e 100644 --- a/src/plugins/embeddable/public/public.api.md +++ b/src/plugins/embeddable/public/public.api.md @@ -600,6 +600,7 @@ export class EmbeddableStateTransfer { // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "ApplicationStart" navigateToEditor(appId: string, options?: { path?: string; + openInNewTab?: boolean; state: EmbeddableEditorState; }): Promise; // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "ApplicationStart" diff --git a/x-pack/examples/embedded_lens_example/public/app.tsx b/x-pack/examples/embedded_lens_example/public/app.tsx index d2af98e8e85e4..33bb1f06d045c 100644 --- a/x-pack/examples/embedded_lens_example/public/app.tsx +++ b/x-pack/examples/embedded_lens_example/public/app.tsx @@ -156,13 +156,17 @@ export const App = (props: { { - props.plugins.lens.navigateToPrefilledEditor({ - id: '', - timeRange: time, - attributes: getLensAttributes(props.defaultIndexPattern!, color), - }); + props.plugins.lens.navigateToPrefilledEditor( + { + id: '', + timeRange: time, + attributes: getLensAttributes(props.defaultIndexPattern!, color), + }, + true + ); // eslint-disable-next-line no-bitwise const newColor = '#' + ((Math.random() * 0xffffff) << 0).toString(16); setColor(newColor); diff --git a/x-pack/plugins/lens/common/constants.test.ts b/x-pack/plugins/lens/common/constants.test.ts new file mode 100644 index 0000000000000..1bf3ec49a4780 --- /dev/null +++ b/x-pack/plugins/lens/common/constants.test.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getEditPath } from './constants'; + +describe('getEditPath', function () { + it('should return value when no time range', function () { + expect(getEditPath(undefined)).toEqual('#/edit_by_value'); + }); + + it('should return value when no time range but id is given', function () { + expect(getEditPath('1234354')).toEqual('#/edit/1234354'); + }); + + it('should return value when time range is given', function () { + expect(getEditPath(undefined, { from: 'now-15m', to: 'now' })).toEqual( + '#/edit_by_value?_g=(time:(from:now-15m,to:now))' + ); + }); + + it('should return value when time range and id is given', function () { + expect(getEditPath('12345', { from: 'now-15m', to: 'now' })).toEqual( + '#/edit/12345?_g=(time:(from:now-15m,to:now))' + ); + }); +}); diff --git a/x-pack/plugins/lens/common/constants.ts b/x-pack/plugins/lens/common/constants.ts index c3e556b167889..26edf66130ee3 100644 --- a/x-pack/plugins/lens/common/constants.ts +++ b/x-pack/plugins/lens/common/constants.ts @@ -5,6 +5,9 @@ * 2.0. */ +import rison from 'rison-node'; +import type { TimeRange } from '../../../../src/plugins/data/common/query'; + export const PLUGIN_ID = 'lens'; export const APP_ID = 'lens'; export const LENS_EMBEDDABLE_TYPE = 'lens'; @@ -17,8 +20,18 @@ export function getBasePath() { return `#/`; } -export function getEditPath(id: string | undefined) { - return id ? `#/edit/${encodeURIComponent(id)}` : `#/${LENS_EDIT_BY_VALUE}`; +const GLOBAL_RISON_STATE_PARAM = '_g'; + +export function getEditPath(id: string | undefined, timeRange?: TimeRange) { + let timeParam = ''; + + if (timeRange) { + timeParam = `?${GLOBAL_RISON_STATE_PARAM}=${rison.encode({ time: timeRange })}`; + } + + return id + ? `#/edit/${encodeURIComponent(id)}${timeParam}` + : `#/${LENS_EDIT_BY_VALUE}${timeParam}`; } export function getFullPath(id?: string) { diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index aed4db2e88e21..81937f3f41557 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -96,7 +96,7 @@ export interface LensPublicStart { * * @experimental */ - navigateToPrefilledEditor: (input: LensEmbeddableInput) => void; + navigateToPrefilledEditor: (input: LensEmbeddableInput, openInNewTab?: boolean) => void; /** * Method which returns true if the user has permission to use Lens as defined by application capabilities. */ @@ -243,8 +243,9 @@ export class LensPlugin { return { EmbeddableComponent: getEmbeddableComponent(startDependencies.embeddable), - navigateToPrefilledEditor: (input: LensEmbeddableInput) => { - if (input.timeRange) { + navigateToPrefilledEditor: (input: LensEmbeddableInput, openInNewTab?: boolean) => { + // for openInNewTab, we set the time range in url via getEditPath below + if (input.timeRange && !openInNewTab) { startDependencies.data.query.timefilter.timefilter.setTime(input.timeRange); } const transfer = new EmbeddableStateTransfer( @@ -252,7 +253,8 @@ export class LensPlugin { core.application.currentAppId$ ); transfer.navigateToEditor('lens', { - path: getEditPath(undefined), + openInNewTab, + path: getEditPath(undefined, openInNewTab ? input.timeRange : undefined), state: { originatingApp: '', valueInput: input, diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/header/header.test.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/header/header.test.tsx index de6912f256be7..4c43c11521722 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/header/header.test.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/header/header.test.tsx @@ -41,13 +41,16 @@ describe('ExploratoryViewHeader', function () { fireEvent.click(getByText('Open in Lens')); expect(core?.lens?.navigateToPrefilledEditor).toHaveBeenCalledTimes(1); - expect(core?.lens?.navigateToPrefilledEditor).toHaveBeenCalledWith({ - attributes: { title: 'Performance distribution' }, - id: '', - timeRange: { - from: 'now-15m', - to: 'now', + expect(core?.lens?.navigateToPrefilledEditor).toHaveBeenCalledWith( + { + attributes: { title: 'Performance distribution' }, + id: '', + timeRange: { + from: 'now-15m', + to: 'now', + }, }, - }); + true + ); }); }); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/header/header.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/header/header.tsx index 17f06436c8535..af5657a56a995 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/header/header.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/header/header.tsx @@ -45,11 +45,14 @@ export function ExploratoryViewHeader({ seriesId, lensAttributes }: Props) { isDisabled={!lens.canUseEditor() || lensAttributes === null} onClick={() => { if (lensAttributes) { - lens.navigateToPrefilledEditor({ - id: '', - timeRange: series.time, - attributes: lensAttributes, - }); + lens.navigateToPrefilledEditor( + { + id: '', + timeRange: series.time, + attributes: lensAttributes, + }, + true + ); } }} > From e38a3dabf7151fe4d6211b31e936ab9d478aa45f Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 15 Apr 2021 09:07:34 -0400 Subject: [PATCH 12/68] [Maps] Add cache control to mvt endpoints (#94861) --- .../tiled_vector_layer.test.tsx | 12 +++++-- .../tiled_vector_layer/tiled_vector_layer.tsx | 22 ++++++++++-- .../es_geo_grid_source.test.ts | 16 +++++---- .../es_geo_grid_source/es_geo_grid_source.tsx | 8 ++--- .../es_search_source/es_search_source.test.ts | 6 ++-- .../es_search_source/es_search_source.tsx | 8 ++--- .../mvt_single_layer_vector_source/types.ts | 1 + x-pack/plugins/maps/server/mvt/mvt_routes.ts | 35 +++++++++++-------- .../apis/maps/get_grid_tile.js | 14 +++----- .../api_integration/apis/maps/get_tile.js | 14 +++----- .../test/functional/apps/maps/mvt_scaling.js | 8 +++-- .../functional/apps/maps/mvt_super_fine.js | 8 +++-- 12 files changed, 88 insertions(+), 64 deletions(-) diff --git a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx index 01902d1fec89d..408c2ec18164d 100644 --- a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx +++ b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx @@ -112,7 +112,10 @@ describe('syncData', () => { // @ts-expect-error const call = syncContext.stopLoading.getCall(0); - expect(call.args[2]).toEqual(defaultConfig); + expect(call.args[2]!.minSourceZoom).toEqual(defaultConfig.minSourceZoom); + expect(call.args[2]!.maxSourceZoom).toEqual(defaultConfig.maxSourceZoom); + expect(call.args[2]!.layerName).toEqual(defaultConfig.layerName); + expect(call.args[2]!.urlTemplate!.startsWith(defaultConfig.urlTemplate)).toEqual(true); }); it('Should not resync when no changes to source params', async () => { @@ -185,7 +188,12 @@ describe('syncData', () => { // @ts-expect-error const call = syncContext.stopLoading.getCall(0); - expect(call.args[2]).toEqual({ ...defaultConfig, ...changes }); + + const newMeta = { ...defaultConfig, ...changes }; + expect(call.args[2]!.minSourceZoom).toEqual(newMeta.minSourceZoom); + expect(call.args[2]!.maxSourceZoom).toEqual(newMeta.maxSourceZoom); + expect(call.args[2]!.layerName).toEqual(newMeta.layerName); + expect(call.args[2]!.urlTemplate!.startsWith(newMeta.urlTemplate)).toEqual(true); }); }); }); diff --git a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx index f2fe916953801..90c4896f2a287 100644 --- a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx @@ -13,6 +13,7 @@ import { } from 'mapbox-gl'; import { EuiIcon } from '@elastic/eui'; import { Feature } from 'geojson'; +import uuid from 'uuid/v4'; import { IVectorStyle, VectorStyle } from '../../styles/vector/vector_style'; import { SOURCE_DATA_REQUEST_ID, LAYER_TYPE } from '../../../../common/constants'; import { VectorLayer, VectorLayerArguments } from '../vector_layer'; @@ -24,6 +25,7 @@ import { } from '../../../../common/descriptor_types'; import { MVTSingleLayerVectorSourceConfig } from '../../sources/mvt_single_layer_vector_source/types'; import { canSkipSourceUpdate } from '../../util/can_skip_fetch'; +import { isRefreshOnlyQuery } from '../../util/is_refresh_only_query'; export class TiledVectorLayer extends VectorLayer { static type = LAYER_TYPE.TILED_VECTOR; @@ -69,7 +71,6 @@ export class TiledVectorLayer extends VectorLayer { this._style as IVectorStyle ); const prevDataRequest = this.getSourceDataRequest(); - const dataRequest = await this._source.getUrlTemplateWithMeta(searchFilters); if (prevDataRequest) { const data: MVTSingleLayerVectorSourceConfig = prevDataRequest.getData() as MVTSingleLayerVectorSourceConfig; if (data) { @@ -92,7 +93,22 @@ export class TiledVectorLayer extends VectorLayer { startLoading(SOURCE_DATA_REQUEST_ID, requestToken, searchFilters); try { - stopLoading(SOURCE_DATA_REQUEST_ID, requestToken, dataRequest, {}); + const prevMeta = prevDataRequest ? prevDataRequest.getMeta() : undefined; + const prevData = prevDataRequest + ? (prevDataRequest.getData() as MVTSingleLayerVectorSourceConfig) + : undefined; + const urlToken = + !prevData || isRefreshOnlyQuery(prevMeta ? prevMeta.query : undefined, searchFilters.query) + ? uuid() + : prevData.urlToken; + + const newUrlTemplateAndMeta = await this._source.getUrlTemplateWithMeta(searchFilters); + const urlTemplateAndMetaWithToken = { + ...newUrlTemplateAndMeta, + urlToken, + urlTemplate: newUrlTemplateAndMeta.urlTemplate + `&token=${urlToken}`, + }; + stopLoading(SOURCE_DATA_REQUEST_ID, requestToken, urlTemplateAndMetaWithToken, {}); } catch (error) { onLoadError(SOURCE_DATA_REQUEST_ID, requestToken, error.message); } @@ -113,7 +129,7 @@ export class TiledVectorLayer extends VectorLayer { if (!sourceDataRequest) { // this is possible if the layer was invisible at startup. // the actions will not perform any data=syncing as an optimization when a layer is invisible - // when turning the layer back into visible, it's possible the url has not been resovled yet. + // when turning the layer back into visible, it's possible the url had not been resolved yet. return; } diff --git a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts index 5ac487c713173..ad413419a289b 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts +++ b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts @@ -125,7 +125,7 @@ describe('ESGeoGridSource', () => { getHttp.mockReturnValue({ basePath: { prepend(path: string) { - return `rootdir${path};`; + return `rootdir${path}`; }, }, }); @@ -282,8 +282,8 @@ describe('ESGeoGridSource', () => { expect(urlTemplateWithMeta.layerName).toBe('source_layer'); expect(urlTemplateWithMeta.minSourceZoom).toBe(0); expect(urlTemplateWithMeta.maxSourceZoom).toBe(24); - expect(urlTemplateWithMeta.urlTemplate).toBe( - "rootdir/api/maps/mvt/getGridTile;?x={x}&y={y}&z={z}&geometryFieldName=bar&index=undefined&requestBody=(foobar:ES_DSL_PLACEHOLDER,params:('0':('0':index,'1':(fields:())),'1':('0':size,'1':0),'2':('0':filter,'1':!((geo_bounding_box:(bar:(bottom_right:!(180,-82.67628),top_left:!(-180,82.67628))),meta:(alias:!n,disabled:!f,key:bar,negate:!f)))),'3':('0':query),'4':('0':index,'1':(fields:())),'5':('0':query,'1':(language:KQL,query:'',queryLastTriggeredAt:'2019-04-25T20:53:22.331Z')),'6':('0':aggs,'1':(gridSplit:(aggs:(gridCentroid:(geo_centroid:(field:bar))),geotile_grid:(bounds:!n,field:bar,precision:!n,shard_size:65535,size:65535))))))&requestType=heatmap&geoFieldType=geo_point" + expect(urlTemplateWithMeta.urlTemplate).toEqual( + "rootdir/api/maps/mvt/getGridTile/{z}/{x}/{y}.pbf?geometryFieldName=bar&index=undefined&requestBody=(foobar:ES_DSL_PLACEHOLDER,params:('0':('0':index,'1':(fields:())),'1':('0':size,'1':0),'2':('0':filter,'1':!((geo_bounding_box:(bar:(bottom_right:!(180,-82.67628),top_left:!(-180,82.67628))),meta:(alias:!n,disabled:!f,key:bar,negate:!f)))),'3':('0':query),'4':('0':index,'1':(fields:())),'5':('0':query,'1':(language:KQL,query:'',queryLastTriggeredAt:'2019-04-25T20:53:22.331Z')),'6':('0':aggs,'1':(gridSplit:(aggs:(gridCentroid:(geo_centroid:(field:bar))),geotile_grid:(bounds:!n,field:bar,precision:!n,shard_size:65535,size:65535))))))&requestType=heatmap&geoFieldType=geo_point" ); }); @@ -293,9 +293,13 @@ describe('ESGeoGridSource', () => { searchSessionId: '1', }); - expect(urlTemplateWithMeta.urlTemplate).toBe( - "rootdir/api/maps/mvt/getGridTile;?x={x}&y={y}&z={z}&geometryFieldName=bar&index=undefined&requestBody=(foobar:ES_DSL_PLACEHOLDER,params:('0':('0':index,'1':(fields:())),'1':('0':size,'1':0),'2':('0':filter,'1':!((geo_bounding_box:(bar:(bottom_right:!(180,-82.67628),top_left:!(-180,82.67628))),meta:(alias:!n,disabled:!f,key:bar,negate:!f)))),'3':('0':query),'4':('0':index,'1':(fields:())),'5':('0':query,'1':(language:KQL,query:'',queryLastTriggeredAt:'2019-04-25T20:53:22.331Z')),'6':('0':aggs,'1':(gridSplit:(aggs:(gridCentroid:(geo_centroid:(field:bar))),geotile_grid:(bounds:!n,field:bar,precision:!n,shard_size:65535,size:65535))))))&requestType=heatmap&geoFieldType=geo_point&searchSessionId=1" - ); + expect( + urlTemplateWithMeta.urlTemplate.startsWith( + "rootdir/api/maps/mvt/getGridTile/{z}/{x}/{y}.pbf?geometryFieldName=bar&index=undefined&requestBody=(foobar:ES_DSL_PLACEHOLDER,params:('0':('0':index,'1':(fields:())),'1':('0':size,'1':0),'2':('0':filter,'1':!((geo_bounding_box:(bar:(bottom_right:!(180,-82.67628),top_left:!(-180,82.67628))),meta:(alias:!n,disabled:!f,key:bar,negate:!f)))),'3':('0':query),'4':('0':index,'1':(fields:())),'5':('0':query,'1':(language:KQL,query:'',queryLastTriggeredAt:'2019-04-25T20:53:22.331Z')),'6':('0':aggs,'1':(gridSplit:(aggs:(gridCentroid:(geo_centroid:(field:bar))),geotile_grid:(bounds:!n,field:bar,precision:!n,shard_size:65535,size:65535))))))&requestType=heatmap&geoFieldType=geo_point" + ) + ).toBe(true); + + expect(urlTemplateWithMeta.urlTemplate.endsWith('&searchSessionId=1')).toBe(true); }); }); diff --git a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.tsx b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.tsx index d601e4fa9a39a..e9cf62d8f4089 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.tsx +++ b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.tsx @@ -441,19 +441,17 @@ export class ESGeoGridSource extends AbstractESAggSource implements ITiledSingle const risonDsl = rison.encode(dsl); const mvtUrlServicePath = getHttp().basePath.prepend( - `/${GIS_API_PATH}/${MVT_GETGRIDTILE_API_PATH}` + `/${GIS_API_PATH}/${MVT_GETGRIDTILE_API_PATH}/{z}/{x}/{y}.pbf` ); const geoField = await this._getGeoField(); const urlTemplate = `${mvtUrlServicePath}\ -?x={x}\ -&y={y}\ -&z={z}\ -&geometryFieldName=${this._descriptor.geoField}\ +?geometryFieldName=${this._descriptor.geoField}\ &index=${indexPattern.title}\ &requestBody=${risonDsl}\ &requestType=${this._descriptor.requestType}\ &geoFieldType=${geoField.type}`; + return { layerName: this.getLayerName(), minSourceZoom: this.getMinZoom(), diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.test.ts b/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.test.ts index c5b1d6e0b7baa..014dfe7da929b 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.test.ts +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.test.ts @@ -83,7 +83,7 @@ describe('ESSearchSource', () => { getHttp.mockReturnValue({ basePath: { prepend(path: string) { - return `rootdir${path};`; + return `rootdir${path}`; }, }, }); @@ -115,7 +115,7 @@ describe('ESSearchSource', () => { }); const urlTemplateWithMeta = await esSearchSource.getUrlTemplateWithMeta(searchFilters); expect(urlTemplateWithMeta.urlTemplate).toBe( - `rootdir/api/maps/mvt/getTile;?x={x}&y={y}&z={z}&geometryFieldName=bar&index=foobar-title-*&requestBody=(foobar:ES_DSL_PLACEHOLDER,params:('0':('0':index,'1':(fields:(),title:'foobar-title-*')),'1':('0':size,'1':1000),'2':('0':filter,'1':!()),'3':('0':query),'4':('0':index,'1':(fields:(),title:'foobar-title-*')),'5':('0':query,'1':(language:KQL,query:'tooltipField: foobar',queryLastTriggeredAt:'2019-04-25T20:53:22.331Z')),'6':('0':fieldsFromSource,'1':!(tooltipField,styleField)),'7':('0':source,'1':!(tooltipField,styleField))))&geoFieldType=geo_shape` + `rootdir/api/maps/mvt/getTile/{z}/{x}/{y}.pbf?geometryFieldName=bar&index=foobar-title-*&requestBody=(foobar:ES_DSL_PLACEHOLDER,params:('0':('0':index,'1':(fields:(),title:'foobar-title-*')),'1':('0':size,'1':1000),'2':('0':filter,'1':!()),'3':('0':query),'4':('0':index,'1':(fields:(),title:'foobar-title-*')),'5':('0':query,'1':(language:KQL,query:'tooltipField: foobar',queryLastTriggeredAt:'2019-04-25T20:53:22.331Z')),'6':('0':fieldsFromSource,'1':!(tooltipField,styleField)),'7':('0':source,'1':!(tooltipField,styleField))))&geoFieldType=geo_shape` ); }); @@ -129,7 +129,7 @@ describe('ESSearchSource', () => { searchSessionId: '1', }); expect(urlTemplateWithMeta.urlTemplate).toBe( - `rootdir/api/maps/mvt/getTile;?x={x}&y={y}&z={z}&geometryFieldName=bar&index=foobar-title-*&requestBody=(foobar:ES_DSL_PLACEHOLDER,params:('0':('0':index,'1':(fields:(),title:'foobar-title-*')),'1':('0':size,'1':1000),'2':('0':filter,'1':!()),'3':('0':query),'4':('0':index,'1':(fields:(),title:'foobar-title-*')),'5':('0':query,'1':(language:KQL,query:'tooltipField: foobar',queryLastTriggeredAt:'2019-04-25T20:53:22.331Z')),'6':('0':fieldsFromSource,'1':!(tooltipField,styleField)),'7':('0':source,'1':!(tooltipField,styleField))))&geoFieldType=geo_shape&searchSessionId=1` + `rootdir/api/maps/mvt/getTile/{z}/{x}/{y}.pbf?geometryFieldName=bar&index=foobar-title-*&requestBody=(foobar:ES_DSL_PLACEHOLDER,params:('0':('0':index,'1':(fields:(),title:'foobar-title-*')),'1':('0':size,'1':1000),'2':('0':filter,'1':!()),'3':('0':query),'4':('0':index,'1':(fields:(),title:'foobar-title-*')),'5':('0':query,'1':(language:KQL,query:'tooltipField: foobar',queryLastTriggeredAt:'2019-04-25T20:53:22.331Z')),'6':('0':fieldsFromSource,'1':!(tooltipField,styleField)),'7':('0':source,'1':!(tooltipField,styleField))))&geoFieldType=geo_shape&searchSessionId=1` ); }); }); diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.tsx b/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.tsx index 82d7b09e9c3f2..ff4675413985c 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.tsx +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.tsx @@ -710,19 +710,17 @@ export class ESSearchSource extends AbstractESSource implements ITiledSingleLaye const risonDsl = rison.encode(dsl); const mvtUrlServicePath = getHttp().basePath.prepend( - `/${GIS_API_PATH}/${MVT_GETTILE_API_PATH}` + `/${GIS_API_PATH}/${MVT_GETTILE_API_PATH}/{z}/{x}/{y}.pbf` ); const geoField = await this._getGeoField(); const urlTemplate = `${mvtUrlServicePath}\ -?x={x}\ -&y={y}\ -&z={z}\ -&geometryFieldName=${this._descriptor.geoField}\ +?geometryFieldName=${this._descriptor.geoField}\ &index=${indexPattern.title}\ &requestBody=${risonDsl}\ &geoFieldType=${geoField.type}`; + return { layerName: this.getLayerName(), minSourceZoom: this.getMinZoom(), diff --git a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/types.ts b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/types.ts index 27e148d9bcb2a..fb7d7e135b86e 100644 --- a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/types.ts +++ b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/types.ts @@ -14,4 +14,5 @@ export interface MVTSingleLayerVectorSourceConfig { maxSourceZoom: number; fields?: MVTFieldDescriptor[]; tooltipProperties?: string[]; + urlToken?: string; } diff --git a/x-pack/plugins/maps/server/mvt/mvt_routes.ts b/x-pack/plugins/maps/server/mvt/mvt_routes.ts index 1423e4ef5a20d..b844d5400e2fc 100644 --- a/x-pack/plugins/maps/server/mvt/mvt_routes.ts +++ b/x-pack/plugins/maps/server/mvt/mvt_routes.ts @@ -21,7 +21,7 @@ import { } from '../../common/constants'; import { getGridTile, getTile } from './get_tile'; -const CACHE_TIMEOUT = 0; // Todo. determine good value. Unsure about full-implications (e.g. wrt. time-based data). +const CACHE_TIMEOUT_SECONDS = 60 * 60; export function initMVTRoutes({ router, @@ -32,17 +32,20 @@ export function initMVTRoutes({ }) { router.get( { - path: `${API_ROOT_PATH}/${MVT_GETTILE_API_PATH}`, + path: `${API_ROOT_PATH}/${MVT_GETTILE_API_PATH}/{z}/{x}/{y}.pbf`, validate: { - query: schema.object({ + params: schema.object({ x: schema.number(), y: schema.number(), z: schema.number(), + }), + query: schema.object({ geometryFieldName: schema.string(), requestBody: schema.string(), index: schema.string(), geoFieldType: schema.string(), searchSessionId: schema.maybe(schema.string()), + token: schema.maybe(schema.string()), }), }, }, @@ -51,7 +54,7 @@ export function initMVTRoutes({ request: KibanaRequest, unknown>, response: KibanaResponseFactory ) => { - const { query } = request; + const { query, params } = request; const abortController = new AbortController(); request.events.aborted$.subscribe(() => { @@ -64,9 +67,9 @@ export function initMVTRoutes({ logger, context, geometryFieldName: query.geometryFieldName as string, - x: query.x as number, - y: query.y as number, - z: query.z as number, + x: parseInt((params as any).x, 10) as number, + y: parseInt((params as any).y, 10) as number, + z: parseInt((params as any).z, 10) as number, index: query.index as string, requestBody: requestBodyDSL as any, geoFieldType: query.geoFieldType as ES_GEO_FIELD_TYPE, @@ -80,18 +83,21 @@ export function initMVTRoutes({ router.get( { - path: `${API_ROOT_PATH}/${MVT_GETGRIDTILE_API_PATH}`, + path: `${API_ROOT_PATH}/${MVT_GETGRIDTILE_API_PATH}/{z}/{x}/{y}.pbf`, validate: { - query: schema.object({ + params: schema.object({ x: schema.number(), y: schema.number(), z: schema.number(), + }), + query: schema.object({ geometryFieldName: schema.string(), requestBody: schema.string(), index: schema.string(), requestType: schema.string(), geoFieldType: schema.string(), searchSessionId: schema.maybe(schema.string()), + token: schema.maybe(schema.string()), }), }, }, @@ -100,7 +106,7 @@ export function initMVTRoutes({ request: KibanaRequest, unknown>, response: KibanaResponseFactory ) => { - const { query } = request; + const { query, params } = request; const abortController = new AbortController(); request.events.aborted$.subscribe(() => { abortController.abort(); @@ -112,9 +118,9 @@ export function initMVTRoutes({ logger, context, geometryFieldName: query.geometryFieldName as string, - x: query.x as number, - y: query.y as number, - z: query.z as number, + x: parseInt((params as any).x, 10) as number, + y: parseInt((params as any).y, 10) as number, + z: parseInt((params as any).z, 10) as number, index: query.index as string, requestBody: requestBodyDSL as any, requestType: query.requestType as RENDER_AS, @@ -133,7 +139,8 @@ function sendResponse(response: KibanaResponseFactory, tile: any) { 'content-disposition': 'inline', 'content-length': tile ? `${tile.length}` : `0`, 'Content-Type': 'application/x-protobuf', - 'Cache-Control': `max-age=${CACHE_TIMEOUT}`, + 'Cache-Control': `public, max-age=${CACHE_TIMEOUT_SECONDS}`, + 'Last-Modified': `${new Date().toUTCString()}`, }; if (tile) { diff --git a/x-pack/test/api_integration/apis/maps/get_grid_tile.js b/x-pack/test/api_integration/apis/maps/get_grid_tile.js index 6e75c00f5007c..c929a1af7b150 100644 --- a/x-pack/test/api_integration/apis/maps/get_grid_tile.js +++ b/x-pack/test/api_integration/apis/maps/get_grid_tile.js @@ -20,11 +20,8 @@ export default function ({ getService }) { it('should return vector tile containing cluster features', async () => { const resp = await supertest .get( - `/api/maps/mvt/getGridTile\ -?x=2\ -&y=3\ -&z=3\ -&geometryFieldName=geo.coordinates\ + `/api/maps/mvt/getGridTile/3/2/3.pbf\ +?geometryFieldName=geo.coordinates\ &index=logstash-*\ &requestBody=(_source:(excludes:!()),aggs:(gridSplit:(aggs:(avg_of_bytes:(avg:(field:bytes)),gridCentroid:(geo_centroid:(field:geo.coordinates))),geotile_grid:(bounds:!n,field:geo.coordinates,precision:!n,shard_size:65535,size:65535))),fields:!((field:%27@timestamp%27,format:date_time),(field:%27relatedContent.article:modified_time%27,format:date_time),(field:%27relatedContent.article:published_time%27,format:date_time),(field:utc_time,format:date_time)),query:(bool:(filter:!((match_all:()),(range:(%27@timestamp%27:(format:strict_date_optional_time,gte:%272015-09-20T00:00:00.000Z%27,lte:%272015-09-20T01:00:00.000Z%27)))),must:!(),must_not:!(),should:!())),runtime_mappings:(),script_fields:(hour_of_day:(script:(lang:painless,source:%27doc[!%27@timestamp!%27].value.getHour()%27))),size:0,stored_fields:!(%27*%27))\ &requestType=point\ @@ -48,11 +45,8 @@ export default function ({ getService }) { it('should return vector tile containing grid features', async () => { const resp = await supertest .get( - `/api/maps/mvt/getGridTile\ -?x=2\ -&y=3\ -&z=3\ -&geometryFieldName=geo.coordinates\ + `/api/maps/mvt/getGridTile/3/2/3.pbf\ +?geometryFieldName=geo.coordinates\ &index=logstash-*\ &requestBody=(_source:(excludes:!()),aggs:(gridSplit:(aggs:(avg_of_bytes:(avg:(field:bytes)),gridCentroid:(geo_centroid:(field:geo.coordinates))),geotile_grid:(bounds:!n,field:geo.coordinates,precision:!n,shard_size:65535,size:65535))),fields:!((field:%27@timestamp%27,format:date_time),(field:%27relatedContent.article:modified_time%27,format:date_time),(field:%27relatedContent.article:published_time%27,format:date_time),(field:utc_time,format:date_time)),query:(bool:(filter:!((match_all:()),(range:(%27@timestamp%27:(format:strict_date_optional_time,gte:%272015-09-20T00:00:00.000Z%27,lte:%272015-09-20T01:00:00.000Z%27)))),must:!(),must_not:!(),should:!())),runtime_mappings:(),script_fields:(hour_of_day:(script:(lang:painless,source:%27doc[!%27@timestamp!%27].value.getHour()%27))),size:0,stored_fields:!(%27*%27))\ &requestType=grid\ diff --git a/x-pack/test/api_integration/apis/maps/get_tile.js b/x-pack/test/api_integration/apis/maps/get_tile.js index 8ece77a5096f3..f75d43cf0cee3 100644 --- a/x-pack/test/api_integration/apis/maps/get_tile.js +++ b/x-pack/test/api_integration/apis/maps/get_tile.js @@ -17,11 +17,8 @@ export default function ({ getService }) { it('should return vector tile containing document', async () => { const resp = await supertest .get( - `/api/maps/mvt/getTile\ -?x=1\ -&y=1\ -&z=2\ -&geometryFieldName=geo.coordinates\ + `/api/maps/mvt/getTile/2/1/1.pbf\ +?geometryFieldName=geo.coordinates\ &index=logstash-*\ &requestBody=(_source:!f,docvalue_fields:!(bytes,geo.coordinates,machine.os.raw),query:(bool:(filter:!((match_all:()),(range:(%27@timestamp%27:(format:strict_date_optional_time,gte:%272015-09-20T00:00:00.000Z%27,lte:%272015-09-20T01:00:00.000Z%27)))),must:!(),must_not:!(),should:!())),runtime_mappings:(),script_fields:(),size:10000,stored_fields:!(bytes,geo.coordinates,machine.os.raw))\ &geoFieldType=geo_point` @@ -51,11 +48,8 @@ export default function ({ getService }) { const resp = await supertest // requestBody sets size=1 to force count exceeded .get( - `/api/maps/mvt/getTile\ -?x=1\ -&y=1\ -&z=2\ -&geometryFieldName=geo.coordinates\ + `/api/maps/mvt/getTile/2/1/1.pbf\ +?geometryFieldName=geo.coordinates\ &index=logstash-*\ &requestBody=(_source:!f,docvalue_fields:!(bytes,geo.coordinates,machine.os.raw),query:(bool:(filter:!((match_all:()),(range:(%27@timestamp%27:(format:strict_date_optional_time,gte:%272015-09-20T00:00:00.000Z%27,lte:%272015-09-20T01:00:00.000Z%27)))),must:!(),must_not:!(),should:!())),runtime_mappings:(),script_fields:(),size:1,stored_fields:!(bytes,geo.coordinates,machine.os.raw))\ &geoFieldType=geo_point` diff --git a/x-pack/test/functional/apps/maps/mvt_scaling.js b/x-pack/test/functional/apps/maps/mvt_scaling.js index 83467ed726581..d0e2ddd0ae9f0 100644 --- a/x-pack/test/functional/apps/maps/mvt_scaling.js +++ b/x-pack/test/functional/apps/maps/mvt_scaling.js @@ -29,9 +29,11 @@ export default function ({ getPageObjects, getService }) { const mapboxStyle = await PageObjects.maps.getMapboxStyle(); //Source should be correct - expect(mapboxStyle.sources[VECTOR_SOURCE_ID].tiles[0]).to.equal( - '/api/maps/mvt/getTile?x={x}&y={y}&z={z}&geometryFieldName=geometry&index=geo_shapes*&requestBody=(_source:!(geometry),docvalue_fields:!(prop1),query:(bool:(filter:!((match_all:())),must:!(),must_not:!(),should:!())),runtime_mappings:(),script_fields:(),size:10001,stored_fields:!(geometry,prop1))&geoFieldType=geo_shape' - ); + expect( + mapboxStyle.sources[VECTOR_SOURCE_ID].tiles[0].startsWith( + `/api/maps/mvt/getTile/{z}/{x}/{y}.pbf?geometryFieldName=geometry&index=geo_shapes*&requestBody=(_source:!(geometry),docvalue_fields:!(prop1),query:(bool:(filter:!((match_all:())),must:!(),must_not:!(),should:!())),runtime_mappings:(),script_fields:(),size:10001,stored_fields:!(geometry,prop1))&geoFieldType=geo_shape` + ) + ).to.equal(true); //Should correctly load meta for style-rule (sigma is set to 1, opacity to 1) const fillLayer = mapboxStyle.layers.find((layer) => layer.id === VECTOR_SOURCE_ID + '_fill'); diff --git a/x-pack/test/functional/apps/maps/mvt_super_fine.js b/x-pack/test/functional/apps/maps/mvt_super_fine.js index 0f18ac8ac72e4..8608b62dee8f7 100644 --- a/x-pack/test/functional/apps/maps/mvt_super_fine.js +++ b/x-pack/test/functional/apps/maps/mvt_super_fine.js @@ -32,9 +32,11 @@ export default function ({ getPageObjects, getService }) { const mapboxStyle = await PageObjects.maps.getMapboxStyle(); //Source should be correct - expect(mapboxStyle.sources[MB_VECTOR_SOURCE_ID].tiles[0]).to.equal( - "/api/maps/mvt/getGridTile?x={x}&y={y}&z={z}&geometryFieldName=geo.coordinates&index=logstash-*&requestBody=(_source:(excludes:!()),aggs:(gridSplit:(aggs:(gridCentroid:(geo_centroid:(field:geo.coordinates)),max_of_bytes:(max:(field:bytes))),geotile_grid:(bounds:!n,field:geo.coordinates,precision:!n,shard_size:65535,size:65535))),fields:!((field:'@timestamp',format:date_time),(field:'relatedContent.article:modified_time',format:date_time),(field:'relatedContent.article:published_time',format:date_time),(field:utc_time,format:date_time)),query:(bool:(filter:!((match_all:()),(range:('@timestamp':(format:strict_date_optional_time,gte:'2015-09-20T00:00:00.000Z',lte:'2015-09-20T01:00:00.000Z')))),must:!(),must_not:!(),should:!())),runtime_mappings:(),script_fields:(hour_of_day:(script:(lang:painless,source:'doc[!'@timestamp!'].value.getHour()'))),size:0,stored_fields:!('*'))&requestType=grid&geoFieldType=geo_point" - ); + expect( + mapboxStyle.sources[MB_VECTOR_SOURCE_ID].tiles[0].startsWith( + `/api/maps/mvt/getGridTile/{z}/{x}/{y}.pbf?geometryFieldName=geo.coordinates&index=logstash-*&requestBody=(_source:(excludes:!()),aggs:(gridSplit:(aggs:(gridCentroid:(geo_centroid:(field:geo.coordinates)),max_of_bytes:(max:(field:bytes))),geotile_grid:(bounds:!n,field:geo.coordinates,precision:!n,shard_size:65535,size:65535))),fields:!((field:'@timestamp',format:date_time),(field:'relatedContent.article:modified_time',format:date_time),(field:'relatedContent.article:published_time',format:date_time),(field:utc_time,format:date_time)),query:(bool:(filter:!((match_all:()),(range:('@timestamp':(format:strict_date_optional_time,gte:'2015-09-20T00:00:00.000Z',lte:'2015-09-20T01:00:00.000Z')))),must:!(),must_not:!(),should:!())),runtime_mappings:(),script_fields:(hour_of_day:(script:(lang:painless,source:'doc[!'@timestamp!'].value.getHour()'))),size:0,stored_fields:!('*'))&requestType=grid&geoFieldType=geo_point` + ) + ).to.equal(true); //Should correctly load meta for style-rule (sigma is set to 1, opacity to 1) const fillLayer = mapboxStyle.layers.find( From 41bf9e84271d4c3d2091bc158121ff1f053c2c8e Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 15 Apr 2021 15:39:37 +0200 Subject: [PATCH 13/68] Remove blank line at the end of cli plugin list (#97234) --- src/cli_plugin/list/list.js | 2 -- src/cli_plugin/list/list.test.js | 1 - 2 files changed, 3 deletions(-) diff --git a/src/cli_plugin/list/list.js b/src/cli_plugin/list/list.js index a30334aaf5542..fc381da72f121 100644 --- a/src/cli_plugin/list/list.js +++ b/src/cli_plugin/list/list.js @@ -23,6 +23,4 @@ export function list(pluginDir, logger) { } } }); - - logger.log(''); //intentional blank line for aesthetics } diff --git a/src/cli_plugin/list/list.test.js b/src/cli_plugin/list/list.test.js index 51633f339e73c..cba21ba706b37 100644 --- a/src/cli_plugin/list/list.test.js +++ b/src/cli_plugin/list/list.test.js @@ -64,7 +64,6 @@ describe('kibana cli', function () { "log: plugin1@5.0.0-alpha2", "log: plugin2@3.2.1", "log: plugin3@1.2.3", - "log: ", ] `); }); From 005745e6493e45c6029056f2cc1901a1daf4928a Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 15 Apr 2021 15:58:58 +0200 Subject: [PATCH 14/68] Log if no plugins are installed when listing plugins in cli (#97235) --- src/cli_plugin/list/list.js | 25 +++++++++++++++---------- src/cli_plugin/list/list.test.js | 9 +++++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/cli_plugin/list/list.js b/src/cli_plugin/list/list.js index fc381da72f121..6e59258ab0f1f 100644 --- a/src/cli_plugin/list/list.js +++ b/src/cli_plugin/list/list.js @@ -10,17 +10,22 @@ import { statSync, readdirSync, readFileSync } from 'fs'; import { join } from 'path'; export function list(pluginDir, logger) { - readdirSync(pluginDir).forEach((name) => { - const stat = statSync(join(pluginDir, name)); + const plugins = readdirSync(pluginDir) + .map((name) => [name, statSync(join(pluginDir, name))]) + .filter(([name, stat]) => stat.isDirectory() && name[0] !== '.'); - if (stat.isDirectory() && name[0] !== '.') { - try { - const packagePath = join(pluginDir, name, 'kibana.json'); - const pkg = JSON.parse(readFileSync(packagePath, 'utf8')); - logger.log(pkg.id + '@' + pkg.version); - } catch (e) { - throw new Error('Unable to read kibana.json file for plugin ' + name); - } + if (plugins.length === 0) { + logger.log('No plugins installed.'); + return; + } + + plugins.forEach(([name]) => { + try { + const packagePath = join(pluginDir, name, 'kibana.json'); + const pkg = JSON.parse(readFileSync(packagePath, 'utf8')); + logger.log(pkg.id + '@' + pkg.version); + } catch (e) { + throw new Error('Unable to read kibana.json file for plugin ' + name); } }); } diff --git a/src/cli_plugin/list/list.test.js b/src/cli_plugin/list/list.test.js index cba21ba706b37..281f55f50fc65 100644 --- a/src/cli_plugin/list/list.test.js +++ b/src/cli_plugin/list/list.test.js @@ -91,5 +91,14 @@ describe('kibana cli', function () { `"Unable to read kibana.json file for plugin invalid-plugin"` ); }); + + it('show message if no plugins are installed', function () { + list(pluginDir, logger); + expect(logger.messages).toMatchInlineSnapshot(` + Array [ + "log: No plugins installed.", + ] + `); + }); }); }); From 8f2f65d30ca4946dd88ca5a6db9e811206ae56d4 Mon Sep 17 00:00:00 2001 From: Andrew Pease <7442091+peasead@users.noreply.github.com> Date: Thu, 15 Apr 2021 09:09:14 -0500 Subject: [PATCH 15/68] [Timeline] Add Indicator Match Timeline Template (#95840) * added threat-match timeline template * added indicator match timeline template * updated name to threat match * updated name to threat match * changed file name to threat.json Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../detection_engine/rules/prepackaged_timelines/index.ndjson | 1 + .../lib/detection_engine/rules/prepackaged_timelines/threat.json | 1 + 2 files changed, 2 insertions(+) create mode 100644 x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_timelines/threat.json diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_timelines/index.ndjson b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_timelines/index.ndjson index 184f8011a7a81..bee8f542b5271 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_timelines/index.ndjson +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_timelines/index.ndjson @@ -11,3 +11,4 @@ {"savedObjectId":null,"version":null,"columns":[{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"@timestamp","searchable":null},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"signal.rule.description","searchable":null},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"event.action","searchable":null},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"process.name","searchable":null},{"indexes":null,"aggregatable":true,"name":null,"description":"The working directory of the process.","columnHeaderType":"not-filtered","id":"process.working_directory","category":"process","type":"string","searchable":null,"example":"/home/alice"},{"indexes":null,"aggregatable":true,"name":null,"description":"Array of process arguments, starting with the absolute path to\nthe executable.\n\nMay be filtered to protect sensitive information.","columnHeaderType":"not-filtered","id":"process.args","category":"process","type":"string","searchable":null,"example":"[\"/usr/bin/ssh\",\"-l\",\"user\",\"10.0.0.16\"]"},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"process.pid","searchable":null},{"indexes":null,"aggregatable":true,"name":null,"description":"Absolute path to the process executable.","columnHeaderType":"not-filtered","id":"process.parent.executable","category":"process","type":"string","searchable":null,"example":"/usr/bin/ssh"},{"indexes":null,"aggregatable":true,"name":null,"description":"Array of process arguments.\n\nMay be filtered to protect sensitive information.","columnHeaderType":"not-filtered","id":"process.parent.args","category":"process","type":"string","searchable":null,"example":"[\"ssh\",\"-l\",\"user\",\"10.0.0.16\"]"},{"indexes":null,"aggregatable":true,"name":null,"description":"Process id.","columnHeaderType":"not-filtered","id":"process.parent.pid","category":"process","type":"number","searchable":null,"example":"4242"},{"indexes":null,"aggregatable":true,"name":null,"description":"Short name or login of the user.","columnHeaderType":"not-filtered","id":"user.name","category":"user","type":"string","searchable":null,"example":"albert"},{"indexes":null,"aggregatable":true,"name":null,"description":"Name of the host.\n\nIt can contain what `hostname` returns on Unix systems, the fully qualified\ndomain name, or a name specified by the user. The sender decides which value\nto use.","columnHeaderType":"not-filtered","id":"host.name","category":"host","type":"string","searchable":null}],"dataProviders":[{"excluded":false,"and":[],"kqlQuery":"","name":"","queryMatch":{"displayValue":"endpoint","field":"agent.type","displayField":"agent.type","value":"endpoint","operator":":"},"id":"timeline-1-4685da24-35c1-43f3-892d-1f926dbf5568","type":"default","enabled":true}],"description":"","eventType":"all","filters":[],"kqlMode":"filter","kqlQuery":{"filterQuery":{"kuery":{"kind":"kuery","expression":""},"serializedQuery":""}},"title":"Generic Endpoint Timeline","timelineType":"template","templateTimelineVersion":2,"templateTimelineId":"db366523-f1c6-4c1f-8731-6ce5ed9e5717","dateRange":{"start":1588161020848,"end":1588162280848},"savedQueryId":null,"sort":{"columnId":"@timestamp","sortDirection":"desc"},"created":1594735857110,"createdBy":"Elastic","updated":1611609999115,"updatedBy":"Elastic","eventNotes":[],"globalNotes":[],"pinnedEventIds":[],"status":"immutable"} {"savedObjectId":null,"version":null,"columns":[{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"@timestamp","searchable":null},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"signal.rule.description","searchable":null},{"indexes":null,"aggregatable":true,"name":null,"description":"The action captured by the event.\n\nThis describes the information in the event. It is more specific than `event.category`.\nExamples are `group-add`, `process-started`, `file-created`. The value is\nnormally defined by the implementer.","columnHeaderType":"not-filtered","id":"event.action","category":"event","type":"string","searchable":null,"example":"user-password-change"},{"indexes":null,"aggregatable":true,"name":null,"description":"Array of process arguments, starting with the absolute path to\nthe executable.\n\nMay be filtered to protect sensitive information.","columnHeaderType":"not-filtered","id":"process.args","category":"process","type":"string","searchable":null,"example":"[\"/usr/bin/ssh\",\"-l\",\"user\",\"10.0.0.16\"]"},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"process.pid","searchable":null},{"indexes":null,"aggregatable":true,"name":null,"description":"IP address of the source (IPv4 or IPv6).","columnHeaderType":"not-filtered","id":"source.ip","category":"source","type":"ip","searchable":null},{"indexes":null,"aggregatable":true,"name":null,"description":"Port of the source.","columnHeaderType":"not-filtered","id":"source.port","category":"source","type":"number","searchable":null},{"indexes":null,"aggregatable":true,"name":null,"description":"IP address of the destination (IPv4 or IPv6).","columnHeaderType":"not-filtered","id":"destination.ip","category":"destination","type":"ip","searchable":null},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"destination.port","searchable":null},{"indexes":null,"aggregatable":true,"name":null,"description":"Short name or login of the user.","columnHeaderType":"not-filtered","id":"user.name","category":"user","type":"string","searchable":null,"example":"albert"},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"host.name","searchable":null}],"dataProviders":[{"and":[{"enabled":true,"excluded":false,"id":"timeline-1-e37e37c5-a6e7-4338-af30-47bfbc3c0e1e","kqlQuery":"","name":"{destination.ip}","queryMatch":{"displayField":"destination.ip","displayValue":"{destination.ip}","field":"destination.ip","operator":":","value":"{destination.ip}"},"type":"template"}],"enabled":true,"excluded":false,"id":"timeline-1-ec778f01-1802-40f0-9dfb-ed8de1f656cb","kqlQuery":"","name":"{source.ip}","queryMatch":{"displayField":"source.ip","displayValue":"{source.ip}","field":"source.ip","operator":":","value":"{source.ip}"},"type":"template"}],"description":"","eventType":"all","filters":[],"kqlMode":"filter","kqlQuery":{"filterQuery":{"kuery":{"kind":"kuery","expression":""},"serializedQuery":""}},"title":"Generic Network Timeline","timelineType":"template","templateTimelineVersion":2,"templateTimelineId":"91832785-286d-4ebe-b884-1a208d111a70","dateRange":{"start":1588255858373,"end":1588256218373},"savedQueryId":null,"sort":{"columnId":"@timestamp","sortDirection":"desc"},"created":1594735573866,"createdBy":"Elastic","updated":1611609960850,"updatedBy":"Elastic","eventNotes":[],"globalNotes":[],"pinnedEventIds":[],"status":"immutable"} {"savedObjectId":null,"version":null,"columns":[{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"@timestamp","searchable":null},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"signal.rule.description","searchable":null},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"event.action","searchable":null},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"process.name","searchable":null},{"indexes":null,"aggregatable":true,"name":null,"description":"The working directory of the process.","columnHeaderType":"not-filtered","id":"process.working_directory","category":"process","type":"string","searchable":null,"example":"/home/alice"},{"indexes":null,"aggregatable":true,"name":null,"description":"Array of process arguments, starting with the absolute path to\nthe executable.\n\nMay be filtered to protect sensitive information.","columnHeaderType":"not-filtered","id":"process.args","category":"process","type":"string","searchable":null,"example":"[\"/usr/bin/ssh\",\"-l\",\"user\",\"10.0.0.16\"]"},{"indexes":null,"name":null,"columnHeaderType":"not-filtered","id":"process.pid","searchable":null},{"indexes":null,"aggregatable":true,"name":null,"description":"Absolute path to the process executable.","columnHeaderType":"not-filtered","id":"process.parent.executable","category":"process","type":"string","searchable":null,"example":"/usr/bin/ssh"},{"indexes":null,"aggregatable":true,"name":null,"description":"Array of process arguments.\n\nMay be filtered to protect sensitive information.","columnHeaderType":"not-filtered","id":"process.parent.args","category":"process","type":"string","searchable":null,"example":"[\"ssh\",\"-l\",\"user\",\"10.0.0.16\"]"},{"indexes":null,"aggregatable":true,"name":null,"description":"Process id.","columnHeaderType":"not-filtered","id":"process.parent.pid","category":"process","type":"number","searchable":null,"example":"4242"},{"indexes":null,"aggregatable":true,"name":null,"description":"Short name or login of the user.","columnHeaderType":"not-filtered","id":"user.name","category":"user","type":"string","searchable":null,"example":"albert"},{"indexes":null,"aggregatable":true,"name":null,"description":"Name of the host.\n\nIt can contain what `hostname` returns on Unix systems, the fully qualified\ndomain name, or a name specified by the user. The sender decides which value\nto use.","columnHeaderType":"not-filtered","id":"host.name","category":"host","type":"string","searchable":null}],"dataProviders":[{"excluded":false,"and":[],"kqlQuery":"","name":"{process.name}","queryMatch":{"displayValue":null,"field":"process.name","displayField":null,"value":"{process.name}","operator":":"},"id":"timeline-1-8622010a-61fb-490d-b162-beac9c36a853","type":"template","enabled":true}],"description":"","eventType":"all","filters":[],"kqlMode":"filter","kqlQuery":{"filterQuery":{"kuery":{"kind":"kuery","expression":""},"serializedQuery":""}},"title":"Generic Process Timeline","timelineType":"template","templateTimelineVersion":2,"templateTimelineId":"76e52245-7519-4251-91ab-262fb1a1728c","dateRange":{"start":1588161020848,"end":1588162280848},"savedQueryId":null,"sort":{"columnId":"@timestamp","sortDirection":"desc"},"created":1594735629389,"createdBy":"Elastic","updated":1611609848602,"updatedBy":"Elastic","eventNotes":[],"globalNotes":[],"pinnedEventIds":[],"status":"immutable"} +{"savedObjectId":null,"version":null,"columns":[{"columnHeaderType":"not-filtered","id":"@timestamp"},{"columnHeaderType":"not-filtered","id":"signal.rule.description"},{"aggregatable":true,"description":"The action captured by the event.\n\nThis describes the information in the event. It is more specific than `event.category`.\nExamples are `group-add`, `process-started`, `file-created`. The value is\nnormally defined by the implementer.","columnHeaderType":"not-filtered","id":"event.action","category":"event","type":"string","example":"user-password-change"},{"aggregatable":true,"description":"Array of process arguments, starting with the absolute path to\nthe executable.\n\nMay be filtered to protect sensitive information.","columnHeaderType":"not-filtered","id":"process.args","category":"process","type":"string","example":"[\"/usr/bin/ssh\",\"-l\",\"user\",\"10.0.0.16\"]"},{"columnHeaderType":"not-filtered","id":"process.pid"},{"aggregatable":true,"description":"IP address of the source (IPv4 or IPv6).","columnHeaderType":"not-filtered","id":"source.ip","category":"source","type":"ip"},{"aggregatable":true,"description":"Port of the source.","columnHeaderType":"not-filtered","id":"source.port","category":"source","type":"number"},{"aggregatable":true,"description":"IP address of the destination (IPv4 or IPv6).","columnHeaderType":"not-filtered","id":"destination.ip","category":"destination","type":"ip"},{"columnHeaderType":"not-filtered","id":"destination.port"},{"aggregatable":true,"description":"Short name or login of the user.","columnHeaderType":"not-filtered","id":"user.name","category":"user","type":"string","example":"albert"},{"columnHeaderType":"not-filtered","id":"host.name"}],"dataProviders":[{"excluded":false,"and":[{"excluded":false,"kqlQuery":"","name":"{threat.indicator.matched.type}","queryMatch":{"displayValue":null,"field":"threat.indicator.matched.type","displayField":null,"value":"{threat.indicator.matched.type}","operator":":"},"id":"timeline-1-ae18ef4b-f690-4122-a24d-e13b6818fba8","type":"template","enabled":true},{"excluded":false,"kqlQuery":"","name":"{threat.indicator.matched.field}","queryMatch":{"displayValue":null,"field":"threat.indicator.matched.field","displayField":null,"value":"{threat.indicator.matched.field}","operator":":"},"id":"timeline-1-7b4cf27e-6788-4d8e-9188-7687f0eba0f2","type":"template","enabled":true}],"kqlQuery":"","name":"{threat.indicator.matched.atomic}","queryMatch":{"displayValue":null,"field":"threat.indicator.matched.atomic","displayField":null,"value":"{threat.indicator.matched.atomic}","operator":":"},"id":"timeline-1-7db7d278-a80a-4853-971a-904319c50777","type":"template","enabled":true}],"description":"This Timeline template is for alerts generated by Indicator Match detection rules.","eqlOptions":{"eventCategoryField":"event.category","tiebreakerField":"","timestampField":"@timestamp","query":"","size":100},"eventType":"alert","filters":[],"kqlMode":"filter","kqlQuery":{"filterQuery":{"kuery":{"kind":"kuery","expression":""},"serializedQuery":""}},"indexNames":[".siem-signals-default"],"title":"Generic Threat Match Timeline","timelineType":"template","templateTimelineVersion":1,"templateTimelineId":"495ad7a7-316e-4544-8a0f-9c098daee76e","dateRange":{"start":1588161020848,"end":1588162280848},"savedQueryId":null,"sort":[{"sortDirection":"desc","columnId":"@timestamp"}],"created":1616696609311,"createdBy":"elastic","updated":1616788372794,"updatedBy":"elastic","eventNotes":[],"globalNotes":[],"pinnedEventIds":[],"status":"immutable"} diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_timelines/threat.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_timelines/threat.json new file mode 100644 index 0000000000000..01edb484f4a01 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_timelines/threat.json @@ -0,0 +1 @@ +{"savedObjectId":null,"version":null,"columns":[{"columnHeaderType":"not-filtered","id":"@timestamp"},{"columnHeaderType":"not-filtered","id":"signal.rule.description"},{"aggregatable":true,"description":"The action captured by the event.\n\nThis describes the information in the event. It is more specific than `event.category`.\nExamples are `group-add`, `process-started`, `file-created`. The value is\nnormally defined by the implementer.","columnHeaderType":"not-filtered","id":"event.action","category":"event","type":"string","example":"user-password-change"},{"aggregatable":true,"description":"Array of process arguments, starting with the absolute path to\nthe executable.\n\nMay be filtered to protect sensitive information.","columnHeaderType":"not-filtered","id":"process.args","category":"process","type":"string","example":"[\"/usr/bin/ssh\",\"-l\",\"user\",\"10.0.0.16\"]"},{"columnHeaderType":"not-filtered","id":"process.pid"},{"aggregatable":true,"description":"IP address of the source (IPv4 or IPv6).","columnHeaderType":"not-filtered","id":"source.ip","category":"source","type":"ip"},{"aggregatable":true,"description":"Port of the source.","columnHeaderType":"not-filtered","id":"source.port","category":"source","type":"number"},{"aggregatable":true,"description":"IP address of the destination (IPv4 or IPv6).","columnHeaderType":"not-filtered","id":"destination.ip","category":"destination","type":"ip"},{"columnHeaderType":"not-filtered","id":"destination.port"},{"aggregatable":true,"description":"Short name or login of the user.","columnHeaderType":"not-filtered","id":"user.name","category":"user","type":"string","example":"albert"},{"columnHeaderType":"not-filtered","id":"host.name"}],"dataProviders":[{"excluded":false,"and":[{"excluded":false,"kqlQuery":"","name":"{threat.indicator.matched.type}","queryMatch":{"displayValue":null,"field":"threat.indicator.matched.type","displayField":null,"value":"{threat.indicator.matched.type}","operator":":"},"id":"timeline-1-ae18ef4b-f690-4122-a24d-e13b6818fba8","type":"template","enabled":true},{"excluded":false,"kqlQuery":"","name":"{threat.indicator.matched.field}","queryMatch":{"displayValue":null,"field":"threat.indicator.matched.field","displayField":null,"value":"{threat.indicator.matched.field}","operator":":"},"id":"timeline-1-7b4cf27e-6788-4d8e-9188-7687f0eba0f2","type":"template","enabled":true}],"kqlQuery":"","name":"{threat.indicator.matched.atomic}","queryMatch":{"displayValue":null,"field":"threat.indicator.matched.atomic","displayField":null,"value":"{threat.indicator.matched.atomic}","operator":":"},"id":"timeline-1-7db7d278-a80a-4853-971a-904319c50777","type":"template","enabled":true}],"description":"This Timeline template is for alerts generated by Indicator Match detection rules.","eqlOptions":{"eventCategoryField":"event.category","tiebreakerField":"","timestampField":"@timestamp","query":"","size":100},"eventType":"alert","filters":[],"kqlMode":"filter","kqlQuery":{"filterQuery":{"kuery":{"kind":"kuery","expression":""},"serializedQuery":""}},"indexNames":[".siem-signals-default"],"title":"Generic Threat Match Timeline","timelineType":"template","templateTimelineVersion":1,"templateTimelineId":"495ad7a7-316e-4544-8a0f-9c098daee76e","dateRange":{"start":1588161020848,"end":1588162280848},"savedQueryId":null,"sort":[{"sortDirection":"desc","columnId":"@timestamp"}],"created":1616696609311,"createdBy":"elastic","updated":1616788372794,"updatedBy":"elastic","eventNotes":[],"globalNotes":[],"pinnedEventIds":[],"status":"immutable"} From 9a76d34b049b0a6effbf0c42e30ae7df2e56366b Mon Sep 17 00:00:00 2001 From: Chris Roberson Date: Thu, 15 Apr 2021 10:15:40 -0400 Subject: [PATCH 16/68] [Alerting] Show more user friendly ES error message when executor fails (#96254) * WIP for ES error parser * Fix tests * Ensure the error shows up in the UI too * wip * Handle multiple types here * Fix tests * PR feedback Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/alerting/server/index.ts | 1 + .../server/lib/alert_execution_status.ts | 3 +- .../server/lib/errors/es_error_parser.test.ts | 112 ++++++++++++++++++ .../server/lib/errors/es_error_parser.ts | 44 +++++++ .../alerting/server/lib/errors/index.ts | 5 +- .../alerting/server/lib/errors/types.ts | 24 +++- x-pack/plugins/alerting/server/lib/index.ts | 1 + .../server/task_runner/task_runner.ts | 12 +- .../server/data/lib/time_series_query.ts | 3 +- 9 files changed, 196 insertions(+), 9 deletions(-) create mode 100644 x-pack/plugins/alerting/server/lib/errors/es_error_parser.test.ts create mode 100644 x-pack/plugins/alerting/server/lib/errors/es_error_parser.ts diff --git a/x-pack/plugins/alerting/server/index.ts b/x-pack/plugins/alerting/server/index.ts index 2c282bc373896..72e3325107f31 100644 --- a/x-pack/plugins/alerting/server/index.ts +++ b/x-pack/plugins/alerting/server/index.ts @@ -33,6 +33,7 @@ export { PluginSetupContract, PluginStartContract } from './plugin'; export { FindResult } from './alerts_client'; export { PublicAlertInstance as AlertInstance } from './alert_instance'; export { parseDuration } from './lib'; +export { getEsErrorMessage } from './lib/errors'; export const plugin = (initContext: PluginInitializerContext) => new AlertingPlugin(initContext); diff --git a/x-pack/plugins/alerting/server/lib/alert_execution_status.ts b/x-pack/plugins/alerting/server/lib/alert_execution_status.ts index 5bf3467ee592f..7fad08a3cd29e 100644 --- a/x-pack/plugins/alerting/server/lib/alert_execution_status.ts +++ b/x-pack/plugins/alerting/server/lib/alert_execution_status.ts @@ -8,6 +8,7 @@ import { Logger } from 'src/core/server'; import { AlertTaskState, AlertExecutionStatus, RawAlertExecutionStatus } from '../types'; import { getReasonFromError } from './error_with_reason'; +import { getEsErrorMessage } from './errors'; export function executionStatusFromState(state: AlertTaskState): AlertExecutionStatus { const instanceIds = Object.keys(state.alertInstances ?? {}); @@ -23,7 +24,7 @@ export function executionStatusFromError(error: Error): AlertExecutionStatus { status: 'error', error: { reason: getReasonFromError(error), - message: error.message, + message: getEsErrorMessage(error), }, }; } diff --git a/x-pack/plugins/alerting/server/lib/errors/es_error_parser.test.ts b/x-pack/plugins/alerting/server/lib/errors/es_error_parser.test.ts new file mode 100644 index 0000000000000..883f17ada530a --- /dev/null +++ b/x-pack/plugins/alerting/server/lib/errors/es_error_parser.test.ts @@ -0,0 +1,112 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getEsErrorMessage } from './es_error_parser'; + +describe('ES error parser', () => { + test('should return all the cause of the error', () => { + expect( + getEsErrorMessage({ + name: '', + message: '', + error: { + meta: { + body: { + error: { + caused_by: { + reason: 'reason1', + }, + }, + }, + }, + }, + }) + ).toStrictEqual(', caused by: "reason1"'); + + expect( + getEsErrorMessage({ + name: '', + message: '', + meta: { + body: { + error: { + caused_by: { + reason: 'reason2', + }, + }, + }, + }, + }) + ).toStrictEqual(', caused by: "reason2"'); + + expect( + getEsErrorMessage({ + name: '', + message: '', + meta: { + body: { + error: { + caused_by: { + reason: 'reason3', + caused_by: { + reason: 'reason4', + }, + }, + }, + }, + }, + }) + ).toStrictEqual(', caused by: "reason3,reason4"'); + + expect( + getEsErrorMessage({ + name: '', + message: '', + meta: { + body: { + error: { + failed_shards: [ + { + reason: { + caused_by: { + reason: 'reason4', + }, + }, + }, + ], + }, + }, + }, + }) + ).toStrictEqual(', caused by: "reason4"'); + + expect( + getEsErrorMessage({ + name: '', + message: '', + meta: { + body: { + error: { + failed_shards: [ + { + reason: { + caused_by: { + reason: 'reason5', + caused_by: { + reason: 'reason6', + }, + }, + }, + }, + ], + }, + }, + }, + }) + ).toStrictEqual(', caused by: "reason5,reason6"'); + }); +}); diff --git a/x-pack/plugins/alerting/server/lib/errors/es_error_parser.ts b/x-pack/plugins/alerting/server/lib/errors/es_error_parser.ts new file mode 100644 index 0000000000000..3573da3a52eea --- /dev/null +++ b/x-pack/plugins/alerting/server/lib/errors/es_error_parser.ts @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +// import { ResponseError } from '@elastic/elasticsearch/lib/errors'; +import { ElasticsearchError, ElasticsearchErrorCausedByObject } from './types'; + +const getEsCause = ( + obj: ElasticsearchErrorCausedByObject = {}, + causes: string[] = [] +): string[] => { + const updated = [...causes]; + + if (obj.caused_by) { + if (obj.caused_by?.reason) { + updated.push(obj.caused_by?.reason); + } + + // Recursively find all the "caused by" reasons + return getEsCause(obj.caused_by, updated); + } + + if (obj.failed_shards && obj.failed_shards.length) { + for (const failure of obj.failed_shards) { + if (failure && failure.reason) { + updated.push(...getEsCause(failure.reason)); + } + } + } + + return updated.filter(Boolean); +}; + +export const getEsErrorMessage = (error: ElasticsearchError) => { + let message = error?.message; + const apiError = error?.error?.meta?.body?.error ?? error?.meta?.body?.error; + if (apiError) { + message += `, caused by: "${getEsCause(apiError as ElasticsearchErrorCausedByObject)}"`; + } + return message; +}; diff --git a/x-pack/plugins/alerting/server/lib/errors/index.ts b/x-pack/plugins/alerting/server/lib/errors/index.ts index 9c6d233f15d3d..66db39916832a 100644 --- a/x-pack/plugins/alerting/server/lib/errors/index.ts +++ b/x-pack/plugins/alerting/server/lib/errors/index.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { ErrorThatHandlesItsOwnResponse } from './types'; +import { ErrorThatHandlesItsOwnResponse, ElasticsearchError } from './types'; +import { getEsErrorMessage } from './es_error_parser'; export function isErrorThatHandlesItsOwnResponse( e: ErrorThatHandlesItsOwnResponse @@ -13,5 +14,5 @@ export function isErrorThatHandlesItsOwnResponse( return typeof (e as ErrorThatHandlesItsOwnResponse).sendResponse === 'function'; } -export { ErrorThatHandlesItsOwnResponse }; +export { ErrorThatHandlesItsOwnResponse, ElasticsearchError, getEsErrorMessage }; export { AlertTypeDisabledError, AlertTypeDisabledReason } from './alert_type_disabled'; diff --git a/x-pack/plugins/alerting/server/lib/errors/types.ts b/x-pack/plugins/alerting/server/lib/errors/types.ts index c8cd7d6d294f7..1b83526610270 100644 --- a/x-pack/plugins/alerting/server/lib/errors/types.ts +++ b/x-pack/plugins/alerting/server/lib/errors/types.ts @@ -4,9 +4,31 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - import { KibanaResponseFactory, IKibanaResponse } from '../../../../../../src/core/server'; export interface ErrorThatHandlesItsOwnResponse extends Error { sendResponse(res: KibanaResponseFactory): IKibanaResponse; } + +export interface ElasticsearchErrorCausedByObject { + reason?: string; + caused_by?: ElasticsearchErrorCausedByObject; + failed_shards?: Array<{ + reason?: { + caused_by?: ElasticsearchErrorCausedByObject; + }; + }>; +} + +interface ElasticsearchErrorMeta { + body?: { + error?: ElasticsearchErrorCausedByObject; + }; +} + +export interface ElasticsearchError extends Error { + error?: { + meta?: ElasticsearchErrorMeta; + }; + meta?: ElasticsearchErrorMeta; +} diff --git a/x-pack/plugins/alerting/server/lib/index.ts b/x-pack/plugins/alerting/server/lib/index.ts index 493b004106933..ed55548307e7c 100644 --- a/x-pack/plugins/alerting/server/lib/index.ts +++ b/x-pack/plugins/alerting/server/lib/index.ts @@ -16,6 +16,7 @@ export { AlertTypeDisabledReason, ErrorThatHandlesItsOwnResponse, isErrorThatHandlesItsOwnResponse, + ElasticsearchError, } from './errors'; export { executionStatusFromState, diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.ts index 744be16451999..8c3d22eeb2e7f 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner.ts @@ -20,6 +20,7 @@ import { executionStatusFromError, alertExecutionStatusToRaw, ErrorWithReason, + ElasticsearchError, } from '../lib'; import { RawAlert, @@ -49,6 +50,7 @@ import { WithoutReservedActionGroups, } from '../../common'; import { NormalizedAlertType } from '../alert_type_registry'; +import { getEsErrorMessage } from '../lib/errors'; const FALLBACK_RETRY_INTERVAL = '5m'; @@ -480,7 +482,7 @@ export class TaskRunner< const executionStatus: AlertExecutionStatus = map( state, (alertTaskState: AlertTaskState) => executionStatusFromState(alertTaskState), - (err: Error) => executionStatusFromError(err) + (err: ElasticsearchError) => executionStatusFromError(err) ); // set the executionStatus date to same as event, if it's set @@ -530,7 +532,7 @@ export class TaskRunner< } return { - state: map( + state: map( state, (stateUpdates: AlertTaskState) => { return { @@ -538,8 +540,10 @@ export class TaskRunner< previousStartedAt: startedAt, }; }, - (err: Error) => { - const message = `Executing Alert "${alertId}" has resulted in Error: ${err.message}`; + (err: ElasticsearchError) => { + const message = `Executing Alert "${alertId}" has resulted in Error: ${getEsErrorMessage( + err + )}`; if (isAlertSavedObjectNotFoundError(err, alertId)) { this.logger.debug(message); } else { diff --git a/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_query.ts b/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_query.ts index 98212f1dc6aaf..ad044f4570ea3 100644 --- a/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_query.ts +++ b/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_query.ts @@ -7,6 +7,7 @@ import type { estypes } from '@elastic/elasticsearch'; import { Logger, ElasticsearchClient } from 'kibana/server'; +import { getEsErrorMessage } from '../../../../alerting/server'; import { DEFAULT_GROUPS } from '../index'; import { getDateRangeInfo } from './date_range_info'; @@ -137,7 +138,7 @@ export async function timeSeriesQuery( esResult = (await esClient.search(esQuery, { ignore: [404] })).body; } catch (err) { // console.log('time_series_query.ts error\n', JSON.stringify(err, null, 4)); - logger.warn(`${logPrefix} error: ${err.message}`); + logger.warn(`${logPrefix} error: ${getEsErrorMessage(err)}`); return { results: [] }; } From d20ecaf93990c6199958faad29e08d51af0c3b99 Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Thu, 15 Apr 2021 16:32:27 +0200 Subject: [PATCH 17/68] [ML] Functional tests - fix transform _nodes API test for cloud (#97240) This PR fixes the transform _node API tests for cloud, where more than one transform node could be available. --- .../test/api_integration/apis/transform/transforms_nodes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/test/api_integration/apis/transform/transforms_nodes.ts b/x-pack/test/api_integration/apis/transform/transforms_nodes.ts index 593a1fb8fb723..ca9ab8e8a728d 100644 --- a/x-pack/test/api_integration/apis/transform/transforms_nodes.ts +++ b/x-pack/test/api_integration/apis/transform/transforms_nodes.ts @@ -20,14 +20,14 @@ export default ({ getService }: FtrProviderContext) => { const expected = { apiTransformTransformsNodes: { - count: 1, + minCount: 1, }, }; function assertTransformsNodesResponseBody(body: GetTransformNodesResponseSchema) { expect(isGetTransformNodesResponseSchema(body)).to.eql(true); - expect(body.count).to.eql(expected.apiTransformTransformsNodes.count); + expect(body.count).to.not.be.lessThan(expected.apiTransformTransformsNodes.minCount); } describe('/api/transform/transforms/_nodes', function () { From c710cb9bbd394ea7ff08bcda566ebb46eb5b0fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Thu, 15 Apr 2021 17:01:36 +0200 Subject: [PATCH 18/68] [DocLinks] Update outdated docs (#97217) --- .../core/public/kibana-plugin-core-public.doclinksstart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md index 11814e7ca8b77..b8d0d2288993e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md +++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md @@ -17,5 +17,5 @@ export interface DocLinksStart | --- | --- | --- | | [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md) | string | | | [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md) | string | | -| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly discover: Record<string, string>;
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly elasticsearchModule: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
readonly configure: string;
readonly httpEndpoint: string;
readonly install: string;
readonly start: string;
};
readonly enterpriseSearch: {
readonly base: string;
readonly appSearchBase: string;
readonly workplaceSearchBase: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly composite: string;
readonly composite_missing_bucket: string;
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly runtimeFields: {
readonly overview: string;
readonly mapping: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessLangSpec: string;
readonly painlessSyntax: string;
readonly painlessWalkthrough: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly introduction: string;
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
};
readonly addData: string;
readonly kibana: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly eql: string;
readonly kueryQuerySyntax: string;
readonly luceneQuerySyntax: string;
readonly percolate: string;
readonly queryDsl: string;
};
readonly date: {
readonly dateMath: string;
readonly dateMathIndexNames: string;
};
readonly management: Record<string, string>;
readonly ml: Record<string, string>;
readonly transforms: Record<string, string>;
readonly visualize: Record<string, string>;
readonly apis: Readonly<{
bulkIndexAlias: string;
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
createRoleMappingTemplates: string;
createApiKey: string;
createPipeline: string;
createTransformRequest: string;
cronExpressions: string;
executeWatchActionModes: string;
indexExists: string;
openIndex: string;
putComponentTemplate: string;
painlessExecute: string;
painlessExecuteAPIContexts: string;
putComponentTemplateMetadata: string;
putSnapshotLifecyclePolicy: string;
putIndexTemplateV1: string;
putWatch: string;
simulatePipeline: string;
updateTransform: string;
}>;
readonly observability: Record<string, string>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly monitoring: Record<string, string>;
readonly security: Readonly<{
apiKeyServiceSettings: string;
clusterPrivileges: string;
elasticsearchSettings: string;
elasticsearchEnableSecurity: string;
indicesPrivileges: string;
kibanaTLS: string;
kibanaPrivileges: string;
mappingRoles: string;
mappingRolesFieldRules: string;
runAsPrivilege: string;
}>;
readonly watcher: Record<string, string>;
readonly ccs: Record<string, string>;
readonly plugins: Record<string, string>;
readonly snapshotRestore: Record<string, string>;
readonly ingest: Record<string, string>;
} | | +| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly discover: Record<string, string>;
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly elasticsearchModule: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
readonly configure: string;
readonly httpEndpoint: string;
readonly install: string;
readonly start: string;
};
readonly enterpriseSearch: {
readonly base: string;
readonly appSearchBase: string;
readonly workplaceSearchBase: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly composite: string;
readonly composite_missing_bucket: string;
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly runtimeFields: {
readonly overview: string;
readonly mapping: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessLangSpec: string;
readonly painlessSyntax: string;
readonly painlessWalkthrough: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly introduction: string;
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
};
readonly addData: string;
readonly kibana: string;
readonly upgradeAssistant: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly eql: string;
readonly kueryQuerySyntax: string;
readonly luceneQuerySyntax: string;
readonly percolate: string;
readonly queryDsl: string;
};
readonly date: {
readonly dateMath: string;
readonly dateMathIndexNames: string;
};
readonly management: Record<string, string>;
readonly ml: Record<string, string>;
readonly transforms: Record<string, string>;
readonly visualize: Record<string, string>;
readonly apis: Readonly<{
bulkIndexAlias: string;
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
createRoleMappingTemplates: string;
createApiKey: string;
createPipeline: string;
createTransformRequest: string;
cronExpressions: string;
executeWatchActionModes: string;
indexExists: string;
openIndex: string;
putComponentTemplate: string;
painlessExecute: string;
painlessExecuteAPIContexts: string;
putComponentTemplateMetadata: string;
putSnapshotLifecyclePolicy: string;
putIndexTemplateV1: string;
putWatch: string;
simulatePipeline: string;
updateTransform: string;
}>;
readonly observability: Record<string, string>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly monitoring: Record<string, string>;
readonly security: Readonly<{
apiKeyServiceSettings: string;
clusterPrivileges: string;
elasticsearchSettings: string;
elasticsearchEnableSecurity: string;
indicesPrivileges: string;
kibanaTLS: string;
kibanaPrivileges: string;
mappingRoles: string;
mappingRolesFieldRules: string;
runAsPrivilege: string;
}>;
readonly watcher: Record<string, string>;
readonly ccs: Record<string, string>;
readonly plugins: Record<string, string>;
readonly snapshotRestore: Record<string, string>;
readonly ingest: Record<string, string>;
} | | From 9b456ac0fe706528a686060c8c013b9998e7c45e Mon Sep 17 00:00:00 2001 From: Kerry Gallagher <471693+Kerry350@users.noreply.github.com> Date: Thu, 15 Apr 2021 16:15:11 +0100 Subject: [PATCH 19/68] [Logs UI] Provide support for Kibana Index Patterns in the logs source configuration (#96454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Provide support for Kibana Index Patterns in the logs source configuration Co-authored-by: Felix Stürmer --- .../common/http_api/log_entries/highlights.ts | 2 +- .../common/http_api/log_sources/common.ts | 11 +++ .../get_log_source_configuration.ts | 2 +- .../log_sources/get_log_source_status.ts | 6 +- .../common/http_api/log_sources/index.ts | 2 +- .../patch_log_source_configuration.ts | 2 +- .../plugins/infra/common/log_sources/index.ts | 9 ++ .../log_sources/log_source_configuration.ts | 22 +++-- .../resolve_log_source_configuration.ts | 19 ----- .../resolved_log_source_configuration.ts | 83 +++++++++++++++++++ .../log_entries/log_entries.ts | 2 +- .../source_configuration.ts | 30 ++++++- .../components/expression_editor/editor.tsx | 32 +++---- .../components/log_stream/log_stream.tsx | 11 ++- .../logs/log_source/log_source.mock.ts | 13 ++- .../containers/logs/log_source/log_source.ts | 82 +++++++++++++----- .../log_stream/use_fetch_log_entries_after.ts | 2 +- .../use_fetch_log_entries_around.ts | 2 +- .../use_fetch_log_entries_before.ts | 2 +- .../pages/link_to/link_to_logs.test.tsx | 3 + .../pages/link_to/redirect_to_node_logs.tsx | 6 +- .../log_entry_categories/page_providers.tsx | 8 +- .../logs/log_entry_rate/page_providers.tsx | 12 +-- .../public/pages/logs/page_providers.tsx | 11 ++- .../source_configuration_form_state.tsx | 12 +-- .../source_configuration_settings.tsx | 27 ++++-- .../pages/logs/stream/page_logs_content.tsx | 4 +- .../public/test_utils/source_configuration.ts | 6 +- .../public/utils/fixtures/metrics_explorer.ts | 2 - .../public/utils/logs_overview_fetchers.ts | 10 ++- .../utils/logs_overview_fetches.test.ts | 11 ++- .../fields/framework_fields_adapter.ts | 11 ++- .../framework/kibana_framework_adapter.ts | 39 +++++++-- .../log_entries/kibana_log_entries_adapter.ts | 24 +++--- .../inventory_metric_threshold_executor.ts | 3 +- .../log_threshold_chart_preview.ts | 8 +- .../log_threshold/log_threshold_executor.ts | 12 ++- .../lib/alerting/log_threshold/mocks/index.ts | 5 +- .../infra/server/lib/domains/fields_domain.ts | 7 +- .../log_entries_domain/log_entries_domain.ts | 29 +++++-- .../plugins/infra/server/lib/source_status.ts | 37 +-------- .../infra/server/lib/sources/defaults.ts | 5 +- ...0_convert_log_alias_to_log_indices.test.ts | 62 ++++++++++++++ ...7_13_0_convert_log_alias_to_log_indices.ts | 34 ++++++++ ...0_add_new_indexing_strategy_index_names.ts | 8 +- .../server/lib/sources/saved_object_type.ts | 2 + .../infra/server/lib/sources/sources.test.ts | 10 +-- .../infra/server/lib/sources/sources.ts | 35 +++++--- x-pack/plugins/infra/server/plugin.ts | 4 +- .../infra/server/routes/alerting/preview.ts | 3 +- .../routes/log_alerts/chart_preview_data.ts | 10 ++- .../infra/server/routes/log_sources/status.ts | 22 +++-- .../infra/server/routes/snapshot/index.ts | 3 +- ...orm_request_to_metrics_api_request.test.ts | 5 +- .../log_entries_search_strategy.test.ts | 11 ++- .../log_entries_search_strategy.ts | 59 +++++++------ .../log_entry_search_strategy.test.ts | 10 ++- .../log_entries/log_entry_search_strategy.ts | 32 +++++-- .../server/services/log_entries/mocks.ts | 37 +++++++++ .../log_queries/get_log_query_fields.ts | 19 +++-- .../server/lib/logs/init_infra_source.ts | 5 +- .../apis/metrics_ui/log_sources.ts | 35 ++++++-- 62 files changed, 756 insertions(+), 276 deletions(-) create mode 100644 x-pack/plugins/infra/common/http_api/log_sources/common.ts create mode 100644 x-pack/plugins/infra/common/log_sources/index.ts rename x-pack/plugins/infra/common/{http_api => }/log_sources/log_source_configuration.ts (83%) delete mode 100644 x-pack/plugins/infra/common/log_sources/resolve_log_source_configuration.ts create mode 100644 x-pack/plugins/infra/common/log_sources/resolved_log_source_configuration.ts create mode 100644 x-pack/plugins/infra/server/lib/sources/migrations/7_13_0_convert_log_alias_to_log_indices.test.ts create mode 100644 x-pack/plugins/infra/server/lib/sources/migrations/7_13_0_convert_log_alias_to_log_indices.ts create mode 100644 x-pack/plugins/infra/server/services/log_entries/mocks.ts diff --git a/x-pack/plugins/infra/common/http_api/log_entries/highlights.ts b/x-pack/plugins/infra/common/http_api/log_entries/highlights.ts index 892abca32e753..be3a8f50922f7 100644 --- a/x-pack/plugins/infra/common/http_api/log_entries/highlights.ts +++ b/x-pack/plugins/infra/common/http_api/log_entries/highlights.ts @@ -7,7 +7,7 @@ import * as rt from 'io-ts'; import { logEntryCursorRT, logEntryRT } from '../../log_entry'; -import { logSourceColumnConfigurationRT } from '../log_sources'; +import { logSourceColumnConfigurationRT } from '../../log_sources/log_source_configuration'; export const LOG_ENTRIES_HIGHLIGHTS_PATH = '/api/log_entries/highlights'; diff --git a/x-pack/plugins/infra/common/http_api/log_sources/common.ts b/x-pack/plugins/infra/common/http_api/log_sources/common.ts new file mode 100644 index 0000000000000..3a30e94e9a153 --- /dev/null +++ b/x-pack/plugins/infra/common/http_api/log_sources/common.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const LOG_SOURCE_CONFIGURATION_PATH_PREFIX = '/api/infra/log_source_configurations'; +export const LOG_SOURCE_CONFIGURATION_PATH = `${LOG_SOURCE_CONFIGURATION_PATH_PREFIX}/{sourceId}`; +export const getLogSourceConfigurationPath = (sourceId: string) => + `${LOG_SOURCE_CONFIGURATION_PATH_PREFIX}/${sourceId}`; diff --git a/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_configuration.ts b/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_configuration.ts index e464601702ed5..bbecc642fd7ab 100644 --- a/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_configuration.ts +++ b/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_configuration.ts @@ -7,7 +7,7 @@ import * as rt from 'io-ts'; import { badRequestErrorRT, forbiddenErrorRT, routeTimingMetadataRT } from '../shared'; -import { logSourceConfigurationRT } from './log_source_configuration'; +import { logSourceConfigurationRT } from '../../log_sources/log_source_configuration'; /** * request diff --git a/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_status.ts b/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_status.ts index 5836b8e9d220f..83919c60de0af 100644 --- a/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_status.ts +++ b/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_status.ts @@ -7,10 +7,7 @@ import * as rt from 'io-ts'; import { routeTimingMetadataRT } from '../shared'; -import { - getLogSourceConfigurationPath, - LOG_SOURCE_CONFIGURATION_PATH, -} from './log_source_configuration'; +import { getLogSourceConfigurationPath, LOG_SOURCE_CONFIGURATION_PATH } from './common'; export const LOG_SOURCE_STATUS_PATH_SUFFIX = 'status'; export const LOG_SOURCE_STATUS_PATH = `${LOG_SOURCE_CONFIGURATION_PATH}/${LOG_SOURCE_STATUS_PATH_SUFFIX}`; @@ -50,7 +47,6 @@ const logIndexStatusRT = rt.keyof({ export type LogIndexStatus = rt.TypeOf; const logSourceStatusRT = rt.strict({ - logIndexFields: rt.array(logIndexFieldRT), logIndexStatus: logIndexStatusRT, }); diff --git a/x-pack/plugins/infra/common/http_api/log_sources/index.ts b/x-pack/plugins/infra/common/http_api/log_sources/index.ts index 1dc8ab5ab646f..f37ad1f4b1f73 100644 --- a/x-pack/plugins/infra/common/http_api/log_sources/index.ts +++ b/x-pack/plugins/infra/common/http_api/log_sources/index.ts @@ -7,5 +7,5 @@ export * from './get_log_source_configuration'; export * from './get_log_source_status'; -export * from './log_source_configuration'; export * from './patch_log_source_configuration'; +export * from './common'; diff --git a/x-pack/plugins/infra/common/http_api/log_sources/patch_log_source_configuration.ts b/x-pack/plugins/infra/common/http_api/log_sources/patch_log_source_configuration.ts index 5d4ee1d7b5b62..30f53bc256cd8 100644 --- a/x-pack/plugins/infra/common/http_api/log_sources/patch_log_source_configuration.ts +++ b/x-pack/plugins/infra/common/http_api/log_sources/patch_log_source_configuration.ts @@ -8,7 +8,7 @@ import * as rt from 'io-ts'; import { badRequestErrorRT, forbiddenErrorRT } from '../shared'; import { getLogSourceConfigurationSuccessResponsePayloadRT } from './get_log_source_configuration'; -import { logSourceConfigurationPropertiesRT } from './log_source_configuration'; +import { logSourceConfigurationPropertiesRT } from '../../log_sources/log_source_configuration'; /** * request diff --git a/x-pack/plugins/infra/common/log_sources/index.ts b/x-pack/plugins/infra/common/log_sources/index.ts new file mode 100644 index 0000000000000..bc36c45307e4d --- /dev/null +++ b/x-pack/plugins/infra/common/log_sources/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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export * from './log_source_configuration'; +export * from './resolved_log_source_configuration'; diff --git a/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts b/x-pack/plugins/infra/common/log_sources/log_source_configuration.ts similarity index 83% rename from x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts rename to x-pack/plugins/infra/common/log_sources/log_source_configuration.ts index ea723e12256eb..83bc8743900eb 100644 --- a/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts +++ b/x-pack/plugins/infra/common/log_sources/log_source_configuration.ts @@ -7,11 +7,6 @@ import * as rt from 'io-ts'; -export const LOG_SOURCE_CONFIGURATION_PATH_PREFIX = '/api/infra/log_source_configurations'; -export const LOG_SOURCE_CONFIGURATION_PATH = `${LOG_SOURCE_CONFIGURATION_PATH_PREFIX}/{sourceId}`; -export const getLogSourceConfigurationPath = (sourceId: string) => - `${LOG_SOURCE_CONFIGURATION_PATH_PREFIX}/${sourceId}`; - export const logSourceConfigurationOriginRT = rt.keyof({ fallback: null, internal: null, @@ -26,6 +21,7 @@ const logSourceFieldsConfigurationRT = rt.strict({ pod: rt.string, timestamp: rt.string, tiebreaker: rt.string, + message: rt.array(rt.string), }); const logSourceCommonColumnConfigurationRT = rt.strict({ @@ -56,10 +52,24 @@ export const logSourceColumnConfigurationRT = rt.union([ ]); export type LogSourceColumnConfiguration = rt.TypeOf; +// Kibana index pattern +const logIndexPatternReferenceRT = rt.type({ + type: rt.literal('index_pattern'), + indexPatternId: rt.string, +}); + +// Legacy support +const logIndexNameReferenceRT = rt.type({ + type: rt.literal('index_name'), + indexName: rt.string, +}); + +export const logIndexReferenceRT = rt.union([logIndexPatternReferenceRT, logIndexNameReferenceRT]); + export const logSourceConfigurationPropertiesRT = rt.strict({ name: rt.string, description: rt.string, - logAlias: rt.string, + logIndices: logIndexReferenceRT, fields: logSourceFieldsConfigurationRT, logColumns: rt.array(logSourceColumnConfigurationRT), }); diff --git a/x-pack/plugins/infra/common/log_sources/resolve_log_source_configuration.ts b/x-pack/plugins/infra/common/log_sources/resolve_log_source_configuration.ts deleted file mode 100644 index ad4b2963a41bd..0000000000000 --- a/x-pack/plugins/infra/common/log_sources/resolve_log_source_configuration.ts +++ /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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { LogSourceConfigurationProperties } from '../http_api/log_sources'; - -// NOTE: Type will change, see below. -type ResolvedLogsSourceConfiguration = LogSourceConfigurationProperties; - -// NOTE: This will handle real resolution for https://github.com/elastic/kibana/issues/92650, via the index patterns service, but for now just -// hands back properties from the saved object (and therefore looks pointless...). -export const resolveLogSourceConfiguration = ( - sourceConfiguration: LogSourceConfigurationProperties -): ResolvedLogsSourceConfiguration => { - return sourceConfiguration; -}; diff --git a/x-pack/plugins/infra/common/log_sources/resolved_log_source_configuration.ts b/x-pack/plugins/infra/common/log_sources/resolved_log_source_configuration.ts new file mode 100644 index 0000000000000..8bc7eee7d4eb6 --- /dev/null +++ b/x-pack/plugins/infra/common/log_sources/resolved_log_source_configuration.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + LogSourceConfigurationProperties, + LogSourceColumnConfiguration, +} from './log_source_configuration'; +import { IndexPatternsContract, IndexPattern } from '../../../../../src/plugins/data/common'; + +export interface ResolvedLogSourceConfiguration { + name: string; + description: string; + indices: string; + timestampField: string; + tiebreakerField: string; + messageField: string[]; + fields: IndexPattern['fields']; + columns: LogSourceColumnConfiguration[]; +} + +export const resolveLogSourceConfiguration = async ( + sourceConfiguration: LogSourceConfigurationProperties, + indexPatternsService: IndexPatternsContract +): Promise => { + if (sourceConfiguration.logIndices.type === 'index_name') { + return await resolveLegacyReference(sourceConfiguration, indexPatternsService); + } else { + return await resolveKibanaIndexPatternReference(sourceConfiguration, indexPatternsService); + } +}; + +const resolveLegacyReference = async ( + sourceConfiguration: LogSourceConfigurationProperties, + indexPatternsService: IndexPatternsContract +): Promise => { + if (sourceConfiguration.logIndices.type !== 'index_name') { + throw new Error('This function can only resolve legacy references'); + } + + const fields = await indexPatternsService.getFieldsForWildcard({ + pattern: sourceConfiguration.logIndices.indexName, + allowNoIndex: true, + }); + + return { + indices: sourceConfiguration.logIndices.indexName, + timestampField: sourceConfiguration.fields.timestamp, + tiebreakerField: sourceConfiguration.fields.tiebreaker, + messageField: sourceConfiguration.fields.message, + fields, + columns: sourceConfiguration.logColumns, + name: sourceConfiguration.name, + description: sourceConfiguration.description, + }; +}; + +const resolveKibanaIndexPatternReference = async ( + sourceConfiguration: LogSourceConfigurationProperties, + indexPatternsService: IndexPatternsContract +): Promise => { + if (sourceConfiguration.logIndices.type !== 'index_pattern') { + throw new Error('This function can only resolve Kibana Index Pattern references'); + } + + const indexPattern = await indexPatternsService.get( + sourceConfiguration.logIndices.indexPatternId + ); + + return { + indices: indexPattern.title, + timestampField: indexPattern.timeFieldName ?? '@timestamp', + tiebreakerField: '_doc', + messageField: ['message'], + fields: indexPattern.fields, + columns: sourceConfiguration.logColumns, + name: sourceConfiguration.name, + description: sourceConfiguration.description, + }; +}; diff --git a/x-pack/plugins/infra/common/search_strategies/log_entries/log_entries.ts b/x-pack/plugins/infra/common/search_strategies/log_entries/log_entries.ts index d6fec592e848c..071432e4937c3 100644 --- a/x-pack/plugins/infra/common/search_strategies/log_entries/log_entries.ts +++ b/x-pack/plugins/infra/common/search_strategies/log_entries/log_entries.ts @@ -7,7 +7,7 @@ import * as rt from 'io-ts'; import { DslQuery } from '../../../../../../src/plugins/data/common'; -import { logSourceColumnConfigurationRT } from '../../http_api/log_sources'; +import { logSourceColumnConfigurationRT } from '../../log_sources/log_source_configuration'; import { logEntryAfterCursorRT, logEntryBeforeCursorRT, diff --git a/x-pack/plugins/infra/common/source_configuration/source_configuration.ts b/x-pack/plugins/infra/common/source_configuration/source_configuration.ts index ad68a7a019848..40390d386f1c5 100644 --- a/x-pack/plugins/infra/common/source_configuration/source_configuration.ts +++ b/x-pack/plugins/infra/common/source_configuration/source_configuration.ts @@ -22,6 +22,7 @@ import * as rt from 'io-ts'; import moment from 'moment'; import { pipe } from 'fp-ts/lib/pipeable'; import { chain } from 'fp-ts/lib/Either'; +import { logIndexReferenceRT } from '../log_sources'; export const TimestampFromString = new rt.Type( 'TimestampFromString', @@ -39,6 +40,33 @@ export const TimestampFromString = new rt.Type( (output) => new Date(output).toISOString() ); +/** + * Source configuration config file properties. + * These are properties that can appear in the kibana.yml file. + * This is a legacy method of providing properties, and will be deprecated in the future (v 8.0.0). + */ + +export const sourceConfigurationConfigFilePropertiesRT = rt.type({ + sources: rt.type({ + default: rt.partial({ + logAlias: rt.string, // Cannot be deprecated until 8.0.0. Will be converted to an indexName reference. + metricAlias: rt.string, + fields: rt.partial({ + timestamp: rt.string, + message: rt.array(rt.string), + tiebreaker: rt.string, + host: rt.string, + container: rt.string, + pod: rt.string, + }), + }), + }), +}); + +export type SourceConfigurationConfigFileProperties = rt.TypeOf< + typeof sourceConfigurationConfigFilePropertiesRT +>; + /** * Log columns */ @@ -103,7 +131,7 @@ export const SourceConfigurationRT = rt.type({ name: rt.string, description: rt.string, metricAlias: rt.string, - logAlias: rt.string, + logIndices: logIndexReferenceRT, inventoryDefaultView: rt.string, metricsExplorerDefaultView: rt.string, fields: SourceConfigurationFieldsRT, diff --git a/x-pack/plugins/infra/public/alerting/log_threshold/components/expression_editor/editor.tsx b/x-pack/plugins/infra/public/alerting/log_threshold/components/expression_editor/editor.tsx index b71a8d934a4d2..ef533f63dc175 100644 --- a/x-pack/plugins/infra/public/alerting/log_threshold/components/expression_editor/editor.tsx +++ b/x-pack/plugins/infra/public/alerting/log_threshold/components/expression_editor/editor.tsx @@ -102,7 +102,11 @@ export const ExpressionEditor: React.FC< ) : ( - + @@ -115,10 +119,10 @@ export const ExpressionEditor: React.FC< export const SourceStatusWrapper: React.FC = ({ children }) => { const { initialize, - isLoadingSourceStatus, + loadSource, + isLoadingSourceConfiguration, + hasFailedLoadingSource, isUninitialized, - hasFailedLoadingSourceStatus, - loadSourceStatus, } = useLogSourceContext(); useMount(() => { @@ -127,13 +131,13 @@ export const SourceStatusWrapper: React.FC = ({ children }) => { return ( <> - {isLoadingSourceStatus || isUninitialized ? ( + {isLoadingSourceConfiguration || isUninitialized ? (
- ) : hasFailedLoadingSourceStatus ? ( + ) : hasFailedLoadingSource ? ( { color="danger" iconType="alert" > - + {i18n.translate('xpack.infra.logs.alertFlyout.sourceStatusErrorTryAgain', { defaultMessage: 'Try again', })} @@ -159,7 +163,7 @@ export const Editor: React.FC< > = (props) => { const { setAlertParams, alertParams, errors } = props; const [hasSetDefaults, setHasSetDefaults] = useState(false); - const { sourceId, sourceStatus } = useLogSourceContext(); + const { sourceId, resolvedSourceConfiguration } = useLogSourceContext(); const { criteria: criteriaErrors, @@ -169,24 +173,24 @@ export const Editor: React.FC< } = useMemo(() => decodeOrThrow(errorsRT)(errors), [errors]); const supportedFields = useMemo(() => { - if (sourceStatus?.logIndexFields) { - return sourceStatus.logIndexFields.filter((field) => { + if (resolvedSourceConfiguration?.fields) { + return resolvedSourceConfiguration.fields.filter((field) => { return (field.type === 'string' || field.type === 'number') && field.searchable; }); } else { return []; } - }, [sourceStatus]); + }, [resolvedSourceConfiguration]); const groupByFields = useMemo(() => { - if (sourceStatus?.logIndexFields) { - return sourceStatus.logIndexFields.filter((field) => { + if (resolvedSourceConfiguration?.fields) { + return resolvedSourceConfiguration.fields.filter((field) => { return field.type === 'string' && field.aggregatable; }); } else { return []; } - }, [sourceStatus]); + }, [resolvedSourceConfiguration]); const updateThreshold = useCallback( (thresholdParams) => { diff --git a/x-pack/plugins/infra/public/components/log_stream/log_stream.tsx b/x-pack/plugins/infra/public/components/log_stream/log_stream.tsx index 7904f70ebfd39..a481a3897789e 100644 --- a/x-pack/plugins/infra/public/components/log_stream/log_stream.tsx +++ b/x-pack/plugins/infra/public/components/log_stream/log_stream.tsx @@ -7,8 +7,8 @@ import React, { useMemo, useCallback, useEffect } from 'react'; import { noop } from 'lodash'; +import type { DataPublicPluginStart } from '../../../../../../src/plugins/data/public'; import { euiStyled } from '../../../../../../src/plugins/kibana_react/common'; - import { LogEntryCursor } from '../../../common/log_entry'; import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; @@ -20,6 +20,10 @@ import { LogColumnRenderConfiguration } from '../../utils/log_column_render_conf import { JsonValue } from '../../../../../../src/plugins/kibana_utils/common'; import { Query } from '../../../../../../src/plugins/data/common'; +interface LogStreamPluginDeps { + data: DataPublicPluginStart; +} + const PAGE_THRESHOLD = 2; interface CommonColumnDefinition { @@ -80,8 +84,8 @@ export const LogStream: React.FC = ({ ); // source boilerplate - const { services } = useKibana(); - if (!services?.http?.fetch) { + const { services } = useKibana(); + if (!services?.http?.fetch || !services?.data?.indexPatterns) { throw new Error( ` cannot access kibana core services. @@ -98,6 +102,7 @@ Read more at https://github.com/elastic/kibana/blob/master/src/plugins/kibana_re } = useLogSource({ sourceId, fetch: services.http.fetch, + indexPatternsService: services.data.indexPatterns, }); // Internal state diff --git a/x-pack/plugins/infra/public/containers/logs/log_source/log_source.mock.ts b/x-pack/plugins/infra/public/containers/logs/log_source/log_source.mock.ts index 6fdbf4a104e62..7e23f51c1c562 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_source/log_source.mock.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_source/log_source.mock.ts @@ -20,19 +20,24 @@ export const createUninitializedUseLogSourceMock: CreateUseLogSource = ({ }, hasFailedLoadingSource: false, hasFailedLoadingSourceStatus: false, + hasFailedResolvingSourceConfiguration: false, initialize: jest.fn(), isLoading: false, isLoadingSourceConfiguration: false, isLoadingSourceStatus: false, + isResolvingSourceConfiguration: false, isUninitialized: true, loadSource: jest.fn(), loadSourceConfiguration: jest.fn(), loadSourceFailureMessage: undefined, + resolveSourceFailureMessage: undefined, loadSourceStatus: jest.fn(), sourceConfiguration: undefined, sourceId, sourceStatus: undefined, updateSourceConfiguration: jest.fn(), + resolvedSourceConfiguration: undefined, + loadResolveLogSourceConfiguration: jest.fn(), }); export const createLoadingUseLogSourceMock: CreateUseLogSource = ({ @@ -42,6 +47,7 @@ export const createLoadingUseLogSourceMock: CreateUseLogSource = ({ isLoading: true, isLoadingSourceConfiguration: true, isLoadingSourceStatus: true, + isResolvingSourceConfiguration: true, }); export const createLoadedUseLogSourceMock: CreateUseLogSource = ({ @@ -60,7 +66,10 @@ export const createBasicSourceConfiguration = (sourceId: string): LogSourceConfi origin: 'stored', configuration: { description: `description for ${sourceId}`, - logAlias: 'LOG_INDICES', + logIndices: { + type: 'index_pattern', + indexPatternId: 'some-id', + }, logColumns: [], fields: { container: 'CONTAINER_FIELD', @@ -68,12 +77,12 @@ export const createBasicSourceConfiguration = (sourceId: string): LogSourceConfi pod: 'POD_FIELD', tiebreaker: 'TIEBREAKER_FIELD', timestamp: 'TIMESTAMP_FIELD', + message: ['MESSAGE_FIELD'], }, name: sourceId, }, }); export const createAvailableSourceStatus = (logIndexFields = []): LogSourceStatus => ({ - logIndexFields, logIndexStatus: 'available', }); diff --git a/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts b/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts index 98636b3e4afea..81d650fcef35c 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts @@ -11,15 +11,20 @@ import useMountedState from 'react-use/lib/useMountedState'; import type { HttpHandler } from 'src/core/public'; import { LogIndexField, - LogSourceConfiguration, - LogSourceConfigurationProperties, LogSourceConfigurationPropertiesPatch, LogSourceStatus, } from '../../../../common/http_api/log_sources'; +import { + LogSourceConfiguration, + LogSourceConfigurationProperties, + ResolvedLogSourceConfiguration, + resolveLogSourceConfiguration, +} from '../../../../common/log_sources'; import { useTrackedPromise } from '../../../utils/use_tracked_promise'; import { callFetchLogSourceConfigurationAPI } from './api/fetch_log_source_configuration'; import { callFetchLogSourceStatusAPI } from './api/fetch_log_source_status'; import { callPatchLogSourceConfigurationAPI } from './api/patch_log_source_configuration'; +import { IndexPatternsContract } from '../../../../../../../src/plugins/data/common'; export { LogIndexField, @@ -29,47 +34,78 @@ export { LogSourceStatus, }; -export const useLogSource = ({ sourceId, fetch }: { sourceId: string; fetch: HttpHandler }) => { +export const useLogSource = ({ + sourceId, + fetch, + indexPatternsService, +}: { + sourceId: string; + fetch: HttpHandler; + indexPatternsService: IndexPatternsContract; +}) => { const getIsMounted = useMountedState(); const [sourceConfiguration, setSourceConfiguration] = useState< LogSourceConfiguration | undefined >(undefined); + const [resolvedSourceConfiguration, setResolvedSourceConfiguration] = useState< + ResolvedLogSourceConfiguration | undefined + >(undefined); + const [sourceStatus, setSourceStatus] = useState(undefined); const [loadSourceConfigurationRequest, loadSourceConfiguration] = useTrackedPromise( { cancelPreviousOn: 'resolution', createPromise: async () => { - return await callFetchLogSourceConfigurationAPI(sourceId, fetch); + const { data: sourceConfigurationResponse } = await callFetchLogSourceConfigurationAPI( + sourceId, + fetch + ); + const resolvedSourceConfigurationResponse = await resolveLogSourceConfiguration( + sourceConfigurationResponse?.configuration, + indexPatternsService + ); + return { sourceConfigurationResponse, resolvedSourceConfigurationResponse }; }, - onResolve: ({ data }) => { + onResolve: ({ sourceConfigurationResponse, resolvedSourceConfigurationResponse }) => { if (!getIsMounted()) { return; } - setSourceConfiguration(data); + setSourceConfiguration(sourceConfigurationResponse); + setResolvedSourceConfiguration(resolvedSourceConfigurationResponse); }, }, - [sourceId, fetch] + [sourceId, fetch, indexPatternsService] ); const [updateSourceConfigurationRequest, updateSourceConfiguration] = useTrackedPromise( { cancelPreviousOn: 'resolution', createPromise: async (patchedProperties: LogSourceConfigurationPropertiesPatch) => { - return await callPatchLogSourceConfigurationAPI(sourceId, patchedProperties, fetch); + const { data: updatedSourceConfig } = await callPatchLogSourceConfigurationAPI( + sourceId, + patchedProperties, + fetch + ); + const resolvedSourceConfig = await resolveLogSourceConfiguration( + updatedSourceConfig.configuration, + indexPatternsService + ); + return { updatedSourceConfig, resolvedSourceConfig }; }, - onResolve: ({ data }) => { + onResolve: ({ updatedSourceConfig, resolvedSourceConfig }) => { if (!getIsMounted()) { return; } - setSourceConfiguration(data); + setSourceConfiguration(updatedSourceConfig); + setResolvedSourceConfiguration(resolvedSourceConfig); loadSourceStatus(); }, }, - [sourceId, fetch] + [sourceId, fetch, indexPatternsService] ); const [loadSourceStatusRequest, loadSourceStatus] = useTrackedPromise( @@ -91,10 +127,10 @@ export const useLogSource = ({ sourceId, fetch }: { sourceId: string; fetch: Htt const derivedIndexPattern = useMemo( () => ({ - fields: sourceStatus?.logIndexFields ?? [], - title: sourceConfiguration?.configuration.logAlias ?? 'unknown', + fields: resolvedSourceConfiguration?.fields ?? [], + title: resolvedSourceConfiguration?.indices ?? 'unknown', }), - [sourceConfiguration, sourceStatus] + [resolvedSourceConfiguration] ); const isLoadingSourceConfiguration = useMemo( @@ -153,22 +189,28 @@ export const useLogSource = ({ sourceId, fetch }: { sourceId: string; fetch: Htt }, [isUninitialized, loadSource]); return { + sourceId, + initialize, + isUninitialized, derivedIndexPattern, + // Failure states hasFailedLoadingSource, hasFailedLoadingSourceStatus, - initialize, + loadSourceFailureMessage, + // Loading states isLoading, isLoadingSourceConfiguration, isLoadingSourceStatus, - isUninitialized, + // Source status (denotes the state of the indices, e.g. missing) + sourceStatus, + loadSourceStatus, + // Source configuration (represents the raw attributes of the source configuration) loadSource, - loadSourceFailureMessage, loadSourceConfiguration, - loadSourceStatus, sourceConfiguration, - sourceId, - sourceStatus, updateSourceConfiguration, + // Resolved source configuration (represents a fully resolved state, you would use this for the vast majority of "read" scenarios) + resolvedSourceConfiguration, }; }; diff --git a/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_after.ts b/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_after.ts index 2bb67f91c468b..5455029afa1a7 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_after.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_after.ts @@ -9,7 +9,7 @@ import { useCallback } from 'react'; import { Observable } from 'rxjs'; import { exhaustMap } from 'rxjs/operators'; import { IKibanaSearchRequest } from '../../../../../../../src/plugins/data/public'; -import { LogSourceColumnConfiguration } from '../../../../common/http_api/log_sources'; +import { LogSourceColumnConfiguration } from '../../../../common/log_sources'; import { LogEntryAfterCursor } from '../../../../common/log_entry'; import { decodeOrThrow } from '../../../../common/runtime_types'; import { diff --git a/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_around.ts b/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_around.ts index 40a887686cb54..d2b014c22ad1b 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_around.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_around.ts @@ -8,7 +8,7 @@ import { useCallback } from 'react'; import { combineLatest, Observable, ReplaySubject } from 'rxjs'; import { last, map, startWith, switchMap } from 'rxjs/operators'; -import { LogSourceColumnConfiguration } from '../../../../common/http_api/log_sources'; +import { LogSourceColumnConfiguration } from '../../../../common/log_sources'; import { LogEntryCursor } from '../../../../common/log_entry'; import { LogEntriesSearchRequestQuery } from '../../../../common/search_strategies/log_entries/log_entries'; import { flattenDataSearchResponseDescriptor } from '../../../utils/data_search'; diff --git a/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_before.ts b/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_before.ts index c1722d27cd343..ef57a16ecbeef 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_before.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_stream/use_fetch_log_entries_before.ts @@ -9,7 +9,7 @@ import { useCallback } from 'react'; import { Observable } from 'rxjs'; import { exhaustMap } from 'rxjs/operators'; import { IKibanaSearchRequest } from '../../../../../../../src/plugins/data/public'; -import { LogSourceColumnConfiguration } from '../../../../common/http_api/log_sources'; +import { LogSourceColumnConfiguration } from '../../../../common/log_sources'; import { LogEntryBeforeCursor } from '../../../../common/log_entry'; import { decodeOrThrow } from '../../../../common/runtime_types'; import { diff --git a/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx b/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx index 7fb205648fbc2..0d57f8dad1e72 100644 --- a/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx @@ -25,6 +25,9 @@ const renderRoutes = (routes: React.ReactElement) => { const history = createMemoryHistory(); const services = { http: httpServiceMock.createStartContract(), + data: { + indexPatterns: {}, + }, }; const renderResult = render( diff --git a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx index 047903ea1f777..741fad5a5310e 100644 --- a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx @@ -12,8 +12,6 @@ import flowRight from 'lodash/flowRight'; import React from 'react'; import { Redirect, RouteComponentProps } from 'react-router-dom'; import useMount from 'react-use/lib/useMount'; -import { HttpStart } from 'src/core/public'; -import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; import { findInventoryFields } from '../../../common/inventory_models'; import { InventoryItemType } from '../../../common/inventory_models/types'; import { LoadingPage } from '../../components/loading_page'; @@ -23,6 +21,7 @@ import { useLogSource } from '../../containers/logs/log_source'; import { replaceSourceIdInQueryString } from '../../containers/source_id'; import { LinkDescriptor } from '../../hooks/use_link_props'; import { getFilterFromLocation, getTimeFromLocation } from './query_params'; +import { useKibanaContextForPlugin } from '../../hooks/use_kibana'; type RedirectToNodeLogsType = RouteComponentProps<{ nodeId: string; @@ -36,10 +35,11 @@ export const RedirectToNodeLogs = ({ }, location, }: RedirectToNodeLogsType) => { - const { services } = useKibana<{ http: HttpStart }>(); + const { services } = useKibanaContextForPlugin(); const { isLoading, loadSourceConfiguration, sourceConfiguration } = useLogSource({ fetch: services.http.fetch, sourceId, + indexPatternsService: services.data.indexPatterns, }); const fields = sourceConfiguration?.configuration.fields; diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx index fd7cb9efa77e0..68b5a133550b0 100644 --- a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx @@ -12,22 +12,22 @@ import { useLogSourceContext } from '../../../containers/logs/log_source'; import { useActiveKibanaSpace } from '../../../hooks/use_kibana_space'; export const LogEntryCategoriesPageProviders: React.FunctionComponent = ({ children }) => { - const { sourceConfiguration, sourceId } = useLogSourceContext(); + const { sourceId, resolvedSourceConfiguration } = useLogSourceContext(); const { space } = useActiveKibanaSpace(); // This is a rather crude way of guarding the dependent providers against // arguments that are only made available asynchronously. Ideally, we'd use // React concurrent mode and Suspense in order to handle that more gracefully. - if (sourceConfiguration?.configuration.logAlias == null || space == null) { + if (!resolvedSourceConfiguration || space == null) { return null; } return ( {children} diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx index c131b16894dc7..cb52dfd713578 100644 --- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx @@ -14,29 +14,29 @@ import { useActiveKibanaSpace } from '../../../hooks/use_kibana_space'; import { LogFlyout } from '../../../containers/logs/log_flyout'; export const LogEntryRatePageProviders: React.FunctionComponent = ({ children }) => { - const { sourceId, sourceConfiguration } = useLogSourceContext(); + const { sourceId, resolvedSourceConfiguration } = useLogSourceContext(); const { space } = useActiveKibanaSpace(); // This is a rather crude way of guarding the dependent providers against // arguments that are only made available asynchronously. Ideally, we'd use // React concurrent mode and Suspense in order to handle that more gracefully. - if (sourceConfiguration?.configuration.logAlias == null || space == null) { + if (!resolvedSourceConfiguration || space == null) { return null; } return ( {children} diff --git a/x-pack/plugins/infra/public/pages/logs/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/page_providers.tsx index b30d6d08ba976..34ff237a9bd03 100644 --- a/x-pack/plugins/infra/public/pages/logs/page_providers.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_providers.tsx @@ -6,17 +6,20 @@ */ import React from 'react'; -import { HttpStart } from 'src/core/public'; -import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; +import { useKibanaContextForPlugin } from '../../hooks/use_kibana'; import { LogAnalysisCapabilitiesProvider } from '../../containers/logs/log_analysis'; import { LogSourceProvider } from '../../containers/logs/log_source'; import { useSourceId } from '../../containers/source_id'; export const LogsPageProviders: React.FunctionComponent = ({ children }) => { const [sourceId] = useSourceId(); - const { services } = useKibana<{ http: HttpStart }>(); + const { services } = useKibanaContextForPlugin(); return ( - + {children} ); diff --git a/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_state.tsx b/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_state.tsx index d0017a4123e64..95c55b556ab86 100644 --- a/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_state.tsx +++ b/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_state.tsx @@ -6,12 +6,12 @@ */ import { useCallback, useMemo } from 'react'; -import { LogSourceConfigurationProperties } from '../../../containers/logs/log_source'; +import { ResolvedLogSourceConfiguration } from '../../../../common/log_sources'; import { useLogIndicesConfigurationFormState } from './indices_configuration_form_state'; import { useLogColumnsConfigurationFormState } from './log_columns_configuration_form_state'; export const useLogSourceConfigurationFormState = ( - configuration?: LogSourceConfigurationProperties + configuration?: ResolvedLogSourceConfiguration ) => { const indicesConfigurationFormState = useLogIndicesConfigurationFormState({ initialFormState: useMemo( @@ -20,9 +20,9 @@ export const useLogSourceConfigurationFormState = ( ? { name: configuration.name, description: configuration.description, - logAlias: configuration.logAlias, - tiebreakerField: configuration.fields.tiebreaker, - timestampField: configuration.fields.timestamp, + logAlias: configuration.indices, + tiebreakerField: configuration.tiebreakerField, + timestampField: configuration.timestampField, } : undefined, [configuration] @@ -34,7 +34,7 @@ export const useLogSourceConfigurationFormState = ( () => configuration ? { - logColumns: configuration.logColumns, + logColumns: configuration.columns, } : undefined, [configuration] diff --git a/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_settings.tsx b/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_settings.tsx index 754a29de47c51..2eaf4f61409a8 100644 --- a/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_settings.tsx +++ b/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_settings.tsx @@ -28,6 +28,7 @@ import { useLogSourceConfigurationFormState } from './source_configuration_form_ import { useLogSourceContext } from '../../../containers/logs/log_source'; import { SourceLoadingPage } from '../../../components/source_loading_page'; import { Prompt } from '../../../utils/navigation_warning_prompt'; +import { LogSourceConfigurationPropertiesPatch } from '../../../../common/http_api/log_sources'; export const LogsSettingsPage = () => { const uiCapabilities = useKibana().services.application?.capabilities; @@ -35,15 +36,15 @@ export const LogsSettingsPage = () => { const { sourceConfiguration: source, - sourceStatus, isLoading, isUninitialized, updateSourceConfiguration, + resolvedSourceConfiguration, } = useLogSourceContext(); const availableFields = useMemo( - () => sourceStatus?.logIndexFields.map((field) => field.name) ?? [], - [sourceStatus] + () => resolvedSourceConfiguration?.fields.map((field) => field.name) ?? [], + [resolvedSourceConfiguration] ); const { @@ -56,10 +57,24 @@ export const LogsSettingsPage = () => { isFormDirty, isFormValid, formStateChanges, - } = useLogSourceConfigurationFormState(source?.configuration); + } = useLogSourceConfigurationFormState(resolvedSourceConfiguration); const persistUpdates = useCallback(async () => { - await updateSourceConfiguration(formStateChanges); + // NOTE / TODO: This is just a temporary workaround until this work is merged with the corresponding UI branch. + // Otherwise we would be duplicating work changing the logAlias etc references twice. + const patchedProperties: LogSourceConfigurationPropertiesPatch & { logAlias?: string } = { + ...formStateChanges, + ...(formStateChanges.logAlias + ? { + logIndices: { + type: 'index_name', + indexName: formStateChanges.logAlias, + }, + } + : {}), + }; + delete patchedProperties.logAlias; + await updateSourceConfiguration(patchedProperties); resetForm(); }, [updateSourceConfiguration, resetForm, formStateChanges]); @@ -68,7 +83,7 @@ export const LogsSettingsPage = () => { source, ]); - if ((isLoading || isUninitialized) && !source) { + if ((isLoading || isUninitialized) && !resolvedSourceConfiguration) { return ; } if (!source?.configuration) { diff --git a/x-pack/plugins/infra/public/pages/logs/stream/page_logs_content.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_logs_content.tsx index 70279678a3877..664cccb552202 100644 --- a/x-pack/plugins/infra/public/pages/logs/stream/page_logs_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/stream/page_logs_content.tsx @@ -35,7 +35,7 @@ import { datemathToEpochMillis, isValidDatemath } from '../../../utils/datemath' const PAGE_THRESHOLD = 2; export const LogsPageLogsContent: React.FunctionComponent = () => { - const { sourceConfiguration, sourceId } = useLogSourceContext(); + const { resolvedSourceConfiguration, sourceConfiguration, sourceId } = useLogSourceContext(); const { textScale, textWrap } = useContext(LogViewConfiguration.Context); const { surroundingLogsId, @@ -218,7 +218,7 @@ export const LogsPageLogsContent: React.FunctionComponent = () => { { const { mockedGetStartServices } = setup(); mockedCallFetchLogSourceStatusAPI.mockResolvedValue({ - data: { logIndexFields: [], logIndexStatus: 'available' }, + data: { logIndexStatus: 'available' }, }); const hasData = getLogsHasDataFetcher(mockedGetStartServices); @@ -82,7 +82,7 @@ describe('Logs UI Observability Homepage Functions', () => { const { mockedGetStartServices } = setup(); mockedCallFetchLogSourceStatusAPI.mockResolvedValue({ - data: { logIndexFields: [], logIndexStatus: 'empty' }, + data: { logIndexStatus: 'empty' }, }); const hasData = getLogsHasDataFetcher(mockedGetStartServices); @@ -96,7 +96,7 @@ describe('Logs UI Observability Homepage Functions', () => { const { mockedGetStartServices } = setup(); mockedCallFetchLogSourceStatusAPI.mockResolvedValue({ - data: { logIndexFields: [], logIndexStatus: 'missing' }, + data: { logIndexStatus: 'missing' }, }); const hasData = getLogsHasDataFetcher(mockedGetStartServices); @@ -112,7 +112,10 @@ describe('Logs UI Observability Homepage Functions', () => { mockedCallFetchLogSourceConfigurationAPI.mockResolvedValue({ data: { configuration: { - logAlias: 'filebeat-*', + logIndices: { + type: 'index_pattern', + indexPatternId: 'some-test-id', + }, fields: { timestamp: '@timestamp', tiebreaker: '_doc' }, }, }, diff --git a/x-pack/plugins/infra/server/lib/adapters/fields/framework_fields_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/fields/framework_fields_adapter.ts index 8b170f49267f2..268afccd4c2bc 100644 --- a/x-pack/plugins/infra/server/lib/adapters/fields/framework_fields_adapter.ts +++ b/x-pack/plugins/infra/server/lib/adapters/fields/framework_fields_adapter.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { FieldSpec } from 'src/plugins/data/common'; import type { InfraPluginRequestHandlerContext } from '../../../types'; import { KibanaFramework } from '../framework/kibana_framework_adapter'; import { FieldsAdapter, IndexFieldDescriptor } from './adapter_types'; @@ -20,11 +21,17 @@ export class FrameworkFieldsAdapter implements FieldsAdapter { requestContext: InfraPluginRequestHandlerContext, indices: string ): Promise { - const indexPatternsService = this.framework.getIndexPatternsService(requestContext); + const indexPatternsService = await this.framework.getIndexPatternsServiceWithRequestContext( + requestContext + ); + + // NOTE: Unfortunately getFieldsForWildcard is typed to "any" here in the data plugin, FieldSpec is used below in the map. const response = await indexPatternsService.getFieldsForWildcard({ pattern: indices, + allowNoIndex: true, }); - return response.map((field) => ({ + + return response.map((field: FieldSpec) => ({ ...field, displayable: true, })); diff --git a/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts index 0176361ede66f..d3ea162781b5d 100644 --- a/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts +++ b/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts @@ -12,6 +12,7 @@ import { } from '@elastic/elasticsearch/api/requestParams'; import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport'; import { estypes } from '@elastic/elasticsearch'; +import { SavedObjectsClientContract, ElasticsearchClient } from 'src/core/server'; import { InfraRouteConfig, InfraServerPluginSetupDeps, @@ -32,16 +33,23 @@ import { import { RequestHandler } from '../../../../../../../src/core/server'; import { InfraConfig } from '../../../plugin'; import type { InfraPluginRequestHandlerContext } from '../../../types'; -import { IndexPatternsFetcher, UI_SETTINGS } from '../../../../../../../src/plugins/data/server'; +import { UI_SETTINGS } from '../../../../../../../src/plugins/data/server'; import { TimeseriesVisData } from '../../../../../../../src/plugins/vis_type_timeseries/server'; +import { InfraServerPluginStartDeps } from './adapter_types'; export class KibanaFramework { public router: IRouter; public plugins: InfraServerPluginSetupDeps; + private core: CoreSetup; - constructor(core: CoreSetup, config: InfraConfig, plugins: InfraServerPluginSetupDeps) { + constructor( + core: CoreSetup, + config: InfraConfig, + plugins: InfraServerPluginSetupDeps + ) { this.router = core.http.createRouter(); this.plugins = plugins; + this.core = core; } public registerRoute( @@ -195,10 +203,31 @@ export class KibanaFramework { return apiResult ? (await apiResult).body : undefined; } - public getIndexPatternsService( + public async getIndexPatternsServiceWithRequestContext( requestContext: InfraPluginRequestHandlerContext - ): IndexPatternsFetcher { - return new IndexPatternsFetcher(requestContext.core.elasticsearch.client.asCurrentUser, true); + ) { + return await this.createIndexPatternsService( + requestContext.core.savedObjects.client, + requestContext.core.elasticsearch.client.asCurrentUser + ); + } + + public async getIndexPatternsService( + savedObjectsClient: SavedObjectsClientContract, + elasticsearchClient: ElasticsearchClient + ) { + return await this.createIndexPatternsService(savedObjectsClient, elasticsearchClient); + } + + private async createIndexPatternsService( + savedObjectsClient: SavedObjectsClientContract, + elasticsearchClient: ElasticsearchClient + ) { + const [, startPlugins] = await this.core.getStartServices(); + return startPlugins.data.indexPatterns.indexPatternsServiceFactory( + savedObjectsClient, + elasticsearchClient + ); } public getSpaceId(request: KibanaRequest): string { diff --git a/x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts index a72446fc1e1bf..33df2b4d55d22 100644 --- a/x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts +++ b/x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts @@ -21,9 +21,9 @@ import { LogSummaryBucket, LOG_ENTRIES_PAGE_SIZE, } from '../../domains/log_entries_domain'; -import { InfraSourceConfiguration } from '../../sources'; import { SortedSearchHit } from '../framework'; import { KibanaFramework } from '../framework/kibana_framework_adapter'; +import { ResolvedLogSourceConfiguration } from '../../../../common/log_sources'; const TIMESTAMP_FORMAT = 'epoch_millis'; @@ -32,7 +32,7 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter { public async getLogEntries( requestContext: InfraPluginRequestHandlerContext, - sourceConfiguration: InfraSourceConfiguration, + resolvedLogSourceConfiguration: ResolvedLogSourceConfiguration, fields: string[], params: LogEntriesParams ): Promise<{ documents: LogEntryDocument[]; hasMoreBefore?: boolean; hasMoreAfter?: boolean }> { @@ -64,13 +64,13 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter { : {}; const sort = { - [sourceConfiguration.fields.timestamp]: sortDirection, - [sourceConfiguration.fields.tiebreaker]: sortDirection, + [resolvedLogSourceConfiguration.timestampField]: sortDirection, + [resolvedLogSourceConfiguration.tiebreakerField]: sortDirection, }; const esQuery = { allowNoIndices: true, - index: sourceConfiguration.logAlias, + index: resolvedLogSourceConfiguration.indices, ignoreUnavailable: true, body: { size: size + 1, // Extra one to test if it has more before or after @@ -83,7 +83,7 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter { ...createFilterClauses(query, highlightQuery), { range: { - [sourceConfiguration.fields.timestamp]: { + [resolvedLogSourceConfiguration.timestampField]: { gte: startTimestamp, lte: endTimestamp, format: TIMESTAMP_FORMAT, @@ -125,7 +125,7 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter { public async getContainedLogSummaryBuckets( requestContext: InfraPluginRequestHandlerContext, - sourceConfiguration: InfraSourceConfiguration, + resolvedLogSourceConfiguration: ResolvedLogSourceConfiguration, startTimestamp: number, endTimestamp: number, bucketSize: number, @@ -139,13 +139,13 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter { const query = { allowNoIndices: true, - index: sourceConfiguration.logAlias, + index: resolvedLogSourceConfiguration.indices, ignoreUnavailable: true, body: { aggregations: { count_by_date: { date_range: { - field: sourceConfiguration.fields.timestamp, + field: resolvedLogSourceConfiguration.timestampField, format: TIMESTAMP_FORMAT, ranges: bucketIntervalStarts.map((bucketIntervalStart) => ({ from: bucketIntervalStart.getTime(), @@ -157,8 +157,8 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter { top_hits: { size: 1, sort: [ - { [sourceConfiguration.fields.timestamp]: 'asc' }, - { [sourceConfiguration.fields.tiebreaker]: 'asc' }, + { [resolvedLogSourceConfiguration.timestampField]: 'asc' }, + { [resolvedLogSourceConfiguration.tiebreakerField]: 'asc' }, ], _source: false, }, @@ -172,7 +172,7 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter { ...createQueryFilterClauses(filterQuery), { range: { - [sourceConfiguration.fields.timestamp]: { + [resolvedLogSourceConfiguration.timestampField]: { gte: startTimestamp, lte: endTimestamp, format: TIMESTAMP_FORMAT, diff --git a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts index 8fb8ee54d22ab..0db6a9d83c852 100644 --- a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts +++ b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts @@ -70,7 +70,8 @@ export const createInventoryMetricThresholdExecutor = (libs: InfraBackendLibs) = const logQueryFields = await libs.getLogQueryFields( sourceId || 'default', - services.savedObjectsClient + services.savedObjectsClient, + services.scopedClusterClient.asCurrentUser ); const compositeSize = libs.configuration.inventory.compositeSize; diff --git a/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_chart_preview.ts b/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_chart_preview.ts index cb9ba8b254401..0914fab00dbe2 100644 --- a/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_chart_preview.ts +++ b/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_chart_preview.ts @@ -7,7 +7,6 @@ import { i18n } from '@kbn/i18n'; import type { InfraPluginRequestHandlerContext } from '../../../types'; -import { InfraSource } from '../../sources'; import { KibanaFramework } from '../../adapters/framework/kibana_framework_adapter'; import { GetLogAlertsChartPreviewDataAlertParamsSubset, @@ -26,18 +25,19 @@ import { GroupedSearchQueryResponseRT, } from '../../../../common/alerting/logs/log_threshold/types'; import { decodeOrThrow } from '../../../../common/runtime_types'; +import { ResolvedLogSourceConfiguration } from '../../../../common/log_sources'; const COMPOSITE_GROUP_SIZE = 40; export async function getChartPreviewData( requestContext: InfraPluginRequestHandlerContext, - sourceConfiguration: InfraSource, + resolvedLogSourceConfiguration: ResolvedLogSourceConfiguration, callWithRequest: KibanaFramework['callWithRequest'], alertParams: GetLogAlertsChartPreviewDataAlertParamsSubset, buckets: number ) { - const indexPattern = sourceConfiguration.configuration.logAlias; - const timestampField = sourceConfiguration.configuration.fields.timestamp; + const indexPattern = resolvedLogSourceConfiguration.indices; + const timestampField = resolvedLogSourceConfiguration.timestampField; const { groupBy, timeSize, timeUnit } = alertParams; const isGrouped = groupBy && groupBy.length > 0 ? true : false; diff --git a/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.ts b/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.ts index 0dff7e1070971..b81219b1afda2 100644 --- a/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.ts +++ b/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.ts @@ -40,6 +40,7 @@ import { InfraBackendLibs } from '../../infra_types'; import { getIntervalInSeconds } from '../../../utils/get_interval_in_seconds'; import { decodeOrThrow } from '../../../../common/runtime_types'; import { UNGROUPED_FACTORY_KEY } from '../common/utils'; +import { resolveLogSourceConfiguration } from '../../../../common/log_sources'; type LogThresholdActionGroups = ActionGroupIdsOf; type LogThresholdAlertServices = AlertServices< @@ -72,8 +73,15 @@ export const createLogThresholdExecutor = (libs: InfraBackendLibs) => const { sources } = libs; const sourceConfiguration = await sources.getSourceConfiguration(savedObjectsClient, 'default'); - const indexPattern = sourceConfiguration.configuration.logAlias; - const timestampField = sourceConfiguration.configuration.fields.timestamp; + const resolvedLogSourceConfiguration = await resolveLogSourceConfiguration( + sourceConfiguration.configuration, + await libs.framework.getIndexPatternsService( + savedObjectsClient, + scopedClusterClient.asCurrentUser + ) + ); + const indexPattern = resolvedLogSourceConfiguration.indices; + const timestampField = resolvedLogSourceConfiguration.timestampField; try { const validatedParams = decodeOrThrow(alertParamsRT)(params); diff --git a/x-pack/plugins/infra/server/lib/alerting/log_threshold/mocks/index.ts b/x-pack/plugins/infra/server/lib/alerting/log_threshold/mocks/index.ts index 55a2868716bb4..296a540b4a920 100644 --- a/x-pack/plugins/infra/server/lib/alerting/log_threshold/mocks/index.ts +++ b/x-pack/plugins/infra/server/lib/alerting/log_threshold/mocks/index.ts @@ -13,7 +13,10 @@ export const libsMock = { return Promise.resolve({ id: sourceId, configuration: { - logAlias: 'filebeat-*', + logIndices: { + type: 'index_pattern', + indexPatternId: 'some-id', + }, fields: { timestamp: '@timestamp' }, }, }); diff --git a/x-pack/plugins/infra/server/lib/domains/fields_domain.ts b/x-pack/plugins/infra/server/lib/domains/fields_domain.ts index d5ffa56987666..0997d9517fa8d 100644 --- a/x-pack/plugins/infra/server/lib/domains/fields_domain.ts +++ b/x-pack/plugins/infra/server/lib/domains/fields_domain.ts @@ -18,17 +18,14 @@ export class InfraFieldsDomain { public async getFields( requestContext: InfraPluginRequestHandlerContext, sourceId: string, - indexType: 'LOGS' | 'METRICS' + indexType: 'METRICS' ): Promise { const { configuration } = await this.libs.sources.getSourceConfiguration( requestContext.core.savedObjects.client, sourceId ); - const fields = await this.adapter.getIndexFields( - requestContext, - indexType === 'LOGS' ? configuration.logAlias : configuration.metricAlias - ); + const fields = await this.adapter.getIndexFields(requestContext, configuration.metricAlias); return fields; } diff --git a/x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts index 278ae0e086cfc..ea57885bcdfbb 100644 --- a/x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts +++ b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts @@ -12,7 +12,11 @@ import { LogEntriesSummaryBucket, LogEntriesSummaryHighlightsBucket, } from '../../../../common/http_api'; -import { LogSourceColumnConfiguration } from '../../../../common/http_api/log_sources'; +import { + LogSourceColumnConfiguration, + ResolvedLogSourceConfiguration, + resolveLogSourceConfiguration, +} from '../../../../common/log_sources'; import { LogColumn, LogEntryCursor, LogEntry } from '../../../../common/log_entry'; import { InfraSourceConfiguration, @@ -137,7 +141,10 @@ export class InfraLogEntriesDomain { requestContext.core.savedObjects.client, sourceId ); - + const resolvedLogSourceConfiguration = await resolveLogSourceConfiguration( + configuration, + await this.libs.framework.getIndexPatternsServiceWithRequestContext(requestContext) + ); const columnDefinitions = columnOverrides ?? configuration.logColumns; const messageFormattingRules = compileFormattingRules( @@ -148,7 +155,7 @@ export class InfraLogEntriesDomain { const { documents, hasMoreBefore, hasMoreAfter } = await this.adapter.getLogEntries( requestContext, - configuration, + resolvedLogSourceConfiguration, requiredFields, params ); @@ -199,9 +206,13 @@ export class InfraLogEntriesDomain { requestContext.core.savedObjects.client, sourceId ); + const resolvedLogSourceConfiguration = await resolveLogSourceConfiguration( + configuration, + await this.libs.framework.getIndexPatternsServiceWithRequestContext(requestContext) + ); const dateRangeBuckets = await this.adapter.getContainedLogSummaryBuckets( requestContext, - configuration, + resolvedLogSourceConfiguration, start, end, bucketSize, @@ -223,6 +234,10 @@ export class InfraLogEntriesDomain { requestContext.core.savedObjects.client, sourceId ); + const resolvedLogSourceConfiguration = await resolveLogSourceConfiguration( + configuration, + await this.libs.framework.getIndexPatternsServiceWithRequestContext(requestContext) + ); const messageFormattingRules = compileFormattingRules( getBuiltinRules(configuration.fields.message) ); @@ -240,7 +255,7 @@ export class InfraLogEntriesDomain { : highlightQuery; const summaryBuckets = await this.adapter.getContainedLogSummaryBuckets( requestContext, - configuration, + resolvedLogSourceConfiguration, startTimestamp, endTimestamp, bucketSize, @@ -299,14 +314,14 @@ export class InfraLogEntriesDomain { export interface LogEntriesAdapter { getLogEntries( requestContext: InfraPluginRequestHandlerContext, - sourceConfiguration: InfraSourceConfiguration, + resolvedLogSourceConfiguration: ResolvedLogSourceConfiguration, fields: string[], params: LogEntriesParams ): Promise<{ documents: LogEntryDocument[]; hasMoreBefore?: boolean; hasMoreAfter?: boolean }>; getContainedLogSummaryBuckets( requestContext: InfraPluginRequestHandlerContext, - sourceConfiguration: InfraSourceConfiguration, + resolvedLogSourceConfiguration: ResolvedLogSourceConfiguration, startTimestamp: number, endTimestamp: number, bucketSize: number, diff --git a/x-pack/plugins/infra/server/lib/source_status.ts b/x-pack/plugins/infra/server/lib/source_status.ts index 1fde742b8183d..2b04bf84c1546 100644 --- a/x-pack/plugins/infra/server/lib/source_status.ts +++ b/x-pack/plugins/infra/server/lib/source_status.ts @@ -7,6 +7,7 @@ import type { InfraPluginRequestHandlerContext } from '../types'; import { InfraSources } from './sources'; +import { ResolvedLogSourceConfiguration } from '../../common/log_sources'; export class InfraSourceStatus { constructor( @@ -14,20 +15,6 @@ export class InfraSourceStatus { private readonly libs: { sources: InfraSources } ) {} - public async getLogIndexNames( - requestContext: InfraPluginRequestHandlerContext, - sourceId: string - ): Promise { - const sourceConfiguration = await this.libs.sources.getSourceConfiguration( - requestContext.core.savedObjects.client, - sourceId - ); - const indexNames = await this.adapter.getIndexNames( - requestContext, - sourceConfiguration.configuration.logAlias - ); - return indexNames; - } public async getMetricIndexNames( requestContext: InfraPluginRequestHandlerContext, sourceId: string @@ -42,20 +29,6 @@ export class InfraSourceStatus { ); return indexNames; } - public async hasLogAlias( - requestContext: InfraPluginRequestHandlerContext, - sourceId: string - ): Promise { - const sourceConfiguration = await this.libs.sources.getSourceConfiguration( - requestContext.core.savedObjects.client, - sourceId - ); - const hasAlias = await this.adapter.hasAlias( - requestContext, - sourceConfiguration.configuration.logAlias - ); - return hasAlias; - } public async hasMetricAlias( requestContext: InfraPluginRequestHandlerContext, sourceId: string @@ -72,15 +45,11 @@ export class InfraSourceStatus { } public async getLogIndexStatus( requestContext: InfraPluginRequestHandlerContext, - sourceId: string + resolvedLogSourceConfiguration: ResolvedLogSourceConfiguration ): Promise { - const sourceConfiguration = await this.libs.sources.getSourceConfiguration( - requestContext.core.savedObjects.client, - sourceId - ); const indexStatus = await this.adapter.getIndexStatus( requestContext, - sourceConfiguration.configuration.logAlias + resolvedLogSourceConfiguration.indices ); return indexStatus; } diff --git a/x-pack/plugins/infra/server/lib/sources/defaults.ts b/x-pack/plugins/infra/server/lib/sources/defaults.ts index ff6d6a4f5514b..b6139613cfce3 100644 --- a/x-pack/plugins/infra/server/lib/sources/defaults.ts +++ b/x-pack/plugins/infra/server/lib/sources/defaults.ts @@ -16,7 +16,10 @@ export const defaultSourceConfiguration: InfraSourceConfiguration = { name: 'Default', description: '', metricAlias: METRICS_INDEX_PATTERN, - logAlias: LOGS_INDEX_PATTERN, + logIndices: { + type: 'index_name', + indexName: LOGS_INDEX_PATTERN, + }, fields: { container: 'container.id', host: 'host.name', diff --git a/x-pack/plugins/infra/server/lib/sources/migrations/7_13_0_convert_log_alias_to_log_indices.test.ts b/x-pack/plugins/infra/server/lib/sources/migrations/7_13_0_convert_log_alias_to_log_indices.test.ts new file mode 100644 index 0000000000000..7dde0c590a968 --- /dev/null +++ b/x-pack/plugins/infra/server/lib/sources/migrations/7_13_0_convert_log_alias_to_log_indices.test.ts @@ -0,0 +1,62 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { migrationMocks } from 'src/core/server/mocks'; +import { convertLogAliasToLogIndices } from './7_13_0_convert_log_alias_to_log_indices'; +import { infraSourceConfigurationSavedObjectName } from '../saved_object_type'; + +describe('infra source configuration migration function for 7.13.0', () => { + test('migrates the logAlias property to logIndices', () => { + const unmigratedConfiguration = createTestSourceConfiguration({ + logAlias: 'filebeat-*', + }); + + const migratedConfiguration = convertLogAliasToLogIndices( + unmigratedConfiguration as any, + migrationMocks.createContext() + ); + + expect(migratedConfiguration).toStrictEqual( + createTestSourceConfiguration({ + logIndices: { + type: 'index_name', + indexName: 'filebeat-*', + }, + }) + ); + }); +}); + +const createTestSourceConfiguration = (additionalProperties = {}) => ({ + attributes: { + name: 'TEST CONFIGURATION', + description: '', + fields: { + pod: 'TEST POD FIELD', + host: 'TEST HOST FIELD', + message: ['TEST MESSAGE FIELD'], + container: 'TEST CONTAINER FIELD', + timestamp: 'TEST TIMESTAMP FIELD', + tiebreaker: 'TEST TIEBREAKER FIELD', + }, + inventoryDefaultView: '0', + metricsExplorerDefaultView: '0', + logColumns: [ + { + fieldColumn: { + id: 'TEST FIELD COLUMN ID', + field: 'TEST FIELD COLUMN FIELD', + }, + }, + ], + metricAlias: 'metricbeat-*,metrics-*', + anomalyThreshold: 20, + ...additionalProperties, + }, + id: 'TEST_ID', + type: infraSourceConfigurationSavedObjectName, +}); diff --git a/x-pack/plugins/infra/server/lib/sources/migrations/7_13_0_convert_log_alias_to_log_indices.ts b/x-pack/plugins/infra/server/lib/sources/migrations/7_13_0_convert_log_alias_to_log_indices.ts new file mode 100644 index 0000000000000..599f2de191172 --- /dev/null +++ b/x-pack/plugins/infra/server/lib/sources/migrations/7_13_0_convert_log_alias_to_log_indices.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { SavedObjectMigrationFn } from 'src/core/server'; +import { InfraSourceConfiguration } from '../../../../common/source_configuration/source_configuration'; +import { LOGS_INDEX_PATTERN } from '../../../../common/constants'; + +type SevenTwelveZeroSourceConfig = Omit & { + logAlias: string; +}; + +export const convertLogAliasToLogIndices: SavedObjectMigrationFn< + SevenTwelveZeroSourceConfig, + InfraSourceConfiguration +> = (sourceConfigurationDocument) => { + const { logAlias, ...otherAttributes } = sourceConfigurationDocument.attributes; + + const newAttributes: InfraSourceConfiguration = { + ...otherAttributes, + logIndices: { + type: 'index_name', + indexName: logAlias ?? LOGS_INDEX_PATTERN, + }, + }; + + return { + ...sourceConfigurationDocument, + attributes: newAttributes, + }; +}; diff --git a/x-pack/plugins/infra/server/lib/sources/migrations/7_9_0_add_new_indexing_strategy_index_names.ts b/x-pack/plugins/infra/server/lib/sources/migrations/7_9_0_add_new_indexing_strategy_index_names.ts index e71994fe11517..8c9a3ca1d5a06 100644 --- a/x-pack/plugins/infra/server/lib/sources/migrations/7_9_0_add_new_indexing_strategy_index_names.ts +++ b/x-pack/plugins/infra/server/lib/sources/migrations/7_9_0_add_new_indexing_strategy_index_names.ts @@ -8,9 +8,13 @@ import { SavedObjectMigrationFn } from 'src/core/server'; import { InfraSourceConfiguration } from '../../../../common/source_configuration/source_configuration'; +type SevenNineZeroSourceConfig = Omit & { + logAlias: string; +}; + export const addNewIndexingStrategyIndexNames: SavedObjectMigrationFn< - InfraSourceConfiguration, - InfraSourceConfiguration + SevenNineZeroSourceConfig, + SevenNineZeroSourceConfig > = (sourceConfigurationDocument) => { const oldLogAliasSegments = sourceConfigurationDocument.attributes.logAlias.split(','); const oldMetricAliasSegments = sourceConfigurationDocument.attributes.metricAlias.split(','); diff --git a/x-pack/plugins/infra/server/lib/sources/saved_object_type.ts b/x-pack/plugins/infra/server/lib/sources/saved_object_type.ts index 0612d1fa4762a..135f715d8b604 100644 --- a/x-pack/plugins/infra/server/lib/sources/saved_object_type.ts +++ b/x-pack/plugins/infra/server/lib/sources/saved_object_type.ts @@ -7,6 +7,7 @@ import { SavedObjectsType } from 'src/core/server'; import { addNewIndexingStrategyIndexNames } from './migrations/7_9_0_add_new_indexing_strategy_index_names'; +import { convertLogAliasToLogIndices } from './migrations/7_13_0_convert_log_alias_to_log_indices'; export const infraSourceConfigurationSavedObjectName = 'infrastructure-ui-source'; @@ -23,5 +24,6 @@ export const infraSourceConfigurationSavedObjectType: SavedObjectsType = { }, migrations: { '7.9.0': addNewIndexingStrategyIndexNames, + '7.13.0': convertLogAliasToLogIndices, }, }; diff --git a/x-pack/plugins/infra/server/lib/sources/sources.test.ts b/x-pack/plugins/infra/server/lib/sources/sources.test.ts index 0786722e5a479..e5807322b87fc 100644 --- a/x-pack/plugins/infra/server/lib/sources/sources.test.ts +++ b/x-pack/plugins/infra/server/lib/sources/sources.test.ts @@ -20,7 +20,7 @@ describe('the InfraSources lib', () => { updated_at: '2000-01-01T00:00:00.000Z', attributes: { metricAlias: 'METRIC_ALIAS', - logAlias: 'LOG_ALIAS', + logIndices: { type: 'index_pattern', indexPatternId: 'LOG_ALIAS' }, fields: { container: 'CONTAINER', host: 'HOST', @@ -39,7 +39,7 @@ describe('the InfraSources lib', () => { updatedAt: 946684800000, configuration: { metricAlias: 'METRIC_ALIAS', - logAlias: 'LOG_ALIAS', + logIndices: { type: 'index_pattern', indexPatternId: 'LOG_ALIAS' }, fields: { container: 'CONTAINER', host: 'HOST', @@ -56,7 +56,7 @@ describe('the InfraSources lib', () => { config: createMockStaticConfiguration({ default: { metricAlias: 'METRIC_ALIAS', - logAlias: 'LOG_ALIAS', + logIndices: { type: 'index_pattern', indexPatternId: 'LOG_ALIAS' }, fields: { host: 'HOST', pod: 'POD', @@ -86,7 +86,7 @@ describe('the InfraSources lib', () => { updatedAt: 946684800000, configuration: { metricAlias: 'METRIC_ALIAS', - logAlias: 'LOG_ALIAS', + logIndices: { type: 'index_pattern', indexPatternId: 'LOG_ALIAS' }, fields: { container: 'CONTAINER', host: 'HOST', @@ -118,7 +118,7 @@ describe('the InfraSources lib', () => { updatedAt: 946684800000, configuration: { metricAlias: expect.any(String), - logAlias: expect.any(String), + logIndices: expect.any(Object), fields: { container: expect.any(String), host: expect.any(String), diff --git a/x-pack/plugins/infra/server/lib/sources/sources.ts b/x-pack/plugins/infra/server/lib/sources/sources.ts index 7abbed0a9fbdd..0016e4716725d 100644 --- a/x-pack/plugins/infra/server/lib/sources/sources.ts +++ b/x-pack/plugins/infra/server/lib/sources/sources.ts @@ -5,7 +5,6 @@ * 2.0. */ -import * as runtimeTypes from 'io-ts'; import { failure } from 'io-ts/lib/PathReporter'; import { identity, constant } from 'fp-ts/lib/function'; import { pipe } from 'fp-ts/lib/pipeable'; @@ -21,8 +20,9 @@ import { InfraStaticSourceConfiguration, pickSavedSourceConfiguration, SourceConfigurationSavedObjectRuntimeType, - StaticSourceConfigurationRuntimeType, InfraSource, + sourceConfigurationConfigFilePropertiesRT, + SourceConfigurationConfigFileProperties, } from '../../../common/source_configuration/source_configuration'; import { InfraConfig } from '../../../server'; @@ -199,19 +199,32 @@ export class InfraSources { } private async getStaticDefaultSourceConfiguration() { - const staticSourceConfiguration = pipe( - runtimeTypes - .type({ - sources: runtimeTypes.type({ - default: StaticSourceConfigurationRuntimeType, - }), - }) - .decode(this.libs.config), + const staticSourceConfiguration: SourceConfigurationConfigFileProperties['sources']['default'] = pipe( + sourceConfigurationConfigFilePropertiesRT.decode(this.libs.config), map(({ sources: { default: defaultConfiguration } }) => defaultConfiguration), fold(constant({}), identity) ); - return mergeSourceConfiguration(defaultSourceConfiguration, staticSourceConfiguration); + // NOTE: Legacy logAlias needs converting to a logIndices reference until we can remove + // config file sources in 8.0.0. + if (staticSourceConfiguration && staticSourceConfiguration.logAlias) { + const convertedStaticSourceConfiguration: InfraStaticSourceConfiguration & { + logAlias?: string; + } = { + ...staticSourceConfiguration, + logIndices: { + type: 'index_name', + indexName: staticSourceConfiguration.logAlias, + }, + }; + delete convertedStaticSourceConfiguration.logAlias; + return mergeSourceConfiguration( + defaultSourceConfiguration, + convertedStaticSourceConfiguration + ); + } else { + return mergeSourceConfiguration(defaultSourceConfiguration, staticSourceConfiguration); + } } private async getSavedSourceConfiguration( diff --git a/x-pack/plugins/infra/server/plugin.ts b/x-pack/plugins/infra/server/plugin.ts index cbffa0a11eae5..7c5666049bd60 100644 --- a/x-pack/plugins/infra/server/plugin.ts +++ b/x-pack/plugins/infra/server/plugin.ts @@ -43,7 +43,7 @@ export const config = { schema.object({ default: schema.maybe( schema.object({ - logAlias: schema.maybe(schema.string()), + logAlias: schema.maybe(schema.string()), // NOTE / TODO: Should be deprecated in 8.0.0 metricAlias: schema.maybe(schema.string()), fields: schema.maybe( schema.object({ @@ -124,7 +124,7 @@ export class InfraServerPlugin implements Plugin { sources, sourceStatus, ...domainLibs, - getLogQueryFields: createGetLogQueryFields(sources), + getLogQueryFields: createGetLogQueryFields(sources, framework), handleEsError, }; diff --git a/x-pack/plugins/infra/server/routes/alerting/preview.ts b/x-pack/plugins/infra/server/routes/alerting/preview.ts index 3008504f3b06c..4cafc743b1ecb 100644 --- a/x-pack/plugins/infra/server/routes/alerting/preview.ts +++ b/x-pack/plugins/infra/server/routes/alerting/preview.ts @@ -86,7 +86,8 @@ export const initAlertPreviewRoute = ({ case METRIC_INVENTORY_THRESHOLD_ALERT_TYPE_ID: { const logQueryFields = await getLogQueryFields( sourceId || 'default', - requestContext.core.savedObjects.client + requestContext.core.savedObjects.client, + requestContext.core.elasticsearch.client.asCurrentUser ); const { nodeType, diff --git a/x-pack/plugins/infra/server/routes/log_alerts/chart_preview_data.ts b/x-pack/plugins/infra/server/routes/log_alerts/chart_preview_data.ts index b4fbad0bc3314..4cda9db3079e7 100644 --- a/x-pack/plugins/infra/server/routes/log_alerts/chart_preview_data.ts +++ b/x-pack/plugins/infra/server/routes/log_alerts/chart_preview_data.ts @@ -14,6 +14,7 @@ import { } from '../../../common/http_api/log_alerts/chart_preview_data'; import { createValidationFunction } from '../../../common/runtime_types'; import { getChartPreviewData } from '../../lib/alerting/log_threshold/log_threshold_chart_preview'; +import { resolveLogSourceConfiguration } from '../../../common/log_sources'; export const initGetLogAlertsChartPreviewDataRoute = ({ framework, sources }: InfraBackendLibs) => { framework.registerRoute( @@ -29,15 +30,20 @@ export const initGetLogAlertsChartPreviewDataRoute = ({ framework, sources }: In data: { sourceId, buckets, alertParams }, } = request.body; - const sourceConfiguration = await sources.getSourceConfiguration( + const { configuration } = await sources.getSourceConfiguration( requestContext.core.savedObjects.client, sourceId ); + const resolvedLogSourceConfiguration = await resolveLogSourceConfiguration( + configuration, + await framework.getIndexPatternsServiceWithRequestContext(requestContext) + ); + try { const { series } = await getChartPreviewData( requestContext, - sourceConfiguration, + resolvedLogSourceConfiguration, framework.callWithRequest, alertParams, buckets diff --git a/x-pack/plugins/infra/server/routes/log_sources/status.ts b/x-pack/plugins/infra/server/routes/log_sources/status.ts index fd0b4cebfa727..b43cff83a63fa 100644 --- a/x-pack/plugins/infra/server/routes/log_sources/status.ts +++ b/x-pack/plugins/infra/server/routes/log_sources/status.ts @@ -13,11 +13,13 @@ import { } from '../../../common/http_api/log_sources'; import { createValidationFunction } from '../../../common/runtime_types'; import { InfraBackendLibs } from '../../lib/infra_types'; +import { resolveLogSourceConfiguration } from '../../../common/log_sources'; export const initLogSourceStatusRoutes = ({ framework, sourceStatus, fields, + sources, }: InfraBackendLibs) => { framework.registerRoute( { @@ -31,16 +33,24 @@ export const initLogSourceStatusRoutes = ({ const { sourceId } = request.params; try { - const logIndexStatus = await sourceStatus.getLogIndexStatus(requestContext, sourceId); - const logIndexFields = - logIndexStatus !== 'missing' - ? await fields.getFields(requestContext, sourceId, 'LOGS') - : []; + const sourceConfiguration = await sources.getSourceConfiguration( + requestContext.core.savedObjects.client, + sourceId + ); + + const resolvedLogSourceConfiguration = await resolveLogSourceConfiguration( + sourceConfiguration.configuration, + await framework.getIndexPatternsServiceWithRequestContext(requestContext) + ); + + const logIndexStatus = await sourceStatus.getLogIndexStatus( + requestContext, + resolvedLogSourceConfiguration + ); return response.ok({ body: getLogSourceStatusSuccessResponsePayloadRT.encode({ data: { - logIndexFields, logIndexStatus, }, }), diff --git a/x-pack/plugins/infra/server/routes/snapshot/index.ts b/x-pack/plugins/infra/server/routes/snapshot/index.ts index 0adb35bbfbf67..846fabcfa4e68 100644 --- a/x-pack/plugins/infra/server/routes/snapshot/index.ts +++ b/x-pack/plugins/infra/server/routes/snapshot/index.ts @@ -43,7 +43,8 @@ export const initSnapshotRoute = (libs: InfraBackendLibs) => { const compositeSize = libs.configuration.inventory.compositeSize; const logQueryFields = await libs.getLogQueryFields( snapshotRequest.sourceId, - requestContext.core.savedObjects.client + requestContext.core.savedObjects.client, + requestContext.core.elasticsearch.client.asCurrentUser ); UsageCollector.countNode(snapshotRequest.nodeType); diff --git a/x-pack/plugins/infra/server/routes/snapshot/lib/transform_request_to_metrics_api_request.test.ts b/x-pack/plugins/infra/server/routes/snapshot/lib/transform_request_to_metrics_api_request.test.ts index 1e1c202b7e602..de44cf016886f 100644 --- a/x-pack/plugins/infra/server/routes/snapshot/lib/transform_request_to_metrics_api_request.test.ts +++ b/x-pack/plugins/infra/server/routes/snapshot/lib/transform_request_to_metrics_api_request.test.ts @@ -42,7 +42,10 @@ const source: InfraSource = { name: 'Default', description: '', metricAlias: 'metrics-*,metricbeat-*', - logAlias: 'logs-*,filebeat-*,kibana_sample_data_logs*', + logIndices: { + type: 'index_pattern', + indexPatternId: 'kibana_index_pattern', + }, fields: { container: 'container.id', host: 'host.name', diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.test.ts b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.test.ts index bc4976a068f4d..7c7417d038e2e 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.test.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.test.ts @@ -25,6 +25,7 @@ import { logEntriesSearchRequestStateRT, logEntriesSearchStrategyProvider, } from './log_entries_search_strategy'; +import { getIndexPatternsMock } from './mocks'; describe('LogEntries search strategy', () => { it('handles initial search requests', async () => { @@ -102,7 +103,7 @@ describe('LogEntries search strategy', () => { fields: { '@timestamp': [1605116827143], 'event.dataset': ['HIT_DATASET'], - MESSAGE_FIELD: ['HIT_MESSAGE'], + message: ['HIT_MESSAGE'], 'container.id': ['HIT_CONTAINER_ID'], }, sort: [1605116827143 as any, 1 as any], // incorrectly typed as string upstream @@ -167,7 +168,7 @@ describe('LogEntries search strategy', () => { columnId: 'MESSAGE_COLUMN_ID', message: [ { - field: 'MESSAGE_FIELD', + field: 'message', value: ['HIT_MESSAGE'], highlights: [], }, @@ -255,7 +256,10 @@ const createSourceConfigurationMock = (): InfraSource => ({ configuration: { name: 'SOURCE_NAME', description: 'SOURCE_DESCRIPTION', - logAlias: 'log-indices-*', + logIndices: { + type: 'index_pattern', + indexPatternId: 'some-test-id', + }, metricAlias: 'metric-indices-*', inventoryDefaultView: 'DEFAULT_VIEW', metricsExplorerDefaultView: 'DEFAULT_VIEW', @@ -319,4 +323,5 @@ const createDataPluginMock = (esSearchStrategyMock: ISearchStrategy): any => ({ search: { getSearchStrategy: jest.fn().mockReturnValue(esSearchStrategyMock), }, + indexPatterns: getIndexPatternsMock(), }); diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts index 32bb0596ab561..fc5dab9006df6 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts @@ -21,7 +21,7 @@ import type { import { LogSourceColumnConfiguration, logSourceFieldColumnConfigurationRT, -} from '../../../common/http_api/log_sources'; +} from '../../../common/log_sources'; import { getLogEntryCursorFromHit, LogColumn, @@ -56,6 +56,7 @@ import { getSortDirection, LogEntryHit, } from './queries/log_entries'; +import { resolveLogSourceConfiguration } from '../../../common/log_sources'; type LogEntriesSearchRequest = IKibanaSearchRequest; type LogEntriesSearchResponse = IKibanaSearchResponse; @@ -74,15 +75,26 @@ export const logEntriesSearchStrategyProvider = ({ defer(() => { const request = decodeOrThrow(asyncRequestRT)(rawRequest); - const sourceConfiguration$ = defer(() => - sources.getSourceConfiguration(dependencies.savedObjectsClient, request.params.sourceId) + const resolvedSourceConfiguration$ = defer(() => + forkJoin([ + sources.getSourceConfiguration( + dependencies.savedObjectsClient, + request.params.sourceId + ), + data.indexPatterns.indexPatternsServiceFactory( + dependencies.savedObjectsClient, + dependencies.esClient.asCurrentUser + ), + ]).pipe( + concatMap(([sourceConfiguration, indexPatternsService]) => + resolveLogSourceConfiguration(sourceConfiguration.configuration, indexPatternsService) + ) + ) ).pipe(take(1), shareReplay(1)); const messageFormattingRules$ = defer(() => - sourceConfiguration$.pipe( - map(({ configuration }) => - compileFormattingRules(getBuiltinRules(configuration.fields.message)) - ) + resolvedSourceConfiguration$.pipe( + map(({ messageField }) => compileFormattingRules(getBuiltinRules(messageField))) ) ).pipe(take(1), shareReplay(1)); @@ -94,23 +106,23 @@ export const logEntriesSearchStrategyProvider = ({ const initialRequest$ = of(request).pipe( filter(asyncInitialRequestRT.is), concatMap(({ params }) => - forkJoin([sourceConfiguration$, messageFormattingRules$]).pipe( + forkJoin([resolvedSourceConfiguration$, messageFormattingRules$]).pipe( map( - ([{ configuration }, messageFormattingRules]): IEsSearchRequest => { + ([ + { indices, timestampField, tiebreakerField, columns }, + messageFormattingRules, + ]): IEsSearchRequest => { return { // @ts-expect-error @elastic/elasticsearch declares indices_boost as Record params: createGetLogEntriesQuery( - configuration.logAlias, + indices, params.startTimestamp, params.endTimestamp, pickRequestCursor(params), params.size + 1, - configuration.fields.timestamp, - configuration.fields.tiebreaker, - getRequiredFields( - params.columns ?? configuration.logColumns, - messageFormattingRules - ), + timestampField, + tiebreakerField, + getRequiredFields(params.columns ?? columns, messageFormattingRules), params.query, params.highlightPhrase ), @@ -126,18 +138,17 @@ export const logEntriesSearchStrategyProvider = ({ concatMap((esRequest) => esSearchStrategy.search(esRequest, options, dependencies)) ); - return combineLatest([searchResponse$, sourceConfiguration$, messageFormattingRules$]).pipe( - map(([esResponse, { configuration }, messageFormattingRules]) => { + return combineLatest([ + searchResponse$, + resolvedSourceConfiguration$, + messageFormattingRules$, + ]).pipe( + map(([esResponse, { columns }, messageFormattingRules]) => { const rawResponse = decodeOrThrow(getLogEntriesResponseRT)(esResponse.rawResponse); const entries = rawResponse.hits.hits .slice(0, request.params.size) - .map( - getLogEntryFromHit( - request.params.columns ?? configuration.logColumns, - messageFormattingRules - ) - ); + .map(getLogEntryFromHit(request.params.columns ?? columns, messageFormattingRules)); const sortDirection = getSortDirection(pickRequestCursor(request.params)); diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.test.ts b/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.test.ts index 7ac8b71c04b2a..785a4414a984c 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.test.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.test.ts @@ -18,12 +18,14 @@ import { ISearchStrategy, SearchStrategyDependencies, } from 'src/plugins/data/server'; +import { getIndexPatternsMock } from './mocks'; import { createInfraSourcesMock } from '../../lib/sources/mocks'; import { logEntrySearchRequestStateRT, logEntrySearchStrategyProvider, } from './log_entry_search_strategy'; import { createSearchSessionsClientMock } from '../../../../../../src/plugins/data/server/search/mocks'; +import { InfraSource } from '../../../common/source_configuration/source_configuration'; describe('LogEntry search strategy', () => { it('handles initial search requests', async () => { @@ -197,13 +199,16 @@ describe('LogEntry search strategy', () => { }); }); -const createSourceConfigurationMock = () => ({ +const createSourceConfigurationMock = (): InfraSource => ({ id: 'SOURCE_ID', origin: 'stored' as const, configuration: { name: 'SOURCE_NAME', description: 'SOURCE_DESCRIPTION', - logAlias: 'log-indices-*', + logIndices: { + type: 'index_pattern', + indexPatternId: 'some-test-id', + }, metricAlias: 'metric-indices-*', inventoryDefaultView: 'DEFAULT_VIEW', metricsExplorerDefaultView: 'DEFAULT_VIEW', @@ -256,4 +261,5 @@ const createDataPluginMock = (esSearchStrategyMock: ISearchStrategy): any => ({ search: { getSearchStrategy: jest.fn().mockReturnValue(esSearchStrategyMock), }, + indexPatterns: getIndexPatternsMock(), }); diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.ts b/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.ts index b6073f1bbe4c9..c35c05d947da0 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.ts @@ -6,7 +6,7 @@ */ import * as rt from 'io-ts'; -import { concat, defer, of } from 'rxjs'; +import { concat, defer, of, forkJoin } from 'rxjs'; import { concatMap, filter, map, shareReplay, take } from 'rxjs/operators'; import type { IEsSearchRequest, @@ -32,6 +32,7 @@ import { jsonFromBase64StringRT, } from '../../utils/typed_search_strategy'; import { createGetLogEntryQuery, getLogEntryResponseRT, LogEntryHit } from './queries/log_entry'; +import { resolveLogSourceConfiguration } from '../../../common/log_sources'; type LogEntrySearchRequest = IKibanaSearchRequest; type LogEntrySearchResponse = IKibanaSearchResponse; @@ -50,9 +51,22 @@ export const logEntrySearchStrategyProvider = ({ defer(() => { const request = decodeOrThrow(asyncRequestRT)(rawRequest); - const sourceConfiguration$ = defer(() => - sources.getSourceConfiguration(dependencies.savedObjectsClient, request.params.sourceId) - ).pipe(shareReplay(1)); + const resolvedSourceConfiguration$ = defer(() => + forkJoin([ + sources.getSourceConfiguration( + dependencies.savedObjectsClient, + request.params.sourceId + ), + data.indexPatterns.indexPatternsServiceFactory( + dependencies.savedObjectsClient, + dependencies.esClient.asCurrentUser + ), + ]).pipe( + concatMap(([sourceConfiguration, indexPatternsService]) => + resolveLogSourceConfiguration(sourceConfiguration.configuration, indexPatternsService) + ) + ) + ).pipe(take(1), shareReplay(1)); const recoveredRequest$ = of(request).pipe( filter(asyncRecoveredRequestRT.is), @@ -62,15 +76,15 @@ export const logEntrySearchStrategyProvider = ({ const initialRequest$ = of(request).pipe( filter(asyncInitialRequestRT.is), concatMap(({ params }) => - sourceConfiguration$.pipe( + resolvedSourceConfiguration$.pipe( map( - ({ configuration }): IEsSearchRequest => ({ + ({ indices, timestampField, tiebreakerField }): IEsSearchRequest => ({ // @ts-expect-error @elastic/elasticsearch declares indices_boost as Record params: createGetLogEntryQuery( - configuration.logAlias, + indices, params.logEntryId, - configuration.fields.timestamp, - configuration.fields.tiebreaker + timestampField, + tiebreakerField ), }) ) diff --git a/x-pack/plugins/infra/server/services/log_entries/mocks.ts b/x-pack/plugins/infra/server/services/log_entries/mocks.ts new file mode 100644 index 0000000000000..7c508b98554ec --- /dev/null +++ b/x-pack/plugins/infra/server/services/log_entries/mocks.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { IIndexPattern, IFieldType, IndexPatternsContract } from 'src/plugins/data/common'; + +const indexPatternFields: IFieldType[] = [ + { + name: 'event.dataset', + type: 'string', + esTypes: ['keyword'], + aggregatable: true, + filterable: true, + searchable: true, + }, +]; + +const indexPattern: IIndexPattern = { + id: '1234', + title: 'log-indices-*', + timeFieldName: '@timestamp', + fields: indexPatternFields, +}; + +export const getIndexPatternsMock = (): any => { + return { + indexPatternsServiceFactory: async () => { + return { + get: async (id) => indexPattern, + getFieldsForWildcard: async (options) => indexPatternFields, + } as Pick; + }, + }; +}; diff --git a/x-pack/plugins/infra/server/services/log_queries/get_log_query_fields.ts b/x-pack/plugins/infra/server/services/log_queries/get_log_query_fields.ts index 9497a8b442768..55491db97dbd6 100644 --- a/x-pack/plugins/infra/server/services/log_queries/get_log_query_fields.ts +++ b/x-pack/plugins/infra/server/services/log_queries/get_log_query_fields.ts @@ -5,26 +5,31 @@ * 2.0. */ -import { SavedObjectsClientContract } from 'src/core/server'; +import { SavedObjectsClientContract, ElasticsearchClient } from 'src/core/server'; import { InfraSources } from '../../lib/sources'; +import { resolveLogSourceConfiguration } from '../../../common/log_sources'; +import { KibanaFramework } from '../../lib/adapters/framework/kibana_framework_adapter'; -// NOTE: TEMPORARY: This will become a subset of the new resolved KIP compatible log source configuration. export interface LogQueryFields { indexPattern: string; timestamp: string; } -// NOTE: TEMPORARY: This will become a subset of the new resolved KIP compatible log source configuration. -export const createGetLogQueryFields = (sources: InfraSources) => { +export const createGetLogQueryFields = (sources: InfraSources, framework: KibanaFramework) => { return async ( sourceId: string, - savedObjectsClient: SavedObjectsClientContract + savedObjectsClient: SavedObjectsClientContract, + elasticsearchClient: ElasticsearchClient ): Promise => { const source = await sources.getSourceConfiguration(savedObjectsClient, sourceId); + const resolvedLogSourceConfiguration = await resolveLogSourceConfiguration( + source.configuration, + await framework.getIndexPatternsService(savedObjectsClient, elasticsearchClient) + ); return { - indexPattern: source.configuration.logAlias, - timestamp: source.configuration.fields.timestamp, + indexPattern: resolvedLogSourceConfiguration.indices, + timestamp: resolvedLogSourceConfiguration.timestampField, }; }; }; diff --git a/x-pack/plugins/monitoring/server/lib/logs/init_infra_source.ts b/x-pack/plugins/monitoring/server/lib/logs/init_infra_source.ts index 374bfbea73883..d1b0417e2851a 100644 --- a/x-pack/plugins/monitoring/server/lib/logs/init_infra_source.ts +++ b/x-pack/plugins/monitoring/server/lib/logs/init_infra_source.ts @@ -16,7 +16,10 @@ export const initInfraSource = (config: MonitoringConfig, infraPlugin: InfraPlug const filebeatIndexPattern = prefixIndexPattern(config, config.ui.logs.index, '*'); infraPlugin.defineInternalSourceConfiguration(INFRA_SOURCE_ID, { name: 'Elastic Stack Logs', - logAlias: filebeatIndexPattern, + logIndices: { + type: 'index_name', + indexName: filebeatIndexPattern, + }, }); } }; diff --git a/x-pack/test/api_integration/apis/metrics_ui/log_sources.ts b/x-pack/test/api_integration/apis/metrics_ui/log_sources.ts index a0ece1e6ab003..0cde7263a2454 100644 --- a/x-pack/test/api_integration/apis/metrics_ui/log_sources.ts +++ b/x-pack/test/api_integration/apis/metrics_ui/log_sources.ts @@ -36,7 +36,10 @@ export default function ({ getService }: FtrProviderContext) { expect(origin).to.be('fallback'); expect(configuration.name).to.be('Default'); - expect(configuration.logAlias).to.be('logs-*,filebeat-*,kibana_sample_data_logs*'); + expect(configuration.logIndices).to.eql({ + type: 'index_name', + indexName: 'logs-*,filebeat-*,kibana_sample_data_logs*', + }); expect(configuration.fields.timestamp).to.be('@timestamp'); expect(configuration.fields.tiebreaker).to.be('_doc'); expect(configuration.logColumns[0]).to.have.key('timestampColumn'); @@ -51,7 +54,10 @@ export default function ({ getService }: FtrProviderContext) { .createUpdateLogSourceConfigurationAgent('default', { name: 'NAME', description: 'DESCRIPTION', - logAlias: 'filebeat-**', + logIndices: { + type: 'index_pattern', + indexPatternId: 'kip-id', + }, fields: { tiebreaker: 'TIEBREAKER', timestamp: 'TIMESTAMP', @@ -73,7 +79,10 @@ export default function ({ getService }: FtrProviderContext) { expect(configuration.name).to.be('NAME'); expect(origin).to.be('stored'); - expect(configuration.logAlias).to.be('filebeat-**'); + expect(configuration.logIndices).to.eql({ + type: 'index_pattern', + indexPatternId: 'kip-id', + }); expect(configuration.fields.timestamp).to.be('TIMESTAMP'); expect(configuration.fields.tiebreaker).to.be('TIEBREAKER'); expect(configuration.logColumns).to.have.length(1); @@ -98,7 +107,10 @@ export default function ({ getService }: FtrProviderContext) { expect(configuration.name).to.be('Default'); expect(origin).to.be('stored'); - expect(configuration.logAlias).to.be('logs-*,filebeat-*,kibana_sample_data_logs*'); + expect(configuration.logIndices).eql({ + type: 'index_name', + indexName: 'logs-*,filebeat-*,kibana_sample_data_logs*', + }); expect(configuration.fields.timestamp).to.be('@timestamp'); expect(configuration.fields.tiebreaker).to.be('_doc'); expect(configuration.logColumns).to.have.length(3); @@ -126,7 +138,10 @@ export default function ({ getService }: FtrProviderContext) { .createUpdateLogSourceConfigurationAgent('default', { name: 'NAME', description: 'DESCRIPTION', - logAlias: 'filebeat-**', + logIndices: { + type: 'index_pattern', + indexPatternId: 'kip-id', + }, fields: { tiebreaker: 'TIEBREAKER', timestamp: 'TIMESTAMP', @@ -147,7 +162,10 @@ export default function ({ getService }: FtrProviderContext) { expect(configuration.name).to.be('NAME'); expect(origin).to.be('stored'); - expect(configuration.logAlias).to.be('filebeat-**'); + expect(configuration.logIndices).to.eql({ + type: 'index_pattern', + indexPatternId: 'kip-id', + }); expect(configuration.fields.timestamp).to.be('TIMESTAMP'); expect(configuration.fields.tiebreaker).to.be('TIEBREAKER'); expect(configuration.logColumns).to.have.length(1); @@ -167,7 +185,10 @@ export default function ({ getService }: FtrProviderContext) { expect(configuration.name).to.be('NAME'); expect(origin).to.be('stored'); - expect(configuration.logAlias).to.be('logs-*,filebeat-*,kibana_sample_data_logs*'); + expect(configuration.logIndices).to.eql({ + type: 'index_name', + indexName: 'logs-*,filebeat-*,kibana_sample_data_logs*', + }); expect(configuration.fields.timestamp).to.be('@timestamp'); expect(configuration.fields.tiebreaker).to.be('_doc'); expect(configuration.logColumns).to.have.length(3); From ede8ed3f9502746bdb7b38b870c913628042cd1c Mon Sep 17 00:00:00 2001 From: Frank Hassanabad Date: Thu, 15 Apr 2021 09:22:56 -0600 Subject: [PATCH 20/68] [Security Solutions ] Fixes failed to query DNS data - too_many_buckets_exception (#97069) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Fixes a bug where on the DNS tab of networks you can get a `too_many_buckets_exception`. Worked through the query with @angorayc and together I think we figured out that the query could be re-written with aggregations in a way to get the same results without having to query a large amount of terms which causes the buckets exception. Added a e2e test and one way of being able to call bsearch in the e2e when it returns the search is still in progress so we don't have the large query test cause flakiness 🤞 . ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --- .../matrix_histogram/__mocks__/index.ts | 56 +-------- .../matrix_histogram/dns/__mocks__/index.ts | 41 ++++--- .../dns/query.dns_histogram.dsl.ts | 21 +--- .../apis/security_solution/index.js | 1 + .../security_solution/matrix_dns_histogram.ts | 106 ++++++++++++++++++ .../matrix_dns_histogram/README.md | 32 ++++++ .../large_dns_query/data.json.gz | Bin 0 -> 61914 bytes .../large_dns_query/mappings.json | 35 ++++++ 8 files changed, 205 insertions(+), 87 deletions(-) create mode 100644 x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts create mode 100644 x-pack/test/functional/es_archives/security_solution/matrix_dns_histogram/README.md create mode 100644 x-pack/test/functional/es_archives/security_solution/matrix_dns_histogram/large_dns_query/data.json.gz create mode 100644 x-pack/test/functional/es_archives/security_solution/matrix_dns_histogram/large_dns_query/mappings.json diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/__mocks__/index.ts index 07ae64bc63f19..c33ca75aa26e1 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/__mocks__/index.ts @@ -1935,17 +1935,15 @@ export const formattedDnsSearchStrategyResponse: MatrixHistogramStrategyResponse ignoreUnavailable: true, body: { aggregations: { - dns_count: { - cardinality: { - field: 'dns.question.registered_domain', - }, - }, + dns_count: { cardinality: { field: 'dns.question.registered_domain' } }, dns_name_query_count: { terms: { field: 'dns.question.registered_domain', - size: 1000000, + order: { unique_domains: 'desc' }, + size: 10, }, aggs: { + unique_domains: { cardinality: { field: 'dns.question.name' } }, dns_question_name: { date_histogram: { field: '@timestamp', @@ -1954,47 +1952,13 @@ export const formattedDnsSearchStrategyResponse: MatrixHistogramStrategyResponse extended_bounds: { min: 1599579675528, max: 1599666075529 }, }, }, - bucket_sort: { - bucket_sort: { - sort: [ - { - unique_domains: { - order: 'desc', - }, - }, - { - _key: { - order: 'asc', - }, - }, - ], - from: 0, - size: 10, - }, - }, - unique_domains: { - cardinality: { - field: 'dns.question.name', - }, - }, }, }, }, query: { bool: { filter: [ - { - bool: { - must: [], - filter: [ - { - match_all: {}, - }, - ], - should: [], - must_not: [], - }, - }, + { bool: { must: [], filter: [{ match_all: {} }], should: [], must_not: [] } }, { range: { '@timestamp': { @@ -2005,15 +1969,7 @@ export const formattedDnsSearchStrategyResponse: MatrixHistogramStrategyResponse }, }, ], - must_not: [ - { - term: { - 'dns.question.type': { - value: 'PTR', - }, - }, - }, - ], + must_not: [{ term: { 'dns.question.type': { value: 'PTR' } } }], }, }, }, diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/dns/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/dns/__mocks__/index.ts index d842481718a3a..9b8dfb139d9f4 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/dns/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/dns/__mocks__/index.ts @@ -26,41 +26,48 @@ export const mockOptions = { export const expectedDsl = { allowNoIndices: true, + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'logs-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + ignoreUnavailable: true, body: { aggregations: { dns_count: { cardinality: { field: 'dns.question.registered_domain' } }, dns_name_query_count: { + terms: { + field: 'dns.question.registered_domain', + order: { unique_domains: 'desc' }, + size: 10, + }, aggs: { - bucket_sort: { - bucket_sort: { - from: 0, - size: 10, - sort: [{ unique_domains: { order: 'desc' } }, { _key: { order: 'asc' } }], - }, - }, + unique_domains: { cardinality: { field: 'dns.question.name' } }, dns_question_name: { date_histogram: { - extended_bounds: { max: 1599666075529, min: 1599579675528 }, field: '@timestamp', fixed_interval: '2700000ms', min_doc_count: 0, + extended_bounds: { min: 1599579675528, max: 1599666075529 }, }, }, - unique_domains: { cardinality: { field: 'dns.question.name' } }, }, - terms: { field: 'dns.question.registered_domain', size: 1000000 }, }, }, query: { bool: { filter: [ - { bool: { filter: [{ match_all: {} }], must: [], must_not: [], should: [] } }, + { bool: { must: [], filter: [{ match_all: {} }], should: [], must_not: [] } }, { range: { '@timestamp': { - format: 'strict_date_optional_time', gte: '2020-09-08T15:41:15.528Z', lte: '2020-09-09T15:41:15.529Z', + format: 'strict_date_optional_time', }, }, }, @@ -69,16 +76,6 @@ export const expectedDsl = { }, }, }, - ignoreUnavailable: true, - index: [ - 'apm-*-transaction*', - 'auditbeat-*', - 'endgame-*', - 'filebeat-*', - 'logs-*', - 'packetbeat-*', - 'winlogbeat-*', - ], size: 0, track_total_hits: false, }; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/dns/query.dns_histogram.dsl.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/dns/query.dns_histogram.dsl.ts index 89c4c8d2ea698..d9dfc57a264a8 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/dns/query.dns_histogram.dsl.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/dns/query.dns_histogram.dsl.ts @@ -9,14 +9,12 @@ import { isEmpty } from 'lodash/fp'; import moment from 'moment'; -import { Direction, MatrixHistogramRequestOptions } from '../../../../../../common/search_strategy'; +import { MatrixHistogramRequestOptions } from '../../../../../../common/search_strategy'; import { calculateTimeSeriesInterval, createQueryFilterClauses, } from '../../../../../utils/build_query'; -const HUGE_QUERY_SIZE = 1000000; - const getCountAgg = () => ({ dns_count: { cardinality: { @@ -89,25 +87,18 @@ export const buildDnsHistogramQuery = ({ dns_name_query_count: { terms: { field: stackByField, - size: HUGE_QUERY_SIZE, + order: { + unique_domains: 'desc', + }, + size: 10, }, aggs: { - dns_question_name: getHistogramAggregation({ from, to }), - bucket_sort: { - bucket_sort: { - sort: [ - { unique_domains: { order: Direction.desc } }, - { _key: { order: Direction.asc } }, - ], - from: 0, - size: 10, - }, - }, unique_domains: { cardinality: { field: 'dns.question.name', }, }, + dns_question_name: getHistogramAggregation({ from, to }), }, }, }, diff --git a/x-pack/test/api_integration/apis/security_solution/index.js b/x-pack/test/api_integration/apis/security_solution/index.js index 56d52763c8794..57fc712549859 100644 --- a/x-pack/test/api_integration/apis/security_solution/index.js +++ b/x-pack/test/api_integration/apis/security_solution/index.js @@ -12,6 +12,7 @@ export default function ({ loadTestFile }) { loadTestFile(require.resolve('./host_details')); loadTestFile(require.resolve('./kpi_network')); loadTestFile(require.resolve('./kpi_hosts')); + loadTestFile(require.resolve('./matrix_dns_histogram')); loadTestFile(require.resolve('./network_details')); loadTestFile(require.resolve('./network_dns')); loadTestFile(require.resolve('./network_top_n_flow')); diff --git a/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts b/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts new file mode 100644 index 0000000000000..69beb65dec670 --- /dev/null +++ b/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts @@ -0,0 +1,106 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import request from 'superagent'; + +import { + MatrixHistogramQuery, + MatrixHistogramType, +} from '../../../../plugins/security_solution/common/search_strategy'; + +import { FtrProviderContext } from '../../ftr_provider_context'; + +/** + * Function copied from here: + * test/api_integration/apis/search/bsearch.ts + * + * Splits the JSON lines from bsearch + */ +export const parseBfetchResponse = (resp: request.Response): Array> => { + return resp.text + .trim() + .split('\n') + .map((item) => JSON.parse(item)); +}; + +export default function ({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertest'); + const retry = getService('retry'); + + describe('Matrix DNS Histogram', () => { + describe('Large data set', () => { + before(() => esArchiver.load('security_solution/matrix_dns_histogram/large_dns_query')); + after(() => esArchiver.unload('security_solution/matrix_dns_histogram/large_dns_query')); + + const FROM = '2000-01-01T00:00:00.000Z'; + const TO = '3000-01-01T00:00:00.000Z'; + + it('Make sure that we get dns data without getting bucket errors when querying large volume of data', async () => { + const { body: networkDns } = await supertest + .post('/internal/search/securitySolutionSearchStrategy/') + .set('kbn-xsrf', 'true') + .send({ + defaultIndex: ['large_volume_dns_data'], + docValueFields: [], + factoryQueryType: MatrixHistogramQuery, + histogramType: MatrixHistogramType.dns, + filterQuery: + '{"bool":{"must":[],"filter":[{"match_all":{}}],"should":[],"must_not":[]}}', + isPtrIncluded: false, + timerange: { + interval: '12h', + to: TO, + from: FROM, + }, + }) + .expect(200); + + if (networkDns.isRunning === true) { + await retry.waitForWithTimeout('bsearch to give us results', 5000, async () => { + const resp = await supertest + .post('/internal/bsearch') + .set('kbn-xsrf', 'true') + .send({ + batch: [ + { + request: { + id: networkDns.id, + defaultIndex: ['large_volume_dns_data'], + docValueFields: [], + factoryQueryType: MatrixHistogramQuery, + histogramType: MatrixHistogramType.dns, + filterQuery: + '{"bool":{"must":[],"filter":[{"match_all":{}}],"should":[],"must_not":[]}}', + isPtrIncluded: false, + timerange: { + interval: '12h', + to: TO, + from: FROM, + }, + }, + options: { + strategy: 'securitySolutionSearchStrategy', + }, + }, + ], + }); + const parsedResponse = parseBfetchResponse(resp); + expect(parsedResponse[0].result.rawResponse.aggregations.dns_count.value).to.equal( + 6604 + ); + return true; + }); + } else { + expect(networkDns.isRunning).to.equal(false); + expect(networkDns.rawResponse.aggregations.dns_count.value).to.equal(6604); + } + }); + }); + }); +} diff --git a/x-pack/test/functional/es_archives/security_solution/matrix_dns_histogram/README.md b/x-pack/test/functional/es_archives/security_solution/matrix_dns_histogram/README.md new file mode 100644 index 0000000000000..809732554fbcf --- /dev/null +++ b/x-pack/test/functional/es_archives/security_solution/matrix_dns_histogram/README.md @@ -0,0 +1,32 @@ +Within this folder is input test data for tests specific to the matrix dns +search strategy and for either corner cases, bugs found on customer sites, or correctness. When possible the mappings should be small and concise but ECS compliant here for these +types of tests. If small, do not gzip them, if large then please do gzip them. + +Script that might be helpful if you have to maintain this test at some point to +generate a large set of values + +```sh +#!/bin/sh + +for i in {1..6600} +do + echo "{" + echo " \"type\": \"doc\"," + echo " \"value\": {" + echo " \"id\": \"$i\"," + echo " \"index\": \"large_volume_dns_data\"," + echo " \"source\": {" + echo " \"@timestamp\": \"2020-10-28T05:00:53.000Z\"," + echo " \"dns\": {" + echo " \"question\": {" + echo " \"registered_domain\": \"domain_$i\"," + echo " \"name\": \"domain_$i\"" + echo " }" + echo " }" + echo " }," + echo " \"type\": \"_doc\"" + echo " }" + echo "}" + echo "" +done +``` \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/security_solution/matrix_dns_histogram/large_dns_query/data.json.gz b/x-pack/test/functional/es_archives/security_solution/matrix_dns_histogram/large_dns_query/data.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..6c174e4e52dc14d7afdcef6ae2f40ff6669f9c0d GIT binary patch literal 61914 zcmeHQeN>ZIo(3a`O<%F4C9Us@pj(`!YS9Z55F!icmr_XO<$Gz(7IpwFI$= zQftAMtu2gvwi=^Ib|iclLP*l7>{tXV2!tdMrP6_XAwq(LymJxWvpr|)jB}2%nc4f7 z&*A?3<>uk{aL-E~?z8Nqi_3#|G8hh|-!ea7u1QKuW;=AKuU|g5FXQas#_C)~@2^u! z27hy%qWvO(n=9~K+`sA0CgCQNMlxLY?Q@PQtbXkR-7>GlPnhx1p;DVR-Zm19PbA+TTY+B- z##{TQMoMiHW{x=?e{gb&hU^gpLna#$TxLLgnbh4e1PMqi1?graNT*2!FTh&JVo)MRFz6_p{_Vq~dsg373 z_@s35E`I+CZu=Y`r$}u^=~O=FV|+ua(N@zMZ~gQ8xSnde6OZHh_dctf$gi9jOZ3_h zV_hHfUj7%KRsNV?`QupPYa3#w*2l!<-~Oy}EWdJWEOEsKrFFgXz5LqGD)sr5`mw}_ z)Ee{MMB`z<$?#MWhcnIz?Cpw(H+si7d6I94oBb5c*=tAv5u{rONs}8E=^7VpU+bzH z+$bD<)3-H5Sn4Lbfy(?=$g(fb4``czOE-UV!%Moxm$t8cSvR;xI2!HS8Y3)Clik2% z>o6I|;1q0h>e4yk4HT=bZ$;vG?lI2iDH`(S9t`lf3+wiaXiGTBL7Z9F7F|aq*1@kqJES>{kBcA*o^=AbOLq0B|rZL=H-WZ zWgEEbjofw}*U~__(?|)qLb)?YKQT&oX{Dbi#k_v8=-n%n`-AkBQTo zc!*6!&iYwVVFI0}Z*Vhdh-=eUL@1NuWMxle7;? z+KVLZV4tOCdE&Snke;R?SN4!c)2QEPQ9ntbe%~hX9hCSMNqmFN^56fJA~WX`K?3!8 z%dy>U7}F19g7>h&$i1oKPBc*NHB$Cmp^OjGyGQBKt@Q3vj0uX?VNCEIf{ffw9e1jM zGX6wGbUOHEJB`b;sFxC`x;BY$P-61Kw18k^Bc&vP+E|Kd&zj}8bX;>9wQ-c5StK!m ztsK&jBd$<1Z4%QBOuK(vKG{IgWKjcK>6zed1sJ*Kd&tH?dglK$^Ed!nEU5R-?K=1B z^PFrmr%_d!Z9DQtYl3A|EG;(BS(D*wQJd9ZJSRThn|*85@nGqs_|FD?ZJ*y=ZJW`? zzKS*JX|36_gQD*M)@6Eo#Y>-zjc@643{36y^^Q{Lpgd*c0p;I$5kH;Z!S zKlm`5zr20xQE%UN!6LuhvV||!_&A+fl{nA2O0a3gqN4sy7jxUUe&k)yF7WmXDPQPQ z<3m36UgEsxt9(LNEP1Hm`A7bXGG`IX99Wb0u-!Q)QB0`_FFfJT2D-?vK2sT9_^Cf*OK*?|tKx8t<3^=nD$&j9YsBS;jEJqpd@q*6=~`^FGVIm;q)%(q zp+9*0yp5K9t=D|!AGuwbSO}IPOsz;`Y07 zzd>3+t8K;n)hvfIwOE`oENefhsYXq@9#S?2F+^4_@RT()0) z=3IDTkv}86H^`q=p{#LaD-DwUZcgWs6Sp!Vb`J8e# zs(3@>SfVt1nB?XpKwLUAB6b(^BUug?YO!yWVP7SYc8JuWo!&lCXqiB-5%@=5Qs(So zncoxT9qx2)2D`c#UUT^krvQuZ!tfP8Ik1Pqg=h&z4l~G_o7t?rFFu%4tWNHIVs`lE8J^I@mXGE>aw>YL@`7`b=z>Vpg1Yx`om*Ca6mgu*G<3UUR9;n@jCw^$@3MR)%$ znR%SgUD_=F6e9M}1D>w|#OgKA$29I*j0u6o~)4gz&uCY$It3$qn!5oxu&jJn3 zBL^5)>s}HG-J-j*l9}iE+_TN{8$iyRSL^1xXJ}%(|1F8RQYakN$YCqU6&!|VCY%>V zLUMF>dNT72pBvXKzl@Q^;7Fb4o}rHIel3Yf5ekPj@->lUaSk^Q$T=^j+i8{VYMpRf zhkOl#*(Kq|0XaL8#o$PVtsqx$7@n1I*g%6vxoV(6@RW+I(lylyV>{$*2GcCzssZgJ zvKSnx?jj)?-Th%QvyRVIH_Ht`&frLOcFzD$sjHKiG@)=(BZsXZS8y1fnQ&eZ2^U0n zrzJD<`P`spc?m|wz>(_cJ`SEzS0piAg~CCN+#`~V<#2<{?&IJom9$FNP$%5dA@^V~ z+a%ne3iojbG6s%R*a~t5hv8WXhYmD&lq&%m1W&2tRXRzXaBqj4&R`lPTnV6k9vK5i z>dPV_CAu3+W>)jLl4iLE$Qc}|PVVF2DfRUvCRHdjYviyM z-~rS%y4$FcX9Izf+{eXr!csnWDu+7-j!Reu34s%0_gXkO8UB*O_M;Xb$t*oKIp%lr z&Y9yJu_kNRkq<-H`ebKW>W0t0|Hm$xpLlj*-}J)jnT2c93&XPu@zV>wGYc!f0}JTg znO6TXy|8v>;rR5zwnqydci&f@h;l#SW-&Q^d0~>L4Yy>)Dxhc06!7H zK{@-sULk-l0Hb4JUiz8tg)`k5#BwG93JAa_Kr;cl31A|COYiKre>K~^eWv?P zVmXljIRyBU073$^5TKs`76L3*J?j2~VP@~on;$XrCivSr7MsI?OQ2|a99K> zfKxE%LWt``4h`@EWXK^P&eNy?h%-u^vV~pmrb^kHu2|Zj-I1bzMUVnG1#>Ti&`!j4 zfVV(~xJJ7G0p3a(5&^_{ z8Z80hj8dDz*qJY?OuN$+ZVlSEQxvcWQUIr5?uD?e6QK_9C^Cc^MQbcT>GNrg;N%Qp zXTG2^y_>EeH)uDfC}0t!08YW&3n8`>Ngm+QWJod)=V?>}#0gH$x7e9(D$|~H1=^qu zPf@@kNCBLJxfjBgPGs2t&sByji=rJVKsU~(9RVljCbk7Ub4I2s7Bpx>QxvcWQUIr5 z?uD?o6Nw+-QDsOx5a(&M35XM%oSWGe@XQ&NuAnq%x1}gx5u^Z4!Q2a>RDjwFP@47j6*Mk$7r%C~bGAx1=z$ut}AzU8f1*9s@_VdI7 z)X;()%0&%8oGWOmh3xu^SGAw2QdZV$VG*PNPQly@p?rw9AXRa!pLbkmb4%dxo8Ox=W<%$LUyL$ zsy0t$`qz3bEP@okDVTd9d^5zOq$*DK^UerRdJ96$Md?7CUbIGVa)M`0uFAB$UJHvL z1#k-HUIa){@e zsyN=y%NL*<_Ovm&GRG z`l;lDA5)@yxfQSPTqBG;_tQVUZ4Ua5p!Ev6&+OEI2b@U2Yy|v7z<&fRM!=FZ?K&zz zvw;x_c#VKJ3D}Qd5u^Z4!5j-ga!7Hvl#kkmNAP4LxiL8+?SS>LwQam4`BW)d6nnSp zE~nOf_qmd_v07CQS9F0r8<2tHn}VNFsRSFss%f~C^54wZAj;|zl3UP3VJ%AF({H|1>A_t8U$}Bzq&35wK-|(&Oa4U zQnwQLzYbfg$2DSYFl~38bBaRRJURY!!033G+62BCof=^A8srV#c3@j5nSCWs2WUzj z4U<%f8F{#Br+P^akxY7s~K?>j$%&`!FYoY|7v6gVKX;;Rxbr1dAptPlX z`r4v@OzQ^pDLuyB1bs@6aW_3vpHd^c4W^>0AO(;D`-}&Ksc0}54rb%oXFOma_)`{` ziUuiwQ(%umfT?IO7!GFR*=IapBlv*E-1rFXj32u+M_0;bk`nh}P z=hqtr$!{-)SIqp-&ITL7z{Rp!DcYnZ0>{2o=A5v*bD}n!Co%u z-N9fp7;FZE&E`JX?1^*-gUw*D84Na?`(U#t(j5#ogTZDn*lg~D&4BLky=qCN%Ljk- zbx^-+tussi>-p-U<;OfzoQ9nIhjyR++Xg>qG=fGWXf%RGqmAGbV|%o7z&*ili+xTe zG#Wvp5i}Y>qY(^LgPC$LR_}?E1%c7Xw&hVS6Q|BRo!|BM_G@|oyeg9UVsca z1jKn7HQ49nEh>1k5~Se&-_1&)orvoIZ-ESPjiLn>pdR3U2=H4@c#9FF08YXGxe#`B zA`t_;l`K2W#vuj&>{GC<6QK_9C^Cc^ vMQbcT>EL5q@B`y-n;c*f Date: Thu, 15 Apr 2021 11:36:10 -0400 Subject: [PATCH 21/68] Track API stats as part of ci (#95733) * Track stats and add extra output information * Update api docs output * Clean up id names * update api docs * Consolidate error messages and fix a bug * Update docs * Update get_declaration_nodes_for_plugin.ts * Fix bug with removeBrokenLinks not being recursive * Update docs Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- api_docs/actions.json | 229 ++- api_docs/alerting.json | 85 +- api_docs/apm.json | 606 +++--- api_docs/apm.mdx | 3 + api_docs/apm_oss.json | 19 + api_docs/banners.json | 2 +- api_docs/bfetch.json | 25 +- api_docs/canvas.json | 20 +- api_docs/cases.json | 8 +- api_docs/charts.json | 71 +- api_docs/cloud.json | 110 +- api_docs/core.json | 1090 ++++++---- api_docs/core_application.json | 43 +- api_docs/core_chrome.json | 88 +- api_docs/core_http.json | 44 +- api_docs/core_saved_objects.json | 647 +++--- api_docs/dashboard.json | 260 +-- api_docs/dashboard.mdx | 11 + api_docs/dashboard_enhanced.json | 16 +- api_docs/dashboard_mode.json | 4 + api_docs/data.json | 1535 +++++++------- api_docs/data_enhanced.json | 116 +- api_docs/data_field_formats.json | 290 +-- api_docs/data_index_patterns.json | 269 ++- api_docs/data_query.json | 125 +- api_docs/data_search.json | 1816 ++++++++++------- api_docs/data_ui.json | 71 +- api_docs/dev_tools.json | 37 +- api_docs/discover.json | 41 +- api_docs/discover_enhanced.json | 48 +- api_docs/embeddable.json | 232 ++- api_docs/embeddable_enhanced.json | 1 + api_docs/encrypted_saved_objects.json | 44 +- api_docs/es_ui_shared.json | 58 +- api_docs/event_log.json | 561 ++++- api_docs/event_log.mdx | 6 + api_docs/expressions.json | 664 +++--- api_docs/features.json | 80 +- api_docs/file_upload.json | 323 +-- api_docs/fleet.json | 1355 ++++++------ api_docs/global_search.json | 161 +- api_docs/home.json | 57 +- api_docs/index_management.json | 36 +- api_docs/index_pattern_field_editor.json | 45 +- api_docs/index_pattern_management.json | 60 +- api_docs/infra.json | 25 +- api_docs/ingest_pipelines.json | 2 + api_docs/inspector.json | 209 +- api_docs/kibana_legacy.json | 68 +- api_docs/kibana_react.json | 138 +- api_docs/kibana_utils.json | 710 ++++--- api_docs/lens.json | 186 +- api_docs/licensing.json | 262 +-- api_docs/lists.json | 921 +++------ api_docs/lists.mdx | 3 + api_docs/management.json | 36 +- api_docs/maps.json | 1089 +++++++++- api_docs/maps.mdx | 3 + api_docs/maps_ems.json | 51 +- api_docs/ml.json | 520 ++--- api_docs/ml.mdx | 3 - api_docs/monitoring.json | 4 +- api_docs/navigation.json | 39 +- api_docs/observability.json | 533 +++-- api_docs/presentation_util.json | 711 ++++++- api_docs/presentation_util.mdx | 20 + api_docs/reporting.json | 305 +-- api_docs/rule_registry.json | 400 ++++ api_docs/rule_registry.mdx | 38 + api_docs/runtime_fields.json | 10 +- api_docs/saved_objects.json | 170 +- api_docs/saved_objects_management.json | 200 +- api_docs/saved_objects_tagging.json | 58 +- api_docs/saved_objects_tagging_oss.json | 249 +-- api_docs/security.json | 166 +- api_docs/security_oss.json | 32 +- api_docs/security_solution.json | 304 ++- api_docs/share.json | 40 +- api_docs/snapshot_restore.json | 9 +- api_docs/spaces.json | 44 +- api_docs/spaces_oss.json | 1 + api_docs/task_manager.json | 21 +- api_docs/telemetry.json | 120 +- api_docs/telemetry_collection_manager.json | 130 +- api_docs/telemetry_management_section.json | 9 +- api_docs/timelines.json | 119 ++ api_docs/timelines.mdx | 31 + api_docs/triggers_actions_ui.json | 279 +-- api_docs/ui_actions.json | 187 +- api_docs/ui_actions_enhanced.json | 192 +- api_docs/uptime.json | 26 +- api_docs/url_forwarding.json | 22 +- api_docs/usage_collection.json | 27 +- api_docs/vis_type_timeseries.json | 111 +- api_docs/vis_type_timeseries.mdx | 6 + api_docs/visualizations.json | 105 +- .../build_function_dec.ts | 2 - .../build_parameter_decs.ts | 25 +- .../extract_import_refs.ts | 4 +- .../api_docs/build_api_declarations/utils.ts | 6 + .../src/api_docs/build_api_docs_cli.ts | 216 +- .../get_declaration_nodes_for_plugin.ts | 2 +- .../src/api_docs/get_plugin_api_map.ts | 37 + .../__fixtures__/src/plugin_a/public/fns.ts | 7 +- .../src/api_docs/tests/api_doc_suite.test.ts | 17 +- .../api_docs/tests/snapshots/plugin_a.json | 96 +- packages/kbn-docs-utils/src/api_docs/types.ts | 7 +- .../kbn-docs-utils/src/api_docs/utils.test.ts | 8 +- packages/kbn-docs-utils/src/api_docs/utils.ts | 93 +- test/scripts/checks/plugin_public_api_docs.sh | 13 +- vars/tasks.groovy | 2 +- 111 files changed, 11723 insertions(+), 9168 deletions(-) create mode 100644 api_docs/rule_registry.json create mode 100644 api_docs/rule_registry.mdx create mode 100644 api_docs/timelines.json create mode 100644 api_docs/timelines.mdx create mode 100644 packages/kbn-docs-utils/src/api_docs/get_plugin_api_map.ts diff --git a/api_docs/actions.json b/api_docs/actions.json index f3f7f284c046c..1a92e7270d4fb 100644 --- a/api_docs/actions.json +++ b/api_docs/actions.json @@ -30,6 +30,7 @@ "description": [], "children": [ { + "id": "def-server.asHttpRequestExecutionSource.$1", "type": "Object", "label": "source", "isRequired": true, @@ -71,18 +72,13 @@ "description": [], "children": [ { + "id": "def-server.asSavedObjectExecutionSource.$1", "type": "Object", "label": "source", "isRequired": true, "signature": [ "Pick<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", ", \"type\" | \"id\">" ], "description": [], @@ -381,11 +377,12 @@ "type": "Function", "label": "renderParameterTemplates", "signature": [ - "((params: Params, variables: Record) => Params) | undefined" + "((params: Params, variables: Record, actionId?: string | undefined) => Params) | undefined" ], "description": [], "children": [ { + "id": "def-server.ActionType.renderParameterTemplates.$1", "type": "Uncategorized", "label": "params", "isRequired": true, @@ -395,10 +392,11 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/types.ts", - "lineNumber": 110 + "lineNumber": 111 } }, { + "id": "def-server.ActionType.renderParameterTemplates.$2", "type": "Object", "label": "variables", "isRequired": true, @@ -408,7 +406,21 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/types.ts", - "lineNumber": 110 + "lineNumber": 112 + } + }, + { + "id": "def-server.ActionType.renderParameterTemplates.$3", + "type": "string", + "label": "actionId", + "isRequired": false, + "signature": [ + "string | undefined" + ], + "description": [], + "source": { + "path": "x-pack/plugins/actions/server/types.ts", + "lineNumber": 113 } } ], @@ -427,16 +439,10 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/types.ts", - "lineNumber": 111 + "lineNumber": 115 }, "signature": [ - { - "pluginId": "actions", - "scope": "server", - "docId": "kibActionsPluginApi", - "section": "def-server.ExecutorType", - "text": "ExecutorType" - }, + "ExecutorType", "" ] } @@ -486,13 +492,7 @@ "lineNumber": 56 }, "signature": [ - { - "pluginId": "actions", - "scope": "server", - "docId": "kibActionsPluginApi", - "section": "def-server.Services", - "text": "Services" - } + "Services" ] }, { @@ -616,10 +616,10 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/builtin_action_types/es_index.ts", - "lineNumber": 34 + "lineNumber": 36 }, "signature": [ - "{ readonly documents: Record[]; }" + "{ readonly documents: Record[]; readonly indexOverride: string | null; }" ], "initialIsOpen": false }, @@ -661,7 +661,7 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/builtin_action_types/slack.ts", - "lineNumber": 46 + "lineNumber": 48 }, "signature": [ "{ readonly message: string; }" @@ -823,7 +823,7 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/builtin_action_types/es_index.ts", - "lineNumber": 43 + "lineNumber": 54 }, "signature": [ "\".index\"" @@ -868,7 +868,7 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/builtin_action_types/slack.ts", - "lineNumber": 54 + "lineNumber": 56 }, "signature": [ "\".slack\"" @@ -992,6 +992,7 @@ "description": [], "children": [ { + "id": "def-server.PluginSetupContract.registerType.$1", "type": "Object", "label": "actionType", "isRequired": true, @@ -1008,7 +1009,7 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 85 + "lineNumber": 88 } } ], @@ -1016,13 +1017,13 @@ "returnComment": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 79 + "lineNumber": 82 } } ], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 78 + "lineNumber": 81 }, "lifecycle": "setup", "initialIsOpen": true @@ -1044,6 +1045,7 @@ "description": [], "children": [ { + "id": "def-server.PluginStartContract.isActionTypeEnabled.$1", "type": "string", "label": "id", "isRequired": true, @@ -1053,11 +1055,11 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 90 + "lineNumber": 93 } }, { - "id": "def-server.PluginStartContract.isActionTypeEnabled.options", + "id": "def-server.PluginStartContract.isActionTypeEnabled.$2.options", "type": "Object", "label": "options", "tags": [], @@ -1065,19 +1067,19 @@ "children": [ { "tags": [], - "id": "def-server.PluginStartContract.isActionTypeEnabled.options.notifyUsage", + "id": "def-server.PluginStartContract.isActionTypeEnabled.$2.options.notifyUsage", "type": "boolean", "label": "notifyUsage", "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 90 + "lineNumber": 93 } } ], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 90 + "lineNumber": 93 } } ], @@ -1085,7 +1087,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 90 + "lineNumber": 93 } }, { @@ -1098,6 +1100,7 @@ "description": [], "children": [ { + "id": "def-server.PluginStartContract.isActionExecutable.$1", "type": "string", "label": "actionId", "isRequired": true, @@ -1107,10 +1110,11 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 92 + "lineNumber": 95 } }, { + "id": "def-server.PluginStartContract.isActionExecutable.$2", "type": "string", "label": "actionTypeId", "isRequired": true, @@ -1120,11 +1124,11 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 93 + "lineNumber": 96 } }, { - "id": "def-server.PluginStartContract.isActionExecutable.options", + "id": "def-server.PluginStartContract.isActionExecutable.$3.options", "type": "Object", "label": "options", "tags": [], @@ -1132,19 +1136,19 @@ "children": [ { "tags": [], - "id": "def-server.PluginStartContract.isActionExecutable.options.notifyUsage", + "id": "def-server.PluginStartContract.isActionExecutable.$3.options.notifyUsage", "type": "boolean", "label": "notifyUsage", "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 94 + "lineNumber": 97 } } ], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 94 + "lineNumber": 97 } } ], @@ -1152,7 +1156,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 91 + "lineNumber": 94 } }, { @@ -1181,6 +1185,7 @@ "description": [], "children": [ { + "id": "def-server.PluginStartContract.getActionsClientWithRequest.$1", "type": "Object", "label": "request", "isRequired": true, @@ -1197,7 +1202,7 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 96 + "lineNumber": 99 } } ], @@ -1205,7 +1210,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 96 + "lineNumber": 99 } }, { @@ -1234,6 +1239,7 @@ "description": [], "children": [ { + "id": "def-server.PluginStartContract.getActionsAuthorizationWithRequest.$1", "type": "Object", "label": "request", "isRequired": true, @@ -1250,7 +1256,7 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 97 + "lineNumber": 100 } } ], @@ -1258,7 +1264,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 97 + "lineNumber": 100 } }, { @@ -1269,7 +1275,7 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 98 + "lineNumber": 101 }, "signature": [ { @@ -1287,11 +1293,12 @@ "type": "Function", "label": "renderActionParameterTemplates", "signature": [ - " = Record>(actionTypeId: string, params: Params, variables: Record) => Params" + " = Record>(actionTypeId: string, actionId: string, params: Params, variables: Record) => Params" ], "description": [], "children": [ { + "id": "def-server.PluginStartContract.renderActionParameterTemplates.$1", "type": "string", "label": "actionTypeId", "isRequired": true, @@ -1301,10 +1308,25 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 100 + "lineNumber": 103 } }, { + "id": "def-server.PluginStartContract.renderActionParameterTemplates.$2", + "type": "string", + "label": "actionId", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/actions/server/plugin.ts", + "lineNumber": 104 + } + }, + { + "id": "def-server.PluginStartContract.renderActionParameterTemplates.$3", "type": "Uncategorized", "label": "params", "isRequired": true, @@ -1314,10 +1336,11 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 101 + "lineNumber": 105 } }, { + "id": "def-server.PluginStartContract.renderActionParameterTemplates.$4", "type": "Object", "label": "variables", "isRequired": true, @@ -1327,7 +1350,7 @@ "description": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 102 + "lineNumber": 106 } } ], @@ -1335,13 +1358,13 @@ "returnComment": [], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 99 + "lineNumber": 102 } } ], "source": { "path": "x-pack/plugins/actions/server/plugin.ts", - "lineNumber": 89 + "lineNumber": 92 }, "lifecycle": "start", "initialIsOpen": true @@ -1350,6 +1373,38 @@ "common": { "classes": [], "functions": [ + { + "id": "def-common.buildAlertHistoryDocument", + "type": "Function", + "children": [ + { + "id": "def-common.buildAlertHistoryDocument.$1", + "type": "Object", + "label": "variables", + "isRequired": true, + "signature": [ + "Record" + ], + "description": [], + "source": { + "path": "x-pack/plugins/actions/common/alert_history_schema.ts", + "lineNumber": 14 + } + } + ], + "signature": [ + "(variables: Record) => { event: { kind: string; }; kibana?: { alert: { actionGroupName?: string; actionGroup?: string; context?: { [x: string]: Record; }; id?: string; }; }; rule?: { type?: string; space?: string; params?: { [x: string]: Record; }; name?: string; id?: string; }; message?: unknown; tags?: string[]; '@timestamp': string; } | null" + ], + "description": [], + "label": "buildAlertHistoryDocument", + "source": { + "path": "x-pack/plugins/actions/common/alert_history_schema.ts", + "lineNumber": 14 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + }, { "id": "def-common.isActionTypeExecutorResult", "type": "Function", @@ -1360,6 +1415,7 @@ "description": [], "children": [ { + "id": "def-common.isActionTypeExecutorResult.$1", "type": "Unknown", "label": "result", "isRequired": true, @@ -1646,6 +1702,63 @@ ], "enums": [], "misc": [ + { + "tags": [], + "id": "def-common.ALERT_HISTORY_PREFIX", + "type": "string", + "label": "ALERT_HISTORY_PREFIX", + "description": [], + "source": { + "path": "x-pack/plugins/actions/common/alert_history_schema.ts", + "lineNumber": 10 + }, + "signature": [ + "\"kibana-alert-history-\"" + ], + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.AlertHistoryDefaultIndexName", + "type": "string", + "label": "AlertHistoryDefaultIndexName", + "description": [], + "source": { + "path": "x-pack/plugins/actions/common/alert_history_schema.ts", + "lineNumber": 11 + }, + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.AlertHistoryDocumentTemplate", + "type": "CompoundType", + "label": "AlertHistoryDocumentTemplate", + "description": [], + "source": { + "path": "x-pack/plugins/actions/common/alert_history_schema.ts", + "lineNumber": 73 + }, + "signature": [ + "Readonly<{ event: { kind: string; }; kibana?: { alert: { actionGroupName?: string; actionGroup?: string; context?: { [x: string]: Record; }; id?: string; }; }; rule?: { type?: string; space?: string; params?: { [x: string]: Record; }; name?: string; id?: string; }; message?: unknown; tags?: string[]; '@timestamp': string; }> | null" + ], + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.AlertHistoryEsIndexConnectorId", + "type": "string", + "label": "AlertHistoryEsIndexConnectorId", + "description": [], + "source": { + "path": "x-pack/plugins/actions/common/alert_history_schema.ts", + "lineNumber": 12 + }, + "signature": [ + "\"preconfigured-alert-history-es-index\"" + ], + "initialIsOpen": false + }, { "id": "def-common.AsApiContract", "type": "Type", @@ -1669,7 +1782,7 @@ "description": [], "source": { "path": "x-pack/plugins/actions/common/index.ts", - "lineNumber": 10 + "lineNumber": 12 }, "signature": [ "\"/api/actions\"" diff --git a/api_docs/alerting.json b/api_docs/alerting.json index f6e37bafdedb0..803047ef9237d 100644 --- a/api_docs/alerting.json +++ b/api_docs/alerting.json @@ -26,13 +26,7 @@ }, "signature": [ "(consumer: string, alertType: string, handler: ", - { - "pluginId": "alerting", - "scope": "public", - "docId": "kibAlertingPluginApi", - "section": "def-public.AlertNavigationHandler", - "text": "AlertNavigationHandler" - }, + "AlertNavigationHandler", ") => void" ] }, @@ -48,13 +42,7 @@ }, "signature": [ "(consumer: string, handler: ", - { - "pluginId": "alerting", - "scope": "public", - "docId": "kibAlertingPluginApi", - "section": "def-public.AlertNavigationHandler", - "text": "AlertNavigationHandler" - }, + "AlertNavigationHandler", ") => void" ] } @@ -125,6 +113,7 @@ "description": [], "children": [ { + "id": "def-server.parseDuration.$1", "type": "string", "label": "duration", "isRequired": true, @@ -429,13 +418,7 @@ }, "signature": [ "() => Set<", - { - "pluginId": "alerting", - "scope": "server", - "docId": "kibAlertingPluginApi", - "section": "def-server.RegistryAlertType", - "text": "RegistryAlertType" - }, + "RegistryAlertType", ">" ] }, @@ -552,13 +535,7 @@ }, "signature": [ "(id: string) => Pick<", - { - "pluginId": "alerting", - "scope": "server", - "docId": "kibAlertingPluginApi", - "section": "def-server.AlertInstance", - "text": "AlertInstance" - }, + "AlertInstance", ", \"getState\" | \"replaceState\" | \"scheduleActions\" | \"scheduleActionsWithSubGroup\">" ] } @@ -620,13 +597,7 @@ }, "signature": [ "{ params?: ", - { - "pluginId": "alerting", - "scope": "server", - "docId": "kibAlertingPluginApi", - "section": "def-server.AlertTypeParamsValidator", - "text": "AlertTypeParamsValidator" - }, + "AlertTypeParamsValidator", " | undefined; } | undefined" ] }, @@ -697,13 +668,7 @@ "lineNumber": 128 }, "signature": [ - { - "pluginId": "alerting", - "scope": "server", - "docId": "kibAlertingPluginApi", - "section": "def-server.ExecutorType", - "text": "ExecutorType" - }, + "ExecutorType", ", \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"muteAll\" | \"tags\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"throttle\" | \"notifyWhen\" | \"mutedInstanceIds\" | \"executionStatus\">[]" + ", \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"tags\" | \"muteAll\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"throttle\" | \"notifyWhen\" | \"mutedInstanceIds\" | \"executionStatus\">[]" ] } ], @@ -889,6 +854,7 @@ "description": [], "children": [ { + "id": "def-server.PluginSetupContract.registerType.$1", "type": "Object", "label": "alertType", "isRequired": true, @@ -942,13 +908,7 @@ }, "signature": [ "() => Set<", - { - "pluginId": "alerting", - "scope": "server", - "docId": "kibAlertingPluginApi", - "section": "def-server.RegistryAlertType", - "text": "RegistryAlertType" - }, + "RegistryAlertType", ">" ] }, @@ -978,6 +938,7 @@ "description": [], "children": [ { + "id": "def-server.PluginStartContract.getAlertsClientWithRequest.$1", "type": "Object", "label": "request", "isRequired": true, @@ -1116,7 +1077,7 @@ "section": "def-common.Alert", "text": "Alert" }, - ", \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"muteAll\" | \"tags\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"throttle\" | \"notifyWhen\" | \"mutedInstanceIds\" | \"executionStatus\">>; delete: ({ id }: { id: string; }) => Promise<{}>; create: = never>({ data, options, }: ", + ", \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"tags\" | \"muteAll\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"throttle\" | \"notifyWhen\" | \"mutedInstanceIds\" | \"executionStatus\">>; delete: ({ id }: { id: string; }) => Promise<{}>; create: = never>({ data, options, }: ", "CreateOptions", ") => Promise, \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"muteAll\" | \"tags\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"throttle\" | \"notifyWhen\" | \"mutedInstanceIds\" | \"executionStatus\">>; find: ({ options: { fields, ...options }, }?: { options?: ", + ", \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"tags\" | \"muteAll\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"throttle\" | \"notifyWhen\" | \"mutedInstanceIds\" | \"executionStatus\">>; find: ({ options: { fields, ...options }, }?: { options?: ", "FindOptions", " | undefined; }) => Promise<", { @@ -1180,7 +1141,7 @@ "lineNumber": 178 }, "signature": [ - "Pick, \"id\"> & Partial, \"enabled\" | \"name\" | \"params\" | \"actions\" | \"muteAll\" | \"apiKey\" | \"tags\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"throttle\" | \"notifyWhen\" | \"mutedInstanceIds\" | \"executionStatus\">>" + "Pick, \"id\"> & Partial, \"enabled\" | \"name\" | \"params\" | \"actions\" | \"tags\" | \"muteAll\" | \"apiKey\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"throttle\" | \"notifyWhen\" | \"mutedInstanceIds\" | \"executionStatus\">>" ], "initialIsOpen": false }, @@ -1239,6 +1200,7 @@ "description": [], "children": [ { + "id": "def-common.getBuiltinActionGroups.$1", "type": "Object", "label": "customRecoveryGroup", "isRequired": false, @@ -1277,6 +1239,7 @@ "description": [], "children": [ { + "id": "def-common.getDurationNumberInItsUnit.$1", "type": "string", "label": "duration", "isRequired": true, @@ -1308,6 +1271,7 @@ "description": [], "children": [ { + "id": "def-common.getDurationUnitValue.$1", "type": "string", "label": "duration", "isRequired": true, @@ -1339,6 +1303,7 @@ "description": [], "children": [ { + "id": "def-common.isActionGroupDisabledForActionTypeId.$1", "type": "string", "label": "actionGroup", "isRequired": true, @@ -1352,6 +1317,7 @@ } }, { + "id": "def-common.isActionGroupDisabledForActionTypeId.$2", "type": "string", "label": "actionTypeId", "isRequired": true, @@ -1383,6 +1349,7 @@ "description": [], "children": [ { + "id": "def-common.parseDuration.$1", "type": "string", "label": "duration", "isRequired": true, @@ -1414,6 +1381,7 @@ "description": [], "children": [ { + "id": "def-common.validateDurationSchema.$1", "type": "string", "label": "duration", "isRequired": true, @@ -1445,6 +1413,7 @@ "description": [], "children": [ { + "id": "def-common.validateNotifyWhenType.$1", "type": "string", "label": "notifyWhen", "isRequired": true, @@ -1951,13 +1920,7 @@ "lineNumber": 47 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectAttributes", - "text": "SavedObjectAttributes" - } + "SavedObjectAttributes" ] } ], @@ -3120,7 +3083,7 @@ "lineNumber": 78 }, "signature": [ - "{ enabled: boolean; id: string; name: string; params: Params; actions: AlertAction[]; muteAll: boolean; tags: string[]; alertTypeId: string; consumer: string; schedule: IntervalSchedule; scheduledTaskId?: string | undefined; createdBy: string | null; updatedBy: string | null; createdAt: Date; updatedAt: Date; apiKeyOwner: string | null; throttle: string | null; notifyWhen: \"onActionGroupChange\" | \"onActiveAlert\" | \"onThrottleInterval\" | null; mutedInstanceIds: string[]; executionStatus: AlertExecutionStatus; }" + "{ enabled: boolean; id: string; name: string; params: Params; actions: AlertAction[]; tags: string[]; muteAll: boolean; alertTypeId: string; consumer: string; schedule: IntervalSchedule; scheduledTaskId?: string | undefined; createdBy: string | null; updatedBy: string | null; createdAt: Date; updatedAt: Date; apiKeyOwner: string | null; throttle: string | null; notifyWhen: \"onActionGroupChange\" | \"onActiveAlert\" | \"onThrottleInterval\" | null; mutedInstanceIds: string[]; executionStatus: AlertExecutionStatus; }" ], "initialIsOpen": false }, diff --git a/api_docs/apm.json b/api_docs/apm.json index 7ddf4f2548d84..e3d8747d7b465 100644 --- a/api_docs/apm.json +++ b/api_docs/apm.json @@ -107,7 +107,10 @@ "section": "def-server.APMPluginSetup", "text": "APMPluginSetup" }, - ", void, object, object>" + ", void, ", + "APMPluginSetupDependencies", + ", ", + "APMPluginStartDependencies" ], "children": [ { @@ -120,6 +123,7 @@ "description": [], "children": [ { + "id": "def-server.APMPlugin.Unnamed.$1", "type": "Object", "label": "initContext", "isRequired": true, @@ -136,7 +140,7 @@ "description": [], "source": { "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 61 + "lineNumber": 58 } } ], @@ -144,7 +148,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 61 + "lineNumber": 58 } }, { @@ -160,42 +164,19 @@ "section": "def-server.CoreSetup", "text": "CoreSetup" }, - ", plugins: { apmOss: ", - { - "pluginId": "apmOss", - "scope": "server", - "docId": "kibApmOssPluginApi", - "section": "def-server.APMOSSPluginSetup", - "text": "APMOSSPluginSetup" - }, - "; home: ", - { - "pluginId": "home", - "scope": "server", - "docId": "kibHomePluginApi", - "section": "def-server.HomeServerPluginSetup", - "text": "HomeServerPluginSetup" - }, - "; licensing: ", - { - "pluginId": "licensing", - "scope": "server", - "docId": "kibLicensingPluginApi", - "section": "def-server.LicensingPluginSetup", - "text": "LicensingPluginSetup" - }, - "; cloud?: ", - { - "pluginId": "cloud", - "scope": "server", - "docId": "kibCloudPluginApi", - "section": "def-server.CloudSetup", - "text": "CloudSetup" - } + "<", + "APMPluginStartDependencies", + ", unknown>, plugins: Pick<", + "APMPluginSetupDependencies", + ", \"data\" | \"security\" | \"home\" | \"features\" | \"ml\" | \"actions\" | \"usageCollection\" | \"apmOss\" | \"licensing\" | \"observability\" | \"spaces\" | \"cloud\" | \"taskManager\" | \"alerting\">) => { config$: ", + "Observable", + "<{ 'apm_oss.transactionIndices': string; 'apm_oss.spanIndices': string; 'apm_oss.errorIndices': string; 'apm_oss.metricsIndices': string; 'apm_oss.sourcemapIndices': string; 'apm_oss.onboardingIndices': string; 'apm_oss.indexPattern': string; 'xpack.apm.serviceMapEnabled': boolean; 'xpack.apm.serviceMapFingerprintBucketSize': number; 'xpack.apm.serviceMapTraceIdBucketSize': number; 'xpack.apm.serviceMapFingerprintGlobalBucketSize': number; 'xpack.apm.serviceMapTraceIdGlobalBucketSize': number; 'xpack.apm.serviceMapMaxTracesPerRequest': number; 'xpack.apm.ui.enabled': boolean; 'xpack.apm.maxServiceEnvironments': number; 'xpack.apm.maxServiceSelection': number; 'xpack.apm.ui.maxTraceItems': number; 'xpack.apm.ui.transactionGroupBucketSize': number; 'xpack.apm.autocreateApmIndexPattern': boolean; 'xpack.apm.telemetryCollectionEnabled': boolean; 'xpack.apm.searchAggregatedTransactions': ", + "SearchAggregatedTransactionSetting" ], "description": [], "children": [ { + "id": "def-server.APMPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -207,274 +188,30 @@ "section": "def-server.CoreSetup", "text": "CoreSetup" }, - "" + "<", + "APMPluginStartDependencies", + ", unknown>" ], "description": [], "source": { "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 66 + "lineNumber": 63 } }, { - "id": "def-server.APMPlugin.setup.plugins", + "id": "def-server.APMPlugin.setup.$2", "type": "Object", "label": "plugins", - "tags": [], - "description": [], - "children": [ - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.apmOss", - "type": "Object", - "label": "apmOss", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 68 - }, - "signature": [ - { - "pluginId": "apmOss", - "scope": "server", - "docId": "kibApmOssPluginApi", - "section": "def-server.APMOSSPluginSetup", - "text": "APMOSSPluginSetup" - } - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.home", - "type": "Object", - "label": "home", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 69 - }, - "signature": [ - { - "pluginId": "home", - "scope": "server", - "docId": "kibHomePluginApi", - "section": "def-server.HomeServerPluginSetup", - "text": "HomeServerPluginSetup" - } - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.licensing", - "type": "Object", - "label": "licensing", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 70 - }, - "signature": [ - { - "pluginId": "licensing", - "scope": "server", - "docId": "kibLicensingPluginApi", - "section": "def-server.LicensingPluginSetup", - "text": "LicensingPluginSetup" - } - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.cloud", - "type": "Object", - "label": "cloud", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 71 - }, - "signature": [ - { - "pluginId": "cloud", - "scope": "server", - "docId": "kibCloudPluginApi", - "section": "def-server.CloudSetup", - "text": "CloudSetup" - }, - " | undefined" - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.usageCollection", - "type": "Object", - "label": "usageCollection", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 72 - }, - "signature": [ - "Pick<", - { - "pluginId": "usageCollection", - "scope": "server", - "docId": "kibUsageCollectionPluginApi", - "section": "def-server.CollectorSet", - "text": "CollectorSet" - }, - ", \"makeStatsCollector\" | \"makeUsageCollector\" | \"registerCollector\" | \"getCollectorByType\" | \"areAllCollectorsReady\" | \"bulkFetch\" | \"bulkFetchUsage\" | \"toObject\" | \"toApiFieldNames\"> | undefined" - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.taskManager", - "type": "CompoundType", - "label": "taskManager", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 73 - }, - "signature": [ - { - "pluginId": "taskManager", - "scope": "server", - "docId": "kibTaskManagerPluginApi", - "section": "def-server.TaskManagerSetupContract", - "text": "TaskManagerSetupContract" - }, - " | undefined" - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.alerting", - "type": "Object", - "label": "alerting", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 74 - }, - "signature": [ - { - "pluginId": "alerting", - "scope": "server", - "docId": "kibAlertingPluginApi", - "section": "def-server.PluginSetupContract", - "text": "PluginSetupContract" - }, - " | undefined" - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.actions", - "type": "Object", - "label": "actions", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 75 - }, - "signature": [ - { - "pluginId": "actions", - "scope": "server", - "docId": "kibActionsPluginApi", - "section": "def-server.PluginSetupContract", - "text": "PluginSetupContract" - }, - " | undefined" - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.observability", - "type": "Object", - "label": "observability", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 76 - }, - "signature": [ - { - "pluginId": "observability", - "scope": "server", - "docId": "kibObservabilityPluginApi", - "section": "def-server.ObservabilityPluginSetup", - "text": "ObservabilityPluginSetup" - }, - " | undefined" - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.features", - "type": "Object", - "label": "features", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 77 - }, - "signature": [ - { - "pluginId": "features", - "scope": "server", - "docId": "kibFeaturesPluginApi", - "section": "def-server.PluginSetupContract", - "text": "PluginSetupContract" - } - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.security", - "type": "Object", - "label": "security", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 78 - }, - "signature": [ - { - "pluginId": "security", - "scope": "server", - "docId": "kibSecurityPluginApi", - "section": "def-server.SecurityPluginSetup", - "text": "SecurityPluginSetup" - }, - " | undefined" - ] - }, - { - "tags": [], - "id": "def-server.APMPlugin.setup.plugins.ml", - "type": "CompoundType", - "label": "ml", - "description": [], - "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 79 - }, - "signature": [ - { - "pluginId": "ml", - "scope": "server", - "docId": "kibMlPluginApi", - "section": "def-server.SharedServices", - "text": "SharedServices" - }, - " | undefined" - ] - } + "isRequired": true, + "signature": [ + "Pick<", + "APMPluginSetupDependencies", + ", \"data\" | \"security\" | \"home\" | \"features\" | \"ml\" | \"actions\" | \"usageCollection\" | \"apmOss\" | \"licensing\" | \"observability\" | \"spaces\" | \"cloud\" | \"taskManager\" | \"alerting\">" ], + "description": [], "source": { "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 67 + "lineNumber": 64 } } ], @@ -482,7 +219,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 65 + "lineNumber": 62 } }, { @@ -503,6 +240,7 @@ "description": [], "children": [ { + "id": "def-server.APMPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -518,7 +256,7 @@ "description": [], "source": { "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 196 + "lineNumber": 208 } } ], @@ -526,7 +264,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 196 + "lineNumber": 208 } }, { @@ -542,13 +280,13 @@ "returnComment": [], "source": { "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 215 + "lineNumber": 227 } } ], "source": { "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 58 + "lineNumber": 48 }, "initialIsOpen": false } @@ -568,6 +306,7 @@ "description": [], "children": [ { + "id": "def-server.mergeConfigs.$1", "type": "Object", "label": "apmOssConfig", "isRequired": true, @@ -581,18 +320,13 @@ } }, { + "id": "def-server.mergeConfigs.$2", "type": "Object", "label": "apmConfig", "isRequired": true, "signature": [ "Readonly<{} & { enabled: boolean; serviceMapEnabled: boolean; serviceMapFingerprintBucketSize: number; serviceMapTraceIdBucketSize: number; serviceMapFingerprintGlobalBucketSize: number; serviceMapTraceIdGlobalBucketSize: number; serviceMapMaxTracesPerRequest: number; autocreateApmIndexPattern: boolean; ui: Readonly<{} & { enabled: boolean; transactionGroupBucketSize: number; maxTraceItems: number; }>; searchAggregatedTransactions: ", - { - "pluginId": "apm", - "scope": "common", - "docId": "kibApmPluginApi", - "section": "def-common.SearchAggregatedTransactionSetting", - "text": "SearchAggregatedTransactionSetting" - }, + "SearchAggregatedTransactionSetting", "; telemetryCollectionEnabled: boolean; metricsInterval: number; maxServiceEnvironments: number; maxServiceSelection: number; profilingEnabled: boolean; }>" ], "description": [], @@ -611,7 +345,184 @@ "initialIsOpen": false } ], - "interfaces": [], + "interfaces": [ + { + "id": "def-server.APMRouteHandlerResources", + "type": "Interface", + "label": "APMRouteHandlerResources", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-server.APMRouteHandlerResources.request", + "type": "Object", + "label": "request", + "description": [], + "source": { + "path": "x-pack/plugins/apm/server/routes/typings.ts", + "lineNumber": 43 + }, + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ] + }, + { + "tags": [], + "id": "def-server.APMRouteHandlerResources.context", + "type": "Object", + "label": "context", + "description": [], + "source": { + "path": "x-pack/plugins/apm/server/routes/typings.ts", + "lineNumber": 44 + }, + "signature": [ + "ApmPluginRequestHandlerContext" + ] + }, + { + "tags": [], + "id": "def-server.APMRouteHandlerResources.params", + "type": "Object", + "label": "params", + "description": [], + "source": { + "path": "x-pack/plugins/apm/server/routes/typings.ts", + "lineNumber": 45 + }, + "signature": [ + "{ query: { _inspect: boolean; }; }" + ] + }, + { + "tags": [], + "id": "def-server.APMRouteHandlerResources.config", + "type": "Object", + "label": "config", + "description": [], + "source": { + "path": "x-pack/plugins/apm/server/routes/typings.ts", + "lineNumber": 50 + }, + "signature": [ + "{ 'apm_oss.transactionIndices': string; 'apm_oss.spanIndices': string; 'apm_oss.errorIndices': string; 'apm_oss.metricsIndices': string; 'apm_oss.sourcemapIndices': string; 'apm_oss.onboardingIndices': string; 'apm_oss.indexPattern': string; 'xpack.apm.serviceMapEnabled': boolean; 'xpack.apm.serviceMapFingerprintBucketSize': number; 'xpack.apm.serviceMapTraceIdBucketSize': number; 'xpack.apm.serviceMapFingerprintGlobalBucketSize': number; 'xpack.apm.serviceMapTraceIdGlobalBucketSize': number; 'xpack.apm.serviceMapMaxTracesPerRequest': number; 'xpack.apm.ui.enabled': boolean; 'xpack.apm.maxServiceEnvironments': number; 'xpack.apm.maxServiceSelection': number; 'xpack.apm.ui.maxTraceItems': number; 'xpack.apm.ui.transactionGroupBucketSize': number; 'xpack.apm.autocreateApmIndexPattern': boolean; 'xpack.apm.telemetryCollectionEnabled': boolean; 'xpack.apm.searchAggregatedTransactions': ", + "SearchAggregatedTransactionSetting", + "; 'xpack.apm.metricsInterval': number; }" + ] + }, + { + "tags": [], + "id": "def-server.APMRouteHandlerResources.logger", + "type": "Object", + "label": "logger", + "description": [], + "source": { + "path": "x-pack/plugins/apm/server/routes/typings.ts", + "lineNumber": 51 + }, + "signature": [ + "Logger" + ] + }, + { + "tags": [], + "id": "def-server.APMRouteHandlerResources.core", + "type": "Object", + "label": "core", + "description": [], + "source": { + "path": "x-pack/plugins/apm/server/routes/typings.ts", + "lineNumber": 52 + }, + "signature": [ + "{ setup: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.CoreSetup", + "text": "CoreSetup" + }, + "; start: () => Promise<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.CoreStart", + "text": "CoreStart" + }, + ">; }" + ] + }, + { + "tags": [], + "id": "def-server.APMRouteHandlerResources.plugins", + "type": "Object", + "label": "plugins", + "description": [], + "source": { + "path": "x-pack/plugins/apm/server/routes/typings.ts", + "lineNumber": 56 + }, + "signature": [ + "{ data: { setup: ", + { + "pluginId": "data", + "scope": "server", + "docId": "kibDataPluginApi", + "section": "def-server.DataPluginSetup", + "text": "DataPluginSetup" + }, + "; start: () => Promise<", + { + "pluginId": "data", + "scope": "server", + "docId": "kibDataPluginApi", + "section": "def-server.DataPluginStart", + "text": "DataPluginStart" + }, + ">; }; features: { setup: ", + { + "pluginId": "features", + "scope": "server", + "docId": "kibFeaturesPluginApi", + "section": "def-server.PluginSetupContract", + "text": "PluginSetupContract" + }, + "; start: () => Promise<", + { + "pluginId": "features", + "scope": "server", + "docId": "kibFeaturesPluginApi", + "section": "def-server.PluginStartContract", + "text": "PluginStartContract" + }, + ">; }; apmOss: { setup: ", + { + "pluginId": "apmOss", + "scope": "server", + "docId": "kibApmOssPluginApi", + "section": "def-server.APMOSSPluginSetup", + "text": "APMOSSPluginSetup" + } + ] + } + ], + "source": { + "path": "x-pack/plugins/apm/server/routes/typings.ts", + "lineNumber": 42 + }, + "initialIsOpen": false + } + ], "enums": [ { "id": "def-server.ProcessorEvent", @@ -642,6 +553,30 @@ ], "initialIsOpen": false }, + { + "id": "def-server.APMServerRouteRepository", + "type": "Type", + "label": "APMServerRouteRepository", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/apm/server/routes/get_global_apm_server_route_repository.ts", + "lineNumber": 60 + }, + "signature": [ + "ServerRouteRepository; } & { \"GET /api/apm/index_pattern/dynamic\": ", + "ServerRoute", + "<\"GET /api/apm/index_pattern/dynamic\", undefined, APMRouteHandlerResources, { dynamicIndexPattern: ", + "IndexPatternTitleAndFields" + ], + "initialIsOpen": false + }, { "id": "def-server.APMXPackConfig", "type": "Type", @@ -656,6 +591,21 @@ "{ readonly enabled: boolean; readonly serviceMapEnabled: boolean; readonly serviceMapFingerprintBucketSize: number; readonly serviceMapTraceIdBucketSize: number; readonly serviceMapFingerprintGlobalBucketSize: number; readonly serviceMapTraceIdGlobalBucketSize: number; readonly serviceMapMaxTracesPerRequest: number; readonly autocreateApmIndexPattern: boolean; readonly ui: Readonly<{} & { enabled: boolean; transactionGroupBucketSize: number; maxTraceItems: number; }>; readonly searchAggregatedTransactions: SearchAggregatedTransactionSetting; readonly telemetryCollectionEnabled: boolean; readonly metricsInterval: number; readonly maxServiceEnvironments: number; readonly maxServiceSelection: number; readonly profilingEnabled: boolean; }" ], "initialIsOpen": false + }, + { + "id": "def-server.InspectResponse", + "type": "Type", + "label": "InspectResponse", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/apm/server/routes/typings.ts", + "lineNumber": 23 + }, + "signature": [ + "{ response: any; duration: number; requestType: string; requestParams: Record; esError: Error; }[]" + ], + "initialIsOpen": false } ], "objects": [], @@ -673,19 +623,13 @@ "label": "config$", "description": [], "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 49 + "path": "x-pack/plugins/apm/server/types.ts", + "lineNumber": 48 }, "signature": [ "Observable", "<{ 'apm_oss.transactionIndices': string; 'apm_oss.spanIndices': string; 'apm_oss.errorIndices': string; 'apm_oss.metricsIndices': string; 'apm_oss.sourcemapIndices': string; 'apm_oss.onboardingIndices': string; 'apm_oss.indexPattern': string; 'xpack.apm.serviceMapEnabled': boolean; 'xpack.apm.serviceMapFingerprintBucketSize': number; 'xpack.apm.serviceMapTraceIdBucketSize': number; 'xpack.apm.serviceMapFingerprintGlobalBucketSize': number; 'xpack.apm.serviceMapTraceIdGlobalBucketSize': number; 'xpack.apm.serviceMapMaxTracesPerRequest': number; 'xpack.apm.ui.enabled': boolean; 'xpack.apm.maxServiceEnvironments': number; 'xpack.apm.maxServiceSelection': number; 'xpack.apm.ui.maxTraceItems': number; 'xpack.apm.ui.transactionGroupBucketSize': number; 'xpack.apm.autocreateApmIndexPattern': boolean; 'xpack.apm.telemetryCollectionEnabled': boolean; 'xpack.apm.searchAggregatedTransactions': ", - { - "pluginId": "apm", - "scope": "common", - "docId": "kibApmPluginApi", - "section": "def-common.SearchAggregatedTransactionSetting", - "text": "SearchAggregatedTransactionSetting" - }, + "SearchAggregatedTransactionSetting", "; 'xpack.apm.metricsInterval': number; }>" ] }, @@ -696,18 +640,12 @@ "label": "getApmIndices", "description": [], "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 50 + "path": "x-pack/plugins/apm/server/types.ts", + "lineNumber": 49 }, "signature": [ "() => Promise<", - { - "pluginId": "apm", - "scope": "server", - "docId": "kibApmPluginApi", - "section": "def-server.ApmIndicesConfig", - "text": "ApmIndicesConfig" - }, + "ApmIndicesConfig", ">" ] }, @@ -718,8 +656,8 @@ "label": "createApmEventClient", "description": [], "source": { - "path": "x-pack/plugins/apm/server/plugin.ts", - "lineNumber": 51 + "path": "x-pack/plugins/apm/server/types.ts", + "lineNumber": 50 }, "signature": [ "(params: { debug?: boolean | undefined; request: ", @@ -731,21 +669,9 @@ "text": "KibanaRequest" }, "; context: ", - { - "pluginId": "apm", - "scope": "server", - "docId": "kibApmPluginApi", - "section": "def-server.ApmPluginRequestHandlerContext", - "text": "ApmPluginRequestHandlerContext" - }, + "ApmPluginRequestHandlerContext", "; }) => Promise<{ search(params: TParams, { includeLegacyData }?: { includeLegacyData?: boolean | undefined; }): Promise<", "InferSearchResponseOf", " +### Interfaces + + ### Enums diff --git a/api_docs/apm_oss.json b/api_docs/apm_oss.json index 389cf76726613..69dc62ceff4c0 100644 --- a/api_docs/apm_oss.json +++ b/api_docs/apm_oss.json @@ -60,6 +60,7 @@ "type": "Function", "children": [ { + "id": "def-server.createDjangoAgentInstructions.$1", "type": "string", "label": "apmServerUrl", "isRequired": true, @@ -73,6 +74,7 @@ } }, { + "id": "def-server.createDjangoAgentInstructions.$2", "type": "string", "label": "secretToken", "isRequired": true, @@ -104,6 +106,7 @@ "type": "Function", "children": [ { + "id": "def-server.createDotNetAgentInstructions.$1", "type": "string", "label": "apmServerUrl", "isRequired": true, @@ -117,6 +120,7 @@ } }, { + "id": "def-server.createDotNetAgentInstructions.$2", "type": "string", "label": "secretToken", "isRequired": true, @@ -148,6 +152,7 @@ "type": "Function", "children": [ { + "id": "def-server.createFlaskAgentInstructions.$1", "type": "string", "label": "apmServerUrl", "isRequired": true, @@ -161,6 +166,7 @@ } }, { + "id": "def-server.createFlaskAgentInstructions.$2", "type": "string", "label": "secretToken", "isRequired": true, @@ -192,6 +198,7 @@ "type": "Function", "children": [ { + "id": "def-server.createGoAgentInstructions.$1", "type": "string", "label": "apmServerUrl", "isRequired": true, @@ -205,6 +212,7 @@ } }, { + "id": "def-server.createGoAgentInstructions.$2", "type": "string", "label": "secretToken", "isRequired": true, @@ -236,6 +244,7 @@ "type": "Function", "children": [ { + "id": "def-server.createJavaAgentInstructions.$1", "type": "string", "label": "apmServerUrl", "isRequired": true, @@ -249,6 +258,7 @@ } }, { + "id": "def-server.createJavaAgentInstructions.$2", "type": "string", "label": "secretToken", "isRequired": true, @@ -280,6 +290,7 @@ "type": "Function", "children": [ { + "id": "def-server.createJsAgentInstructions.$1", "type": "string", "label": "apmServerUrl", "isRequired": true, @@ -311,6 +322,7 @@ "type": "Function", "children": [ { + "id": "def-server.createNodeAgentInstructions.$1", "type": "string", "label": "apmServerUrl", "isRequired": true, @@ -324,6 +336,7 @@ } }, { + "id": "def-server.createNodeAgentInstructions.$2", "type": "string", "label": "secretToken", "isRequired": true, @@ -355,6 +368,7 @@ "type": "Function", "children": [ { + "id": "def-server.createPhpAgentInstructions.$1", "type": "string", "label": "apmServerUrl", "isRequired": true, @@ -368,6 +382,7 @@ } }, { + "id": "def-server.createPhpAgentInstructions.$2", "type": "string", "label": "secretToken", "isRequired": true, @@ -399,6 +414,7 @@ "type": "Function", "children": [ { + "id": "def-server.createRackAgentInstructions.$1", "type": "string", "label": "apmServerUrl", "isRequired": true, @@ -412,6 +428,7 @@ } }, { + "id": "def-server.createRackAgentInstructions.$2", "type": "string", "label": "secretToken", "isRequired": true, @@ -443,6 +460,7 @@ "type": "Function", "children": [ { + "id": "def-server.createRailsAgentInstructions.$1", "type": "string", "label": "apmServerUrl", "isRequired": true, @@ -456,6 +474,7 @@ } }, { + "id": "def-server.createRailsAgentInstructions.$2", "type": "string", "label": "secretToken", "isRequired": true, diff --git a/api_docs/banners.json b/api_docs/banners.json index 46c827ab47767..15fe714af2007 100644 --- a/api_docs/banners.json +++ b/api_docs/banners.json @@ -146,7 +146,7 @@ "lineNumber": 13 }, "signature": [ - "\"disabled\" | \"header\"" + "\"top\" | \"disabled\"" ], "initialIsOpen": false } diff --git a/api_docs/bfetch.json b/api_docs/bfetch.json index 99d37a0c9acbd..b3b251d2c49bb 100644 --- a/api_docs/bfetch.json +++ b/api_docs/bfetch.json @@ -8,6 +8,7 @@ "type": "Function", "children": [ { + "id": "def-public.split.$1", "type": "string", "label": "delimiter", "isRequired": true, @@ -80,13 +81,7 @@ }, "signature": [ "(params: ", - { - "pluginId": "bfetch", - "scope": "public", - "docId": "kibBfetchPluginApi", - "section": "def-public.FetchStreamingParams", - "text": "FetchStreamingParams" - }, + "FetchStreamingParams", ") => { xhr: XMLHttpRequest; stream: ", "Observable", "; }" @@ -104,13 +99,7 @@ }, "signature": [ "(params: ", - { - "pluginId": "bfetch", - "scope": "public", - "docId": "kibBfetchPluginApi", - "section": "def-public.StreamingBatchedFunctionParams", - "text": "StreamingBatchedFunctionParams" - }, + "StreamingBatchedFunctionParams", ") => ", { "pluginId": "bfetch", @@ -395,6 +384,7 @@ "description": [], "children": [ { + "id": "def-common.ItemBuffer.Unnamed.$1", "type": "Object", "label": "params", "isRequired": true, @@ -447,6 +437,7 @@ ], "children": [ { + "id": "def-common.ItemBuffer.write.$1", "type": "Uncategorized", "label": "item", "isRequired": true, @@ -545,6 +536,7 @@ "description": [], "children": [ { + "id": "def-common.TimedItemBuffer.Unnamed.$1", "type": "Object", "label": "params", "isRequired": true, @@ -582,6 +574,7 @@ "description": [], "children": [ { + "id": "def-common.TimedItemBuffer.write.$1", "type": "Uncategorized", "label": "item", "isRequired": true, @@ -648,6 +641,7 @@ "type": "Function", "children": [ { + "id": "def-common.createBatchedFunction.$1", "type": "Object", "label": "params", "isRequired": true, @@ -702,6 +696,7 @@ "type": "Function", "children": [ { + "id": "def-common.normalizeError.$1", "type": "Any", "label": "err", "isRequired": true, @@ -749,6 +744,7 @@ "type": "Function", "children": [ { + "id": "def-common.removeLeadingSlash.$1", "type": "string", "label": "text", "isRequired": true, @@ -1068,6 +1064,7 @@ "description": [], "children": [ { + "id": "def-common.StreamingResponseHandler.getResponseStream.$1", "type": "Uncategorized", "label": "payload", "isRequired": true, diff --git a/api_docs/canvas.json b/api_docs/canvas.json index 70d3fa06bf2eb..e4b56ae0d6aa1 100644 --- a/api_docs/canvas.json +++ b/api_docs/canvas.json @@ -31,21 +31,9 @@ "text": "CoreStart" }, " & ", - { - "pluginId": "canvas", - "scope": "public", - "docId": "kibCanvasPluginApi", - "section": "def-public.CanvasStartDeps", - "text": "CanvasStartDeps" - }, + "CanvasStartDeps", " & { canvas: ", - { - "pluginId": "canvas", - "scope": "public", - "docId": "kibCanvasPluginApi", - "section": "def-public.CanvasServices", - "text": "CanvasServices" - }, + "CanvasServices", "; }; }" ] } @@ -72,7 +60,7 @@ ], "source": { "path": "x-pack/plugins/canvas/public/plugin.tsx", - "lineNumber": 63 + "lineNumber": 65 }, "signature": [ "CanvasApi" @@ -88,7 +76,7 @@ "description": [], "source": { "path": "x-pack/plugins/canvas/public/plugin.tsx", - "lineNumber": 64 + "lineNumber": 66 }, "signature": [ "void" diff --git a/api_docs/cases.json b/api_docs/cases.json index 8ac2fb86061bd..71538a0ad5d47 100644 --- a/api_docs/cases.json +++ b/api_docs/cases.json @@ -31,13 +31,7 @@ }, "signature": [ "() => ", - { - "pluginId": "cases", - "scope": "server", - "docId": "kibCasesPluginApi", - "section": "def-server.CasesClient", - "text": "CasesClient" - } + "CasesClient" ] } ], diff --git a/api_docs/charts.json b/api_docs/charts.json index 70bf2166de7c8..9bc9b559cee6e 100644 --- a/api_docs/charts.json +++ b/api_docs/charts.json @@ -8,6 +8,7 @@ "type": "Function", "children": [ { + "id": "def-public.ColorPicker.$1", "type": "Object", "label": "{\n onChange,\n color: selectedColor,\n label,\n useLegacyColors = true,\n colorIsOverwritten = true,\n onKeyDown,\n}", "isRequired": true, @@ -46,6 +47,7 @@ ], "children": [ { + "id": "def-public.createColorPalette.$1", "type": "number", "label": "num", "isRequired": true, @@ -72,6 +74,7 @@ "type": "Function", "children": [ { + "id": "def-public.CurrentTime.$1", "type": "CompoundType", "label": "{ isDarkMode, domainEnd }", "isRequired": true, @@ -105,6 +108,7 @@ "type": "Function", "children": [ { + "id": "def-public.Endzones.$1", "type": "CompoundType", "label": "{\n isDarkMode,\n domainStart,\n domainEnd,\n interval,\n domainMin,\n domainMax,\n hideTooltips = true,\n isFullBin = false,\n}", "isRequired": true, @@ -136,6 +140,7 @@ "type": "Function", "children": [ { + "id": "def-public.getAdjustedInterval.$1", "type": "Array", "label": "xValues", "isRequired": true, @@ -149,6 +154,7 @@ } }, { + "id": "def-public.getAdjustedInterval.$2", "type": "number", "label": "esValue", "isRequired": true, @@ -162,6 +168,7 @@ } }, { + "id": "def-public.getAdjustedInterval.$3", "type": "CompoundType", "label": "esUnit", "isRequired": true, @@ -175,6 +182,7 @@ } }, { + "id": "def-public.getAdjustedInterval.$4", "type": "string", "label": "timeZone", "isRequired": true, @@ -208,6 +216,7 @@ "type": "Function", "children": [ { + "id": "def-public.getBrushFromChartBrushEventFn.$1", "type": "Object", "label": "table", "isRequired": true, @@ -227,6 +236,7 @@ } }, { + "id": "def-public.getBrushFromChartBrushEventFn.$2", "type": "CompoundType", "label": "xAccessor", "isRequired": true, @@ -280,6 +290,7 @@ "type": "Function", "children": [ { + "id": "def-public.getFilterFromChartClickEventFn.$1", "type": "Object", "label": "table", "isRequired": true, @@ -299,6 +310,7 @@ } }, { + "id": "def-public.getFilterFromChartClickEventFn.$2", "type": "CompoundType", "label": "xAccessor", "isRequired": true, @@ -313,6 +325,7 @@ } }, { + "id": "def-public.getFilterFromChartClickEventFn.$3", "type": "Object", "label": "splitSeriesAccessorFnMap", "isRequired": false, @@ -328,6 +341,7 @@ } }, { + "id": "def-public.getFilterFromChartClickEventFn.$4", "type": "CompoundType", "label": "splitChartAccessor", "isRequired": false, @@ -343,6 +357,7 @@ } }, { + "id": "def-public.getFilterFromChartClickEventFn.$5", "type": "boolean", "label": "negate", "isRequired": true, @@ -391,6 +406,7 @@ "type": "Function", "children": [ { + "id": "def-public.getFilterFromSeriesFn.$1", "type": "Object", "label": "table", "isRequired": true, @@ -456,6 +472,7 @@ "description": [], "children": [ { + "id": "def-public.getHeatmapColors.$1", "type": "Any", "label": "value", "isRequired": true, @@ -469,6 +486,7 @@ } }, { + "id": "def-public.getHeatmapColors.$2", "type": "string", "label": "colorSchemaName", "isRequired": true, @@ -510,6 +528,7 @@ "type": "Function", "children": [ { + "id": "def-public.renderEndzoneTooltip.$1", "type": "number", "label": "xInterval", "isRequired": false, @@ -523,6 +542,7 @@ } }, { + "id": "def-public.renderEndzoneTooltip.$2", "type": "number", "label": "domainStart", "isRequired": false, @@ -536,6 +556,7 @@ } }, { + "id": "def-public.renderEndzoneTooltip.$3", "type": "number", "label": "domainEnd", "isRequired": false, @@ -549,6 +570,7 @@ } }, { + "id": "def-public.renderEndzoneTooltip.$4", "type": "Function", "label": "formatter", "isRequired": false, @@ -562,6 +584,7 @@ } }, { + "id": "def-public.renderEndzoneTooltip.$5", "type": "boolean", "label": "renderValue", "isRequired": true, @@ -1743,13 +1766,13 @@ "tags": [], "children": [ { - "id": "def-public.vislibColorMaps.[ColorSchemas.Blues]", + "id": "def-public.vislibColorMaps.ColorSchemas.Blues", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Blues].id", + "id": "def-public.vislibColorMaps.ColorSchemas.Blues.id", "type": "string", "label": "id", "description": [], @@ -1770,7 +1793,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Blues].label", + "id": "def-public.vislibColorMaps.ColorSchemas.Blues.label", "type": "string", "label": "label", "description": [], @@ -1781,7 +1804,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Blues].value", + "id": "def-public.vislibColorMaps.ColorSchemas.Blues.value", "type": "Array", "label": "value", "description": [], @@ -1804,13 +1827,13 @@ } }, { - "id": "def-public.vislibColorMaps.[ColorSchemas.Greens]", + "id": "def-public.vislibColorMaps.ColorSchemas.Greens", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Greens].id", + "id": "def-public.vislibColorMaps.ColorSchemas.Greens.id", "type": "string", "label": "id", "description": [], @@ -1831,7 +1854,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Greens].label", + "id": "def-public.vislibColorMaps.ColorSchemas.Greens.label", "type": "string", "label": "label", "description": [], @@ -1842,7 +1865,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Greens].value", + "id": "def-public.vislibColorMaps.ColorSchemas.Greens.value", "type": "Array", "label": "value", "description": [], @@ -1863,13 +1886,13 @@ } }, { - "id": "def-public.vislibColorMaps.[ColorSchemas.Greys]", + "id": "def-public.vislibColorMaps.ColorSchemas.Greys", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Greys].id", + "id": "def-public.vislibColorMaps.ColorSchemas.Greys.id", "type": "string", "label": "id", "description": [], @@ -1890,7 +1913,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Greys].label", + "id": "def-public.vislibColorMaps.ColorSchemas.Greys.label", "type": "string", "label": "label", "description": [], @@ -1901,7 +1924,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Greys].value", + "id": "def-public.vislibColorMaps.ColorSchemas.Greys.value", "type": "Array", "label": "value", "description": [], @@ -1922,13 +1945,13 @@ } }, { - "id": "def-public.vislibColorMaps.[ColorSchemas.Reds]", + "id": "def-public.vislibColorMaps.ColorSchemas.Reds", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Reds].id", + "id": "def-public.vislibColorMaps.ColorSchemas.Reds.id", "type": "string", "label": "id", "description": [], @@ -1949,7 +1972,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Reds].label", + "id": "def-public.vislibColorMaps.ColorSchemas.Reds.label", "type": "string", "label": "label", "description": [], @@ -1960,7 +1983,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.Reds].value", + "id": "def-public.vislibColorMaps.ColorSchemas.Reds.value", "type": "Array", "label": "value", "description": [], @@ -1981,13 +2004,13 @@ } }, { - "id": "def-public.vislibColorMaps.[ColorSchemas.YellowToRed]", + "id": "def-public.vislibColorMaps.ColorSchemas.YellowToRed", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.YellowToRed].id", + "id": "def-public.vislibColorMaps.ColorSchemas.YellowToRed.id", "type": "string", "label": "id", "description": [], @@ -2008,7 +2031,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.YellowToRed].label", + "id": "def-public.vislibColorMaps.ColorSchemas.YellowToRed.label", "type": "string", "label": "label", "description": [], @@ -2019,7 +2042,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.YellowToRed].value", + "id": "def-public.vislibColorMaps.ColorSchemas.YellowToRed.value", "type": "Array", "label": "value", "description": [], @@ -2040,13 +2063,13 @@ } }, { - "id": "def-public.vislibColorMaps.[ColorSchemas.GreenToRed]", + "id": "def-public.vislibColorMaps.ColorSchemas.GreenToRed", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.GreenToRed].id", + "id": "def-public.vislibColorMaps.ColorSchemas.GreenToRed.id", "type": "string", "label": "id", "description": [], @@ -2067,7 +2090,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.GreenToRed].label", + "id": "def-public.vislibColorMaps.ColorSchemas.GreenToRed.label", "type": "string", "label": "label", "description": [], @@ -2078,7 +2101,7 @@ }, { "tags": [], - "id": "def-public.vislibColorMaps.[ColorSchemas.GreenToRed].value", + "id": "def-public.vislibColorMaps.ColorSchemas.GreenToRed.value", "type": "Array", "label": "value", "description": [], diff --git a/api_docs/cloud.json b/api_docs/cloud.json index 28364d79367dd..1ac97f2fac5b3 100644 --- a/api_docs/cloud.json +++ b/api_docs/cloud.json @@ -19,7 +19,7 @@ "description": [], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 17 + "lineNumber": 18 }, "signature": [ "string | undefined" @@ -27,13 +27,13 @@ }, { "tags": [], - "id": "def-public.CloudConfigType.resetPasswordUrl", + "id": "def-public.CloudConfigType.cname", "type": "string", - "label": "resetPasswordUrl", + "label": "cname", "description": [], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 18 + "lineNumber": 19 }, "signature": [ "string | undefined" @@ -41,13 +41,13 @@ }, { "tags": [], - "id": "def-public.CloudConfigType.deploymentUrl", + "id": "def-public.CloudConfigType.base_url", "type": "string", - "label": "deploymentUrl", + "label": "base_url", "description": [], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 19 + "lineNumber": 20 }, "signature": [ "string | undefined" @@ -55,13 +55,41 @@ }, { "tags": [], - "id": "def-public.CloudConfigType.accountUrl", + "id": "def-public.CloudConfigType.profile_url", "type": "string", - "label": "accountUrl", + "label": "profile_url", "description": [], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 20 + "lineNumber": 21 + }, + "signature": [ + "string | undefined" + ] + }, + { + "tags": [], + "id": "def-public.CloudConfigType.deployment_url", + "type": "string", + "label": "deployment_url", + "description": [], + "source": { + "path": "x-pack/plugins/cloud/public/plugin.ts", + "lineNumber": 22 + }, + "signature": [ + "string | undefined" + ] + }, + { + "tags": [], + "id": "def-public.CloudConfigType.organization_url", + "type": "string", + "label": "organization_url", + "description": [], + "source": { + "path": "x-pack/plugins/cloud/public/plugin.ts", + "lineNumber": 23 }, "signature": [ "string | undefined" @@ -70,7 +98,7 @@ ], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 16 + "lineNumber": 17 }, "initialIsOpen": false } @@ -93,7 +121,7 @@ "description": [], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 32 + "lineNumber": 35 }, "signature": [ "string | undefined" @@ -101,13 +129,13 @@ }, { "tags": [], - "id": "def-public.CloudSetup.cloudDeploymentUrl", + "id": "def-public.CloudSetup.cname", "type": "string", - "label": "cloudDeploymentUrl", + "label": "cname", "description": [], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 33 + "lineNumber": 36 }, "signature": [ "string | undefined" @@ -115,24 +143,27 @@ }, { "tags": [], - "id": "def-public.CloudSetup.isCloudEnabled", - "type": "boolean", - "label": "isCloudEnabled", + "id": "def-public.CloudSetup.baseUrl", + "type": "string", + "label": "baseUrl", "description": [], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 34 - } + "lineNumber": 37 + }, + "signature": [ + "string | undefined" + ] }, { "tags": [], - "id": "def-public.CloudSetup.resetPasswordUrl", + "id": "def-public.CloudSetup.deploymentUrl", "type": "string", - "label": "resetPasswordUrl", + "label": "deploymentUrl", "description": [], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 35 + "lineNumber": 38 }, "signature": [ "string | undefined" @@ -140,22 +171,47 @@ }, { "tags": [], - "id": "def-public.CloudSetup.accountUrl", + "id": "def-public.CloudSetup.profileUrl", "type": "string", - "label": "accountUrl", + "label": "profileUrl", "description": [], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 36 + "lineNumber": 39 }, "signature": [ "string | undefined" ] + }, + { + "tags": [], + "id": "def-public.CloudSetup.organizationUrl", + "type": "string", + "label": "organizationUrl", + "description": [], + "source": { + "path": "x-pack/plugins/cloud/public/plugin.ts", + "lineNumber": 40 + }, + "signature": [ + "string | undefined" + ] + }, + { + "tags": [], + "id": "def-public.CloudSetup.isCloudEnabled", + "type": "boolean", + "label": "isCloudEnabled", + "description": [], + "source": { + "path": "x-pack/plugins/cloud/public/plugin.ts", + "lineNumber": 41 + } } ], "source": { "path": "x-pack/plugins/cloud/public/plugin.ts", - "lineNumber": 31 + "lineNumber": 34 }, "lifecycle": "setup", "initialIsOpen": true diff --git a/api_docs/core.json b/api_docs/core.json index cb416cba80078..9695aaebdd313 100644 --- a/api_docs/core.json +++ b/api_docs/core.json @@ -41,7 +41,7 @@ "description": [], "children": [ { - "id": "def-public.ToastsApi.Unnamed.deps", + "id": "def-public.ToastsApi.Unnamed.$1.deps", "type": "Object", "label": "deps", "tags": [], @@ -49,7 +49,7 @@ "children": [ { "tags": [], - "id": "def-public.ToastsApi.Unnamed.deps.uiSettings", + "id": "def-public.ToastsApi.Unnamed.$1.deps.uiSettings", "type": "Object", "label": "uiSettings", "description": [], @@ -136,6 +136,7 @@ ], "children": [ { + "id": "def-public.ToastsApi.add.$1", "type": "CompoundType", "label": "toastOrTitle", "isRequired": true, @@ -186,6 +187,7 @@ ], "children": [ { + "id": "def-public.ToastsApi.remove.$1", "type": "CompoundType", "label": "toastOrId", "isRequired": true, @@ -250,6 +252,7 @@ ], "children": [ { + "id": "def-public.ToastsApi.addInfo.$1", "type": "CompoundType", "label": "toastOrTitle", "isRequired": true, @@ -271,6 +274,7 @@ } }, { + "id": "def-public.ToastsApi.addInfo.$2", "type": "Object", "label": "options", "isRequired": false, @@ -337,6 +341,7 @@ ], "children": [ { + "id": "def-public.ToastsApi.addSuccess.$1", "type": "CompoundType", "label": "toastOrTitle", "isRequired": true, @@ -358,6 +363,7 @@ } }, { + "id": "def-public.ToastsApi.addSuccess.$2", "type": "Object", "label": "options", "isRequired": false, @@ -424,6 +430,7 @@ ], "children": [ { + "id": "def-public.ToastsApi.addWarning.$1", "type": "CompoundType", "label": "toastOrTitle", "isRequired": true, @@ -445,6 +452,7 @@ } }, { + "id": "def-public.ToastsApi.addWarning.$2", "type": "Object", "label": "options", "isRequired": false, @@ -511,6 +519,7 @@ ], "children": [ { + "id": "def-public.ToastsApi.addDanger.$1", "type": "CompoundType", "label": "toastOrTitle", "isRequired": true, @@ -532,6 +541,7 @@ } }, { + "id": "def-public.ToastsApi.addDanger.$2", "type": "Object", "label": "options", "isRequired": false, @@ -590,6 +600,7 @@ ], "children": [ { + "id": "def-public.ToastsApi.addError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -605,6 +616,7 @@ } }, { + "id": "def-public.ToastsApi.addError.$2", "type": "Object", "label": "options", "isRequired": true, @@ -777,6 +789,7 @@ "description": [], "children": [ { + "id": "def-public.AsyncPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -797,6 +810,7 @@ } }, { + "id": "def-public.AsyncPlugin.setup.$2", "type": "Uncategorized", "label": "plugins", "isRequired": true, @@ -835,6 +849,7 @@ "description": [], "children": [ { + "id": "def-public.AsyncPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -854,6 +869,7 @@ } }, { + "id": "def-public.AsyncPlugin.start.$2", "type": "Uncategorized", "label": "plugins", "isRequired": true, @@ -1010,7 +1026,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 207 + "lineNumber": 210 }, "signature": [ { @@ -1032,7 +1048,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 209 + "lineNumber": 212 }, "signature": [ { @@ -1054,7 +1070,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 211 + "lineNumber": 214 }, "signature": [ { @@ -1076,7 +1092,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 213 + "lineNumber": 216 }, "signature": [ { @@ -1098,7 +1114,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 215 + "lineNumber": 218 }, "signature": [ { @@ -1122,7 +1138,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 222 + "lineNumber": 225 }, "signature": [ "{ getInjectedVar: (name: string, defaultValue?: any) => unknown; }" @@ -1138,7 +1154,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 226 + "lineNumber": 229 }, "signature": [ { @@ -1154,7 +1170,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 205 + "lineNumber": 208 }, "initialIsOpen": false }, @@ -1179,7 +1195,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 252 + "lineNumber": 255 }, "signature": [ { @@ -1201,7 +1217,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 254 + "lineNumber": 257 }, "signature": [ { @@ -1223,7 +1239,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 256 + "lineNumber": 259 }, "signature": [ { @@ -1245,7 +1261,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 258 + "lineNumber": 261 }, "signature": [ { @@ -1267,7 +1283,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 260 + "lineNumber": 263 }, "signature": [ { @@ -1289,7 +1305,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 262 + "lineNumber": 265 }, "signature": [ { @@ -1311,7 +1327,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 264 + "lineNumber": 267 }, "signature": [ { @@ -1333,7 +1349,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 266 + "lineNumber": 269 }, "signature": [ { @@ -1355,7 +1371,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 268 + "lineNumber": 271 }, "signature": [ { @@ -1377,7 +1393,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 270 + "lineNumber": 273 }, "signature": [ { @@ -1389,6 +1405,28 @@ } ] }, + { + "tags": [], + "id": "def-public.CoreStart.deprecations", + "type": "Object", + "label": "deprecations", + "description": [ + "{@link DeprecationsServiceStart}" + ], + "source": { + "path": "src/core/public/index.ts", + "lineNumber": 275 + }, + "signature": [ + { + "pluginId": "core", + "scope": "public", + "docId": "kibCorePluginApi", + "section": "def-public.DeprecationsServiceStart", + "text": "DeprecationsServiceStart" + } + ] + }, { "tags": [ "deprecated" @@ -1401,7 +1439,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 277 + "lineNumber": 282 }, "signature": [ "{ getInjectedVar: (name: string, defaultValue?: any) => unknown; }" @@ -1410,7 +1448,105 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 250 + "lineNumber": 253 + }, + "initialIsOpen": false + }, + { + "id": "def-public.DeprecationsServiceStart", + "type": "Interface", + "label": "DeprecationsServiceStart", + "description": [ + "\nDeprecationsService provides methods to fetch domain deprecation details from\nthe Kibana server.\n" + ], + "tags": [ + "public" + ], + "children": [ + { + "tags": [], + "id": "def-public.DeprecationsServiceStart.getAllDeprecations", + "type": "Function", + "label": "getAllDeprecations", + "description": [ + "\nGrabs deprecations details for all domains." + ], + "source": { + "path": "src/core/public/deprecations/deprecations_service.ts", + "lineNumber": 24 + }, + "signature": [ + "() => Promise<", + "DomainDeprecationDetails", + "[]>" + ] + }, + { + "tags": [], + "id": "def-public.DeprecationsServiceStart.getDeprecations", + "type": "Function", + "label": "getDeprecations", + "description": [ + "\nGrabs deprecations for a specific domain.\n" + ], + "source": { + "path": "src/core/public/deprecations/deprecations_service.ts", + "lineNumber": 30 + }, + "signature": [ + "(domainId: string) => Promise<", + "DomainDeprecationDetails", + "[]>" + ] + }, + { + "tags": [], + "id": "def-public.DeprecationsServiceStart.isDeprecationResolvable", + "type": "Function", + "label": "isDeprecationResolvable", + "description": [ + "\nReturns a boolean if the provided deprecation can be automatically resolvable.\n" + ], + "source": { + "path": "src/core/public/deprecations/deprecations_service.ts", + "lineNumber": 36 + }, + "signature": [ + "(details: ", + "DomainDeprecationDetails", + ") => boolean" + ] + }, + { + "tags": [], + "id": "def-public.DeprecationsServiceStart.resolveDeprecation", + "type": "Function", + "label": "resolveDeprecation", + "description": [ + "\nCalls the correctiveActions.api to automatically resolve the depprecation.\n" + ], + "source": { + "path": "src/core/public/deprecations/deprecations_service.ts", + "lineNumber": 42 + }, + "signature": [ + "(details: ", + "DomainDeprecationDetails", + ") => Promise<", + { + "pluginId": "core", + "scope": "public", + "docId": "kibCorePluginApi", + "section": "def-public.ResolveDeprecationResponse", + "text": "ResolveDeprecationResponse" + }, + ">" + ] + } + ], + "source": { + "path": "src/core/public/deprecations/deprecations_service.ts", + "lineNumber": 20 }, "initialIsOpen": false }, @@ -1431,7 +1567,7 @@ "description": [], "source": { "path": "src/core/public/doc_links/doc_links_service.ts", - "lineNumber": 302 + "lineNumber": 349 } }, { @@ -1442,7 +1578,7 @@ "description": [], "source": { "path": "src/core/public/doc_links/doc_links_service.ts", - "lineNumber": 303 + "lineNumber": 350 } }, { @@ -1453,16 +1589,16 @@ "description": [], "source": { "path": "src/core/public/doc_links/doc_links_service.ts", - "lineNumber": 304 + "lineNumber": 351 }, "signature": [ - "{ readonly dashboard: { readonly guide: string; readonly drilldowns: string; readonly drilldownsTriggerPicker: string; readonly urlDrilldownTemplateSyntax: string; readonly urlDrilldownVariables: string; }; readonly discover: Record; readonly filebeat: { readonly base: string; readonly installation: string; readonly configuration: string; readonly elasticsearchOutput: string; readonly elasticsearchModule: string; readonly startup: string; readonly exportedFields: string; }; readonly auditbeat: { readonly base: string; }; readonly metricbeat: { readonly base: string; readonly configure: string; readonly httpEndpoint: string; readonly install: string; readonly start: string; }; readonly enterpriseSearch: { readonly base: string; readonly appSearchBase: string; readonly workplaceSearchBase: string; }; readonly heartbeat: { readonly base: string; }; readonly logstash: { readonly base: string; }; readonly functionbeat: { readonly base: string; }; readonly winlogbeat: { readonly base: string; }; readonly aggs: { readonly composite: string; readonly composite_missing_bucket: string; readonly date_histogram: string; readonly date_range: string; readonly date_format_pattern: string; readonly filter: string; readonly filters: string; readonly geohash_grid: string; readonly histogram: string; readonly ip_range: string; readonly range: string; readonly significant_terms: string; readonly terms: string; readonly avg: string; readonly avg_bucket: string; readonly max_bucket: string; readonly min_bucket: string; readonly sum_bucket: string; readonly cardinality: string; readonly count: string; readonly cumulative_sum: string; readonly derivative: string; readonly geo_bounds: string; readonly geo_centroid: string; readonly max: string; readonly median: string; readonly min: string; readonly moving_avg: string; readonly percentile_ranks: string; readonly serial_diff: string; readonly std_dev: string; readonly sum: string; readonly top_hits: string; }; readonly runtimeFields: string; readonly scriptedFields: { readonly scriptFields: string; readonly scriptAggs: string; readonly painless: string; readonly painlessApi: string; readonly painlessLangSpec: string; readonly painlessSyntax: string; readonly painlessWalkthrough: string; readonly luceneExpressions: string; }; readonly indexPatterns: { readonly introduction: string; readonly fieldFormattersNumber: string; readonly fieldFormattersString: string; }; readonly addData: string; readonly kibana: string; readonly elasticsearch: Record; readonly siem: { readonly guide: string; readonly gettingStarted: string; }; readonly query: { readonly eql: string; readonly luceneQuerySyntax: string; readonly queryDsl: string; readonly kueryQuerySyntax: string; }; readonly date: { readonly dateMath: string; readonly dateMathIndexNames: string; }; readonly management: Record; readonly ml: Record; readonly transforms: Record; readonly visualize: Record; readonly apis: Readonly<{ createIndex: string; createSnapshotLifecyclePolicy: string; createRoleMapping: string; createRoleMappingTemplates: string; createApiKey: string; createPipeline: string; createTransformRequest: string; cronExpressions: string; executeWatchActionModes: string; indexExists: string; openIndex: string; putComponentTemplate: string; painlessExecute: string; painlessExecuteAPIContexts: string; putComponentTemplateMetadata: string; putSnapshotLifecyclePolicy: string; putWatch: string; updateTransform: string; }>; readonly observability: Record; readonly alerting: Record; readonly maps: Record; readonly monitoring: Record; readonly security: Readonly<{ apiKeyServiceSettings: string; clusterPrivileges: string; elasticsearchSettings: string; elasticsearchEnableSecurity: string; indicesPrivileges: string; kibanaTLS: string; kibanaPrivileges: string; mappingRoles: string; mappingRolesFieldRules: string; runAsPrivilege: string; }>; readonly watcher: Record; readonly ccs: Record; readonly plugins: Record; readonly snapshotRestore: Record; readonly ingest: Record; }" + "{ readonly dashboard: { readonly guide: string; readonly drilldowns: string; readonly drilldownsTriggerPicker: string; readonly urlDrilldownTemplateSyntax: string; readonly urlDrilldownVariables: string; }; readonly discover: Record; readonly filebeat: { readonly base: string; readonly installation: string; readonly configuration: string; readonly elasticsearchOutput: string; readonly elasticsearchModule: string; readonly startup: string; readonly exportedFields: string; }; readonly auditbeat: { readonly base: string; }; readonly metricbeat: { readonly base: string; readonly configure: string; readonly httpEndpoint: string; readonly install: string; readonly start: string; }; readonly enterpriseSearch: { readonly base: string; readonly appSearchBase: string; readonly workplaceSearchBase: string; }; readonly heartbeat: { readonly base: string; }; readonly logstash: { readonly base: string; }; readonly functionbeat: { readonly base: string; }; readonly winlogbeat: { readonly base: string; }; readonly aggs: { readonly composite: string; readonly composite_missing_bucket: string; readonly date_histogram: string; readonly date_range: string; readonly date_format_pattern: string; readonly filter: string; readonly filters: string; readonly geohash_grid: string; readonly histogram: string; readonly ip_range: string; readonly range: string; readonly significant_terms: string; readonly terms: string; readonly avg: string; readonly avg_bucket: string; readonly max_bucket: string; readonly min_bucket: string; readonly sum_bucket: string; readonly cardinality: string; readonly count: string; readonly cumulative_sum: string; readonly derivative: string; readonly geo_bounds: string; readonly geo_centroid: string; readonly max: string; readonly median: string; readonly min: string; readonly moving_avg: string; readonly percentile_ranks: string; readonly serial_diff: string; readonly std_dev: string; readonly sum: string; readonly top_hits: string; }; readonly runtimeFields: { readonly mapping: string; }; readonly scriptedFields: { readonly scriptFields: string; readonly scriptAggs: string; readonly painless: string; readonly painlessApi: string; readonly painlessLangSpec: string; readonly painlessSyntax: string; readonly painlessWalkthrough: string; readonly luceneExpressions: string; }; readonly indexPatterns: { readonly introduction: string; readonly fieldFormattersNumber: string; readonly fieldFormattersString: string; }; readonly addData: string; readonly kibana: string; readonly elasticsearch: Record; readonly siem: { readonly guide: string; readonly gettingStarted: string; }; readonly query: { readonly eql: string; readonly luceneQuerySyntax: string; readonly queryDsl: string; readonly kueryQuerySyntax: string; }; readonly date: { readonly dateMath: string; readonly dateMathIndexNames: string; }; readonly management: Record; readonly ml: Record; readonly transforms: Record; readonly visualize: Record; readonly apis: Readonly<{ createIndex: string; createSnapshotLifecyclePolicy: string; createRoleMapping: string; createRoleMappingTemplates: string; createApiKey: string; createPipeline: string; createTransformRequest: string; cronExpressions: string; executeWatchActionModes: string; indexExists: string; openIndex: string; putComponentTemplate: string; painlessExecute: string; painlessExecuteAPIContexts: string; putComponentTemplateMetadata: string; putSnapshotLifecyclePolicy: string; putWatch: string; simulatePipeline: string; updateTransform: string; }>; readonly observability: Record; readonly alerting: Record; readonly maps: Record; readonly monitoring: Record; readonly security: Readonly<{ apiKeyServiceSettings: string; clusterPrivileges: string; elasticsearchSettings: string; elasticsearchEnableSecurity: string; indicesPrivileges: string; kibanaTLS: string; kibanaPrivileges: string; mappingRoles: string; mappingRolesFieldRules: string; runAsPrivilege: string; }>; readonly watcher: Record; readonly ccs: Record; readonly plugins: Record; readonly snapshotRestore: Record; readonly ingest: Record; }" ] } ], "source": { "path": "src/core/public/doc_links/doc_links_service.ts", - "lineNumber": 301 + "lineNumber": 348 }, "initialIsOpen": false }, @@ -1874,21 +2010,9 @@ }, "signature": [ "() => Readonly, \"type\" | \"options\" | \"description\" | \"name\" | \"order\" | \"value\" | \"category\" | \"metric\" | \"optionLabels\" | \"requiresPageReload\" | \"readonly\" | \"sensitive\" | \"deprecation\" | \"validation\"> & ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.UserProvidedValues", - "text": "UserProvidedValues" - }, + "UiSettingsParams", + ", \"type\" | \"options\" | \"description\" | \"name\" | \"order\" | \"value\" | \"category\" | \"metric\" | \"validation\" | \"optionLabels\" | \"requiresPageReload\" | \"readonly\" | \"sensitive\" | \"deprecation\"> & ", + "UserProvidedValues", ">>" ] }, @@ -2174,6 +2298,7 @@ ], "children": [ { + "id": "def-public.OverlayBannersStart.add.$1", "type": "Function", "label": "mount", "isRequired": true, @@ -2194,6 +2319,7 @@ } }, { + "id": "def-public.OverlayBannersStart.add.$2", "type": "number", "label": "priority", "isRequired": false, @@ -2230,6 +2356,7 @@ ], "children": [ { + "id": "def-public.OverlayBannersStart.remove.$1", "type": "string", "label": "id", "isRequired": true, @@ -2274,6 +2401,7 @@ ], "children": [ { + "id": "def-public.OverlayBannersStart.replace.$1", "type": "string", "label": "id", "isRequired": false, @@ -2289,6 +2417,7 @@ } }, { + "id": "def-public.OverlayBannersStart.replace.$2", "type": "Function", "label": "mount", "isRequired": true, @@ -2309,6 +2438,7 @@ } }, { + "id": "def-public.OverlayBannersStart.replace.$3", "type": "number", "label": "priority", "isRequired": false, @@ -2409,7 +2539,7 @@ }, { "tags": [], - "id": "def-public.OverlayFlyoutOpenOptions.'data-test-subj'", + "id": "def-public.OverlayFlyoutOpenOptions.datatestsubj", "type": "string", "label": "'data-test-subj'", "description": [], @@ -2502,6 +2632,7 @@ ], "children": [ { + "id": "def-public.OverlayFlyoutStart.open.$1", "type": "Function", "label": "mount", "isRequired": true, @@ -2522,6 +2653,7 @@ } }, { + "id": "def-public.OverlayFlyoutStart.open.$2", "type": "Object", "label": "options", "isRequired": false, @@ -2639,7 +2771,7 @@ }, { "tags": [], - "id": "def-public.OverlayModalConfirmOptions.'data-test-subj'", + "id": "def-public.OverlayModalConfirmOptions.datatestsubj", "type": "string", "label": "'data-test-subj'", "description": [], @@ -2741,7 +2873,7 @@ }, { "tags": [], - "id": "def-public.OverlayModalOpenOptions.'data-test-subj'", + "id": "def-public.OverlayModalOpenOptions.datatestsubj", "type": "string", "label": "'data-test-subj'", "description": [], @@ -2820,6 +2952,7 @@ ], "children": [ { + "id": "def-public.OverlayModalStart.open.$1", "type": "Function", "label": "mount", "isRequired": true, @@ -2840,6 +2973,7 @@ } }, { + "id": "def-public.OverlayModalStart.open.$2", "type": "Object", "label": "options", "isRequired": false, @@ -2897,6 +3031,7 @@ ], "children": [ { + "id": "def-public.OverlayModalStart.openConfirm.$1", "type": "CompoundType", "label": "message", "isRequired": true, @@ -2918,6 +3053,7 @@ } }, { + "id": "def-public.OverlayModalStart.openConfirm.$2", "type": "Object", "label": "options", "isRequired": false, @@ -3265,6 +3401,7 @@ "description": [], "children": [ { + "id": "def-public.Plugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -3285,6 +3422,7 @@ } }, { + "id": "def-public.Plugin.setup.$2", "type": "Uncategorized", "label": "plugins", "isRequired": true, @@ -3323,6 +3461,7 @@ "description": [], "children": [ { + "id": "def-public.Plugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -3342,6 +3481,7 @@ } }, { + "id": "def-public.Plugin.start.$2", "type": "Uncategorized", "label": "plugins", "isRequired": true, @@ -3541,13 +3681,7 @@ "lineNumber": 78 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectError", - "text": "SavedObjectError" - }, + "SavedObjectError", " | undefined" ] }, @@ -3580,13 +3714,7 @@ "lineNumber": 82 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ] }, @@ -3603,13 +3731,7 @@ "lineNumber": 84 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectsMigrationVersion", - "text": "SavedObjectsMigrationVersion" - }, + "SavedObjectsMigrationVersion", " | undefined" ] }, @@ -5334,13 +5456,7 @@ "lineNumber": 68 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.DeprecationSettings", - "text": "DeprecationSettings" - }, + "DeprecationSettings", " | undefined" ] }, @@ -5371,29 +5487,11 @@ "lineNumber": 81 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.ImageValidation", - "text": "ImageValidation" - }, + "ImageValidation", " | ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.StringValidationRegex", - "text": "StringValidationRegex" - }, + "StringValidationRegex", " | ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.StringValidationRegexString", - "text": "StringValidationRegexString" - }, + "StringValidationRegexString", " | undefined" ] }, @@ -5661,7 +5759,22 @@ "lineNumber": 102 }, "signature": [ - "{ type?: \"string\" | \"number\" | \"boolean\" | \"undefined\" | \"color\" | \"json\" | \"image\" | \"select\" | \"array\" | \"markdown\" | undefined; options?: string[] | undefined; description?: string | undefined; name?: string | undefined; order?: number | undefined; value?: unknown; category?: string[] | undefined; metric?: { type: UiCounterMetricType; name: string; } | undefined; optionLabels?: Record | undefined; requiresPageReload?: boolean | undefined; readonly?: boolean | undefined; sensitive?: boolean | undefined; deprecation?: DeprecationSettings | undefined; validation?: ImageValidation | StringValidationRegex | StringValidationRegexString | undefined; }" + "{ type?: \"string\" | \"number\" | \"boolean\" | \"undefined\" | \"color\" | \"json\" | \"image\" | \"select\" | \"array\" | \"markdown\" | undefined; options?: string[] | undefined; description?: string | undefined; name?: string | undefined; order?: number | undefined; value?: unknown; category?: string[] | undefined; metric?: { type: UiCounterMetricType; name: string; } | undefined; validation?: ImageValidation | StringValidationRegex | StringValidationRegexString | undefined; optionLabels?: Record | undefined; requiresPageReload?: boolean | undefined; readonly?: boolean | undefined; sensitive?: boolean | undefined; deprecation?: DeprecationSettings | undefined; }" + ], + "initialIsOpen": false + }, + { + "id": "def-public.ResolveDeprecationResponse", + "type": "Type", + "label": "ResolveDeprecationResponse", + "tags": [], + "description": [], + "source": { + "path": "src/core/public/deprecations/deprecations_client.ts", + "lineNumber": 18 + }, + "signature": [ + "{ status: \"ok\"; } | { status: \"fail\"; reason: string; }" ], "initialIsOpen": false }, @@ -5772,7 +5885,7 @@ ], "source": { "path": "src/core/public/index.ts", - "lineNumber": 236 + "lineNumber": 239 }, "signature": [ "() => Promise<[", @@ -6385,6 +6498,7 @@ "description": [], "children": [ { + "id": "def-server.ElasticsearchConfig.Unnamed.$1", "type": "Object", "label": "rawConfig", "isRequired": true, @@ -6452,6 +6566,7 @@ "description": [], "children": [ { + "id": "def-server.LegacyClusterClient.Unnamed.$1", "type": "CompoundType", "label": "config", "isRequired": true, @@ -6471,6 +6586,7 @@ } }, { + "id": "def-server.LegacyClusterClient.Unnamed.$2", "type": "Object", "label": "log", "isRequired": true, @@ -6484,6 +6600,7 @@ } }, { + "id": "def-server.LegacyClusterClient.Unnamed.$3", "type": "string", "label": "type", "isRequired": true, @@ -6497,6 +6614,7 @@ } }, { + "id": "def-server.LegacyClusterClient.Unnamed.$4", "type": "Function", "label": "getAuthHeaders", "isRequired": true, @@ -6528,6 +6646,7 @@ "type": "Function", "children": [ { + "id": "def-server.LegacyClusterClient.callAsInternalUser.$1", "type": "string", "label": "endpoint", "isRequired": true, @@ -6541,6 +6660,7 @@ } }, { + "id": "def-server.LegacyClusterClient.callAsInternalUser.$2", "type": "Object", "label": "clientParams", "isRequired": true, @@ -6554,6 +6674,7 @@ } }, { + "id": "def-server.LegacyClusterClient.callAsInternalUser.$3", "type": "Object", "label": "options", "isRequired": false, @@ -6660,6 +6781,7 @@ ], "children": [ { + "id": "def-server.LegacyClusterClient.asScoped.$1", "type": "CompoundType", "label": "request", "isRequired": false, @@ -6741,6 +6863,7 @@ "description": [], "children": [ { + "id": "def-server.LegacyElasticsearchErrorHelpers.isNotAuthorizedError.$1", "type": "Any", "label": "error", "isRequired": true, @@ -6779,6 +6902,7 @@ "description": [], "children": [ { + "id": "def-server.LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -6792,6 +6916,7 @@ } }, { + "id": "def-server.LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError.$2", "type": "string", "label": "reason", "isRequired": false, @@ -6859,6 +6984,7 @@ "description": [], "children": [ { + "id": "def-server.LegacyScopedClusterClient.Unnamed.$1", "type": "Function", "label": "internalAPICaller", "isRequired": true, @@ -6878,6 +7004,7 @@ } }, { + "id": "def-server.LegacyScopedClusterClient.Unnamed.$2", "type": "Function", "label": "scopedAPICaller", "isRequired": true, @@ -6897,6 +7024,7 @@ } }, { + "id": "def-server.LegacyScopedClusterClient.Unnamed.$3", "type": "CompoundType", "label": "headers", "isRequired": false, @@ -6944,6 +7072,7 @@ ], "children": [ { + "id": "def-server.LegacyScopedClusterClient.callAsInternalUser.$1", "type": "string", "label": "endpoint", "isRequired": true, @@ -6959,6 +7088,7 @@ } }, { + "id": "def-server.LegacyScopedClusterClient.callAsInternalUser.$2", "type": "Object", "label": "clientParams", "isRequired": true, @@ -6974,6 +7104,7 @@ } }, { + "id": "def-server.LegacyScopedClusterClient.callAsInternalUser.$3", "type": "Object", "label": "options", "isRequired": false, @@ -7025,6 +7156,7 @@ ], "children": [ { + "id": "def-server.LegacyScopedClusterClient.callAsCurrentUser.$1", "type": "string", "label": "endpoint", "isRequired": true, @@ -7040,6 +7172,7 @@ } }, { + "id": "def-server.LegacyScopedClusterClient.callAsCurrentUser.$2", "type": "Object", "label": "clientParams", "isRequired": true, @@ -7055,6 +7188,7 @@ } }, { + "id": "def-server.LegacyScopedClusterClient.callAsCurrentUser.$3", "type": "Object", "label": "options", "isRequired": false, @@ -7323,6 +7457,7 @@ "description": [], "children": [ { + "id": "def-server.AsyncPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -7339,10 +7474,11 @@ "description": [], "source": { "path": "src/core/server/plugins/types.ts", - "lineNumber": 269 + "lineNumber": 274 } }, { + "id": "def-server.AsyncPlugin.setup.$2", "type": "Uncategorized", "label": "plugins", "isRequired": true, @@ -7352,7 +7488,7 @@ "description": [], "source": { "path": "src/core/server/plugins/types.ts", - "lineNumber": 269 + "lineNumber": 274 } } ], @@ -7360,7 +7496,7 @@ "returnComment": [], "source": { "path": "src/core/server/plugins/types.ts", - "lineNumber": 269 + "lineNumber": 274 } }, { @@ -7381,6 +7517,7 @@ "description": [], "children": [ { + "id": "def-server.AsyncPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -7396,10 +7533,11 @@ "description": [], "source": { "path": "src/core/server/plugins/types.ts", - "lineNumber": 270 + "lineNumber": 276 } }, { + "id": "def-server.AsyncPlugin.start.$2", "type": "Uncategorized", "label": "plugins", "isRequired": true, @@ -7409,7 +7547,7 @@ "description": [], "source": { "path": "src/core/server/plugins/types.ts", - "lineNumber": 270 + "lineNumber": 276 } } ], @@ -7417,7 +7555,7 @@ "returnComment": [], "source": { "path": "src/core/server/plugins/types.ts", - "lineNumber": 270 + "lineNumber": 276 } }, { @@ -7433,13 +7571,13 @@ "returnComment": [], "source": { "path": "src/core/server/plugins/types.ts", - "lineNumber": 271 + "lineNumber": 278 } } ], "source": { "path": "src/core/server/plugins/types.ts", - "lineNumber": 263 + "lineNumber": 268 }, "initialIsOpen": false }, @@ -7556,6 +7694,7 @@ ], "children": [ { + "id": "def-server.CapabilitiesSetup.registerProvider.$1", "type": "Function", "label": "provider", "isRequired": true, @@ -7602,6 +7741,7 @@ ], "children": [ { + "id": "def-server.CapabilitiesSetup.registerSwitcher.$1", "type": "Function", "label": "switcher", "isRequired": true, @@ -7668,13 +7808,7 @@ "text": "ResolveCapabilitiesOptions" }, " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.Capabilities", - "text": "Capabilities" - }, + "Capabilities", ">" ], "description": [ @@ -7682,6 +7816,7 @@ ], "children": [ { + "id": "def-server.CapabilitiesStart.resolveCapabilities.$1", "type": "Object", "label": "request", "isRequired": true, @@ -7702,6 +7837,7 @@ } }, { + "id": "def-server.CapabilitiesStart.resolveCapabilities.$2", "type": "Object", "label": "options", "isRequired": false, @@ -7755,7 +7891,9 @@ "type": "Function", "label": "rename", "signature": [ - "(oldKey: string, newKey: string) => ", + "(oldKey: string, newKey: string, details?: Partial<", + "DeprecatedConfigDetails", + "> | undefined) => ", "ConfigDeprecation" ], "description": [ @@ -7763,6 +7901,7 @@ ], "children": [ { + "id": "def-server.ConfigDeprecationFactory.rename.$1", "type": "string", "label": "oldKey", "isRequired": true, @@ -7772,10 +7911,11 @@ "description": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 63 + "lineNumber": 80 } }, { + "id": "def-server.ConfigDeprecationFactory.rename.$2", "type": "string", "label": "newKey", "isRequired": true, @@ -7785,7 +7925,23 @@ "description": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 63 + "lineNumber": 80 + } + }, + { + "id": "def-server.ConfigDeprecationFactory.rename.$3", + "type": "Object", + "label": "details", + "isRequired": false, + "signature": [ + "Partial<", + "DeprecatedConfigDetails", + "> | undefined" + ], + "description": [], + "source": { + "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", + "lineNumber": 80 } } ], @@ -7793,7 +7949,7 @@ "returnComment": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 63 + "lineNumber": 80 } }, { @@ -7801,7 +7957,9 @@ "type": "Function", "label": "renameFromRoot", "signature": [ - "(oldKey: string, newKey: string, silent?: boolean | undefined) => ", + "(oldKey: string, newKey: string, details?: Partial<", + "DeprecatedConfigDetails", + "> | undefined) => ", "ConfigDeprecation" ], "description": [ @@ -7809,6 +7967,7 @@ ], "children": [ { + "id": "def-server.ConfigDeprecationFactory.renameFromRoot.$1", "type": "string", "label": "oldKey", "isRequired": true, @@ -7818,10 +7977,11 @@ "description": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 79 + "lineNumber": 96 } }, { + "id": "def-server.ConfigDeprecationFactory.renameFromRoot.$2", "type": "string", "label": "newKey", "isRequired": true, @@ -7831,20 +7991,23 @@ "description": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 79 + "lineNumber": 96 } }, { - "type": "CompoundType", - "label": "silent", + "id": "def-server.ConfigDeprecationFactory.renameFromRoot.$3", + "type": "Object", + "label": "details", "isRequired": false, "signature": [ - "boolean | undefined" + "Partial<", + "DeprecatedConfigDetails", + "> | undefined" ], "description": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 79 + "lineNumber": 96 } } ], @@ -7852,7 +8015,7 @@ "returnComment": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 79 + "lineNumber": 96 } }, { @@ -7860,7 +8023,9 @@ "type": "Function", "label": "unused", "signature": [ - "(unusedKey: string) => ", + "(unusedKey: string, details?: Partial<", + "DeprecatedConfigDetails", + "> | undefined) => ", "ConfigDeprecation" ], "description": [ @@ -7868,6 +8033,7 @@ ], "children": [ { + "id": "def-server.ConfigDeprecationFactory.unused.$1", "type": "string", "label": "unusedKey", "isRequired": true, @@ -7877,7 +8043,23 @@ "description": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 92 + "lineNumber": 109 + } + }, + { + "id": "def-server.ConfigDeprecationFactory.unused.$2", + "type": "Object", + "label": "details", + "isRequired": false, + "signature": [ + "Partial<", + "DeprecatedConfigDetails", + "> | undefined" + ], + "description": [], + "source": { + "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", + "lineNumber": 109 } } ], @@ -7885,7 +8067,7 @@ "returnComment": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 92 + "lineNumber": 109 } }, { @@ -7893,7 +8075,9 @@ "type": "Function", "label": "unusedFromRoot", "signature": [ - "(unusedKey: string) => ", + "(unusedKey: string, details?: Partial<", + "DeprecatedConfigDetails", + "> | undefined) => ", "ConfigDeprecation" ], "description": [ @@ -7901,6 +8085,7 @@ ], "children": [ { + "id": "def-server.ConfigDeprecationFactory.unusedFromRoot.$1", "type": "string", "label": "unusedKey", "isRequired": true, @@ -7910,7 +8095,23 @@ "description": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 108 + "lineNumber": 125 + } + }, + { + "id": "def-server.ConfigDeprecationFactory.unusedFromRoot.$2", + "type": "Object", + "label": "details", + "isRequired": false, + "signature": [ + "Partial<", + "DeprecatedConfigDetails", + "> | undefined" + ], + "description": [], + "source": { + "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", + "lineNumber": 125 } } ], @@ -7918,13 +8119,13 @@ "returnComment": [], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 108 + "lineNumber": 125 } } ], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 50 + "lineNumber": 67 }, "initialIsOpen": false }, @@ -8002,7 +8203,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 462 + "lineNumber": 466 }, "signature": [ { @@ -8024,7 +8225,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 464 + "lineNumber": 468 }, "signature": [ { @@ -8046,7 +8247,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 466 + "lineNumber": 470 }, "signature": [ { @@ -8068,7 +8269,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 468 + "lineNumber": 472 }, "signature": [ { @@ -8099,7 +8300,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 473 + "lineNumber": 477 }, "signature": [ { @@ -8121,7 +8322,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 475 + "lineNumber": 479 }, "signature": [ { @@ -8143,7 +8344,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 477 + "lineNumber": 481 }, "signature": [ { @@ -8165,7 +8366,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 479 + "lineNumber": 483 }, "signature": [ { @@ -8187,7 +8388,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 481 + "lineNumber": 485 }, "signature": [ { @@ -8209,7 +8410,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 483 + "lineNumber": 487 }, "signature": [ { @@ -8221,6 +8422,28 @@ } ] }, + { + "tags": [], + "id": "def-server.CoreSetup.deprecations", + "type": "Object", + "label": "deprecations", + "description": [ + "{@link DeprecationsServiceSetup}" + ], + "source": { + "path": "src/core/server/index.ts", + "lineNumber": 489 + }, + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.DeprecationsServiceSetup", + "text": "DeprecationsServiceSetup" + } + ] + }, { "tags": [], "id": "def-server.CoreSetup.getStartServices", @@ -8231,7 +8454,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 485 + "lineNumber": 491 }, "signature": [ { @@ -8247,7 +8470,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 460 + "lineNumber": 464 }, "initialIsOpen": false }, @@ -8272,7 +8495,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 508 + "lineNumber": 514 }, "signature": [ { @@ -8294,7 +8517,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 510 + "lineNumber": 516 }, "signature": [ { @@ -8316,7 +8539,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 512 + "lineNumber": 518 }, "signature": [ { @@ -8338,7 +8561,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 514 + "lineNumber": 520 }, "signature": [ { @@ -8360,7 +8583,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 516 + "lineNumber": 522 }, "signature": [ { @@ -8382,7 +8605,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 518 + "lineNumber": 524 }, "signature": [ { @@ -8397,7 +8620,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 506 + "lineNumber": 512 }, "initialIsOpen": false }, @@ -8853,6 +9076,75 @@ }, "initialIsOpen": false }, + { + "id": "def-server.DeprecationsDetails", + "type": "Interface", + "label": "DeprecationsDetails", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-server.DeprecationsDetails.message", + "type": "string", + "label": "message", + "description": [], + "source": { + "path": "src/core/server/deprecations/types.ts", + "lineNumber": 20 + } + }, + { + "tags": [], + "id": "def-server.DeprecationsDetails.level", + "type": "CompoundType", + "label": "level", + "description": [ + "\nlevels:\n- warning: will not break deployment upon upgrade\n- critical: needs to be addressed before upgrade.\n- fetch_error: Deprecations service failed to grab the deprecation details for the domain." + ], + "source": { + "path": "src/core/server/deprecations/types.ts", + "lineNumber": 27 + }, + "signature": [ + "\"warning\" | \"critical\" | \"fetch_error\"" + ] + }, + { + "tags": [], + "id": "def-server.DeprecationsDetails.documentationUrl", + "type": "string", + "label": "documentationUrl", + "description": [], + "source": { + "path": "src/core/server/deprecations/types.ts", + "lineNumber": 29 + }, + "signature": [ + "string | undefined" + ] + }, + { + "tags": [], + "id": "def-server.DeprecationsDetails.correctiveActions", + "type": "Object", + "label": "correctiveActions", + "description": [], + "source": { + "path": "src/core/server/deprecations/types.ts", + "lineNumber": 31 + }, + "signature": [ + "{ api?: { path: string; method: \"POST\" | \"PUT\"; body?: { [key: string]: any; } | undefined; } | undefined; manualSteps?: string[] | undefined; }" + ] + } + ], + "source": { + "path": "src/core/server/deprecations/types.ts", + "lineNumber": 18 + }, + "initialIsOpen": false + }, { "id": "def-server.DeprecationSettings", "type": "Interface", @@ -8897,6 +9189,47 @@ }, "initialIsOpen": false }, + { + "id": "def-server.DeprecationsServiceSetup", + "type": "Interface", + "label": "DeprecationsServiceSetup", + "description": [ + "\nThe deprecations service provides a way for the Kibana platform to communicate deprecated\nfeatures and configs with its users. These deprecations are only communicated\nif the deployment is using these features. Allowing for a user tailored experience\nfor upgrading the stack version.\n\nThe Deprecation service is consumed by the upgrade assistant to assist with the upgrade\nexperience.\n\nIf a deprecated feature can be resolved without manual user intervention.\nUsing correctiveActions.api allows the Upgrade Assistant to use this api to correct the\ndeprecation upon a user trigger.\n" + ], + "tags": [ + "gmail", + "public" + ], + "children": [ + { + "tags": [], + "id": "def-server.DeprecationsServiceSetup.registerDeprecations", + "type": "Function", + "label": "registerDeprecations", + "description": [], + "source": { + "path": "src/core/server/deprecations/deprecations_service.ts", + "lineNumber": 104 + }, + "signature": [ + "(deprecationContext: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.RegisterDeprecationsConfig", + "text": "RegisterDeprecationsConfig" + }, + ") => void" + ] + } + ], + "source": { + "path": "src/core/server/deprecations/deprecations_service.ts", + "lineNumber": 103 + }, + "initialIsOpen": false + }, { "id": "def-server.DiscoveredPlugin", "type": "Interface", @@ -9314,6 +9647,62 @@ }, "initialIsOpen": false }, + { + "id": "def-server.GetDeprecationsContext", + "type": "Interface", + "label": "GetDeprecationsContext", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-server.GetDeprecationsContext.esClient", + "type": "Object", + "label": "esClient", + "description": [], + "source": { + "path": "src/core/server/deprecations/types.ts", + "lineNumber": 61 + }, + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.IScopedClusterClient", + "text": "IScopedClusterClient" + } + ] + }, + { + "tags": [], + "id": "def-server.GetDeprecationsContext.savedObjectsClient", + "type": "Object", + "label": "savedObjectsClient", + "description": [], + "source": { + "path": "src/core/server/deprecations/types.ts", + "lineNumber": 62 + }, + "signature": [ + "Pick<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectsClient", + "text": "SavedObjectsClient" + }, + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" + ] + } + ], + "source": { + "path": "src/core/server/deprecations/types.ts", + "lineNumber": 60 + }, + "initialIsOpen": false + }, { "id": "def-server.GetResponse", "type": "Interface", @@ -9854,6 +10243,7 @@ ], "children": [ { + "id": "def-server.IContextContainer.registerContext.$1", "type": "Uncategorized", "label": "pluginOpaqueId", "isRequired": true, @@ -9869,6 +10259,7 @@ } }, { + "id": "def-server.IContextContainer.registerContext.$2", "type": "Uncategorized", "label": "contextName", "isRequired": true, @@ -9884,6 +10275,7 @@ } }, { + "id": "def-server.IContextContainer.registerContext.$3", "type": "Function", "label": "provider", "isRequired": true, @@ -9947,19 +10339,14 @@ "text": "CustomHttpResponseOptions" }, ") => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaResponse", - "text": "KibanaResponse" - } + "KibanaResponse" ], "description": [ "\nCreate a new handler function pre-wired to context for the plugin.\n" ], "children": [ { + "id": "def-server.IContextContainer.createHandler.$1", "type": "Uncategorized", "label": "pluginOpaqueId", "isRequired": true, @@ -9975,6 +10362,7 @@ } }, { + "id": "def-server.IContextContainer.createHandler.$2", "type": "Function", "label": "handler", "isRequired": true, @@ -10005,13 +10393,7 @@ "text": "CustomHttpResponseOptions" }, ") => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaResponse", - "text": "KibanaResponse" - } + "KibanaResponse" ], "description": [ "- Handler function to pass context object to." @@ -10446,14 +10828,8 @@ }, "signature": [ "() => Readonly, \"type\" | \"options\" | \"description\" | \"name\" | \"order\" | \"value\" | \"category\" | \"metric\" | \"optionLabels\" | \"requiresPageReload\" | \"readonly\" | \"sensitive\" | \"deprecation\" | \"validation\">>>" + "UiSettingsParams", + ", \"type\" | \"options\" | \"description\" | \"name\" | \"order\" | \"value\" | \"category\" | \"metric\" | \"validation\" | \"optionLabels\" | \"requiresPageReload\" | \"readonly\" | \"sensitive\" | \"deprecation\">>>" ] }, { @@ -10502,13 +10878,7 @@ }, "signature": [ "() => Promise>>" ] }, @@ -12387,7 +12757,7 @@ "children": [ { "tags": [], - "id": "def-server.LegacyElasticsearchError.[code]", + "id": "def-server.LegacyElasticsearchError.code", "type": "string", "label": "[code]", "description": [], @@ -12406,116 +12776,6 @@ }, "initialIsOpen": false }, - { - "id": "def-server.LegacyServiceSetupDeps", - "type": "Interface", - "label": "LegacyServiceSetupDeps", - "description": [], - "tags": [ - "public", - "deprecated" - ], - "children": [ - { - "tags": [], - "id": "def-server.LegacyServiceSetupDeps.core", - "type": "CompoundType", - "label": "core", - "description": [], - "source": { - "path": "src/core/server/legacy/types.ts", - "lineNumber": 43 - }, - "signature": [ - "LegacyCoreSetup" - ] - }, - { - "tags": [], - "id": "def-server.LegacyServiceSetupDeps.plugins", - "type": "Object", - "label": "plugins", - "description": [], - "source": { - "path": "src/core/server/legacy/types.ts", - "lineNumber": 44 - }, - "signature": [ - "Record" - ] - }, - { - "tags": [], - "id": "def-server.LegacyServiceSetupDeps.uiPlugins", - "type": "Object", - "label": "uiPlugins", - "description": [], - "source": { - "path": "src/core/server/legacy/types.ts", - "lineNumber": 45 - }, - "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.UiPlugins", - "text": "UiPlugins" - } - ] - } - ], - "source": { - "path": "src/core/server/legacy/types.ts", - "lineNumber": 42 - }, - "initialIsOpen": false - }, - { - "id": "def-server.LegacyServiceStartDeps", - "type": "Interface", - "label": "LegacyServiceStartDeps", - "description": [], - "tags": [ - "public", - "deprecated" - ], - "children": [ - { - "tags": [], - "id": "def-server.LegacyServiceStartDeps.core", - "type": "CompoundType", - "label": "core", - "description": [], - "source": { - "path": "src/core/server/legacy/types.ts", - "lineNumber": 53 - }, - "signature": [ - "LegacyCoreStart" - ] - }, - { - "tags": [], - "id": "def-server.LegacyServiceStartDeps.plugins", - "type": "Object", - "label": "plugins", - "description": [], - "source": { - "path": "src/core/server/legacy/types.ts", - "lineNumber": 54 - }, - "signature": [ - "Record" - ] - } - ], - "source": { - "path": "src/core/server/legacy/types.ts", - "lineNumber": 52 - }, - "initialIsOpen": false - }, { "id": "def-server.Logger", "type": "Interface", @@ -12544,6 +12804,7 @@ ], "children": [ { + "id": "def-server.Logger.trace.$1", "type": "string", "label": "message", "isRequired": true, @@ -12559,6 +12820,7 @@ } }, { + "id": "def-server.Logger.trace.$2", "type": "Object", "label": "meta", "isRequired": false, @@ -12596,6 +12858,7 @@ ], "children": [ { + "id": "def-server.Logger.debug.$1", "type": "string", "label": "message", "isRequired": true, @@ -12611,6 +12874,7 @@ } }, { + "id": "def-server.Logger.debug.$2", "type": "Object", "label": "meta", "isRequired": false, @@ -12648,6 +12912,7 @@ ], "children": [ { + "id": "def-server.Logger.info.$1", "type": "string", "label": "message", "isRequired": true, @@ -12663,6 +12928,7 @@ } }, { + "id": "def-server.Logger.info.$2", "type": "Object", "label": "meta", "isRequired": false, @@ -12700,6 +12966,7 @@ ], "children": [ { + "id": "def-server.Logger.warn.$1", "type": "CompoundType", "label": "errorOrMessage", "isRequired": true, @@ -12715,6 +12982,7 @@ } }, { + "id": "def-server.Logger.warn.$2", "type": "Object", "label": "meta", "isRequired": false, @@ -12752,6 +13020,7 @@ ], "children": [ { + "id": "def-server.Logger.error.$1", "type": "CompoundType", "label": "errorOrMessage", "isRequired": true, @@ -12767,6 +13036,7 @@ } }, { + "id": "def-server.Logger.error.$2", "type": "Object", "label": "meta", "isRequired": false, @@ -12804,6 +13074,7 @@ ], "children": [ { + "id": "def-server.Logger.fatal.$1", "type": "CompoundType", "label": "errorOrMessage", "isRequired": true, @@ -12819,6 +13090,7 @@ } }, { + "id": "def-server.Logger.fatal.$2", "type": "Object", "label": "meta", "isRequired": false, @@ -12855,6 +13127,7 @@ ], "children": [ { + "id": "def-server.Logger.get.$1", "type": "Array", "label": "childContextPaths", "isRequired": true, @@ -12899,7 +13172,7 @@ "description": [], "source": { "path": "src/core/server/logging/logging_config.ts", - "lineNumber": 111 + "lineNumber": 113 }, "signature": [ "Record MaybePromise<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.DeprecationsDetails", + "text": "DeprecationsDetails" + }, + "[]>" + ] + } + ], + "source": { + "path": "src/core/server/deprecations/types.ts", + "lineNumber": 56 + }, + "initialIsOpen": false + }, { "id": "def-server.RequestHandlerContext", "type": "Interface", @@ -14272,7 +14595,7 @@ "description": [], "source": { "path": "src/core/server/index.ts", - "lineNumber": 428 + "lineNumber": 432 }, "signature": [ "{ savedObjects: { client: Pick<", @@ -14283,7 +14606,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">; typeRegistry: Pick<", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">; typeRegistry: Pick<", { "pluginId": "core", "scope": "server", @@ -14307,7 +14630,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">; getExporter: (client: Pick<", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">; getExporter: (client: Pick<", { "pluginId": "core", "scope": "server", @@ -14320,7 +14643,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 427 + "lineNumber": 431 }, "initialIsOpen": false }, @@ -14435,13 +14758,7 @@ "lineNumber": 78 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectError", - "text": "SavedObjectError" - }, + "SavedObjectError", " | undefined" ] }, @@ -14474,13 +14791,7 @@ "lineNumber": 82 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ] }, @@ -14497,13 +14808,7 @@ "lineNumber": 84 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectsMigrationVersion", - "text": "SavedObjectsMigrationVersion" - }, + "SavedObjectsMigrationVersion", " | undefined" ] }, @@ -14764,13 +15069,7 @@ }, "signature": [ "{ total: number; max_score: number; hits: { _index: string; _type: string; _id: string; _score: number; _source: T; _version?: number | undefined; _explanation?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.Explanation", - "text": "Explanation" - }, + "Explanation", " | undefined; fields?: any; highlight?: any; inner_hits?: any; matched_queries?: string[] | undefined; sort?: unknown[] | undefined; }[]; }" ] }, @@ -15125,6 +15424,7 @@ ], "children": [ { + "id": "def-server.StatusServiceSetup.set.$1", "type": "Object", "label": "status$", "isRequired": true, @@ -15498,13 +15798,7 @@ "lineNumber": 68 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.DeprecationSettings", - "text": "DeprecationSettings" - }, + "DeprecationSettings", " | undefined" ] }, @@ -15535,29 +15829,11 @@ "lineNumber": 81 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.ImageValidation", - "text": "ImageValidation" - }, + "ImageValidation", " | ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.StringValidationRegex", - "text": "StringValidationRegex" - }, + "StringValidationRegex", " | ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.StringValidationRegexString", - "text": "StringValidationRegexString" - }, + "StringValidationRegexString", " | undefined" ] }, @@ -15618,13 +15894,7 @@ "label": "register", "signature": [ "(settings: Record>) => void" ], "description": [ @@ -15632,18 +15902,13 @@ ], "children": [ { + "id": "def-server.UiSettingsServiceSetup.register.$1", "type": "Object", "label": "settings", "isRequired": true, "signature": [ "Record>" ], "description": [], @@ -15689,7 +15954,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">) => ", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">) => ", { "pluginId": "core", "scope": "server", @@ -15703,6 +15968,7 @@ ], "children": [ { + "id": "def-server.UiSettingsServiceStart.asScopedToClient.$1", "type": "Object", "label": "savedObjectsClient", "isRequired": true, @@ -15715,7 +15981,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ], "description": [], "source": { @@ -15791,6 +16057,27 @@ ], "enums": [], "misc": [ + { + "id": "def-server.AddConfigDeprecation", + "type": "Type", + "label": "AddConfigDeprecation", + "tags": [ + "public" + ], + "description": [ + "\nConfig deprecation hook used when invoking a {@link ConfigDeprecation}\n" + ], + "source": { + "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", + "lineNumber": 6 + }, + "signature": [ + "(details: ", + "DeprecatedConfigDetails", + ") => void" + ], + "initialIsOpen": false + }, { "id": "def-server.AppenderConfigType", "type": "Type", @@ -15882,34 +16169,15 @@ ], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 16 + "lineNumber": 33 }, "signature": [ - "(config: Record, fromPath: string, logger: ", - "ConfigDeprecationLogger", + "(config: Record, fromPath: string, addDeprecation: ", + "AddConfigDeprecation", ") => Record" ], "initialIsOpen": false }, - { - "id": "def-server.ConfigDeprecationLogger", - "type": "Type", - "label": "ConfigDeprecationLogger", - "tags": [ - "public" - ], - "description": [ - "\nLogger interface used when invoking a {@link ConfigDeprecation}\n" - ], - "source": { - "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 6 - }, - "signature": [ - "(message: string) => void" - ], - "initialIsOpen": false - }, { "id": "def-server.ConfigDeprecationProvider", "type": "Type", @@ -15922,7 +16190,7 @@ ], "source": { "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", - "lineNumber": 33 + "lineNumber": 50 }, "signature": [ "(factory: ", @@ -15965,7 +16233,7 @@ "lineNumber": 22 }, "signature": [ - "Pick & { transport: { request(params: TransportRequestParams, options?: TransportRequestOptions | undefined): TransportRequestPromise; }; }" + "Pick & { transport: { request(params: TransportRequestParams, options?: TransportRequestOptions | undefined): TransportRequestPromise; }; }" ], "initialIsOpen": false }, @@ -16280,7 +16548,7 @@ "lineNumber": 27 }, "signature": [ - "Pick & Pick & { pingTimeout?: ElasticsearchConfig['pingTimeout'] | ConfigOptions['pingTimeout']; requestTimeout?: ElasticsearchConfig['requestTimeout'] | ConfigOptions['requestTimeout']; sniffInterval?: ElasticsearchConfig['sniffInterval'] | ConfigOptions['sniffInterval']; ssl?: Partial; truststore: Readonly<{ path?: string | undefined; password?: string | undefined; } & {}>; alwaysPresentCertificate: boolean; }>, \"key\" | \"certificate\" | \"verificationMode\" | \"keyPassphrase\" | \"alwaysPresentCertificate\"> & { certificateAuthorities?: string[] | undefined; }> | undefined; }" + "Pick & Pick & { pingTimeout?: ElasticsearchConfig['pingTimeout'] | ConfigOptions['pingTimeout']; requestTimeout?: ElasticsearchConfig['requestTimeout'] | ConfigOptions['requestTimeout']; sniffInterval?: ElasticsearchConfig['sniffInterval'] | ConfigOptions['sniffInterval']; ssl?: Partial; truststore: Readonly<{ path?: string | undefined; password?: string | undefined; } & {}>; alwaysPresentCertificate: boolean; }>, \"key\" | \"certificate\" | \"verificationMode\" | \"keyPassphrase\" | \"alwaysPresentCertificate\"> & { certificateAuthorities?: string[] | undefined; }> | undefined; }" ], "initialIsOpen": false }, @@ -16294,7 +16562,7 @@ "description": [], "source": { "path": "src/core/server/logging/logging_config.ts", - "lineNumber": 59 + "lineNumber": 60 }, "signature": [ "{ readonly name: string; readonly level: ", @@ -16389,7 +16657,7 @@ ], "source": { "path": "src/core/server/plugins/types.ts", - "lineNumber": 404 + "lineNumber": 411 }, "signature": [ "(core: ", @@ -16471,7 +16739,7 @@ "lineNumber": 102 }, "signature": [ - "{ type?: \"string\" | \"number\" | \"boolean\" | \"undefined\" | \"color\" | \"json\" | \"image\" | \"select\" | \"array\" | \"markdown\" | undefined; options?: string[] | undefined; description?: string | undefined; name?: string | undefined; order?: number | undefined; value?: unknown; category?: string[] | undefined; metric?: { type: UiCounterMetricType; name: string; } | undefined; optionLabels?: Record | undefined; requiresPageReload?: boolean | undefined; readonly?: boolean | undefined; sensitive?: boolean | undefined; deprecation?: DeprecationSettings | undefined; validation?: ImageValidation | StringValidationRegex | StringValidationRegexString | undefined; }" + "{ type?: \"string\" | \"number\" | \"boolean\" | \"undefined\" | \"color\" | \"json\" | \"image\" | \"select\" | \"array\" | \"markdown\" | undefined; options?: string[] | undefined; description?: string | undefined; name?: string | undefined; order?: number | undefined; value?: unknown; category?: string[] | undefined; metric?: { type: UiCounterMetricType; name: string; } | undefined; validation?: ImageValidation | StringValidationRegex | StringValidationRegexString | undefined; optionLabels?: Record | undefined; requiresPageReload?: boolean | undefined; readonly?: boolean | undefined; sensitive?: boolean | undefined; deprecation?: DeprecationSettings | undefined; }" ], "initialIsOpen": false }, @@ -16588,7 +16856,7 @@ "description": [], "source": { "path": "src/core/server/plugins/types.ts", - "lineNumber": 285 + "lineNumber": 292 }, "signature": [ "{ readonly kibana: Readonly<{ readonly index: string; readonly autocompleteTerminateAfter: Readonly<{ clone: () => ", @@ -16616,7 +16884,7 @@ ], "source": { "path": "src/core/server/index.ts", - "lineNumber": 496 + "lineNumber": 502 }, "signature": [ "() => Promise<[", diff --git a/api_docs/core_application.json b/api_docs/core_application.json index c15b47dcb0982..0c9ae36b4cc96 100644 --- a/api_docs/core_application.json +++ b/api_docs/core_application.json @@ -35,6 +35,7 @@ "description": [], "children": [ { + "id": "def-public.ScopedHistory.Unnamed.$1", "type": "Object", "label": "parentHistory", "isRequired": true, @@ -49,6 +50,7 @@ } }, { + "id": "def-public.ScopedHistory.Unnamed.$2", "type": "string", "label": "basePath", "isRequired": true, @@ -74,6 +76,7 @@ "type": "Function", "children": [ { + "id": "def-public.ScopedHistory.createSubHistory.$1", "type": "string", "label": "basePath", "isRequired": true, @@ -160,6 +163,7 @@ "type": "Function", "children": [ { + "id": "def-public.ScopedHistory.push.$1", "type": "CompoundType", "label": "pathOrLocation", "isRequired": true, @@ -175,6 +179,7 @@ } }, { + "id": "def-public.ScopedHistory.push.$2", "type": "Uncategorized", "label": "state", "isRequired": false, @@ -209,6 +214,7 @@ "type": "Function", "children": [ { + "id": "def-public.ScopedHistory.replace.$1", "type": "CompoundType", "label": "pathOrLocation", "isRequired": true, @@ -224,6 +230,7 @@ } }, { + "id": "def-public.ScopedHistory.replace.$2", "type": "Uncategorized", "label": "state", "isRequired": false, @@ -258,6 +265,7 @@ "type": "Function", "children": [ { + "id": "def-public.ScopedHistory.go.$1", "type": "number", "label": "n", "isRequired": true, @@ -326,6 +334,7 @@ "type": "Function", "children": [ { + "id": "def-public.ScopedHistory.block.$1", "type": "CompoundType", "label": "prompt", "isRequired": false, @@ -363,6 +372,7 @@ "type": "Function", "children": [ { + "id": "def-public.ScopedHistory.listen.$1", "type": "Function", "label": "listener", "isRequired": true, @@ -406,6 +416,7 @@ "type": "Function", "children": [ { + "id": "def-public.ScopedHistory.createHref.$1", "type": "Object", "label": "location", "isRequired": true, @@ -420,7 +431,7 @@ } }, { - "id": "def-public.ScopedHistory.createHref.{-prependBasePath = true }", + "id": "def-public.ScopedHistory.createHref.$2.prependBasePathtrue", "type": "Object", "label": "{ prependBasePath = true }", "tags": [], @@ -428,7 +439,7 @@ "children": [ { "tags": [], - "id": "def-public.ScopedHistory.createHref.{-prependBasePath = true }.prependBasePath", + "id": "def-public.ScopedHistory.createHref.$2.prependBasePathtrue.prependBasePath", "type": "CompoundType", "label": "prependBasePath", "description": [], @@ -531,13 +542,7 @@ "lineNumber": 95 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.AppCategory", - "text": "AppCategory" - }, + "AppCategory", " | undefined" ] }, @@ -706,13 +711,7 @@ }, "signature": [ "Partial<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.Capabilities", - "text": "Capabilities" - }, + "Capabilities", "> | undefined" ] }, @@ -963,6 +962,7 @@ ], "children": [ { + "id": "def-public.ApplicationSetup.register.$1", "type": "Object", "label": "app", "isRequired": true, @@ -1014,6 +1014,7 @@ ], "children": [ { + "id": "def-public.ApplicationSetup.registerAppUpdater.$1", "type": "Object", "label": "appUpdater$", "isRequired": true, @@ -1120,6 +1121,7 @@ ], "children": [ { + "id": "def-public.ApplicationStart.navigateToApp.$1", "type": "string", "label": "appId", "isRequired": true, @@ -1133,6 +1135,7 @@ } }, { + "id": "def-public.ApplicationStart.navigateToApp.$2", "type": "Object", "label": "options", "isRequired": false, @@ -1174,6 +1177,7 @@ ], "children": [ { + "id": "def-public.ApplicationStart.navigateToUrl.$1", "type": "string", "label": "url", "isRequired": true, @@ -1208,6 +1212,7 @@ ], "children": [ { + "id": "def-public.ApplicationStart.getUrlForApp.$1", "type": "string", "label": "appId", "isRequired": true, @@ -1221,7 +1226,7 @@ } }, { - "id": "def-public.ApplicationStart.getUrlForApp.options", + "id": "def-public.ApplicationStart.getUrlForApp.$2.options", "type": "Object", "label": "options", "tags": [], @@ -1229,7 +1234,7 @@ "children": [ { "tags": [], - "id": "def-public.ApplicationStart.getUrlForApp.options.path", + "id": "def-public.ApplicationStart.getUrlForApp.$2.options.path", "type": "string", "label": "path", "description": [], @@ -1243,7 +1248,7 @@ }, { "tags": [], - "id": "def-public.ApplicationStart.getUrlForApp.options.absolute", + "id": "def-public.ApplicationStart.getUrlForApp.$2.options.absolute", "type": "CompoundType", "label": "absolute", "description": [], diff --git a/api_docs/core_chrome.json b/api_docs/core_chrome.json index cad8f16b4bd54..8fa999791ee86 100644 --- a/api_docs/core_chrome.json +++ b/api_docs/core_chrome.json @@ -123,6 +123,7 @@ ], "children": [ { + "id": "def-public.ChromeDocTitle.change.$1", "type": "CompoundType", "label": "newTitle", "isRequired": true, @@ -254,10 +255,10 @@ "DisambiguateSet", "<", "PropsForAnchor", - ", ", - "PropsForButton", - "> & CommonEuiButtonEmptyProps & { onClick?: ((event: React.MouseEvent) => void) | undefined; } & React.ButtonHTMLAttributes) | (", - "DisambiguateSet" + "<", + "CommonEuiButtonEmptyProps", + ", {}>, ", + "PropsForButton" ], "description": [], "tags": [ @@ -332,10 +333,10 @@ "DisambiguateSet", "<", "PropsForAnchor", - ", ", - "PropsForButton", - "> & CommonEuiButtonEmptyProps & { onClick?: ((event: React.MouseEvent) => void) | undefined; } & React.ButtonHTMLAttributes) | (", - "DisambiguateSet" + "<", + "CommonEuiButtonEmptyProps", + ", {}>, ", + "PropsForButton" ], "description": [], "tags": [ @@ -394,10 +395,10 @@ "DisambiguateSet", "<", "PropsForAnchor", - ", ", - "PropsForButton", - "> & CommonEuiButtonEmptyProps & { onClick?: ((event: React.MouseEvent) => void) | undefined; } & React.ButtonHTMLAttributes) | (", - "DisambiguateSet" + "<", + "CommonEuiButtonEmptyProps", + ", {}>, ", + "PropsForButton" ], "description": [], "tags": [ @@ -456,10 +457,10 @@ "DisambiguateSet", "<", "PropsForAnchor", - ", ", - "PropsForButton", - "> & CommonEuiButtonEmptyProps & { onClick?: ((event: React.MouseEvent) => void) | undefined; } & React.ButtonHTMLAttributes) | (", - "DisambiguateSet" + "<", + "CommonEuiButtonEmptyProps", + ", {}>, ", + "PropsForButton" ], "description": [], "tags": [ @@ -603,6 +604,7 @@ ], "children": [ { + "id": "def-public.ChromeNavControls.registerLeft.$1", "type": "Object", "label": "navControl", "isRequired": true, @@ -649,6 +651,7 @@ ], "children": [ { + "id": "def-public.ChromeNavControls.registerRight.$1", "type": "Object", "label": "navControl", "isRequired": true, @@ -695,6 +698,7 @@ ], "children": [ { + "id": "def-public.ChromeNavControls.registerCenter.$1", "type": "Object", "label": "navControl", "isRequired": true, @@ -776,13 +780,7 @@ "lineNumber": 29 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.AppCategory", - "text": "AppCategory" - }, + "AppCategory", " | undefined" ] }, @@ -990,6 +988,7 @@ ], "children": [ { + "id": "def-public.ChromeNavLinks.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -1048,6 +1047,7 @@ ], "children": [ { + "id": "def-public.ChromeNavLinks.has.$1", "type": "string", "label": "id", "isRequired": true, @@ -1080,6 +1080,7 @@ ], "children": [ { + "id": "def-public.ChromeNavLinks.showOnly.$1", "type": "string", "label": "id", "isRequired": true, @@ -1128,6 +1129,7 @@ ], "children": [ { + "id": "def-public.ChromeNavLinks.update.$1", "type": "string", "label": "id", "isRequired": true, @@ -1141,6 +1143,7 @@ } }, { + "id": "def-public.ChromeNavLinks.update.$2", "type": "Object", "label": "values", "isRequired": true, @@ -1239,6 +1242,7 @@ ], "children": [ { + "id": "def-public.ChromeRecentlyAccessed.add.$1", "type": "string", "label": "link", "isRequired": true, @@ -1254,6 +1258,7 @@ } }, { + "id": "def-public.ChromeRecentlyAccessed.add.$2", "type": "string", "label": "label", "isRequired": true, @@ -1269,6 +1274,7 @@ } }, { + "id": "def-public.ChromeRecentlyAccessed.add.$3", "type": "string", "label": "id", "isRequired": true, @@ -1512,6 +1518,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.setAppTitle.$1", "type": "string", "label": "appTitle", "isRequired": true, @@ -1580,6 +1587,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.setBrand.$1", "type": "Object", "label": "brand", "isRequired": true, @@ -1638,6 +1646,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.setIsVisible.$1", "type": "boolean", "label": "isVisible", "isRequired": true, @@ -1690,6 +1699,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.addApplicationClass.$1", "type": "string", "label": "className", "isRequired": true, @@ -1722,6 +1732,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.removeApplicationClass.$1", "type": "string", "label": "className", "isRequired": true, @@ -1790,6 +1801,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.setBadge.$1", "type": "Object", "label": "badge", "isRequired": false, @@ -1853,6 +1865,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.setBreadcrumbs.$1", "type": "Array", "label": "newBreadcrumbs", "isRequired": true, @@ -1882,13 +1895,7 @@ "() => ", "Observable", "<", - { - "pluginId": "core", - "scope": "public", - "docId": "kibCoreChromePluginApi", - "section": "def-public.ChromeBreadcrumbsAppendExtension", - "text": "ChromeBreadcrumbsAppendExtension" - }, + "ChromeBreadcrumbsAppendExtension", " | undefined>" ], "description": [ @@ -1908,13 +1915,7 @@ "label": "setBreadcrumbsAppendExtension", "signature": [ "(breadcrumbsAppendExtension?: ", - { - "pluginId": "core", - "scope": "public", - "docId": "kibCoreChromePluginApi", - "section": "def-public.ChromeBreadcrumbsAppendExtension", - "text": "ChromeBreadcrumbsAppendExtension" - }, + "ChromeBreadcrumbsAppendExtension", " | undefined) => void" ], "description": [ @@ -1922,17 +1923,12 @@ ], "children": [ { + "id": "def-public.ChromeStart.setBreadcrumbsAppendExtension.$1", "type": "Object", "label": "breadcrumbsAppendExtension", "isRequired": false, "signature": [ - { - "pluginId": "core", - "scope": "public", - "docId": "kibCoreChromePluginApi", - "section": "def-public.ChromeBreadcrumbsAppendExtension", - "text": "ChromeBreadcrumbsAppendExtension" - }, + "ChromeBreadcrumbsAppendExtension", " | undefined" ], "description": [], @@ -1997,6 +1993,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.setCustomNavLink.$1", "type": "Object", "label": "newCustomNavLink", "isRequired": false, @@ -2073,6 +2070,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.setHelpExtension.$1", "type": "Object", "label": "helpExtension", "isRequired": false, @@ -2112,6 +2110,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.setHelpSupportUrl.$1", "type": "string", "label": "url", "isRequired": true, @@ -2174,6 +2173,7 @@ ], "children": [ { + "id": "def-public.ChromeStart.setHeaderBanner.$1", "type": "Object", "label": "headerBanner", "isRequired": false, diff --git a/api_docs/core_http.json b/api_docs/core_http.json index ce5ceb2840ec7..c65171153a6fb 100644 --- a/api_docs/core_http.json +++ b/api_docs/core_http.json @@ -372,6 +372,7 @@ ], "children": [ { + "id": "def-public.HttpInterceptor.request.$1", "type": "Object", "label": "fetchOptions", "isRequired": true, @@ -393,6 +394,7 @@ } }, { + "id": "def-public.HttpInterceptor.request.$2", "type": "Object", "label": "controller", "isRequired": true, @@ -463,6 +465,7 @@ ], "children": [ { + "id": "def-public.HttpInterceptor.requestError.$1", "type": "Object", "label": "httpErrorRequest", "isRequired": true, @@ -482,6 +485,7 @@ } }, { + "id": "def-public.HttpInterceptor.requestError.$2", "type": "Object", "label": "controller", "isRequired": true, @@ -552,6 +556,7 @@ ], "children": [ { + "id": "def-public.HttpInterceptor.response.$1", "type": "Object", "label": "httpResponse", "isRequired": true, @@ -572,6 +577,7 @@ } }, { + "id": "def-public.HttpInterceptor.response.$2", "type": "Object", "label": "controller", "isRequired": true, @@ -642,6 +648,7 @@ ], "children": [ { + "id": "def-public.HttpInterceptor.responseError.$1", "type": "Object", "label": "httpErrorResponse", "isRequired": true, @@ -661,6 +668,7 @@ } }, { + "id": "def-public.HttpInterceptor.responseError.$2", "type": "Object", "label": "controller", "isRequired": true, @@ -1239,6 +1247,7 @@ ], "children": [ { + "id": "def-public.HttpSetup.intercept.$1", "type": "Object", "label": "interceptor", "isRequired": true, @@ -1459,6 +1468,7 @@ ], "children": [ { + "id": "def-public.HttpSetup.addLoadingCountSource.$1", "type": "Object", "label": "countSource$", "isRequired": true, @@ -1530,6 +1540,7 @@ ], "children": [ { + "id": "def-public.IAnonymousPaths.isAnonymous.$1", "type": "string", "label": "path", "isRequired": true, @@ -1562,6 +1573,7 @@ ], "children": [ { + "id": "def-public.IAnonymousPaths.register.$1", "type": "string", "label": "path", "isRequired": true, @@ -1707,6 +1719,7 @@ ], "children": [ { + "id": "def-public.IExternalUrl.validateUrl.$1", "type": "string", "label": "relativeOrAbsoluteUrl", "isRequired": true, @@ -2026,6 +2039,7 @@ "type": "Function", "children": [ { + "id": "def-server.BasePath.get.$1", "type": "CompoundType", "label": "request", "isRequired": true, @@ -2088,6 +2102,7 @@ "type": "Function", "children": [ { + "id": "def-server.BasePath.set.$1", "type": "CompoundType", "label": "request", "isRequired": true, @@ -2115,6 +2130,7 @@ } }, { + "id": "def-server.BasePath.set.$2", "type": "string", "label": "requestSpecificBasePath", "isRequired": true, @@ -2165,6 +2181,7 @@ "type": "Function", "children": [ { + "id": "def-server.BasePath.prepend.$1", "type": "string", "label": "path", "isRequired": true, @@ -2197,6 +2214,7 @@ "type": "Function", "children": [ { + "id": "def-server.BasePath.remove.$1", "type": "string", "label": "path", "isRequired": true, @@ -2442,6 +2460,7 @@ "description": [], "children": [ { + "id": "def-server.KibanaRequest.Unnamed.$1", "type": "Object", "label": "request", "isRequired": true, @@ -2455,6 +2474,7 @@ } }, { + "id": "def-server.KibanaRequest.Unnamed.$2", "type": "Uncategorized", "label": "params", "isRequired": true, @@ -2468,6 +2488,7 @@ } }, { + "id": "def-server.KibanaRequest.Unnamed.$3", "type": "Uncategorized", "label": "query", "isRequired": true, @@ -2481,6 +2502,7 @@ } }, { + "id": "def-server.KibanaRequest.Unnamed.$4", "type": "Uncategorized", "label": "body", "isRequired": true, @@ -2494,6 +2516,7 @@ } }, { + "id": "def-server.KibanaRequest.Unnamed.$5", "type": "boolean", "label": "withoutSecretHeaders", "isRequired": true, @@ -2553,6 +2576,7 @@ "description": [], "children": [ { + "id": "def-server.RouteValidationError.Unnamed.$1", "type": "CompoundType", "label": "error", "isRequired": true, @@ -2566,6 +2590,7 @@ } }, { + "id": "def-server.RouteValidationError.Unnamed.$2", "type": "Array", "label": "path", "isRequired": true, @@ -3777,6 +3802,7 @@ "description": [], "children": [ { + "id": "def-server.IKibanaSocket.getPeerCertificate.$1", "type": "boolean", "label": "detailed", "isRequired": true, @@ -3815,6 +3841,7 @@ "description": [], "children": [ { + "id": "def-server.IKibanaSocket.getPeerCertificate.$1", "type": "boolean", "label": "detailed", "isRequired": true, @@ -3855,6 +3882,7 @@ ], "children": [ { + "id": "def-server.IKibanaSocket.getPeerCertificate.$1", "type": "CompoundType", "label": "detailed", "isRequired": false, @@ -3909,7 +3937,7 @@ ], "children": [ { - "id": "def-server.IKibanaSocket.renegotiate.options", + "id": "def-server.IKibanaSocket.renegotiate.$1.options", "type": "Object", "label": "options", "tags": [], @@ -3917,7 +3945,7 @@ "children": [ { "tags": [], - "id": "def-server.IKibanaSocket.renegotiate.options.rejectUnauthorized", + "id": "def-server.IKibanaSocket.renegotiate.$1.options.rejectUnauthorized", "type": "CompoundType", "label": "rejectUnauthorized", "description": [], @@ -3931,7 +3959,7 @@ }, { "tags": [], - "id": "def-server.IKibanaSocket.renegotiate.options.requestCert", + "id": "def-server.IKibanaSocket.renegotiate.$1.options.requestCert", "type": "CompoundType", "label": "requestCert", "description": [], @@ -5230,6 +5258,7 @@ ], "children": [ { + "id": "def-server.SessionStorage.set.$1", "type": "Uncategorized", "label": "sessionValue", "isRequired": true, @@ -6521,6 +6550,7 @@ "type": "Function", "children": [ { + "id": "def-server.kibanaResponseFactory.custom.$1", "type": "Object", "label": "options", "isRequired": true, @@ -6553,13 +6583,7 @@ "text": "CustomHttpResponseOptions" }, ") => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaResponse", - "text": "KibanaResponse" - }, + "KibanaResponse", "" ], "description": [ diff --git a/api_docs/core_saved_objects.json b/api_docs/core_saved_objects.json index 54f13f3911be6..693916de32d3a 100644 --- a/api_docs/core_saved_objects.json +++ b/api_docs/core_saved_objects.json @@ -18,6 +18,7 @@ "type": "Function", "children": [ { + "id": "def-public.SavedObjectsClient.create.$1", "type": "string", "label": "type", "isRequired": true, @@ -31,6 +32,7 @@ } }, { + "id": "def-public.SavedObjectsClient.create.$2", "type": "Uncategorized", "label": "attributes", "isRequired": true, @@ -44,6 +46,7 @@ } }, { + "id": "def-public.SavedObjectsClient.create.$3", "type": "Object", "label": "options", "isRequired": true, @@ -98,6 +101,7 @@ "type": "Function", "children": [ { + "id": "def-public.SavedObjectsClient.bulkCreate.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -118,6 +122,7 @@ } }, { + "id": "def-public.SavedObjectsClient.bulkCreate.$2", "type": "Object", "label": "options", "isRequired": true, @@ -184,6 +189,7 @@ "type": "Function", "children": [ { + "id": "def-public.SavedObjectsClient.delete.$1", "type": "string", "label": "type", "isRequired": true, @@ -197,6 +203,7 @@ } }, { + "id": "def-public.SavedObjectsClient.delete.$2", "type": "string", "label": "id", "isRequired": true, @@ -210,17 +217,12 @@ } }, { + "id": "def-public.SavedObjectsClient.delete.$3", "type": "Object", "label": "options", "isRequired": false, "signature": [ - { - "pluginId": "core", - "scope": "public", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-public.SavedObjectsDeleteOptions", - "text": "SavedObjectsDeleteOptions" - }, + "SavedObjectsDeleteOptions", " | undefined" ], "description": [], @@ -232,13 +234,7 @@ ], "signature": [ "(type: string, id: string, options?: ", - { - "pluginId": "core", - "scope": "public", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-public.SavedObjectsDeleteOptions", - "text": "SavedObjectsDeleteOptions" - }, + "SavedObjectsDeleteOptions", " | undefined) => Promise<{}>" ], "description": [ @@ -257,6 +253,7 @@ "type": "Function", "children": [ { + "id": "def-public.SavedObjectsClient.find.$1", "type": "Object", "label": "options", "isRequired": true, @@ -317,6 +314,7 @@ "type": "Function", "children": [ { + "id": "def-public.SavedObjectsClient.get.$1", "type": "string", "label": "type", "isRequired": true, @@ -330,6 +328,7 @@ } }, { + "id": "def-public.SavedObjectsClient.get.$2", "type": "string", "label": "id", "isRequired": true, @@ -372,6 +371,7 @@ "type": "Function", "children": [ { + "id": "def-public.SavedObjectsClient.bulkGet.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -437,6 +437,7 @@ ], "children": [ { + "id": "def-public.SavedObjectsClient.update.$1", "type": "string", "label": "type", "isRequired": true, @@ -450,6 +451,7 @@ } }, { + "id": "def-public.SavedObjectsClient.update.$2", "type": "string", "label": "id", "isRequired": true, @@ -463,6 +465,7 @@ } }, { + "id": "def-public.SavedObjectsClient.update.$3", "type": "Uncategorized", "label": "attributes", "isRequired": true, @@ -476,6 +479,7 @@ } }, { + "id": "def-public.SavedObjectsClient.update.$4", "type": "Object", "label": "{ version, migrationVersion, references }", "isRequired": true, @@ -532,6 +536,7 @@ ], "children": [ { + "id": "def-public.SavedObjectsClient.bulkUpdate.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -652,13 +657,7 @@ "lineNumber": 29 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectsMigrationVersion", - "text": "SavedObjectsMigrationVersion" - }, + "SavedObjectsMigrationVersion", " | undefined" ] }, @@ -687,13 +686,7 @@ "lineNumber": 31 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectError", - "text": "SavedObjectError" - }, + "SavedObjectError", " | undefined" ] }, @@ -708,13 +701,7 @@ "lineNumber": 32 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ] }, @@ -728,6 +715,7 @@ "description": [], "children": [ { + "id": "def-public.SimpleSavedObject.Unnamed.$1", "type": "Object", "label": "client", "isRequired": true, @@ -740,7 +728,7 @@ "section": "def-public.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"find\" | \"bulkGet\" | \"update\" | \"bulkUpdate\">" ], "description": [], "source": { @@ -749,17 +737,12 @@ } }, { + "id": "def-public.SimpleSavedObject.Unnamed.$2", "type": "Object", "label": "{\n id,\n type,\n version,\n attributes,\n error,\n references,\n migrationVersion,\n coreMigrationVersion,\n }", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "" ], "description": [], @@ -786,6 +769,7 @@ "description": [], "children": [ { + "id": "def-public.SimpleSavedObject.get.$1", "type": "string", "label": "key", "isRequired": true, @@ -816,6 +800,7 @@ "description": [], "children": [ { + "id": "def-public.SimpleSavedObject.set.$1", "type": "string", "label": "key", "isRequired": true, @@ -829,6 +814,7 @@ } }, { + "id": "def-public.SimpleSavedObject.set.$2", "type": "Any", "label": "value", "isRequired": true, @@ -859,6 +845,7 @@ "description": [], "children": [ { + "id": "def-public.SimpleSavedObject.has.$1", "type": "string", "label": "key", "isRequired": true, @@ -1146,13 +1133,7 @@ "lineNumber": 71 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[] | undefined" ] } @@ -1247,13 +1228,7 @@ "lineNumber": 42 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectsMigrationVersion", - "text": "SavedObjectsMigrationVersion" - }, + "SavedObjectsMigrationVersion", " | undefined" ] }, @@ -1284,13 +1259,7 @@ "lineNumber": 45 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[] | undefined" ] } @@ -1400,7 +1369,7 @@ "section": "def-public.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"find\" | \"bulkGet\" | \"update\" | \"bulkUpdate\">" ] } ], @@ -1446,13 +1415,7 @@ "lineNumber": 83 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectsMigrationVersion", - "text": "SavedObjectsMigrationVersion" - }, + "SavedObjectsMigrationVersion", " | undefined" ] }, @@ -1467,13 +1430,7 @@ "lineNumber": 84 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[] | undefined" ] } @@ -1502,7 +1459,7 @@ "lineNumber": 138 }, "signature": [ - "{ get: (type: string, id: string) => Promise>; delete: (type: string, id: string, options?: SavedObjectsDeleteOptions | undefined) => Promise<{}>; create: (type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise>; find: (options: Pick) => Promise>; update: (type: string, id: string, attributes: T, { version, migrationVersion, references }?: SavedObjectsUpdateOptions) => Promise>; bulkCreate: (objects?: SavedObjectsBulkCreateObject[], options?: SavedObjectsBulkCreateOptions) => Promise>; bulkGet: (objects?: { id: string; type: string; }[]) => Promise>; bulkUpdate: (objects?: SavedObjectsBulkUpdateObject[]) => Promise>; }" + "{ get: (type: string, id: string) => Promise>; delete: (type: string, id: string, options?: SavedObjectsDeleteOptions | undefined) => Promise<{}>; create: (type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise>; bulkCreate: (objects?: SavedObjectsBulkCreateObject[], options?: SavedObjectsBulkCreateOptions) => Promise>; find: (options: Pick) => Promise>; bulkGet: (objects?: { id: string; type: string; }[]) => Promise>; update: (type: string, id: string, attributes: T, { version, migrationVersion, references }?: SavedObjectsUpdateOptions) => Promise>; bulkUpdate: (objects?: SavedObjectsBulkUpdateObject[]) => Promise>; }" ], "initialIsOpen": false } @@ -1578,13 +1535,7 @@ "text": "SavedObjectsCreateOptions" }, " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ], "description": [ @@ -1592,6 +1543,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.create.$1", "type": "string", "label": "type", "isRequired": true, @@ -1605,6 +1557,7 @@ } }, { + "id": "def-server.SavedObjectsClient.create.$2", "type": "Uncategorized", "label": "attributes", "isRequired": true, @@ -1618,6 +1571,7 @@ } }, { + "id": "def-server.SavedObjectsClient.create.$3", "type": "Object", "label": "options", "isRequired": false, @@ -1681,6 +1635,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.bulkCreate.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -1701,6 +1656,7 @@ } }, { + "id": "def-server.SavedObjectsClient.bulkCreate.$2", "type": "Object", "label": "options", "isRequired": false, @@ -1764,6 +1720,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.checkConflicts.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -1784,6 +1741,7 @@ } }, { + "id": "def-server.SavedObjectsClient.checkConflicts.$2", "type": "Object", "label": "options", "isRequired": true, @@ -1830,6 +1788,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.delete.$1", "type": "string", "label": "type", "isRequired": true, @@ -1843,6 +1802,7 @@ } }, { + "id": "def-server.SavedObjectsClient.delete.$2", "type": "string", "label": "id", "isRequired": true, @@ -1856,6 +1816,7 @@ } }, { + "id": "def-server.SavedObjectsClient.delete.$3", "type": "Object", "label": "options", "isRequired": true, @@ -1910,6 +1871,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.find.$1", "type": "Object", "label": "options", "isRequired": true, @@ -1972,6 +1934,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.bulkGet.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -1994,6 +1957,7 @@ } }, { + "id": "def-server.SavedObjectsClient.bulkGet.$2", "type": "Object", "label": "options", "isRequired": true, @@ -2034,13 +1998,7 @@ "text": "SavedObjectsBaseOptions" }, ") => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ], "description": [ @@ -2048,6 +2006,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.get.$1", "type": "string", "label": "type", "isRequired": true, @@ -2063,6 +2022,7 @@ } }, { + "id": "def-server.SavedObjectsClient.get.$2", "type": "string", "label": "id", "isRequired": true, @@ -2078,6 +2038,7 @@ } }, { + "id": "def-server.SavedObjectsClient.get.$3", "type": "Object", "label": "options", "isRequired": true, @@ -2132,6 +2093,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.resolve.$1", "type": "string", "label": "type", "isRequired": true, @@ -2147,6 +2109,7 @@ } }, { + "id": "def-server.SavedObjectsClient.resolve.$2", "type": "string", "label": "id", "isRequired": true, @@ -2162,6 +2125,7 @@ } }, { + "id": "def-server.SavedObjectsClient.resolve.$3", "type": "Object", "label": "options", "isRequired": true, @@ -2216,6 +2180,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.update.$1", "type": "string", "label": "type", "isRequired": true, @@ -2229,6 +2194,7 @@ } }, { + "id": "def-server.SavedObjectsClient.update.$2", "type": "string", "label": "id", "isRequired": true, @@ -2242,6 +2208,7 @@ } }, { + "id": "def-server.SavedObjectsClient.update.$3", "type": "Object", "label": "attributes", "isRequired": true, @@ -2255,6 +2222,7 @@ } }, { + "id": "def-server.SavedObjectsClient.update.$4", "type": "Object", "label": "options", "isRequired": true, @@ -2309,6 +2277,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.addToNamespaces.$1", "type": "string", "label": "type", "isRequired": true, @@ -2322,6 +2291,7 @@ } }, { + "id": "def-server.SavedObjectsClient.addToNamespaces.$2", "type": "string", "label": "id", "isRequired": true, @@ -2335,6 +2305,7 @@ } }, { + "id": "def-server.SavedObjectsClient.addToNamespaces.$3", "type": "Array", "label": "namespaces", "isRequired": true, @@ -2348,6 +2319,7 @@ } }, { + "id": "def-server.SavedObjectsClient.addToNamespaces.$4", "type": "Object", "label": "options", "isRequired": true, @@ -2402,6 +2374,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.deleteFromNamespaces.$1", "type": "string", "label": "type", "isRequired": true, @@ -2415,6 +2388,7 @@ } }, { + "id": "def-server.SavedObjectsClient.deleteFromNamespaces.$2", "type": "string", "label": "id", "isRequired": true, @@ -2428,6 +2402,7 @@ } }, { + "id": "def-server.SavedObjectsClient.deleteFromNamespaces.$3", "type": "Array", "label": "namespaces", "isRequired": true, @@ -2441,6 +2416,7 @@ } }, { + "id": "def-server.SavedObjectsClient.deleteFromNamespaces.$4", "type": "Object", "label": "options", "isRequired": true, @@ -2503,6 +2479,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.bulkUpdate.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -2523,6 +2500,7 @@ } }, { + "id": "def-server.SavedObjectsClient.bulkUpdate.$2", "type": "Object", "label": "options", "isRequired": false, @@ -2578,6 +2556,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.removeReferencesTo.$1", "type": "string", "label": "type", "isRequired": true, @@ -2591,6 +2570,7 @@ } }, { + "id": "def-server.SavedObjectsClient.removeReferencesTo.$2", "type": "string", "label": "id", "isRequired": true, @@ -2604,6 +2584,7 @@ } }, { + "id": "def-server.SavedObjectsClient.removeReferencesTo.$3", "type": "Object", "label": "options", "isRequired": false, @@ -2659,6 +2640,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.openPointInTimeForType.$1", "type": "CompoundType", "label": "type", "isRequired": true, @@ -2672,6 +2654,7 @@ } }, { + "id": "def-server.SavedObjectsClient.openPointInTimeForType.$2", "type": "Object", "label": "options", "isRequired": true, @@ -2726,6 +2709,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.closePointInTime.$1", "type": "string", "label": "id", "isRequired": true, @@ -2739,6 +2723,7 @@ } }, { + "id": "def-server.SavedObjectsClient.closePointInTime.$2", "type": "Object", "label": "options", "isRequired": false, @@ -2801,6 +2786,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsClient.createPointInTimeFinder.$1", "type": "Object", "label": "findOptions", "isRequired": true, @@ -2822,6 +2808,7 @@ } }, { + "id": "def-server.SavedObjectsClient.createPointInTimeFinder.$2", "type": "Object", "label": "dependencies", "isRequired": false, @@ -2883,6 +2870,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isSavedObjectsClientError.$1", "type": "Any", "label": "error", "isRequired": true, @@ -2921,6 +2909,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.decorateBadRequestError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -2934,6 +2923,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.decorateBadRequestError.$2", "type": "string", "label": "reason", "isRequired": false, @@ -2972,6 +2962,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.createBadRequestError.$1", "type": "string", "label": "reason", "isRequired": false, @@ -3010,6 +3001,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.createUnsupportedTypeError.$1", "type": "string", "label": "type", "isRequired": true, @@ -3048,18 +3040,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isBadRequestError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -3093,6 +3080,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.createInvalidVersionError.$1", "type": "string", "label": "versionInput", "isRequired": false, @@ -3131,18 +3119,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isInvalidVersionError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -3176,6 +3159,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.decorateNotAuthorizedError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -3189,6 +3173,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.decorateNotAuthorizedError.$2", "type": "string", "label": "reason", "isRequired": false, @@ -3227,18 +3212,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isNotAuthorizedError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -3272,6 +3252,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.decorateForbiddenError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -3285,6 +3266,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.decorateForbiddenError.$2", "type": "string", "label": "reason", "isRequired": false, @@ -3323,18 +3305,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isForbiddenError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -3368,6 +3345,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.decorateRequestEntityTooLargeError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -3381,6 +3359,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.decorateRequestEntityTooLargeError.$2", "type": "string", "label": "reason", "isRequired": false, @@ -3419,18 +3398,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isRequestEntityTooLargeError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -3464,6 +3438,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.createGenericNotFoundError.$1", "type": "CompoundType", "label": "type", "isRequired": false, @@ -3477,6 +3452,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.createGenericNotFoundError.$2", "type": "CompoundType", "label": "id", "isRequired": false, @@ -3515,6 +3491,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.createIndexAliasNotFoundError.$1", "type": "string", "label": "alias", "isRequired": true, @@ -3553,6 +3530,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.decorateIndexAliasNotFoundError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -3566,6 +3544,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.decorateIndexAliasNotFoundError.$2", "type": "string", "label": "alias", "isRequired": true, @@ -3604,18 +3583,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isNotFoundError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -3649,6 +3623,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.decorateConflictError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -3662,6 +3637,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.decorateConflictError.$2", "type": "string", "label": "reason", "isRequired": false, @@ -3700,6 +3676,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.createConflictError.$1", "type": "string", "label": "type", "isRequired": true, @@ -3713,6 +3690,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.createConflictError.$2", "type": "string", "label": "id", "isRequired": true, @@ -3726,6 +3704,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.createConflictError.$3", "type": "string", "label": "reason", "isRequired": false, @@ -3764,18 +3743,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isConflictError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -3809,6 +3783,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.decorateTooManyRequestsError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -3822,6 +3797,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.decorateTooManyRequestsError.$2", "type": "string", "label": "reason", "isRequired": false, @@ -3860,6 +3836,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.createTooManyRequestsError.$1", "type": "string", "label": "type", "isRequired": true, @@ -3873,6 +3850,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.createTooManyRequestsError.$2", "type": "string", "label": "id", "isRequired": true, @@ -3911,18 +3889,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isTooManyRequestsError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -3956,6 +3929,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.decorateEsCannotExecuteScriptError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -3969,6 +3943,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.decorateEsCannotExecuteScriptError.$2", "type": "string", "label": "reason", "isRequired": false, @@ -4007,18 +3982,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isEsCannotExecuteScriptError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -4052,6 +4022,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.decorateEsUnavailableError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -4065,6 +4036,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.decorateEsUnavailableError.$2", "type": "string", "label": "reason", "isRequired": false, @@ -4103,18 +4075,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isEsUnavailableError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -4148,6 +4115,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.decorateGeneralError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -4161,6 +4129,7 @@ } }, { + "id": "def-server.SavedObjectsErrorHelpers.decorateGeneralError.$2", "type": "string", "label": "reason", "isRequired": false, @@ -4199,18 +4168,13 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsErrorHelpers.isGeneralError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -4244,7 +4208,7 @@ "children": [ { "tags": [], - "id": "def-server.SavedObjectsExporter.#savedObjectsClient", + "id": "def-server.SavedObjectsExporter.savedObjectsClient", "type": "Object", "label": "#savedObjectsClient", "description": [], @@ -4261,12 +4225,12 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ] }, { "tags": [], - "id": "def-server.SavedObjectsExporter.#exportTransforms", + "id": "def-server.SavedObjectsExporter.exportTransforms", "type": "Object", "label": "#exportTransforms", "description": [], @@ -4288,7 +4252,7 @@ }, { "tags": [], - "id": "def-server.SavedObjectsExporter.#exportSizeLimit", + "id": "def-server.SavedObjectsExporter.exportSizeLimit", "type": "number", "label": "#exportSizeLimit", "description": [], @@ -4299,7 +4263,7 @@ }, { "tags": [], - "id": "def-server.SavedObjectsExporter.#log", + "id": "def-server.SavedObjectsExporter.log", "type": "Object", "label": "#log", "description": [], @@ -4321,7 +4285,7 @@ "description": [], "children": [ { - "id": "def-server.SavedObjectsExporter.Unnamed.{\n- savedObjectsClient,\n typeRegistry,\n exportSizeLimit,\n logger,\n }", + "id": "def-server.SavedObjectsExporter.Unnamed.$1.savedObjectsClienttypeRegistryexportSizeLimitlogger", "type": "Object", "label": "{\n savedObjectsClient,\n typeRegistry,\n exportSizeLimit,\n logger,\n }", "tags": [], @@ -4329,7 +4293,7 @@ "children": [ { "tags": [], - "id": "def-server.SavedObjectsExporter.Unnamed.{\n- savedObjectsClient,\n typeRegistry,\n exportSizeLimit,\n logger,\n }.savedObjectsClient", + "id": "def-server.SavedObjectsExporter.Unnamed.$1.savedObjectsClienttypeRegistryexportSizeLimitlogger.savedObjectsClient", "type": "Object", "label": "savedObjectsClient", "description": [], @@ -4346,12 +4310,12 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ] }, { "tags": [], - "id": "def-server.SavedObjectsExporter.Unnamed.{\n- savedObjectsClient,\n typeRegistry,\n exportSizeLimit,\n logger,\n }.typeRegistry", + "id": "def-server.SavedObjectsExporter.Unnamed.$1.savedObjectsClienttypeRegistryexportSizeLimitlogger.typeRegistry", "type": "Object", "label": "typeRegistry", "description": [], @@ -4373,7 +4337,7 @@ }, { "tags": [], - "id": "def-server.SavedObjectsExporter.Unnamed.{\n- savedObjectsClient,\n typeRegistry,\n exportSizeLimit,\n logger,\n }.exportSizeLimit", + "id": "def-server.SavedObjectsExporter.Unnamed.$1.savedObjectsClienttypeRegistryexportSizeLimitlogger.exportSizeLimit", "type": "number", "label": "exportSizeLimit", "description": [], @@ -4384,7 +4348,7 @@ }, { "tags": [], - "id": "def-server.SavedObjectsExporter.Unnamed.{\n- savedObjectsClient,\n typeRegistry,\n exportSizeLimit,\n logger,\n }.logger", + "id": "def-server.SavedObjectsExporter.Unnamed.$1.savedObjectsClienttypeRegistryexportSizeLimitlogger.logger", "type": "Object", "label": "logger", "description": [], @@ -4432,6 +4396,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsExporter.exportByTypes.$1", "type": "Object", "label": "options", "isRequired": true, @@ -4482,6 +4447,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsExporter.exportByObjects.$1", "type": "Object", "label": "options", "isRequired": true, @@ -4546,6 +4512,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsExportError.Unnamed.$1", "type": "string", "label": "type", "isRequired": true, @@ -4559,6 +4526,7 @@ } }, { + "id": "def-server.SavedObjectsExportError.Unnamed.$2", "type": "string", "label": "message", "isRequired": true, @@ -4572,6 +4540,7 @@ } }, { + "id": "def-server.SavedObjectsExportError.Unnamed.$3", "type": "Object", "label": "attributes", "isRequired": false, @@ -4610,6 +4579,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsExportError.exportSizeExceeded.$1", "type": "number", "label": "limit", "isRequired": true, @@ -4648,17 +4618,12 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsExportError.objectFetchError.$1", "type": "Array", "label": "objects", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "[]" ], "description": [], @@ -4695,17 +4660,12 @@ ], "children": [ { + "id": "def-server.SavedObjectsExportError.objectTransformError.$1", "type": "Array", "label": "objects", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "[]" ], "description": [], @@ -4715,6 +4675,7 @@ } }, { + "id": "def-server.SavedObjectsExportError.objectTransformError.$2", "type": "Object", "label": "cause", "isRequired": true, @@ -4755,6 +4716,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsExportError.invalidTransformError.$1", "type": "Array", "label": "objectKeys", "isRequired": true, @@ -4793,7 +4755,7 @@ "children": [ { "tags": [], - "id": "def-server.SavedObjectsImporter.#savedObjectsClient", + "id": "def-server.SavedObjectsImporter.savedObjectsClient", "type": "Object", "label": "#savedObjectsClient", "description": [], @@ -4810,12 +4772,12 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ] }, { "tags": [], - "id": "def-server.SavedObjectsImporter.#typeRegistry", + "id": "def-server.SavedObjectsImporter.typeRegistry", "type": "Object", "label": "#typeRegistry", "description": [], @@ -4837,7 +4799,7 @@ }, { "tags": [], - "id": "def-server.SavedObjectsImporter.#importSizeLimit", + "id": "def-server.SavedObjectsImporter.importSizeLimit", "type": "number", "label": "#importSizeLimit", "description": [], @@ -4848,7 +4810,7 @@ }, { "tags": [], - "id": "def-server.SavedObjectsImporter.#importHooks", + "id": "def-server.SavedObjectsImporter.importHooks", "type": "Object", "label": "#importHooks", "description": [], @@ -4878,7 +4840,7 @@ "description": [], "children": [ { - "id": "def-server.SavedObjectsImporter.Unnamed.{\n- savedObjectsClient,\n typeRegistry,\n importSizeLimit,\n }", + "id": "def-server.SavedObjectsImporter.Unnamed.$1.savedObjectsClienttypeRegistryimportSizeLimit", "type": "Object", "label": "{\n savedObjectsClient,\n typeRegistry,\n importSizeLimit,\n }", "tags": [], @@ -4886,7 +4848,7 @@ "children": [ { "tags": [], - "id": "def-server.SavedObjectsImporter.Unnamed.{\n- savedObjectsClient,\n typeRegistry,\n importSizeLimit,\n }.savedObjectsClient", + "id": "def-server.SavedObjectsImporter.Unnamed.$1.savedObjectsClienttypeRegistryimportSizeLimit.savedObjectsClient", "type": "Object", "label": "savedObjectsClient", "description": [], @@ -4903,12 +4865,12 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ] }, { "tags": [], - "id": "def-server.SavedObjectsImporter.Unnamed.{\n- savedObjectsClient,\n typeRegistry,\n importSizeLimit,\n }.typeRegistry", + "id": "def-server.SavedObjectsImporter.Unnamed.$1.savedObjectsClienttypeRegistryimportSizeLimit.typeRegistry", "type": "Object", "label": "typeRegistry", "description": [], @@ -4930,7 +4892,7 @@ }, { "tags": [], - "id": "def-server.SavedObjectsImporter.Unnamed.{\n- savedObjectsClient,\n typeRegistry,\n importSizeLimit,\n }.importSizeLimit", + "id": "def-server.SavedObjectsImporter.Unnamed.$1.savedObjectsClienttypeRegistryimportSizeLimit.importSizeLimit", "type": "number", "label": "importSizeLimit", "description": [], @@ -4981,6 +4943,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsImporter.import.$1", "type": "Object", "label": "{\n readStream,\n createNewCopies,\n namespace,\n overwrite,\n }", "isRequired": true, @@ -5037,6 +5000,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsImporter.resolveImportErrors.$1", "type": "Object", "label": "{\n readStream,\n createNewCopies,\n namespace,\n retries,\n }", "isRequired": true, @@ -5109,6 +5073,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsImportError.importSizeExceeded.$1", "type": "number", "label": "limit", "isRequired": true, @@ -5147,6 +5112,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsImportError.nonUniqueImportObjects.$1", "type": "Array", "label": "nonUniqueEntries", "isRequired": true, @@ -5185,6 +5151,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsImportError.nonUniqueRetryObjects.$1", "type": "Array", "label": "nonUniqueRetryObjects", "isRequired": true, @@ -5223,6 +5190,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsImportError.nonUniqueRetryDestinations.$1", "type": "Array", "label": "nonUniqueRetryDestinations", "isRequired": true, @@ -5261,17 +5229,12 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsImportError.referencesFetchError.$1", "type": "Array", "label": "objects", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "[]" ], "description": [], @@ -5318,13 +5281,7 @@ "text": "SavedObjectsCreateOptions" }, ") => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ], "description": [ @@ -5332,6 +5289,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.create.$1", "type": "string", "label": "type", "isRequired": true, @@ -5345,6 +5303,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.create.$2", "type": "Uncategorized", "label": "attributes", "isRequired": true, @@ -5358,6 +5317,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.create.$3", "type": "Object", "label": "options", "isRequired": true, @@ -5424,6 +5384,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.bulkCreate.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -5446,6 +5407,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.bulkCreate.$2", "type": "Object", "label": "options", "isRequired": true, @@ -5512,6 +5474,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.checkConflicts.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -5532,6 +5495,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.checkConflicts.$2", "type": "Object", "label": "options", "isRequired": true, @@ -5578,6 +5542,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.delete.$1", "type": "string", "label": "type", "isRequired": true, @@ -5591,6 +5556,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.delete.$2", "type": "string", "label": "id", "isRequired": true, @@ -5604,6 +5570,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.delete.$3", "type": "Object", "label": "options", "isRequired": true, @@ -5652,6 +5619,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.deleteByNamespace.$1", "type": "string", "label": "namespace", "isRequired": true, @@ -5665,6 +5633,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.deleteByNamespace.$2", "type": "Object", "label": "options", "isRequired": true, @@ -5719,6 +5688,7 @@ "description": [], "children": [ { + "id": "def-server.SavedObjectsRepository.find.$1", "type": "Object", "label": "options", "isRequired": true, @@ -5785,6 +5755,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.bulkGet.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -5807,6 +5778,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.bulkGet.$2", "type": "Object", "label": "options", "isRequired": true, @@ -5851,13 +5823,7 @@ "text": "SavedObjectsBaseOptions" }, ") => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ], "description": [ @@ -5865,6 +5831,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.get.$1", "type": "string", "label": "type", "isRequired": true, @@ -5878,6 +5845,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.get.$2", "type": "string", "label": "id", "isRequired": true, @@ -5891,6 +5859,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.get.$3", "type": "Object", "label": "options", "isRequired": true, @@ -5949,6 +5918,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.resolve.$1", "type": "string", "label": "type", "isRequired": true, @@ -5962,6 +5932,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.resolve.$2", "type": "string", "label": "id", "isRequired": true, @@ -5975,6 +5946,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.resolve.$3", "type": "Object", "label": "options", "isRequired": true, @@ -6033,6 +6005,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.update.$1", "type": "string", "label": "type", "isRequired": true, @@ -6046,6 +6019,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.update.$2", "type": "string", "label": "id", "isRequired": true, @@ -6059,6 +6033,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.update.$3", "type": "Object", "label": "attributes", "isRequired": true, @@ -6072,6 +6047,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.update.$4", "type": "Object", "label": "options", "isRequired": true, @@ -6128,6 +6104,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.addToNamespaces.$1", "type": "string", "label": "type", "isRequired": true, @@ -6141,6 +6118,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.addToNamespaces.$2", "type": "string", "label": "id", "isRequired": true, @@ -6154,6 +6132,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.addToNamespaces.$3", "type": "Array", "label": "namespaces", "isRequired": true, @@ -6167,6 +6146,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.addToNamespaces.$4", "type": "Object", "label": "options", "isRequired": true, @@ -6221,6 +6201,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.deleteFromNamespaces.$1", "type": "string", "label": "type", "isRequired": true, @@ -6234,6 +6215,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.deleteFromNamespaces.$2", "type": "string", "label": "id", "isRequired": true, @@ -6247,6 +6229,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.deleteFromNamespaces.$3", "type": "Array", "label": "namespaces", "isRequired": true, @@ -6260,6 +6243,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.deleteFromNamespaces.$4", "type": "Object", "label": "options", "isRequired": true, @@ -6322,6 +6306,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.bulkUpdate.$1", "type": "Array", "label": "objects", "isRequired": true, @@ -6344,6 +6329,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.bulkUpdate.$2", "type": "Object", "label": "options", "isRequired": true, @@ -6402,6 +6388,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.removeReferencesTo.$1", "type": "string", "label": "type", "isRequired": true, @@ -6415,6 +6402,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.removeReferencesTo.$2", "type": "string", "label": "id", "isRequired": true, @@ -6428,6 +6416,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.removeReferencesTo.$3", "type": "Object", "label": "options", "isRequired": true, @@ -6476,13 +6465,7 @@ "text": "SavedObjectsIncrementCounterOptions" }, ") => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ], "description": [ @@ -6490,6 +6473,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.incrementCounter.$1", "type": "string", "label": "type", "isRequired": true, @@ -6505,6 +6489,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.incrementCounter.$2", "type": "string", "label": "id", "isRequired": true, @@ -6520,6 +6505,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.incrementCounter.$3", "type": "Array", "label": "counterFields", "isRequired": true, @@ -6543,6 +6529,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.incrementCounter.$4", "type": "Object", "label": "options", "isRequired": true, @@ -6602,6 +6589,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.openPointInTimeForType.$1", "type": "CompoundType", "label": "type", "isRequired": true, @@ -6615,6 +6603,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.openPointInTimeForType.$2", "type": "Object", "label": "{ keepAlive = '5m', preference }", "isRequired": true, @@ -6673,6 +6662,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.closePointInTime.$1", "type": "string", "label": "id", "isRequired": true, @@ -6686,6 +6676,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.closePointInTime.$2", "type": "Object", "label": "options", "isRequired": false, @@ -6752,6 +6743,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsRepository.createPointInTimeFinder.$1", "type": "Object", "label": "findOptions", "isRequired": true, @@ -6773,6 +6765,7 @@ } }, { + "id": "def-server.SavedObjectsRepository.createPointInTimeFinder.$2", "type": "Object", "label": "dependencies", "isRequired": false, @@ -6846,6 +6839,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsSerializer.isRawSavedObject.$1", "type": "Object", "label": "doc", "isRequired": true, @@ -6867,6 +6861,7 @@ } }, { + "id": "def-server.SavedObjectsSerializer.isRawSavedObject.$2", "type": "Object", "label": "options", "isRequired": true, @@ -6931,6 +6926,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsSerializer.rawToSavedObject.$1", "type": "Object", "label": "doc", "isRequired": true, @@ -6952,6 +6948,7 @@ } }, { + "id": "def-server.SavedObjectsSerializer.rawToSavedObject.$2", "type": "Object", "label": "options", "isRequired": true, @@ -7007,6 +7004,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsSerializer.savedObjectToRaw.$1", "type": "CompoundType", "label": "savedObj", "isRequired": true, @@ -7048,6 +7046,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsSerializer.generateRawId.$1", "type": "string", "label": "namespace", "isRequired": false, @@ -7063,6 +7062,7 @@ } }, { + "id": "def-server.SavedObjectsSerializer.generateRawId.$2", "type": "string", "label": "type", "isRequired": true, @@ -7078,6 +7078,7 @@ } }, { + "id": "def-server.SavedObjectsSerializer.generateRawId.$3", "type": "string", "label": "id", "isRequired": true, @@ -7112,6 +7113,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsSerializer.generateRawLegacyUrlAliasId.$1", "type": "string", "label": "namespace", "isRequired": true, @@ -7127,6 +7129,7 @@ } }, { + "id": "def-server.SavedObjectsSerializer.generateRawLegacyUrlAliasId.$2", "type": "string", "label": "type", "isRequired": true, @@ -7142,6 +7145,7 @@ } }, { + "id": "def-server.SavedObjectsSerializer.generateRawLegacyUrlAliasId.$3", "type": "string", "label": "id", "isRequired": true, @@ -7185,6 +7189,7 @@ "type": "Function", "children": [ { + "id": "def-server.SavedObjectsUtils.namespaceIdToString.$1", "type": "string", "label": "namespace", "isRequired": false, @@ -7217,6 +7222,7 @@ "type": "Function", "children": [ { + "id": "def-server.SavedObjectsUtils.namespaceStringToId.$1", "type": "string", "label": "namespace", "isRequired": true, @@ -7249,6 +7255,7 @@ "type": "Function", "children": [ { + "id": "def-server.SavedObjectsUtils.createEmptyFindResponse.$1", "type": "Object", "label": "{\n page = FIND_DEFAULT_PAGE,\n perPage = FIND_DEFAULT_PER_PAGE,\n }", "isRequired": true, @@ -7344,6 +7351,7 @@ ], "children": [ { + "id": "def-server.SavedObjectsUtils.isRandomId.$1", "type": "string", "label": "id", "isRequired": false, @@ -7406,6 +7414,7 @@ ], "children": [ { + "id": "def-server.SavedObjectTypeRegistry.registerType.$1", "type": "Object", "label": "type", "isRequired": true, @@ -7452,6 +7461,7 @@ ], "children": [ { + "id": "def-server.SavedObjectTypeRegistry.getType.$1", "type": "string", "label": "type", "isRequired": true, @@ -7562,6 +7572,7 @@ ], "children": [ { + "id": "def-server.SavedObjectTypeRegistry.isNamespaceAgnostic.$1", "type": "string", "label": "type", "isRequired": true, @@ -7594,6 +7605,7 @@ ], "children": [ { + "id": "def-server.SavedObjectTypeRegistry.isSingleNamespace.$1", "type": "string", "label": "type", "isRequired": true, @@ -7626,6 +7638,7 @@ ], "children": [ { + "id": "def-server.SavedObjectTypeRegistry.isMultiNamespace.$1", "type": "string", "label": "type", "isRequired": true, @@ -7658,6 +7671,7 @@ ], "children": [ { + "id": "def-server.SavedObjectTypeRegistry.isShareable.$1", "type": "string", "label": "type", "isRequired": true, @@ -7690,6 +7704,7 @@ ], "children": [ { + "id": "def-server.SavedObjectTypeRegistry.isHidden.$1", "type": "string", "label": "type", "isRequired": true, @@ -7722,6 +7737,7 @@ ], "children": [ { + "id": "def-server.SavedObjectTypeRegistry.getIndex.$1", "type": "string", "label": "type", "isRequired": true, @@ -7754,6 +7770,7 @@ ], "children": [ { + "id": "def-server.SavedObjectTypeRegistry.isImportableAndExportable.$1", "type": "string", "label": "type", "isRequired": true, @@ -8248,13 +8265,7 @@ "lineNumber": 75 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[] | undefined" ] }, @@ -8271,13 +8282,7 @@ "lineNumber": 77 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectsMigrationVersion", - "text": "SavedObjectsMigrationVersion" - }, + "SavedObjectsMigrationVersion", " | undefined" ] }, @@ -8424,13 +8429,7 @@ "lineNumber": 125 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "[]" ] } @@ -8473,13 +8472,7 @@ "lineNumber": 310 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "[]" ] } @@ -8747,13 +8740,7 @@ }, "signature": [ "{ id: string; type: string; error: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectError", - "text": "SavedObjectError" - }, + "SavedObjectError", "; }[]" ] } @@ -8840,7 +8827,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ] }, { @@ -9205,13 +9192,7 @@ "lineNumber": 41 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectsMigrationVersion", - "text": "SavedObjectsMigrationVersion" - }, + "SavedObjectsMigrationVersion", " | undefined" ] }, @@ -9242,13 +9223,7 @@ "lineNumber": 52 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[] | undefined" ] }, @@ -9335,7 +9310,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">, \"find\" | \"openPointInTimeForType\" | \"closePointInTime\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">, \"find\" | \"openPointInTimeForType\" | \"closePointInTime\">" ] } ], @@ -11313,13 +11288,7 @@ "lineNumber": 115 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectsMigrationVersion", - "text": "SavedObjectsMigrationVersion" - }, + "SavedObjectsMigrationVersion", " | undefined" ] }, @@ -11652,13 +11621,7 @@ "lineNumber": 18 }, "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsRawDocSource", - "text": "SavedObjectsRawDocSource" - } + "SavedObjectsRawDocSource" ] }, { @@ -11869,7 +11832,7 @@ "section": "def-server.SavedObjectsRepository", "text": "SavedObjectsRepository" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"deleteByNamespace\" | \"incrementCounter\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"deleteByNamespace\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"incrementCounter\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" ] }, { @@ -11893,7 +11856,7 @@ "section": "def-server.SavedObjectsRepository", "text": "SavedObjectsRepository" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"deleteByNamespace\" | \"incrementCounter\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"deleteByNamespace\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"incrementCounter\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" ] } ], @@ -12021,13 +11984,7 @@ "lineNumber": 336 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "" ] }, @@ -12208,7 +12165,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ] }, { @@ -12240,7 +12197,7 @@ "section": "def-server.SavedObjectsRepository", "text": "SavedObjectsRepository" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"deleteByNamespace\" | \"incrementCounter\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"deleteByNamespace\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"incrementCounter\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" ] }, { @@ -12264,7 +12221,7 @@ "section": "def-server.SavedObjectsRepository", "text": "SavedObjectsRepository" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"deleteByNamespace\" | \"incrementCounter\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"deleteByNamespace\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"incrementCounter\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" ] }, { @@ -12311,7 +12268,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">) => Pick<", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">) => Pick<", { "pluginId": "core", "scope": "server", @@ -12343,7 +12300,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">) => Pick<", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">) => Pick<", { "pluginId": "core", "scope": "server", @@ -12678,13 +12635,7 @@ }, "signature": [ "((savedObject: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ") => string) | undefined" ] }, @@ -12702,13 +12653,7 @@ }, "signature": [ "((savedObject: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ") => string) | undefined" ] }, @@ -12726,13 +12671,7 @@ }, "signature": [ "((savedObject: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ") => { path: string; uiCapabilitiesPath: string; }) | undefined" ] }, @@ -12902,13 +12841,7 @@ "lineNumber": 213 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[] | undefined" ] }, @@ -12983,13 +12916,7 @@ "lineNumber": 328 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[] | undefined" ] } @@ -13056,7 +12983,7 @@ "lineNumber": 143 }, "signature": [ - "{ get: (type: string, id: string, options?: SavedObjectsBaseOptions) => Promise>; delete: (type: string, id: string, options?: SavedObjectsDeleteOptions) => Promise<{}>; create: (type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise>; find: (options: SavedObjectsFindOptions) => Promise>; update: (type: string, id: string, attributes: Partial, options?: SavedObjectsUpdateOptions) => Promise>; bulkCreate: (objects: SavedObjectsBulkCreateObject[], options?: SavedObjectsCreateOptions) => Promise>; bulkGet: (objects?: SavedObjectsBulkGetObject[], options?: SavedObjectsBaseOptions) => Promise>; bulkUpdate: (objects: SavedObjectsBulkUpdateObject[], options?: SavedObjectsBulkUpdateOptions) => Promise>; checkConflicts: (objects?: SavedObjectsCheckConflictsObject[], options?: SavedObjectsBaseOptions) => Promise; resolve: (type: string, id: string, options?: SavedObjectsBaseOptions) => Promise>; addToNamespaces: (type: string, id: string, namespaces: string[], options?: SavedObjectsAddToNamespacesOptions) => Promise; deleteFromNamespaces: (type: string, id: string, namespaces: string[], options?: SavedObjectsDeleteFromNamespacesOptions) => Promise; removeReferencesTo: (type: string, id: string, options?: SavedObjectsRemoveReferencesToOptions) => Promise; openPointInTimeForType: (type: string | string[], { keepAlive, preference }?: SavedObjectsOpenPointInTimeOptions) => Promise; closePointInTime: (id: string, options?: SavedObjectsBaseOptions | undefined) => Promise; createPointInTimeFinder: (findOptions: Pick, dependencies?: SavedObjectsCreatePointInTimeFinderDependencies | undefined) => ISavedObjectsPointInTimeFinder; deleteByNamespace: (namespace: string, options?: SavedObjectsDeleteByNamespaceOptions) => Promise; incrementCounter: (type: string, id: string, counterFields: (string | SavedObjectsIncrementCounterField)[], options?: SavedObjectsIncrementCounterOptions) => Promise>; }" + "{ get: (type: string, id: string, options?: SavedObjectsBaseOptions) => Promise>; delete: (type: string, id: string, options?: SavedObjectsDeleteOptions) => Promise<{}>; create: (type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise>; bulkCreate: (objects: SavedObjectsBulkCreateObject[], options?: SavedObjectsCreateOptions) => Promise>; checkConflicts: (objects?: SavedObjectsCheckConflictsObject[], options?: SavedObjectsBaseOptions) => Promise; deleteByNamespace: (namespace: string, options?: SavedObjectsDeleteByNamespaceOptions) => Promise; find: (options: SavedObjectsFindOptions) => Promise>; bulkGet: (objects?: SavedObjectsBulkGetObject[], options?: SavedObjectsBaseOptions) => Promise>; resolve: (type: string, id: string, options?: SavedObjectsBaseOptions) => Promise>; update: (type: string, id: string, attributes: Partial, options?: SavedObjectsUpdateOptions) => Promise>; addToNamespaces: (type: string, id: string, namespaces: string[], options?: SavedObjectsAddToNamespacesOptions) => Promise; deleteFromNamespaces: (type: string, id: string, namespaces: string[], options?: SavedObjectsDeleteFromNamespacesOptions) => Promise; bulkUpdate: (objects: SavedObjectsBulkUpdateObject[], options?: SavedObjectsBulkUpdateOptions) => Promise>; removeReferencesTo: (type: string, id: string, options?: SavedObjectsRemoveReferencesToOptions) => Promise; incrementCounter: (type: string, id: string, counterFields: (string | SavedObjectsIncrementCounterField)[], options?: SavedObjectsIncrementCounterOptions) => Promise>; openPointInTimeForType: (type: string | string[], { keepAlive, preference }?: SavedObjectsOpenPointInTimeOptions) => Promise; closePointInTime: (id: string, options?: SavedObjectsBaseOptions | undefined) => Promise; createPointInTimeFinder: (findOptions: Pick, dependencies?: SavedObjectsCreatePointInTimeFinderDependencies | undefined) => ISavedObjectsPointInTimeFinder; }" ], "initialIsOpen": false }, @@ -13191,29 +13118,29 @@ "section": "def-server.SavedObjectsCreateOptions", "text": "SavedObjectsCreateOptions" }, - " | undefined) => Promise>; find: (options: SavedObjectsFindOptions) => Promise<", + " | undefined) => Promise>; bulkCreate: (objects: ", { "pluginId": "core", "scope": "server", "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsFindResponse", - "text": "SavedObjectsFindResponse" + "section": "def-server.SavedObjectsBulkCreateObject", + "text": "SavedObjectsBulkCreateObject" }, - ">; update: (type: string, id: string, attributes: Partial, options?: ", + "[], options?: ", { "pluginId": "core", "scope": "server", "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateOptions", - "text": "SavedObjectsUpdateOptions" + "section": "def-server.SavedObjectsCreateOptions", + "text": "SavedObjectsCreateOptions" }, - ") => Promise<", + " | undefined) => Promise<", { "pluginId": "core", "scope": "server", "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateResponse", - "text": "SavedObjectsUpdateResponse" + "section": "def-server.SavedObjectsBulkResponse", + "text": "SavedObjectsBulkResponse" } ], "initialIsOpen": false @@ -13249,7 +13176,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ], "initialIsOpen": false }, @@ -13318,7 +13245,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ], "initialIsOpen": false }, diff --git a/api_docs/dashboard.json b/api_docs/dashboard.json index b14f24625ed6c..36091a64a414a 100644 --- a/api_docs/dashboard.json +++ b/api_docs/dashboard.json @@ -106,6 +106,7 @@ "description": [], "children": [ { + "id": "def-public.DashboardContainer.Unnamed.$1", "type": "Object", "label": "initialInput", "isRequired": true, @@ -125,17 +126,12 @@ } }, { + "id": "def-public.DashboardContainer.Unnamed.$2", "type": "Object", "label": "services", "isRequired": true, "signature": [ - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainerServices", - "text": "DashboardContainerServices" - } + "DashboardContainerServices" ], "description": [], "source": { @@ -144,6 +140,7 @@ } }, { + "id": "def-public.DashboardContainer.Unnamed.$3", "type": "Object", "label": "parent", "isRequired": false, @@ -217,25 +214,14 @@ "text": "EmbeddableFactory" }, ", partial?: Partial) => ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.DashboardPanelState", - "text": "DashboardPanelState" - } + "DashboardPanelState" ], "description": [], "children": [ { + "id": "def-public.DashboardContainer.createNewPanelState.$1", "type": "Object", "label": "factory", "isRequired": true, @@ -248,13 +234,7 @@ "text": "EmbeddableFactory" }, "" ], "description": [], @@ -264,6 +244,7 @@ } }, { + "id": "def-public.DashboardContainer.createNewPanelState.$2", "type": "Object", "label": "partial", "isRequired": true, @@ -290,13 +271,7 @@ "label": "showPlaceholderUntil", "signature": [ "(newStateComplete: Promise>>, placementMethod?: ", - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.PanelPlacementMethod", - "text": "PanelPlacementMethod" - }, + "PanelPlacementMethod", " | undefined, placementArgs?: TPlacementMethodArgs | undefined) => void" ], "description": [], "children": [ { + "id": "def-public.DashboardContainer.showPlaceholderUntil.$1", "type": "Object", "label": "newStateComplete", "isRequired": true, @@ -339,17 +309,12 @@ } }, { + "id": "def-public.DashboardContainer.showPlaceholderUntil.$2", "type": "Function", "label": "placementMethod", "isRequired": false, "signature": [ - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.PanelPlacementMethod", - "text": "PanelPlacementMethod" - }, + "PanelPlacementMethod", " | undefined" ], "description": [], @@ -359,6 +324,7 @@ } }, { + "id": "def-public.DashboardContainer.showPlaceholderUntil.$3", "type": "Uncategorized", "label": "placementArgs", "isRequired": false, @@ -385,13 +351,7 @@ "label": "replacePanel", "signature": [ "(previousPanelState: ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.DashboardPanelState", - "text": "DashboardPanelState" - }, + "DashboardPanelState", "<", { "pluginId": "embeddable", @@ -413,17 +373,12 @@ "description": [], "children": [ { + "id": "def-public.DashboardContainer.replacePanel.$1", "type": "Object", "label": "previousPanelState", "isRequired": true, "signature": [ - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.DashboardPanelState", - "text": "DashboardPanelState" - }, + "DashboardPanelState", "<", { "pluginId": "embeddable", @@ -441,6 +396,7 @@ } }, { + "id": "def-public.DashboardContainer.replacePanel.$2", "type": "Object", "label": "newPanelState", "isRequired": true, @@ -462,6 +418,7 @@ } }, { + "id": "def-public.DashboardContainer.replacePanel.$3", "type": "CompoundType", "label": "generateNewId", "isRequired": false, @@ -531,6 +488,7 @@ "description": [], "children": [ { + "id": "def-public.DashboardContainer.addOrUpdateEmbeddable.$1", "type": "string", "label": "type", "isRequired": true, @@ -544,6 +502,7 @@ } }, { + "id": "def-public.DashboardContainer.addOrUpdateEmbeddable.$2", "type": "Object", "label": "explicitInput", "isRequired": true, @@ -557,6 +516,7 @@ } }, { + "id": "def-public.DashboardContainer.addOrUpdateEmbeddable.$3", "type": "string", "label": "embeddableId", "isRequired": false, @@ -587,6 +547,7 @@ "description": [], "children": [ { + "id": "def-public.DashboardContainer.render.$1", "type": "Object", "label": "dom", "isRequired": true, @@ -613,17 +574,12 @@ "label": "getInheritedInput", "signature": [ "(id: string) => ", - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.InheritedChildInput", - "text": "InheritedChildInput" - } + "InheritedChildInput" ], "description": [], "children": [ { + "id": "def-public.DashboardContainer.getInheritedInput.$1", "type": "string", "label": "id", "isRequired": true, @@ -737,18 +693,13 @@ "description": [], "children": [ { + "id": "def-public.DashboardContainerFactoryDefinition.Unnamed.$1", "type": "Function", "label": "getStartServices", "isRequired": true, "signature": [ "() => Promise<", - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainerServices", - "text": "DashboardContainerServices" - }, + "DashboardContainerServices", ">" ], "description": [], @@ -826,6 +777,7 @@ "type": "Function", "children": [ { + "id": "def-public.DashboardContainerFactoryDefinition.create.$1", "type": "Object", "label": "initialInput", "isRequired": true, @@ -845,6 +797,7 @@ } }, { + "id": "def-public.DashboardContainerFactoryDefinition.create.$2", "type": "Object", "label": "parent", "isRequired": false, @@ -951,6 +904,7 @@ "description": [], "children": [ { + "id": "def-public.createDashboardEditUrl.$1", "type": "string", "label": "id", "isRequired": false, @@ -964,6 +918,7 @@ } }, { + "id": "def-public.createDashboardEditUrl.$2", "type": "CompoundType", "label": "editMode", "isRequired": false, @@ -990,6 +945,7 @@ "type": "Function", "children": [ { + "id": "def-public.createDashboardUrlGenerator.$1", "type": "Function", "label": "getStartServices", "isRequired": true, @@ -1078,13 +1034,7 @@ "lineNumber": 43 }, "signature": [ - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardCapabilities", - "text": "DashboardCapabilities" - }, + "DashboardCapabilities", " | undefined" ] }, @@ -1291,13 +1241,7 @@ }, "signature": [ "{ [panelId: string]: ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.DashboardPanelState", - "text": "DashboardPanelState" - }, + "DashboardPanelState", "<", { "pluginId": "embeddable", @@ -2105,11 +2049,102 @@ }, "server": { "classes": [], - "functions": [], + "functions": [ + { + "id": "def-server.findByValueEmbeddables", + "type": "Function", + "children": [ + { + "id": "def-server.findByValueEmbeddables.$1", + "type": "Object", + "label": "savedObjectClient", + "isRequired": true, + "signature": [ + "Pick, \"find\">" + ], + "description": [], + "source": { + "path": "src/plugins/dashboard/server/usage/find_by_value_embeddables.ts", + "lineNumber": 13 + } + }, + { + "id": "def-server.findByValueEmbeddables.$2", + "type": "string", + "label": "embeddableType", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "src/plugins/dashboard/server/usage/find_by_value_embeddables.ts", + "lineNumber": 14 + } + } + ], + "signature": [ + "(savedObjectClient: Pick, \"find\">, embeddableType: string) => Promise<{ [key: string]: unknown; }[]>" + ], + "description": [], + "label": "findByValueEmbeddables", + "source": { + "path": "src/plugins/dashboard/server/usage/find_by_value_embeddables.ts", + "lineNumber": 12 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + } + ], "interfaces": [], "enums": [], "misc": [], - "objects": [] + "objects": [], + "setup": { + "id": "def-server.DashboardPluginSetup", + "type": "Interface", + "label": "DashboardPluginSetup", + "description": [], + "tags": [], + "children": [], + "source": { + "path": "src/plugins/dashboard/server/types.ts", + "lineNumber": 10 + }, + "lifecycle": "setup", + "initialIsOpen": true + }, + "start": { + "id": "def-server.DashboardPluginStart", + "type": "Interface", + "label": "DashboardPluginStart", + "description": [], + "tags": [], + "children": [], + "source": { + "path": "src/plugins/dashboard/server/types.ts", + "lineNumber": 12 + }, + "lifecycle": "start", + "initialIsOpen": true + } }, "common": { "classes": [], @@ -2139,42 +2174,19 @@ "description": [], "children": [ { + "id": "def-common.migratePanelsTo730.$1", "type": "Array", "label": "panels", "isRequired": true, "signature": [ "(", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.RawSavedDashboardPanelTo60", - "text": "RawSavedDashboardPanelTo60" - }, + "RawSavedDashboardPanelTo60", " | ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.RawSavedDashboardPanel610", - "text": "RawSavedDashboardPanel610" - }, + "RawSavedDashboardPanel610", " | ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.RawSavedDashboardPanel620", - "text": "RawSavedDashboardPanel620" - }, + "RawSavedDashboardPanel620", " | Pick<", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.RawSavedDashboardPanel620", - "text": "RawSavedDashboardPanel620" - }, + "RawSavedDashboardPanel620", ", \"title\" | \"panelIndex\" | \"name\" | \"gridData\" | \"version\" | \"embeddableConfig\"> | ", { "pluginId": "dashboard", @@ -2191,6 +2203,7 @@ } }, { + "id": "def-common.migratePanelsTo730.$2", "type": "string", "label": "version", "isRequired": true, @@ -2204,6 +2217,7 @@ } }, { + "id": "def-common.migratePanelsTo730.$3", "type": "boolean", "label": "useMargins", "isRequired": true, @@ -2217,14 +2231,14 @@ } }, { - "id": "def-common.migratePanelsTo730.uiState", + "id": "def-common.migratePanelsTo730.$4.uiState", "type": "Object", "label": "uiState", "tags": [], "description": [], "children": [ { - "id": "def-common.migratePanelsTo730.uiState.Unnamed", + "id": "def-common.migratePanelsTo730.$4.uiState.Unnamed", "type": "Any", "label": "Unnamed", "tags": [], diff --git a/api_docs/dashboard.mdx b/api_docs/dashboard.mdx index 3c592a41e2f86..324a389713406 100644 --- a/api_docs/dashboard.mdx +++ b/api_docs/dashboard.mdx @@ -34,6 +34,17 @@ import dashboardObj from './dashboard.json'; ### Consts, variables and types +## Server + +### Setup + + +### Start + + +### Functions + + ## Common ### Functions diff --git a/api_docs/dashboard_enhanced.json b/api_docs/dashboard_enhanced.json index 31c54684e50a4..fc41872fc4dc6 100644 --- a/api_docs/dashboard_enhanced.json +++ b/api_docs/dashboard_enhanced.json @@ -53,6 +53,7 @@ "description": [], "children": [ { + "id": "def-public.AbstractDashboardDrilldown.Unnamed.$1", "type": "Object", "label": "params", "isRequired": true, @@ -130,6 +131,7 @@ "description": [], "children": [ { + "id": "def-public.AbstractDashboardDrilldown.getURL.$1", "type": "Object", "label": "config", "isRequired": true, @@ -149,6 +151,7 @@ } }, { + "id": "def-public.AbstractDashboardDrilldown.getURL.$2", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -279,6 +282,7 @@ "type": "Function", "children": [ { + "id": "def-public.AbstractDashboardDrilldown.isConfigValid.$1", "type": "Object", "label": "config", "isRequired": true, @@ -330,6 +334,7 @@ "type": "Function", "children": [ { + "id": "def-public.AbstractDashboardDrilldown.getHref.$1", "type": "Object", "label": "config", "isRequired": true, @@ -349,6 +354,7 @@ } }, { + "id": "def-public.AbstractDashboardDrilldown.getHref.$2", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -387,6 +393,7 @@ "type": "Function", "children": [ { + "id": "def-public.AbstractDashboardDrilldown.execute.$1", "type": "Object", "label": "config", "isRequired": true, @@ -406,6 +413,7 @@ } }, { + "id": "def-public.AbstractDashboardDrilldown.execute.$2", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -879,7 +887,7 @@ "type": "Function", "children": [ { - "id": "def-common.createExtract.{\n- drilldownId,\n}", + "id": "def-common.createExtract.$1.drilldownId", "type": "Object", "label": "{\n drilldownId,\n}", "tags": [], @@ -887,7 +895,7 @@ "children": [ { "tags": [], - "id": "def-common.createExtract.{\n- drilldownId,\n}.drilldownId", + "id": "def-common.createExtract.$1.drilldownId.drilldownId", "type": "string", "label": "drilldownId", "description": [], @@ -939,7 +947,7 @@ "type": "Function", "children": [ { - "id": "def-common.createInject.{\n- drilldownId,\n}", + "id": "def-common.createInject.$1.drilldownId", "type": "Object", "label": "{\n drilldownId,\n}", "tags": [], @@ -947,7 +955,7 @@ "children": [ { "tags": [], - "id": "def-common.createInject.{\n- drilldownId,\n}.drilldownId", + "id": "def-common.createInject.$1.drilldownId.drilldownId", "type": "string", "label": "drilldownId", "description": [], diff --git a/api_docs/dashboard_mode.json b/api_docs/dashboard_mode.json index dab407a79d7c8..1ad7905f9a65a 100644 --- a/api_docs/dashboard_mode.json +++ b/api_docs/dashboard_mode.json @@ -45,6 +45,7 @@ "description": [], "children": [ { + "id": "def-server.DashboardModeServerPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -90,6 +91,7 @@ "description": [], "children": [ { + "id": "def-server.DashboardModeServerPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -110,6 +112,7 @@ } }, { + "id": "def-server.DashboardModeServerPlugin.setup.$2", "type": "Object", "label": "{ security }", "isRequired": true, @@ -148,6 +151,7 @@ "description": [], "children": [ { + "id": "def-server.DashboardModeServerPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, diff --git a/api_docs/data.json b/api_docs/data.json index a51ad465fe903..629e2aee35eb9 100644 --- a/api_docs/data.json +++ b/api_docs/data.json @@ -29,6 +29,7 @@ ], "children": [ { + "id": "def-public.AggConfig.ensureIds.$1", "type": "Array", "label": "list", "isRequired": true, @@ -75,6 +76,7 @@ ], "children": [ { + "id": "def-public.AggConfig.nextId.$1", "type": "Array", "label": "list", "isRequired": true, @@ -221,6 +223,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfig.Unnamed.$1", "type": "Object", "label": "aggConfigs", "isRequired": true, @@ -240,18 +243,13 @@ } }, { + "id": "def-public.AggConfig.Unnamed.$2", "type": "Object", "label": "opts", "isRequired": true, "signature": [ "Pick & Pick<{ type: ", { "pluginId": "data", @@ -296,6 +294,7 @@ ], "children": [ { + "id": "def-public.AggConfig.setParams.$1", "type": "Any", "label": "from", "isRequired": true, @@ -330,6 +329,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfig.getParam.$1", "type": "string", "label": "key", "isRequired": true, @@ -368,6 +368,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfig.write.$1", "type": "Object", "label": "aggs", "isRequired": false, @@ -421,6 +422,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfig.createFilter.$1", "type": "string", "label": "key", "isRequired": true, @@ -434,6 +436,7 @@ } }, { + "id": "def-public.AggConfig.createFilter.$2", "type": "Object", "label": "params", "isRequired": true, @@ -482,6 +485,7 @@ ], "children": [ { + "id": "def-public.AggConfig.onSearchRequestStart.$1", "type": "Object", "label": "searchSource", "isRequired": true, @@ -503,6 +507,7 @@ } }, { + "id": "def-public.AggConfig.onSearchRequestStart.$2", "type": "Object", "label": "options", "isRequired": false, @@ -552,6 +557,7 @@ ], "children": [ { + "id": "def-public.AggConfig.toDsl.$1", "type": "Object", "label": "aggConfigs", "isRequired": false, @@ -591,13 +597,7 @@ "label": "serialize", "signature": [ "() => { type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; }" ], "description": [], @@ -617,13 +617,7 @@ "label": "toJSON", "signature": [ "() => { type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; }" ], "description": [], @@ -773,6 +767,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfig.getValue.$1", "type": "Any", "label": "bucket", "isRequired": true, @@ -803,6 +798,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfig.getKey.$1", "type": "Any", "label": "bucket", "isRequired": true, @@ -816,6 +812,7 @@ } }, { + "id": "def-public.AggConfig.getKey.$2", "type": "string", "label": "key", "isRequired": false, @@ -896,6 +893,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfig.makeLabel.$1", "type": "boolean", "label": "percentageMode", "isRequired": true, @@ -984,7 +982,7 @@ "type": "Function", "label": "fieldIsTimeField", "signature": [ - "() => boolean | \"\" | undefined" + "() => boolean" ], "description": [], "children": [], @@ -1003,7 +1001,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_config.ts", - "lineNumber": 448 + "lineNumber": 452 }, "signature": [ { @@ -1023,7 +1021,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_config.ts", - "lineNumber": 452 + "lineNumber": 456 }, "signature": [ { @@ -1053,6 +1051,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfig.setType.$1", "type": "Object", "label": "type", "isRequired": true, @@ -1068,7 +1067,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_config.ts", - "lineNumber": 482 + "lineNumber": 486 } } ], @@ -1076,7 +1075,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_config.ts", - "lineNumber": 482 + "lineNumber": 486 } } ], @@ -1134,6 +1133,20 @@ " | undefined" ] }, + { + "tags": [], + "id": "def-public.AggConfigs.timeFields", + "type": "Array", + "label": "timeFields", + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/agg_configs.ts", + "lineNumber": 67 + }, + "signature": [ + "string[] | undefined" + ] + }, { "tags": [], "id": "def-public.AggConfigs.aggs", @@ -1142,7 +1155,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 69 + "lineNumber": 70 }, "signature": [ { @@ -1165,6 +1178,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.Unnamed.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -1180,22 +1194,17 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 72 + "lineNumber": 73 } }, { + "id": "def-public.AggConfigs.Unnamed.$2", "type": "Array", "label": "configStates", "isRequired": true, "signature": [ "Pick & Pick<{ type: string | ", { "pluginId": "data", @@ -1217,10 +1226,11 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 73 + "lineNumber": 74 } }, { + "id": "def-public.AggConfigs.Unnamed.$3", "type": "Object", "label": "opts", "isRequired": true, @@ -1236,7 +1246,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 74 + "lineNumber": 75 } } ], @@ -1244,7 +1254,38 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 71 + "lineNumber": 72 + } + }, + { + "id": "def-public.AggConfigs.setTimeFields", + "type": "Function", + "label": "setTimeFields", + "signature": [ + "(timeFields: string[] | undefined) => void" + ], + "description": [], + "children": [ + { + "id": "def-public.AggConfigs.setTimeFields.$1", + "type": "Array", + "label": "timeFields", + "isRequired": false, + "signature": [ + "string[] | undefined" + ], + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/agg_configs.ts", + "lineNumber": 87 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "src/plugins/data/common/search/aggs/agg_configs.ts", + "lineNumber": 87 } }, { @@ -1265,6 +1306,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.setTimeRange.$1", "type": "Object", "label": "timeRange", "isRequired": true, @@ -1280,7 +1322,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 86 + "lineNumber": 91 } } ], @@ -1288,7 +1330,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 86 + "lineNumber": 91 } }, { @@ -1308,6 +1350,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.clone.$1", "type": "Object", "label": "{ enabledOnly = true }", "isRequired": true, @@ -1317,7 +1360,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 104 + "lineNumber": 109 } } ], @@ -1325,7 +1368,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 104 + "lineNumber": 109 } }, { @@ -1333,18 +1376,13 @@ "type": "Function", "children": [ { + "id": "def-public.AggConfigs.createAggConfig.$1", "type": "Object", "label": "params", "isRequired": true, "signature": [ "Pick & Pick<{ type: string | ", { "pluginId": "data", @@ -1366,10 +1404,11 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 118 + "lineNumber": 123 } }, { + "id": "def-public.AggConfigs.createAggConfig.$2", "type": "Object", "label": "{ addToAggConfigs = true }", "isRequired": true, @@ -1379,7 +1418,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 119 + "lineNumber": 124 } } ], @@ -1401,13 +1440,7 @@ "text": "AggConfig" }, ">(params: Pick & Pick<{ type: string | ", { "pluginId": "data", @@ -1429,7 +1462,7 @@ "label": "createAggConfig", "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 117 + "lineNumber": 122 }, "tags": [], "returnComment": [] @@ -1454,6 +1487,7 @@ ], "children": [ { + "id": "def-public.AggConfigs.jsonDataEquals.$1", "type": "Array", "label": "aggConfigs", "isRequired": true, @@ -1472,7 +1506,7 @@ ], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 160 + "lineNumber": 165 } } ], @@ -1480,7 +1514,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 160 + "lineNumber": 165 } }, { @@ -1493,6 +1527,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.toDsl.$1", "type": "boolean", "label": "hierarchical", "isRequired": true, @@ -1502,7 +1537,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 172 + "lineNumber": 177 } } ], @@ -1510,7 +1545,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 172 + "lineNumber": 177 } }, { @@ -1534,7 +1569,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 241 + "lineNumber": 246 } }, { @@ -1554,6 +1589,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.byIndex.$1", "type": "number", "label": "index", "isRequired": true, @@ -1563,7 +1599,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 245 + "lineNumber": 250 } } ], @@ -1571,7 +1607,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 245 + "lineNumber": 250 } }, { @@ -1592,6 +1628,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.byId.$1", "type": "string", "label": "id", "isRequired": true, @@ -1601,7 +1638,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 249 + "lineNumber": 254 } } ], @@ -1609,7 +1646,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 249 + "lineNumber": 254 } }, { @@ -1630,6 +1667,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.byName.$1", "type": "string", "label": "name", "isRequired": true, @@ -1639,7 +1677,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 253 + "lineNumber": 258 } } ], @@ -1647,7 +1685,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 253 + "lineNumber": 258 } }, { @@ -1668,6 +1706,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.byType.$1", "type": "string", "label": "type", "isRequired": true, @@ -1677,7 +1716,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 257 + "lineNumber": 262 } } ], @@ -1685,7 +1724,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 257 + "lineNumber": 262 } }, { @@ -1706,6 +1745,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.byTypeName.$1", "type": "string", "label": "type", "isRequired": true, @@ -1715,7 +1755,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 261 + "lineNumber": 266 } } ], @@ -1723,7 +1763,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 261 + "lineNumber": 266 } }, { @@ -1744,6 +1784,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.bySchemaName.$1", "type": "string", "label": "schema", "isRequired": true, @@ -1753,7 +1794,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 265 + "lineNumber": 270 } } ], @@ -1761,7 +1802,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 265 + "lineNumber": 270 } }, { @@ -1785,7 +1826,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 269 + "lineNumber": 274 } }, { @@ -1806,6 +1847,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.getRequestAggById.$1", "type": "string", "label": "id", "isRequired": true, @@ -1815,7 +1857,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 283 + "lineNumber": 288 } } ], @@ -1823,7 +1865,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 283 + "lineNumber": 288 } }, { @@ -1851,7 +1893,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 298 + "lineNumber": 303 } }, { @@ -1874,6 +1916,7 @@ ], "children": [ { + "id": "def-public.AggConfigs.getResponseAggById.$1", "type": "string", "label": "id", "isRequired": true, @@ -1885,7 +1928,7 @@ ], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 312 + "lineNumber": 317 } } ], @@ -1895,7 +1938,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 312 + "lineNumber": 317 } }, { @@ -1924,6 +1967,7 @@ "description": [], "children": [ { + "id": "def-public.AggConfigs.onSearchRequestStart.$1", "type": "Object", "label": "searchSource", "isRequired": true, @@ -1941,10 +1985,11 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 321 + "lineNumber": 326 } }, { + "id": "def-public.AggConfigs.onSearchRequestStart.$2", "type": "Object", "label": "options", "isRequired": false, @@ -1961,7 +2006,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 321 + "lineNumber": 326 } } ], @@ -1969,7 +2014,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 321 + "lineNumber": 326 } } ], @@ -2016,13 +2061,7 @@ }, "signature": [ "(agg: TAggConfig, state?: { type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined) => TAggConfig" ] }, @@ -2050,6 +2089,7 @@ "description": [], "children": [ { + "id": "def-public.AggParamType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -2129,6 +2169,7 @@ "description": [], "children": [ { + "id": "def-public.DataPublicPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -2170,13 +2211,7 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataPluginApi", - "section": "def-public.DataStartDependencies", - "text": "DataStartDependencies" - }, + "DataStartDependencies", ", ", { "pluginId": "data", @@ -2186,13 +2221,7 @@ "text": "DataPublicPluginStart" }, ">, { bfetch, expressions, uiActions, usageCollection, inspector }: ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataPluginApi", - "section": "def-public.DataSetupDependencies", - "text": "DataSetupDependencies" - }, + "DataSetupDependencies", ") => ", { "pluginId": "data", @@ -2205,6 +2234,7 @@ "description": [], "children": [ { + "id": "def-public.DataPublicPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -2217,13 +2247,7 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataPluginApi", - "section": "def-public.DataStartDependencies", - "text": "DataStartDependencies" - }, + "DataStartDependencies", ", ", { "pluginId": "data", @@ -2241,17 +2265,12 @@ } }, { + "id": "def-public.DataPublicPlugin.setup.$2", "type": "Object", "label": "{ bfetch, expressions, uiActions, usageCollection, inspector }", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataPluginApi", - "section": "def-public.DataSetupDependencies", - "text": "DataSetupDependencies" - } + "DataSetupDependencies" ], "description": [], "source": { @@ -2281,13 +2300,7 @@ "text": "CoreStart" }, ", { uiActions }: ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataPluginApi", - "section": "def-public.DataStartDependencies", - "text": "DataStartDependencies" - }, + "DataStartDependencies", ") => ", { "pluginId": "data", @@ -2300,6 +2313,7 @@ "description": [], "children": [ { + "id": "def-public.DataPublicPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -2319,17 +2333,12 @@ } }, { + "id": "def-public.DataPublicPlugin.start.$2", "type": "Object", "label": "{ uiActions }", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataPluginApi", - "section": "def-public.DataStartDependencies", - "text": "DataStartDependencies" - } + "DataStartDependencies" ], "description": [], "source": { @@ -2395,6 +2404,7 @@ "description": [], "children": [ { + "id": "def-public.DuplicateIndexPatternError.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -2490,13 +2500,7 @@ "lineNumber": 52 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatConvert", - "text": "FieldFormatConvert" - }, + "FieldFormatConvert", " | undefined" ] }, @@ -2514,13 +2518,7 @@ "lineNumber": 60 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.HtmlContextTypeConvert", - "text": "HtmlContextTypeConvert" - }, + "HtmlContextTypeConvert", " | undefined" ] }, @@ -2538,13 +2536,7 @@ "lineNumber": 68 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.TextContextTypeConvert", - "text": "TextContextTypeConvert" - }, + "TextContextTypeConvert", " | undefined" ] }, @@ -2624,17 +2616,12 @@ "description": [], "children": [ { + "id": "def-public.FieldFormat.Unnamed.$1", "type": "Object", "label": "_params", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.IFieldFormatMetaParams", - "text": "IFieldFormatMetaParams" - } + "IFieldFormatMetaParams" ], "description": [], "source": { @@ -2643,6 +2630,7 @@ } }, { + "id": "def-public.FieldFormat.Unnamed.$2", "type": "Function", "label": "getConfig", "isRequired": false, @@ -2684,13 +2672,7 @@ "text": "FieldFormatsContentType" }, ", options?: Record | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.HtmlContextTypeOptions", - "text": "HtmlContextTypeOptions" - }, + "HtmlContextTypeOptions", " | undefined) => string" ], "description": [ @@ -2698,6 +2680,7 @@ ], "children": [ { + "id": "def-public.FieldFormat.convert.$1", "type": "Any", "label": "value", "isRequired": true, @@ -2711,6 +2694,7 @@ } }, { + "id": "def-public.FieldFormat.convert.$2", "type": "CompoundType", "label": "contentType", "isRequired": true, @@ -2732,18 +2716,13 @@ } }, { + "id": "def-public.FieldFormat.convert.$3", "type": "CompoundType", "label": "options", "isRequired": false, "signature": [ "Record | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.HtmlContextTypeOptions", - "text": "HtmlContextTypeOptions" - }, + "HtmlContextTypeOptions", " | undefined" ], "description": [], @@ -2779,19 +2758,14 @@ "text": "FieldFormatsContentType" }, ") => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatConvertFunction", - "text": "FieldFormatConvertFunction" - } + "FieldFormatConvertFunction" ], "description": [ "\nGet a convert function that is bound to a specific contentType" ], "children": [ { + "id": "def-public.FieldFormat.getConverterFor.$1", "type": "CompoundType", "label": "contentType", "isRequired": true, @@ -2858,6 +2832,7 @@ ], "children": [ { + "id": "def-public.FieldFormat.param.$1", "type": "string", "label": "name", "isRequired": true, @@ -2943,17 +2918,12 @@ "description": [], "children": [ { + "id": "def-public.FieldFormat.from.$1", "type": "Function", "label": "convertFn", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatConvertFunction", - "text": "FieldFormatConvertFunction" - } + "FieldFormatConvertFunction" ], "description": [], "source": { @@ -2975,13 +2945,7 @@ "label": "setupContentType", "signature": [ "() => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatConvert", - "text": "FieldFormatConvert" - } + "FieldFormatConvert" ], "description": [], "children": [], @@ -3010,6 +2974,7 @@ "description": [], "children": [ { + "id": "def-public.FieldFormat.isInstanceOfFieldFormat.$1", "type": "Any", "label": "fieldFormat", "isRequired": true, @@ -3314,6 +3279,7 @@ "description": [], "children": [ { + "id": "def-public.IndexPattern.Unnamed.$1", "type": "Object", "label": "{\n spec = {},\n fieldFormats,\n shortDotsEnable = false,\n metaFields = [],\n }", "isRequired": true, @@ -3473,6 +3439,7 @@ ], "children": [ { + "id": "def-public.IndexPattern.addScriptedField.$1", "type": "string", "label": "name", "isRequired": true, @@ -3488,6 +3455,7 @@ } }, { + "id": "def-public.IndexPattern.addScriptedField.$2", "type": "string", "label": "script", "isRequired": true, @@ -3503,6 +3471,7 @@ } }, { + "id": "def-public.IndexPattern.addScriptedField.$3", "type": "string", "label": "fieldType", "isRequired": true, @@ -3535,6 +3504,7 @@ ], "children": [ { + "id": "def-public.IndexPattern.removeScriptedField.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -3677,6 +3647,7 @@ "description": [], "children": [ { + "id": "def-public.IndexPattern.getFieldByName.$1", "type": "string", "label": "name", "isRequired": true, @@ -3774,6 +3745,7 @@ ], "children": [ { + "id": "def-public.IndexPattern.getFormatterForField.$1", "type": "CompoundType", "label": "field", "isRequired": true, @@ -3836,6 +3808,7 @@ ], "children": [ { + "id": "def-public.IndexPattern.addRuntimeField.$1", "type": "string", "label": "name", "isRequired": true, @@ -3851,6 +3824,7 @@ } }, { + "id": "def-public.IndexPattern.addRuntimeField.$2", "type": "Object", "label": "runtimeField", "isRequired": true, @@ -3891,6 +3865,7 @@ ], "children": [ { + "id": "def-public.IndexPattern.removeRuntimeField.$1", "type": "string", "label": "name", "isRequired": true, @@ -3933,6 +3908,7 @@ ], "children": [ { + "id": "def-public.IndexPattern.getFormatterForFieldNoDefault.$1", "type": "string", "label": "fieldname", "isRequired": true, @@ -3971,6 +3947,7 @@ "description": [], "children": [ { + "id": "def-public.IndexPattern.setFieldAttrs.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -3984,6 +3961,7 @@ } }, { + "id": "def-public.IndexPattern.setFieldAttrs.$2", "type": "Uncategorized", "label": "attrName", "isRequired": true, @@ -3997,6 +3975,7 @@ } }, { + "id": "def-public.IndexPattern.setFieldAttrs.$3", "type": "Uncategorized", "label": "value", "isRequired": true, @@ -4034,6 +4013,7 @@ "description": [], "children": [ { + "id": "def-public.IndexPattern.setFieldCustomLabel.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -4047,6 +4027,7 @@ } }, { + "id": "def-public.IndexPattern.setFieldCustomLabel.$2", "type": "CompoundType", "label": "customLabel", "isRequired": false, @@ -4077,6 +4058,7 @@ "description": [], "children": [ { + "id": "def-public.IndexPattern.setFieldCount.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -4090,6 +4072,7 @@ } }, { + "id": "def-public.IndexPattern.setFieldCount.$2", "type": "CompoundType", "label": "count", "isRequired": false, @@ -4115,6 +4098,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPattern.setFieldFormat.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -4128,6 +4112,7 @@ } }, { + "id": "def-public.IndexPattern.setFieldFormat.$2", "type": "Object", "label": "format", "isRequired": true, @@ -4173,6 +4158,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPattern.deleteFieldFormat.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -4259,6 +4245,7 @@ "description": [], "children": [ { + "id": "def-public.IndexPatternField.Unnamed.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -4719,7 +4706,7 @@ "description": [], "children": [ { - "id": "def-public.IndexPatternField.toSpec.{\n- getFormatterForField,\n }", + "id": "def-public.IndexPatternField.toSpec.$1.getFormatterForField", "type": "Object", "label": "{\n getFormatterForField,\n }", "tags": [], @@ -4727,7 +4714,7 @@ "children": [ { "tags": [], - "id": "def-public.IndexPatternField.toSpec.{\n- getFormatterForField,\n }.getFormatterForField", + "id": "def-public.IndexPatternField.toSpec.$1.getFormatterForField.getFormatterForField", "type": "Function", "label": "getFormatterForField", "description": [], @@ -4810,13 +4797,7 @@ "lineNumber": 67 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.EnsureDefaultIndexPattern", - "text": "EnsureDefaultIndexPattern" - } + "EnsureDefaultIndexPattern" ] }, { @@ -4829,6 +4810,7 @@ "description": [], "children": [ { + "id": "def-public.IndexPatternsService.Unnamed.$1", "type": "Object", "label": "{\n uiSettings,\n savedObjectsClient,\n apiClient,\n fieldFormats,\n onNotification,\n onError,\n onRedirectNoIndexPattern = () => {},\n }", "isRequired": true, @@ -4854,6 +4836,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.getIds.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -4886,6 +4869,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.getTitles.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -4918,6 +4902,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.find.$1", "type": "string", "label": "search", "isRequired": true, @@ -4931,6 +4916,7 @@ } }, { + "id": "def-public.IndexPatternsService.find.$2", "type": "number", "label": "size", "isRequired": true, @@ -4973,6 +4959,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.getIdsWithTitle.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -5005,6 +4992,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.clearCache.$1", "type": "string", "label": "id", "isRequired": false, @@ -5038,21 +5026,9 @@ "children": [], "signature": [ "() => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.IndexPatternSavedObjectAttrs", - "text": "IndexPatternSavedObjectAttrs" - }, + "IndexPatternSavedObjectAttrs", ">[] | null | undefined>" ], "description": [], @@ -5095,6 +5071,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.setDefault.$1", "type": "string", "label": "id", "isRequired": true, @@ -5108,6 +5085,7 @@ } }, { + "id": "def-public.IndexPatternsService.setDefault.$2", "type": "boolean", "label": "force", "isRequired": true, @@ -5140,6 +5118,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.getFieldsForWildcard.$1", "type": "Object", "label": "options", "isRequired": true, @@ -5188,6 +5167,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.getFieldsForIndexPattern.$1", "type": "CompoundType", "label": "indexPattern", "isRequired": true, @@ -5215,6 +5195,7 @@ } }, { + "id": "def-public.IndexPatternsService.getFieldsForIndexPattern.$2", "type": "Object", "label": "options", "isRequired": false, @@ -5280,6 +5261,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.refreshFields.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -5326,6 +5308,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.fieldArrayToMap.$1", "type": "Array", "label": "fields", "isRequired": true, @@ -5346,6 +5329,7 @@ } }, { + "id": "def-public.IndexPatternsService.fieldArrayToMap.$2", "type": "Object", "label": "fieldAttrs", "isRequired": false, @@ -5411,17 +5395,12 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.savedObjectToSpec.$1", "type": "Object", "label": "savedObject", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", { "pluginId": "data", @@ -5441,13 +5420,7 @@ ], "signature": [ "(savedObject: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", { "pluginId": "data", @@ -5483,6 +5456,7 @@ "type": "Function", "children": [ { + "id": "def-public.IndexPatternsService.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -5546,6 +5520,7 @@ ], "children": [ { + "id": "def-public.IndexPatternsService.create.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -5565,6 +5540,7 @@ } }, { + "id": "def-public.IndexPatternsService.create.$2", "type": "boolean", "label": "skipFetchFields", "isRequired": true, @@ -5615,6 +5591,7 @@ ], "children": [ { + "id": "def-public.IndexPatternsService.createAndSave.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -5634,6 +5611,7 @@ } }, { + "id": "def-public.IndexPatternsService.createAndSave.$2", "type": "boolean", "label": "override", "isRequired": true, @@ -5649,6 +5627,7 @@ } }, { + "id": "def-public.IndexPatternsService.createAndSave.$3", "type": "boolean", "label": "skipFetchFields", "isRequired": true, @@ -5699,6 +5678,7 @@ ], "children": [ { + "id": "def-public.IndexPatternsService.createSavedObject.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -5718,6 +5698,7 @@ } }, { + "id": "def-public.IndexPatternsService.createSavedObject.$2", "type": "boolean", "label": "override", "isRequired": true, @@ -5760,6 +5741,7 @@ ], "children": [ { + "id": "def-public.IndexPatternsService.updateSavedObject.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -5775,10 +5757,11 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 548 + "lineNumber": 551 } }, { + "id": "def-public.IndexPatternsService.updateSavedObject.$2", "type": "number", "label": "saveAttempts", "isRequired": true, @@ -5788,10 +5771,11 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 549 + "lineNumber": 552 } }, { + "id": "def-public.IndexPatternsService.updateSavedObject.$3", "type": "boolean", "label": "ignoreErrors", "isRequired": true, @@ -5801,7 +5785,7 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 550 + "lineNumber": 553 } } ], @@ -5809,7 +5793,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 547 + "lineNumber": 550 } }, { @@ -5824,6 +5808,7 @@ ], "children": [ { + "id": "def-public.IndexPatternsService.delete.$1", "type": "string", "label": "indexPatternId", "isRequired": true, @@ -5835,7 +5820,7 @@ ], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 633 + "lineNumber": 636 } } ], @@ -5843,7 +5828,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 633 + "lineNumber": 636 } } ], @@ -5917,6 +5902,7 @@ "description": [], "children": [ { + "id": "def-public.OptionedParamType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -5977,6 +5963,7 @@ "description": [], "children": [ { + "id": "def-public.SearchSource.Unnamed.$1", "type": "Object", "label": "fields", "isRequired": true, @@ -5996,6 +5983,7 @@ } }, { + "id": "def-public.SearchSource.Unnamed.$2", "type": "Object", "label": "dependencies", "isRequired": true, @@ -6034,6 +6022,7 @@ ], "children": [ { + "id": "def-public.SearchSource.setPreferredSearchStrategyId.$1", "type": "string", "label": "searchStrategyId", "isRequired": true, @@ -6074,6 +6063,7 @@ ], "children": [ { + "id": "def-public.SearchSource.setField.$1", "type": "Uncategorized", "label": "field", "isRequired": true, @@ -6089,6 +6079,7 @@ } }, { + "id": "def-public.SearchSource.setField.$2", "type": "Uncategorized", "label": "value", "isRequired": true, @@ -6130,6 +6121,7 @@ ], "children": [ { + "id": "def-public.SearchSource.removeField.$1", "type": "Uncategorized", "label": "field", "isRequired": true, @@ -6172,6 +6164,7 @@ ], "children": [ { + "id": "def-public.SearchSource.setFields.$1", "type": "Object", "label": "newFields", "isRequired": true, @@ -6265,6 +6258,7 @@ ], "children": [ { + "id": "def-public.SearchSource.getField.$1", "type": "Uncategorized", "label": "field", "isRequired": true, @@ -6278,6 +6272,7 @@ } }, { + "id": "def-public.SearchSource.getField.$2", "type": "boolean", "label": "recurse", "isRequired": true, @@ -6318,6 +6313,7 @@ ], "children": [ { + "id": "def-public.SearchSource.getOwnField.$1", "type": "Uncategorized", "label": "field", "isRequired": true, @@ -6407,6 +6403,7 @@ ], "children": [ { + "id": "def-public.SearchSource.createChild.$1", "type": "Object", "label": "options", "isRequired": true, @@ -6455,6 +6452,7 @@ ], "children": [ { + "id": "def-public.SearchSource.setParent.$1", "type": "Object", "label": "parent", "isRequired": false, @@ -6478,6 +6476,7 @@ } }, { + "id": "def-public.SearchSource.setParent.$2", "type": "Object", "label": "options", "isRequired": true, @@ -6562,6 +6561,7 @@ ], "children": [ { + "id": "def-public.SearchSource.fetch$.$1", "type": "Object", "label": "options", "isRequired": true, @@ -6610,6 +6610,7 @@ ], "children": [ { + "id": "def-public.SearchSource.fetch.$1", "type": "Object", "label": "options", "isRequired": true, @@ -6666,6 +6667,7 @@ ], "children": [ { + "id": "def-public.SearchSource.onRequestStart.$1", "type": "Function", "label": "handler", "isRequired": true, @@ -6761,6 +6763,7 @@ ], "children": [ { + "id": "def-public.SearchSource.getSerializedFields.$1", "type": "boolean", "label": "recurse", "isRequired": true, @@ -6787,13 +6790,7 @@ "label": "serialize", "signature": [ "() => { searchSourceJSON: string; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ], "description": [ @@ -6823,6 +6820,7 @@ "type": "Function", "children": [ { + "id": "def-public.castEsToKbnFieldTypeName.$1", "type": "string", "label": "esType", "isRequired": true, @@ -6865,6 +6863,7 @@ "type": "Function", "children": [ { + "id": "def-public.extractReferences.$1", "type": "Object", "label": "state", "isRequired": true, @@ -6920,6 +6919,7 @@ "type": "Function", "children": [ { + "id": "def-public.fieldList.$1", "type": "Array", "label": "specs", "isRequired": true, @@ -6940,6 +6940,7 @@ } }, { + "id": "def-public.fieldList.$2", "type": "boolean", "label": "shortDotsEnable", "isRequired": true, @@ -7027,6 +7028,7 @@ "description": [], "children": [ { + "id": "def-public.getSearchParamsFromRequest.$1", "type": "Object", "label": "searchRequest", "isRequired": true, @@ -7040,7 +7042,7 @@ } }, { - "id": "def-public.getSearchParamsFromRequest.dependencies", + "id": "def-public.getSearchParamsFromRequest.$2.dependencies", "type": "Object", "label": "dependencies", "tags": [], @@ -7048,7 +7050,7 @@ "children": [ { "tags": [], - "id": "def-public.getSearchParamsFromRequest.dependencies.getConfig", + "id": "def-public.getSearchParamsFromRequest.$2.dependencies.getConfig", "type": "Function", "label": "getConfig", "description": [], @@ -7117,6 +7119,7 @@ "description": [], "children": [ { + "id": "def-public.getTime.$1", "type": "Object", "label": "indexPattern", "isRequired": false, @@ -7137,6 +7140,7 @@ } }, { + "id": "def-public.getTime.$2", "type": "Object", "label": "timeRange", "isRequired": true, @@ -7156,7 +7160,7 @@ } }, { - "id": "def-public.getTime.options", + "id": "def-public.getTime.$3.options", "type": "Object", "label": "options", "tags": [], @@ -7164,7 +7168,7 @@ "children": [ { "tags": [], - "id": "def-public.getTime.options.forceNow", + "id": "def-public.getTime.$3.options.forceNow", "type": "Object", "label": "forceNow", "description": [], @@ -7178,7 +7182,7 @@ }, { "tags": [], - "id": "def-public.getTime.options.fieldName", + "id": "def-public.getTime.$3.options.fieldName", "type": "string", "label": "fieldName", "description": [], @@ -7210,6 +7214,7 @@ "type": "Function", "children": [ { + "id": "def-public.injectReferences.$1", "type": "CompoundType", "label": "searchSourceFields", "isRequired": true, @@ -7230,17 +7235,12 @@ } }, { + "id": "def-public.injectReferences.$2", "type": "Array", "label": "references", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [], @@ -7285,6 +7285,7 @@ "type": "Function", "children": [ { + "id": "def-public.isCompleteResponse.$1", "type": "Object", "label": "response", "isRequired": false, @@ -7333,6 +7334,7 @@ "type": "Function", "children": [ { + "id": "def-public.isErrorResponse.$1", "type": "Object", "label": "response", "isRequired": false, @@ -7381,6 +7383,7 @@ "type": "Function", "children": [ { + "id": "def-public.isFilter.$1", "type": "Unknown", "label": "x", "isRequired": true, @@ -7419,6 +7422,7 @@ "type": "Function", "children": [ { + "id": "def-public.isFilters.$1", "type": "Unknown", "label": "x", "isRequired": true, @@ -7458,6 +7462,7 @@ "type": "Function", "children": [ { + "id": "def-public.isPartialResponse.$1", "type": "Object", "label": "response", "isRequired": false, @@ -7506,6 +7511,7 @@ "type": "Function", "children": [ { + "id": "def-public.isQuery.$1", "type": "Unknown", "label": "x", "isRequired": true, @@ -7544,6 +7550,7 @@ "type": "Function", "children": [ { + "id": "def-public.isTimeRange.$1", "type": "Unknown", "label": "x", "isRequired": true, @@ -7582,6 +7589,7 @@ "type": "Function", "children": [ { + "id": "def-public.parseSearchSourceJSON.$1", "type": "string", "label": "searchSourceJSON", "isRequired": true, @@ -7634,7 +7642,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 207 + "lineNumber": 196 }, "signature": [ "FunctionDefinition" @@ -7648,7 +7656,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 208 + "lineNumber": 197 }, "signature": [ "FunctionDefinition" @@ -7662,7 +7670,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 209 + "lineNumber": 198 }, "signature": [ "FunctionDefinition" @@ -7676,7 +7684,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 210 + "lineNumber": 199 }, "signature": [ "FunctionDefinition" @@ -7690,7 +7698,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 211 + "lineNumber": 200 }, "signature": [ "FunctionDefinition" @@ -7704,7 +7712,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 212 + "lineNumber": 201 }, "signature": [ "FunctionDefinition" @@ -7718,7 +7726,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 213 + "lineNumber": 202 }, "signature": [ "FunctionDefinition" @@ -7732,7 +7740,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 214 + "lineNumber": 203 }, "signature": [ "FunctionDefinition" @@ -7746,7 +7754,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 215 + "lineNumber": 204 }, "signature": [ "FunctionDefinition" @@ -7760,7 +7768,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 216 + "lineNumber": 205 }, "signature": [ "FunctionDefinition" @@ -7774,7 +7782,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 217 + "lineNumber": 206 }, "signature": [ "FunctionDefinition" @@ -7788,7 +7796,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 218 + "lineNumber": 207 }, "signature": [ "FunctionDefinition" @@ -7802,7 +7810,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 219 + "lineNumber": 208 }, "signature": [ "FunctionDefinition" @@ -7816,7 +7824,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 220 + "lineNumber": 209 }, "signature": [ "FunctionDefinition" @@ -7830,7 +7838,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 221 + "lineNumber": 210 }, "signature": [ "FunctionDefinition" @@ -7844,7 +7852,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 222 + "lineNumber": 211 }, "signature": [ "FunctionDefinition" @@ -7858,7 +7866,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 223 + "lineNumber": 212 }, "signature": [ "FunctionDefinition" @@ -7872,7 +7880,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 224 + "lineNumber": 213 }, "signature": [ "FunctionDefinition" @@ -7886,7 +7894,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 225 + "lineNumber": 214 }, "signature": [ "FunctionDefinition" @@ -7900,7 +7908,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 226 + "lineNumber": 215 }, "signature": [ "FunctionDefinition" @@ -7914,7 +7922,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 227 + "lineNumber": 216 }, "signature": [ "FunctionDefinition" @@ -7928,7 +7936,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 228 + "lineNumber": 217 }, "signature": [ "FunctionDefinition" @@ -7942,7 +7950,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 229 + "lineNumber": 218 }, "signature": [ "FunctionDefinition" @@ -7956,7 +7964,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 230 + "lineNumber": 219 }, "signature": [ "FunctionDefinition" @@ -7970,7 +7978,21 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 231 + "lineNumber": 220 + }, + "signature": [ + "FunctionDefinition" + ] + }, + { + "tags": [], + "id": "def-public.AggFunctionsMapping.aggSinglePercentile", + "type": "Object", + "label": "aggSinglePercentile", + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/types.ts", + "lineNumber": 221 }, "signature": [ "FunctionDefinition" @@ -7984,7 +8006,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 232 + "lineNumber": 222 }, "signature": [ "FunctionDefinition" @@ -7998,7 +8020,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 233 + "lineNumber": 223 }, "signature": [ "FunctionDefinition" @@ -8012,7 +8034,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 234 + "lineNumber": 224 }, "signature": [ "FunctionDefinition" @@ -8026,7 +8048,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 235 + "lineNumber": 225 }, "signature": [ "FunctionDefinition" @@ -8040,7 +8062,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 236 + "lineNumber": 226 }, "signature": [ "FunctionDefinition" @@ -8054,7 +8076,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 237 + "lineNumber": 227 }, "signature": [ "FunctionDefinition" @@ -8068,7 +8090,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 238 + "lineNumber": 228 }, "signature": [ "FunctionDefinition" @@ -8082,7 +8104,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 239 + "lineNumber": 229 }, "signature": [ "FunctionDefinition" @@ -8091,7 +8113,7 @@ ], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 206 + "lineNumber": 195 }, "initialIsOpen": false }, @@ -8142,6 +8164,7 @@ "description": [], "children": [ { + "id": "def-public.AggParamOption.enabled.$1", "type": "Object", "label": "agg", "isRequired": true, @@ -8259,13 +8282,7 @@ }, "signature": [ "({ data, negate, }: ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataPluginApi", - "section": "def-public.ValueClickDataContext", - "text": "ValueClickDataContext" - }, + "ValueClickDataContext", ") => Promise<", { "pluginId": "data", @@ -8289,13 +8306,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataPluginApi", - "section": "def-public.createFiltersFromRangeSelectAction", - "text": "createFiltersFromRangeSelectAction" - } + "createFiltersFromRangeSelectAction" ] } ], @@ -9298,6 +9309,7 @@ "description": [], "children": [ { + "id": "def-public.IIndexPatternFieldList.add.$1", "type": "Object", "label": "field", "isRequired": true, @@ -9366,6 +9378,7 @@ "description": [], "children": [ { + "id": "def-public.IIndexPatternFieldList.getByName.$1", "type": "string", "label": "name", "isRequired": true, @@ -9404,6 +9417,7 @@ "description": [], "children": [ { + "id": "def-public.IIndexPatternFieldList.getByType.$1", "type": "string", "label": "type", "isRequired": true, @@ -9442,6 +9456,7 @@ "description": [], "children": [ { + "id": "def-public.IIndexPatternFieldList.remove.$1", "type": "Object", "label": "field", "isRequired": true, @@ -9502,6 +9517,7 @@ "description": [], "children": [ { + "id": "def-public.IIndexPatternFieldList.replaceAll.$1", "type": "Array", "label": "specs", "isRequired": true, @@ -9547,6 +9563,7 @@ "description": [], "children": [ { + "id": "def-public.IIndexPatternFieldList.update.$1", "type": "Object", "label": "field", "isRequired": true, @@ -9622,7 +9639,7 @@ "description": [], "children": [ { - "id": "def-public.IIndexPatternFieldList.toSpec.options", + "id": "def-public.IIndexPatternFieldList.toSpec.$1.options", "type": "Object", "label": "options", "tags": [], @@ -9630,7 +9647,7 @@ "children": [ { "tags": [], - "id": "def-public.IIndexPatternFieldList.toSpec.options.getFormatterForField", + "id": "def-public.IIndexPatternFieldList.toSpec.$1.options.getFormatterForField", "type": "Function", "label": "getFormatterForField", "description": [], @@ -11420,10 +11437,18 @@ ], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 141 + "lineNumber": 129 }, "signature": [ - "{ calculateAutoTimeExpression: (range: TimeRange) => string | undefined; getDateMetaByDatatableColumn: (column: DatatableColumn) => Promise<{ timeZone: string; timeRange?: TimeRange | undefined; interval: string; } | undefined>; datatableUtilities: { getIndexPattern: (column: DatatableColumn) => Promise; getAggConfig: (column: DatatableColumn) => Promise; isFilterable: (column: DatatableColumn) => boolean; }; createAggConfigs: (indexPattern: IndexPattern, configStates?: Pick string | undefined; datatableUtilities: { getIndexPattern: (column: DatatableColumn) => Promise; getAggConfig: (column: DatatableColumn) => Promise; isFilterable: (column: DatatableColumn) => boolean; }; createAggConfigs: (indexPattern: IndexPattern, configStates?: Pick & Pick<{ type: string | ", { @@ -11523,6 +11548,54 @@ ], "initialIsOpen": false }, + { + "id": "def-public.EsdslExpressionFunctionDefinition", + "type": "Type", + "label": "EsdslExpressionFunctionDefinition", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/data/common/search/expressions/esdsl.ts", + "lineNumber": 29 + }, + "signature": [ + "ExpressionFunctionDefinition<\"esdsl\", ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_context\", ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.ExecutionContextSearch", + "text": "ExecutionContextSearch" + }, + "> | null, Arguments, Output, ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExecutionContext", + "text": "ExecutionContext" + }, + "<", + { + "pluginId": "inspector", + "scope": "common", + "docId": "kibInspectorPluginApi", + "section": "def-common.Adapters", + "text": "Adapters" + }, + ", ", + "SerializableState" + ], + "initialIsOpen": false + }, { "id": "def-public.EsQuerySortValue", "type": "Type", @@ -11538,6 +11611,21 @@ ], "initialIsOpen": false }, + { + "id": "def-public.EsRawResponseExpressionTypeDefinition", + "type": "Type", + "label": "EsRawResponseExpressionTypeDefinition", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/data/common/search/expressions/es_raw_response.ts", + "lineNumber": 57 + }, + "signature": [ + "ExpressionTypeDefinition<\"es_raw_response\", EsRawResponse, EsRawResponse>" + ], + "initialIsOpen": false + }, { "id": "def-public.ExecutionContextSearch", "type": "Type", @@ -11816,7 +11904,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 21 + "lineNumber": 24 }, "signature": [ "FieldParamType" @@ -11879,10 +11967,10 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 639 + "lineNumber": 642 }, "signature": [ - "{ get: (id: string) => Promise; delete: (indexPatternId: string) => Promise<{}>; create: (spec: IndexPatternSpec, skipFetchFields?: boolean) => Promise; ensureDefaultIndexPattern: EnsureDefaultIndexPattern; getIds: (refresh?: boolean) => Promise; getTitles: (refresh?: boolean) => Promise; find: (search: string, size?: number) => Promise; getIdsWithTitle: (refresh?: boolean) => Promise<{ id: string; title: string; }[]>; clearCache: (id?: string | undefined) => void; getCache: () => Promise[] | null | undefined>; getDefault: () => Promise; setDefault: (id: string, force?: boolean) => Promise; getFieldsForWildcard: (options: GetFieldsOptions) => Promise; getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise; refreshFields: (indexPattern: IndexPattern) => Promise; fieldArrayToMap: (fields: FieldSpec[], fieldAttrs?: FieldAttrs | undefined) => Record; savedObjectToSpec: (savedObject: SavedObject) => IndexPatternSpec; createAndSave: (spec: IndexPatternSpec, override?: boolean, skipFetchFields?: boolean) => Promise; createSavedObject: (indexPattern: IndexPattern, override?: boolean) => Promise; updateSavedObject: (indexPattern: IndexPattern, saveAttempts?: number, ignoreErrors?: boolean) => Promise; }" + "{ get: (id: string) => Promise; delete: (indexPatternId: string) => Promise<{}>; create: (spec: IndexPatternSpec, skipFetchFields?: boolean) => Promise; find: (search: string, size?: number) => Promise; ensureDefaultIndexPattern: EnsureDefaultIndexPattern; getIds: (refresh?: boolean) => Promise; getTitles: (refresh?: boolean) => Promise; getIdsWithTitle: (refresh?: boolean) => Promise<{ id: string; title: string; }[]>; clearCache: (id?: string | undefined) => void; getCache: () => Promise[] | null | undefined>; getDefault: () => Promise; setDefault: (id: string, force?: boolean) => Promise; getFieldsForWildcard: (options: GetFieldsOptions) => Promise; getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise; refreshFields: (indexPattern: IndexPattern) => Promise; fieldArrayToMap: (fields: FieldSpec[], fieldAttrs?: FieldAttrs | undefined) => Record; savedObjectToSpec: (savedObject: SavedObject) => IndexPatternSpec; createAndSave: (spec: IndexPatternSpec, override?: boolean, skipFetchFields?: boolean) => Promise; createSavedObject: (indexPattern: IndexPattern, override?: boolean) => Promise; updateSavedObject: (indexPattern: IndexPattern, saveAttempts?: number, ignoreErrors?: boolean) => Promise; }" ], "initialIsOpen": false }, @@ -12095,7 +12183,7 @@ "children": [ { "tags": [], - "id": "def-public.AggGroupLabels.[AggGroupNames.Buckets]", + "id": "def-public.AggGroupLabels.AggGroupNames.Buckets", "type": "string", "label": "[AggGroupNames.Buckets]", "description": [], @@ -12106,7 +12194,7 @@ }, { "tags": [], - "id": "def-public.AggGroupLabels.[AggGroupNames.Metrics]", + "id": "def-public.AggGroupLabels.AggGroupNames.Metrics", "type": "string", "label": "[AggGroupNames.Metrics]", "description": [], @@ -12117,7 +12205,7 @@ }, { "tags": [], - "id": "def-public.AggGroupLabels.[AggGroupNames.None]", + "id": "def-public.AggGroupLabels.AggGroupNames.None", "type": "string", "label": "[AggGroupNames.None]", "description": [], @@ -12167,13 +12255,7 @@ }, "signature": [ "(props: ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataUiPluginApi", - "section": "def-public.FilterLabelProps", - "text": "FilterLabelProps" - }, + "FilterLabelProps", ") => JSX.Element" ] }, @@ -12189,13 +12271,7 @@ }, "signature": [ "(props: ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataUiPluginApi", - "section": "def-public.FilterItemProps", - "text": "FilterItemProps" - }, + "FilterItemProps", ") => JSX.Element" ] }, @@ -12817,13 +12893,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.generateFilters", - "text": "generateFilters" - } + "generateFilters" ] }, { @@ -12868,13 +12938,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.changeTimeFilter", - "text": "changeTimeFilter" - } + "changeTimeFilter" ] }, { @@ -12889,13 +12953,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.convertRangeFilterToTimeRangeString", - "text": "convertRangeFilterToTimeRangeString" - } + "convertRangeFilterToTimeRangeString" ] }, { @@ -12940,13 +12998,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.extractTimeFilter", - "text": "extractTimeFilter" - } + "extractTimeFilter" ] }, { @@ -12961,13 +13013,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.extractTimeRange", - "text": "extractTimeRange" - } + "extractTimeRange" ] } ], @@ -12995,13 +13041,7 @@ "lineNumber": 124 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataPluginApi", - "section": "def-common.NodeTypes", - "text": "NodeTypes" - } + "NodeTypes" ] }, { @@ -13466,13 +13506,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-public.DateFormat", - "text": "DateFormat" - } + "DateFormat" ] }, { @@ -13487,13 +13521,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.DateNanosFormat", - "text": "DateNanosFormat" - } + "DateNanosFormat" ] }, { @@ -13867,13 +13895,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.validateIndexPattern", - "text": "validateIndexPattern" - } + "validateIndexPattern" ] }, { @@ -13888,13 +13910,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.flattenHitWrapper", - "text": "flattenHitWrapper" - } + "flattenHitWrapper" ] }, { @@ -13909,13 +13925,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.formatHitProvider", - "text": "formatHitProvider" - } + "formatHitProvider" ] } ], @@ -13945,7 +13955,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 405 + "lineNumber": 408 }, "signature": [ "typeof ", @@ -13966,7 +13976,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 406 + "lineNumber": 409 }, "signature": [ "typeof ", @@ -13987,7 +13997,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 407 + "lineNumber": 410 }, "signature": [ "({ display: string; val: string; enabled(agg: ", @@ -13998,7 +14008,7 @@ "section": "def-common.IBucketAggConfig", "text": "IBucketAggConfig" }, - "): boolean | \"\" | undefined; } | { display: string; val: string; })[]" + "): boolean; } | { display: string; val: string; })[]" ] }, { @@ -14009,7 +14019,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 408 + "lineNumber": 411 }, "signature": [ "typeof ", @@ -14030,7 +14040,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 409 + "lineNumber": 412 }, "signature": [ "typeof ", @@ -14051,7 +14061,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 410 + "lineNumber": 413 }, "signature": [ "typeof ", @@ -14072,7 +14082,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 411 + "lineNumber": 414 }, "signature": [ "typeof ", @@ -14093,7 +14103,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 412 + "lineNumber": 415 }, "signature": [ "(agg: ", @@ -14115,7 +14125,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 413 + "lineNumber": 416 }, "signature": [ "(agg: ", @@ -14137,7 +14147,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 414 + "lineNumber": 417 }, "signature": [ "(...types: string[]) => (agg: ", @@ -14159,7 +14169,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 415 + "lineNumber": 418 }, "signature": [ "typeof ", @@ -14180,7 +14190,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 416 + "lineNumber": 419 }, "signature": [ "typeof ", @@ -14201,7 +14211,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 417 + "lineNumber": 420 } }, { @@ -14212,7 +14222,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 418 + "lineNumber": 421 }, "signature": [ "typeof ", @@ -14233,7 +14243,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 419 + "lineNumber": 422 }, "signature": [ "typeof ", @@ -14254,7 +14264,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 420 + "lineNumber": 423 }, "signature": [ "typeof ", @@ -14275,7 +14285,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 421 + "lineNumber": 424 } }, { @@ -14286,7 +14296,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 422 + "lineNumber": 425 }, "signature": [ "string[]" @@ -14300,7 +14310,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 423 + "lineNumber": 426 }, "signature": [ "typeof ", @@ -14321,7 +14331,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 424 + "lineNumber": 427 }, "signature": [ "({ bound: number; interval: moment.Duration; boundLabel: string; intervalLabel: string; } | { bound: moment.Duration; interval: moment.Duration; boundLabel: string; intervalLabel: string; })[]" @@ -14335,7 +14345,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 425 + "lineNumber": 428 }, "signature": [ "(column: ", @@ -14348,13 +14358,43 @@ }, ") => number | undefined" ] + }, + { + "tags": [], + "id": "def-public.search.aggs.getDateHistogramMetaDataByDatatableColumn", + "type": "Function", + "label": "getDateHistogramMetaDataByDatatableColumn", + "description": [], + "source": { + "path": "src/plugins/data/public/index.ts", + "lineNumber": 429 + }, + "signature": [ + "(column: ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.DatatableColumn", + "text": "DatatableColumn" + }, + ") => { interval: string | undefined; timeZone: string | undefined; timeRange: ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataQueryPluginApi", + "section": "def-common.TimeRange", + "text": "TimeRange" + }, + " | undefined; } | undefined" + ] } ], "description": [], "label": "aggs", "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 404 + "lineNumber": 407 } }, { @@ -14365,7 +14405,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 427 + "lineNumber": 431 }, "signature": [ "typeof ", @@ -14386,7 +14426,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 428 + "lineNumber": 432 }, "signature": [ "typeof ", @@ -14407,7 +14447,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 429 + "lineNumber": 433 }, "signature": [ "typeof ", @@ -14428,7 +14468,7 @@ "description": [], "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 430 + "lineNumber": 434 }, "signature": [ "typeof ", @@ -14446,7 +14486,7 @@ "label": "search", "source": { "path": "src/plugins/data/public/index.ts", - "lineNumber": 403 + "lineNumber": 406 }, "initialIsOpen": false }, @@ -14458,7 +14498,7 @@ "description": [], "source": { "path": "src/plugins/data/common/constants.ts", - "lineNumber": 11 + "lineNumber": 12 }, "signature": [ "{ readonly META_FIELDS: \"metaFields\"; readonly DOC_HIGHLIGHT: \"doc_table:highlight\"; readonly QUERY_STRING_OPTIONS: \"query:queryString:options\"; readonly QUERY_ALLOW_LEADING_WILDCARDS: \"query:allowLeadingWildcards\"; readonly SEARCH_QUERY_LANGUAGE: \"search:queryLanguage\"; readonly SORT_OPTIONS: \"sort:options\"; readonly COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX: \"courier:ignoreFilterIfFieldNotInIndex\"; readonly COURIER_SET_REQUEST_PREFERENCE: \"courier:setRequestPreference\"; readonly COURIER_CUSTOM_REQUEST_PREFERENCE: \"courier:customRequestPreference\"; readonly COURIER_MAX_CONCURRENT_SHARD_REQUESTS: \"courier:maxConcurrentShardRequests\"; readonly COURIER_BATCH_SEARCHES: \"courier:batchSearches\"; readonly SEARCH_INCLUDE_FROZEN: \"search:includeFrozen\"; readonly SEARCH_TIMEOUT: \"search:timeout\"; readonly HISTOGRAM_BAR_TARGET: \"histogram:barTarget\"; readonly HISTOGRAM_MAX_BARS: \"histogram:maxBars\"; readonly HISTORY_LIMIT: \"history:limit\"; readonly SHORT_DOTS_ENABLE: \"shortDots:enable\"; readonly FORMAT_DEFAULT_TYPE_MAP: \"format:defaultTypeMap\"; readonly FORMAT_NUMBER_DEFAULT_PATTERN: \"format:number:defaultPattern\"; readonly FORMAT_PERCENT_DEFAULT_PATTERN: \"format:percent:defaultPattern\"; readonly FORMAT_BYTES_DEFAULT_PATTERN: \"format:bytes:defaultPattern\"; readonly FORMAT_CURRENCY_DEFAULT_PATTERN: \"format:currency:defaultPattern\"; readonly FORMAT_NUMBER_DEFAULT_LOCALE: \"format:number:defaultLocale\"; readonly TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: \"timepicker:refreshIntervalDefaults\"; readonly TIMEPICKER_QUICK_RANGES: \"timepicker:quickRanges\"; readonly TIMEPICKER_TIME_DEFAULTS: \"timepicker:timeDefaults\"; readonly INDEXPATTERN_PLACEHOLDER: \"indexPattern:placeholder\"; readonly FILTERS_PINNED_BY_DEFAULT: \"filters:pinnedByDefault\"; readonly FILTERS_EDITOR_SUGGEST_VALUES: \"filterEditor:suggestValues\"; readonly AUTOCOMPLETE_USE_TIMERANGE: \"autocomplete:useTimeRange\"; }" @@ -14548,32 +14588,20 @@ "source": { "path": "src/plugins/data/public/types.ts", "lineNumber": 49 - }, - "signature": [ - "{ filterManager: ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.FilterManager", - "text": "FilterManager" - }, - "; timefilter: ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.TimefilterSetup", - "text": "TimefilterSetup" - }, - "; queryString: Pick<", + }, + "signature": [ + "{ filterManager: ", { "pluginId": "data", "scope": "public", "docId": "kibDataQueryPluginApi", - "section": "def-public.QueryStringManager", - "text": "QueryStringManager" + "section": "def-public.FilterManager", + "text": "FilterManager" }, + "; timefilter: ", + "TimefilterSetup", + "; queryString: Pick<", + "QueryStringManager", ", \"getDefaultQuery\" | \"formatQuery\" | \"getUpdates$\" | \"getQuery\" | \"setQuery\" | \"clearQuery\">; state$: ", "Observable", "<{ changes: ", @@ -14647,13 +14675,7 @@ "text": "QuerySuggestionGetFn" }, "; hasQuerySuggestions: (language: string) => boolean; getValueSuggestions: ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataAutocompletePluginApi", - "section": "def-public.ValueSuggestionsGetFn", - "text": "ValueSuggestionsGetFn" - }, + "ValueSuggestionsGetFn", "; }" ] }, @@ -14678,7 +14700,7 @@ "section": "def-common.IndexPatternsService", "text": "IndexPatternsService" }, - ", \"get\" | \"delete\" | \"create\" | \"ensureDefaultIndexPattern\" | \"getIds\" | \"getTitles\" | \"find\" | \"getIdsWithTitle\" | \"clearCache\" | \"getCache\" | \"getDefault\" | \"setDefault\" | \"getFieldsForWildcard\" | \"getFieldsForIndexPattern\" | \"refreshFields\" | \"fieldArrayToMap\" | \"savedObjectToSpec\" | \"createAndSave\" | \"createSavedObject\" | \"updateSavedObject\">" + ", \"get\" | \"delete\" | \"create\" | \"find\" | \"ensureDefaultIndexPattern\" | \"getIds\" | \"getTitles\" | \"getIdsWithTitle\" | \"clearCache\" | \"getCache\" | \"getDefault\" | \"setDefault\" | \"getFieldsForWildcard\" | \"getFieldsForIndexPattern\" | \"refreshFields\" | \"fieldArrayToMap\" | \"savedObjectToSpec\" | \"createAndSave\" | \"createSavedObject\" | \"updateSavedObject\">" ] }, { @@ -14755,13 +14777,7 @@ "text": "FilterManager" }, "; queryString: Pick<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.QueryStringManager", - "text": "QueryStringManager" - }, + "QueryStringManager", ", \"getDefaultQuery\" | \"formatQuery\" | \"getUpdates$\" | \"getQuery\" | \"setQuery\" | \"clearQuery\">; savedQueries: ", { "pluginId": "data", @@ -14808,13 +14824,7 @@ }, "signature": [ "Pick, \"get\">" ] } @@ -14866,13 +14876,7 @@ }, "signature": [ "(agg: TAggConfig, state?: { type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined) => TAggConfig" ] }, @@ -14900,6 +14904,7 @@ "description": [], "children": [ { + "id": "def-server.AggParamType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -14979,6 +14984,7 @@ "description": [], "children": [ { + "id": "def-server.DataServerPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -14995,7 +15001,7 @@ "description": [], "source": { "path": "src/plugins/data/server/plugin.ts", - "lineNumber": 69 + "lineNumber": 71 } } ], @@ -15003,7 +15009,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/server/plugin.ts", - "lineNumber": 69 + "lineNumber": 71 } }, { @@ -15020,13 +15026,7 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataPluginApi", - "section": "def-server.DataPluginStartDependencies", - "text": "DataPluginStartDependencies" - }, + "DataPluginStartDependencies", ", ", { "pluginId": "data", @@ -15036,25 +15036,14 @@ "text": "DataPluginStart" }, ">, { bfetch, expressions, usageCollection }: ", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataPluginApi", - "section": "def-server.DataPluginSetupDependencies", - "text": "DataPluginSetupDependencies" - }, + "DataPluginSetupDependencies", ") => { __enhance: (enhancements: ", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataPluginApi", - "section": "def-server.DataEnhancements", - "text": "DataEnhancements" - } + "DataEnhancements" ], "description": [], "children": [ { + "id": "def-server.DataServerPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -15067,13 +15056,7 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataPluginApi", - "section": "def-server.DataPluginStartDependencies", - "text": "DataPluginStartDependencies" - }, + "DataPluginStartDependencies", ", ", { "pluginId": "data", @@ -15087,26 +15070,21 @@ "description": [], "source": { "path": "src/plugins/data/server/plugin.ts", - "lineNumber": 78 + "lineNumber": 80 } }, { + "id": "def-server.DataServerPlugin.setup.$2", "type": "Object", "label": "{ bfetch, expressions, usageCollection }", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataPluginApi", - "section": "def-server.DataPluginSetupDependencies", - "text": "DataPluginSetupDependencies" - } + "DataPluginSetupDependencies" ], "description": [], "source": { "path": "src/plugins/data/server/plugin.ts", - "lineNumber": 79 + "lineNumber": 81 } } ], @@ -15114,7 +15092,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/server/plugin.ts", - "lineNumber": 77 + "lineNumber": 79 } }, { @@ -15154,7 +15132,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">, elasticsearchClient: ", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">, elasticsearchClient: ", { "pluginId": "core", "scope": "server", @@ -15166,6 +15144,7 @@ "description": [], "children": [ { + "id": "def-server.DataServerPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -15181,7 +15160,7 @@ "description": [], "source": { "path": "src/plugins/data/server/plugin.ts", - "lineNumber": 104 + "lineNumber": 110 } } ], @@ -15189,7 +15168,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/server/plugin.ts", - "lineNumber": 104 + "lineNumber": 110 } }, { @@ -15205,13 +15184,13 @@ "returnComment": [], "source": { "path": "src/plugins/data/server/plugin.ts", - "lineNumber": 118 + "lineNumber": 124 } } ], "source": { "path": "src/plugins/data/server/plugin.ts", - "lineNumber": 52 + "lineNumber": 54 }, "initialIsOpen": false }, @@ -15492,6 +15471,7 @@ "description": [], "children": [ { + "id": "def-server.IndexPattern.Unnamed.$1", "type": "Object", "label": "{\n spec = {},\n fieldFormats,\n shortDotsEnable = false,\n metaFields = [],\n }", "isRequired": true, @@ -15651,6 +15631,7 @@ ], "children": [ { + "id": "def-server.IndexPattern.addScriptedField.$1", "type": "string", "label": "name", "isRequired": true, @@ -15666,6 +15647,7 @@ } }, { + "id": "def-server.IndexPattern.addScriptedField.$2", "type": "string", "label": "script", "isRequired": true, @@ -15681,6 +15663,7 @@ } }, { + "id": "def-server.IndexPattern.addScriptedField.$3", "type": "string", "label": "fieldType", "isRequired": true, @@ -15713,6 +15696,7 @@ ], "children": [ { + "id": "def-server.IndexPattern.removeScriptedField.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -15855,6 +15839,7 @@ "description": [], "children": [ { + "id": "def-server.IndexPattern.getFieldByName.$1", "type": "string", "label": "name", "isRequired": true, @@ -15952,6 +15937,7 @@ ], "children": [ { + "id": "def-server.IndexPattern.getFormatterForField.$1", "type": "CompoundType", "label": "field", "isRequired": true, @@ -16014,6 +16000,7 @@ ], "children": [ { + "id": "def-server.IndexPattern.addRuntimeField.$1", "type": "string", "label": "name", "isRequired": true, @@ -16029,6 +16016,7 @@ } }, { + "id": "def-server.IndexPattern.addRuntimeField.$2", "type": "Object", "label": "runtimeField", "isRequired": true, @@ -16069,6 +16057,7 @@ ], "children": [ { + "id": "def-server.IndexPattern.removeRuntimeField.$1", "type": "string", "label": "name", "isRequired": true, @@ -16111,6 +16100,7 @@ ], "children": [ { + "id": "def-server.IndexPattern.getFormatterForFieldNoDefault.$1", "type": "string", "label": "fieldname", "isRequired": true, @@ -16149,6 +16139,7 @@ "description": [], "children": [ { + "id": "def-server.IndexPattern.setFieldAttrs.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -16162,6 +16153,7 @@ } }, { + "id": "def-server.IndexPattern.setFieldAttrs.$2", "type": "Uncategorized", "label": "attrName", "isRequired": true, @@ -16175,6 +16167,7 @@ } }, { + "id": "def-server.IndexPattern.setFieldAttrs.$3", "type": "Uncategorized", "label": "value", "isRequired": true, @@ -16212,6 +16205,7 @@ "description": [], "children": [ { + "id": "def-server.IndexPattern.setFieldCustomLabel.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -16225,6 +16219,7 @@ } }, { + "id": "def-server.IndexPattern.setFieldCustomLabel.$2", "type": "CompoundType", "label": "customLabel", "isRequired": false, @@ -16255,6 +16250,7 @@ "description": [], "children": [ { + "id": "def-server.IndexPattern.setFieldCount.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -16268,6 +16264,7 @@ } }, { + "id": "def-server.IndexPattern.setFieldCount.$2", "type": "CompoundType", "label": "count", "isRequired": false, @@ -16293,6 +16290,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPattern.setFieldFormat.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -16306,6 +16304,7 @@ } }, { + "id": "def-server.IndexPattern.setFieldFormat.$2", "type": "Object", "label": "format", "isRequired": true, @@ -16351,6 +16350,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPattern.deleteFieldFormat.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -16401,13 +16401,7 @@ "lineNumber": 67 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.EnsureDefaultIndexPattern", - "text": "EnsureDefaultIndexPattern" - } + "EnsureDefaultIndexPattern" ] }, { @@ -16420,6 +16414,7 @@ "description": [], "children": [ { + "id": "def-server.IndexPatternsService.Unnamed.$1", "type": "Object", "label": "{\n uiSettings,\n savedObjectsClient,\n apiClient,\n fieldFormats,\n onNotification,\n onError,\n onRedirectNoIndexPattern = () => {},\n }", "isRequired": true, @@ -16445,6 +16440,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.getIds.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -16477,6 +16473,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.getTitles.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -16509,6 +16506,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.find.$1", "type": "string", "label": "search", "isRequired": true, @@ -16522,6 +16520,7 @@ } }, { + "id": "def-server.IndexPatternsService.find.$2", "type": "number", "label": "size", "isRequired": true, @@ -16564,6 +16563,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.getIdsWithTitle.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -16596,6 +16596,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.clearCache.$1", "type": "string", "label": "id", "isRequired": false, @@ -16629,21 +16630,9 @@ "children": [], "signature": [ "() => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.IndexPatternSavedObjectAttrs", - "text": "IndexPatternSavedObjectAttrs" - }, + "IndexPatternSavedObjectAttrs", ">[] | null | undefined>" ], "description": [], @@ -16686,6 +16675,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.setDefault.$1", "type": "string", "label": "id", "isRequired": true, @@ -16699,6 +16689,7 @@ } }, { + "id": "def-server.IndexPatternsService.setDefault.$2", "type": "boolean", "label": "force", "isRequired": true, @@ -16731,6 +16722,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.getFieldsForWildcard.$1", "type": "Object", "label": "options", "isRequired": true, @@ -16779,6 +16771,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.getFieldsForIndexPattern.$1", "type": "CompoundType", "label": "indexPattern", "isRequired": true, @@ -16806,6 +16799,7 @@ } }, { + "id": "def-server.IndexPatternsService.getFieldsForIndexPattern.$2", "type": "Object", "label": "options", "isRequired": false, @@ -16871,6 +16865,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.refreshFields.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -16917,6 +16912,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.fieldArrayToMap.$1", "type": "Array", "label": "fields", "isRequired": true, @@ -16937,6 +16933,7 @@ } }, { + "id": "def-server.IndexPatternsService.fieldArrayToMap.$2", "type": "Object", "label": "fieldAttrs", "isRequired": false, @@ -17002,17 +16999,12 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.savedObjectToSpec.$1", "type": "Object", "label": "savedObject", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", { "pluginId": "data", @@ -17032,13 +17024,7 @@ ], "signature": [ "(savedObject: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", { "pluginId": "data", @@ -17074,6 +17060,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -17137,6 +17124,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsService.create.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -17156,6 +17144,7 @@ } }, { + "id": "def-server.IndexPatternsService.create.$2", "type": "boolean", "label": "skipFetchFields", "isRequired": true, @@ -17206,6 +17195,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsService.createAndSave.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -17225,6 +17215,7 @@ } }, { + "id": "def-server.IndexPatternsService.createAndSave.$2", "type": "boolean", "label": "override", "isRequired": true, @@ -17240,6 +17231,7 @@ } }, { + "id": "def-server.IndexPatternsService.createAndSave.$3", "type": "boolean", "label": "skipFetchFields", "isRequired": true, @@ -17290,6 +17282,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsService.createSavedObject.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -17309,6 +17302,7 @@ } }, { + "id": "def-server.IndexPatternsService.createSavedObject.$2", "type": "boolean", "label": "override", "isRequired": true, @@ -17351,6 +17345,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsService.updateSavedObject.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -17366,10 +17361,11 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 548 + "lineNumber": 551 } }, { + "id": "def-server.IndexPatternsService.updateSavedObject.$2", "type": "number", "label": "saveAttempts", "isRequired": true, @@ -17379,10 +17375,11 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 549 + "lineNumber": 552 } }, { + "id": "def-server.IndexPatternsService.updateSavedObject.$3", "type": "boolean", "label": "ignoreErrors", "isRequired": true, @@ -17392,7 +17389,7 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 550 + "lineNumber": 553 } } ], @@ -17400,7 +17397,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 547 + "lineNumber": 550 } }, { @@ -17415,6 +17412,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsService.delete.$1", "type": "string", "label": "indexPatternId", "isRequired": true, @@ -17426,7 +17424,7 @@ ], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 633 + "lineNumber": 636 } } ], @@ -17434,7 +17432,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 633 + "lineNumber": 636 } } ], @@ -17462,13 +17460,7 @@ "lineNumber": 67 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.EnsureDefaultIndexPattern", - "text": "EnsureDefaultIndexPattern" - } + "EnsureDefaultIndexPattern" ] }, { @@ -17481,6 +17473,7 @@ "description": [], "children": [ { + "id": "def-server.IndexPatternsService.Unnamed.$1", "type": "Object", "label": "{\n uiSettings,\n savedObjectsClient,\n apiClient,\n fieldFormats,\n onNotification,\n onError,\n onRedirectNoIndexPattern = () => {},\n }", "isRequired": true, @@ -17506,6 +17499,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.getIds.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -17538,6 +17532,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.getTitles.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -17570,6 +17565,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.find.$1", "type": "string", "label": "search", "isRequired": true, @@ -17583,6 +17579,7 @@ } }, { + "id": "def-server.IndexPatternsService.find.$2", "type": "number", "label": "size", "isRequired": true, @@ -17625,6 +17622,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.getIdsWithTitle.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -17657,6 +17655,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.clearCache.$1", "type": "string", "label": "id", "isRequired": false, @@ -17690,21 +17689,9 @@ "children": [], "signature": [ "() => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.IndexPatternSavedObjectAttrs", - "text": "IndexPatternSavedObjectAttrs" - }, + "IndexPatternSavedObjectAttrs", ">[] | null | undefined>" ], "description": [], @@ -17747,6 +17734,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.setDefault.$1", "type": "string", "label": "id", "isRequired": true, @@ -17760,6 +17748,7 @@ } }, { + "id": "def-server.IndexPatternsService.setDefault.$2", "type": "boolean", "label": "force", "isRequired": true, @@ -17792,6 +17781,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.getFieldsForWildcard.$1", "type": "Object", "label": "options", "isRequired": true, @@ -17840,6 +17830,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.getFieldsForIndexPattern.$1", "type": "CompoundType", "label": "indexPattern", "isRequired": true, @@ -17867,6 +17858,7 @@ } }, { + "id": "def-server.IndexPatternsService.getFieldsForIndexPattern.$2", "type": "Object", "label": "options", "isRequired": false, @@ -17932,6 +17924,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.refreshFields.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -17978,6 +17971,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.fieldArrayToMap.$1", "type": "Array", "label": "fields", "isRequired": true, @@ -17998,6 +17992,7 @@ } }, { + "id": "def-server.IndexPatternsService.fieldArrayToMap.$2", "type": "Object", "label": "fieldAttrs", "isRequired": false, @@ -18063,17 +18058,12 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.savedObjectToSpec.$1", "type": "Object", "label": "savedObject", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", { "pluginId": "data", @@ -18093,13 +18083,7 @@ ], "signature": [ "(savedObject: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", { "pluginId": "data", @@ -18135,6 +18119,7 @@ "type": "Function", "children": [ { + "id": "def-server.IndexPatternsService.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -18198,6 +18183,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsService.create.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -18217,6 +18203,7 @@ } }, { + "id": "def-server.IndexPatternsService.create.$2", "type": "boolean", "label": "skipFetchFields", "isRequired": true, @@ -18267,6 +18254,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsService.createAndSave.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -18286,6 +18274,7 @@ } }, { + "id": "def-server.IndexPatternsService.createAndSave.$2", "type": "boolean", "label": "override", "isRequired": true, @@ -18301,6 +18290,7 @@ } }, { + "id": "def-server.IndexPatternsService.createAndSave.$3", "type": "boolean", "label": "skipFetchFields", "isRequired": true, @@ -18351,6 +18341,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsService.createSavedObject.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -18370,6 +18361,7 @@ } }, { + "id": "def-server.IndexPatternsService.createSavedObject.$2", "type": "boolean", "label": "override", "isRequired": true, @@ -18412,6 +18404,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsService.updateSavedObject.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -18427,10 +18420,11 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 548 + "lineNumber": 551 } }, { + "id": "def-server.IndexPatternsService.updateSavedObject.$2", "type": "number", "label": "saveAttempts", "isRequired": true, @@ -18440,10 +18434,11 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 549 + "lineNumber": 552 } }, { + "id": "def-server.IndexPatternsService.updateSavedObject.$3", "type": "boolean", "label": "ignoreErrors", "isRequired": true, @@ -18453,7 +18448,7 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 550 + "lineNumber": 553 } } ], @@ -18461,7 +18456,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 547 + "lineNumber": 550 } }, { @@ -18476,6 +18471,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsService.delete.$1", "type": "string", "label": "indexPatternId", "isRequired": true, @@ -18487,7 +18483,7 @@ ], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 633 + "lineNumber": 636 } } ], @@ -18495,7 +18491,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 633 + "lineNumber": 636 } } ], @@ -18569,6 +18565,7 @@ "description": [], "children": [ { + "id": "def-server.OptionedParamType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -18603,6 +18600,7 @@ "type": "Function", "children": [ { + "id": "def-server.castEsToKbnFieldTypeName.$1", "type": "string", "label": "esType", "isRequired": true, @@ -18674,6 +18672,7 @@ "description": [], "children": [ { + "id": "def-server.getTime.$1", "type": "Object", "label": "indexPattern", "isRequired": false, @@ -18694,6 +18693,7 @@ } }, { + "id": "def-server.getTime.$2", "type": "Object", "label": "timeRange", "isRequired": true, @@ -18713,7 +18713,7 @@ } }, { - "id": "def-server.getTime.options", + "id": "def-server.getTime.$3.options", "type": "Object", "label": "options", "tags": [], @@ -18721,7 +18721,7 @@ "children": [ { "tags": [], - "id": "def-server.getTime.options.forceNow", + "id": "def-server.getTime.$3.options.forceNow", "type": "Object", "label": "forceNow", "description": [], @@ -18735,7 +18735,7 @@ }, { "tags": [], - "id": "def-server.getTime.options.fieldName", + "id": "def-server.getTime.$3.options.fieldName", "type": "string", "label": "fieldName", "description": [], @@ -18772,6 +18772,7 @@ "description": [], "children": [ { + "id": "def-server.parseInterval.$1", "type": "string", "label": "interval", "isRequired": true, @@ -18812,7 +18813,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 207 + "lineNumber": 196 }, "signature": [ "FunctionDefinition" @@ -18826,7 +18827,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 208 + "lineNumber": 197 }, "signature": [ "FunctionDefinition" @@ -18840,7 +18841,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 209 + "lineNumber": 198 }, "signature": [ "FunctionDefinition" @@ -18854,7 +18855,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 210 + "lineNumber": 199 }, "signature": [ "FunctionDefinition" @@ -18868,7 +18869,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 211 + "lineNumber": 200 }, "signature": [ "FunctionDefinition" @@ -18882,7 +18883,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 212 + "lineNumber": 201 }, "signature": [ "FunctionDefinition" @@ -18896,7 +18897,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 213 + "lineNumber": 202 }, "signature": [ "FunctionDefinition" @@ -18910,7 +18911,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 214 + "lineNumber": 203 }, "signature": [ "FunctionDefinition" @@ -18924,7 +18925,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 215 + "lineNumber": 204 }, "signature": [ "FunctionDefinition" @@ -18938,7 +18939,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 216 + "lineNumber": 205 }, "signature": [ "FunctionDefinition" @@ -18952,7 +18953,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 217 + "lineNumber": 206 }, "signature": [ "FunctionDefinition" @@ -18966,7 +18967,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 218 + "lineNumber": 207 }, "signature": [ "FunctionDefinition" @@ -18980,7 +18981,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 219 + "lineNumber": 208 }, "signature": [ "FunctionDefinition" @@ -18994,7 +18995,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 220 + "lineNumber": 209 }, "signature": [ "FunctionDefinition" @@ -19008,7 +19009,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 221 + "lineNumber": 210 }, "signature": [ "FunctionDefinition" @@ -19022,7 +19023,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 222 + "lineNumber": 211 }, "signature": [ "FunctionDefinition" @@ -19036,7 +19037,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 223 + "lineNumber": 212 }, "signature": [ "FunctionDefinition" @@ -19050,7 +19051,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 224 + "lineNumber": 213 }, "signature": [ "FunctionDefinition" @@ -19064,7 +19065,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 225 + "lineNumber": 214 }, "signature": [ "FunctionDefinition" @@ -19078,7 +19079,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 226 + "lineNumber": 215 }, "signature": [ "FunctionDefinition" @@ -19092,7 +19093,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 227 + "lineNumber": 216 }, "signature": [ "FunctionDefinition" @@ -19106,7 +19107,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 228 + "lineNumber": 217 }, "signature": [ "FunctionDefinition" @@ -19120,7 +19121,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 229 + "lineNumber": 218 }, "signature": [ "FunctionDefinition" @@ -19134,7 +19135,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 230 + "lineNumber": 219 }, "signature": [ "FunctionDefinition" @@ -19148,7 +19149,21 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 231 + "lineNumber": 220 + }, + "signature": [ + "FunctionDefinition" + ] + }, + { + "tags": [], + "id": "def-server.AggFunctionsMapping.aggSinglePercentile", + "type": "Object", + "label": "aggSinglePercentile", + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/types.ts", + "lineNumber": 221 }, "signature": [ "FunctionDefinition" @@ -19162,7 +19177,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 232 + "lineNumber": 222 }, "signature": [ "FunctionDefinition" @@ -19176,7 +19191,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 233 + "lineNumber": 223 }, "signature": [ "FunctionDefinition" @@ -19190,7 +19205,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 234 + "lineNumber": 224 }, "signature": [ "FunctionDefinition" @@ -19204,7 +19219,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 235 + "lineNumber": 225 }, "signature": [ "FunctionDefinition" @@ -19218,7 +19233,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 236 + "lineNumber": 226 }, "signature": [ "FunctionDefinition" @@ -19232,7 +19247,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 237 + "lineNumber": 227 }, "signature": [ "FunctionDefinition" @@ -19246,7 +19261,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 238 + "lineNumber": 228 }, "signature": [ "FunctionDefinition" @@ -19260,7 +19275,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 239 + "lineNumber": 229 }, "signature": [ "FunctionDefinition" @@ -19269,7 +19284,7 @@ ], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 206 + "lineNumber": 195 }, "initialIsOpen": false }, @@ -19320,6 +19335,7 @@ "description": [], "children": [ { + "id": "def-server.AggParamOption.enabled.$1", "type": "Object", "label": "agg", "isRequired": true, @@ -20678,7 +20694,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 21 + "lineNumber": 24 }, "signature": [ "FieldParamType" @@ -20802,7 +20818,7 @@ "children": [ { "tags": [], - "id": "def-server.AggGroupLabels.[AggGroupNames.Buckets]", + "id": "def-server.AggGroupLabels.AggGroupNames.Buckets", "type": "string", "label": "[AggGroupNames.Buckets]", "description": [], @@ -20813,7 +20829,7 @@ }, { "tags": [], - "id": "def-server.AggGroupLabels.[AggGroupNames.Metrics]", + "id": "def-server.AggGroupLabels.AggGroupNames.Metrics", "type": "string", "label": "[AggGroupNames.Metrics]", "description": [], @@ -20824,7 +20840,7 @@ }, { "tags": [], - "id": "def-server.AggGroupLabels.[AggGroupNames.None]", + "id": "def-server.AggGroupLabels.AggGroupNames.None", "type": "string", "label": "[AggGroupNames.None]", "description": [], @@ -21149,13 +21165,7 @@ "lineNumber": 65 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataPluginApi", - "section": "def-common.NodeTypes", - "text": "NodeTypes" - } + "NodeTypes" ] }, { @@ -21858,7 +21868,7 @@ "section": "def-common.IBucketAggConfig", "text": "IBucketAggConfig" }, - "): boolean | \"\" | undefined; } | { display: string; val: string; })[]" + "): boolean; } | { display: string; val: string; })[]" ] }, { @@ -22282,7 +22292,7 @@ "description": [], "source": { "path": "src/plugins/data/common/constants.ts", - "lineNumber": 11 + "lineNumber": 12 }, "signature": [ "{ readonly META_FIELDS: \"metaFields\"; readonly DOC_HIGHLIGHT: \"doc_table:highlight\"; readonly QUERY_STRING_OPTIONS: \"query:queryString:options\"; readonly QUERY_ALLOW_LEADING_WILDCARDS: \"query:allowLeadingWildcards\"; readonly SEARCH_QUERY_LANGUAGE: \"search:queryLanguage\"; readonly SORT_OPTIONS: \"sort:options\"; readonly COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX: \"courier:ignoreFilterIfFieldNotInIndex\"; readonly COURIER_SET_REQUEST_PREFERENCE: \"courier:setRequestPreference\"; readonly COURIER_CUSTOM_REQUEST_PREFERENCE: \"courier:customRequestPreference\"; readonly COURIER_MAX_CONCURRENT_SHARD_REQUESTS: \"courier:maxConcurrentShardRequests\"; readonly COURIER_BATCH_SEARCHES: \"courier:batchSearches\"; readonly SEARCH_INCLUDE_FROZEN: \"search:includeFrozen\"; readonly SEARCH_TIMEOUT: \"search:timeout\"; readonly HISTOGRAM_BAR_TARGET: \"histogram:barTarget\"; readonly HISTOGRAM_MAX_BARS: \"histogram:maxBars\"; readonly HISTORY_LIMIT: \"history:limit\"; readonly SHORT_DOTS_ENABLE: \"shortDots:enable\"; readonly FORMAT_DEFAULT_TYPE_MAP: \"format:defaultTypeMap\"; readonly FORMAT_NUMBER_DEFAULT_PATTERN: \"format:number:defaultPattern\"; readonly FORMAT_PERCENT_DEFAULT_PATTERN: \"format:percent:defaultPattern\"; readonly FORMAT_BYTES_DEFAULT_PATTERN: \"format:bytes:defaultPattern\"; readonly FORMAT_CURRENCY_DEFAULT_PATTERN: \"format:currency:defaultPattern\"; readonly FORMAT_NUMBER_DEFAULT_LOCALE: \"format:number:defaultLocale\"; readonly TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: \"timepicker:refreshIntervalDefaults\"; readonly TIMEPICKER_QUICK_RANGES: \"timepicker:quickRanges\"; readonly TIMEPICKER_TIME_DEFAULTS: \"timepicker:timeDefaults\"; readonly INDEXPATTERN_PLACEHOLDER: \"indexPattern:placeholder\"; readonly FILTERS_PINNED_BY_DEFAULT: \"filters:pinnedByDefault\"; readonly FILTERS_EDITOR_SUGGEST_VALUES: \"filterEditor:suggestValues\"; readonly AUTOCOMPLETE_USE_TIMERANGE: \"autocomplete:useTimeRange\"; }" @@ -22329,13 +22339,7 @@ }, "signature": [ "{ register: (customFieldFormat: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatInstanceType", - "text": "FieldFormatInstanceType" - }, + "FieldFormatInstanceType", ") => number; }" ] } @@ -22432,13 +22436,7 @@ "lineNumber": 40 }, "signature": [ - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-server.IndexPatternsServiceStart", - "text": "IndexPatternsServiceStart" - } + "IndexPatternsServiceStart" ] } ], @@ -22524,6 +22522,7 @@ "description": [], "children": [ { + "id": "def-common.KbnFieldType.Unnamed.$1", "type": "Object", "label": "options", "isRequired": true, @@ -22597,6 +22596,7 @@ "description": [], "children": [ { + "id": "def-common.KQLSyntaxError.Unnamed.$1", "type": "Object", "label": "error", "isRequired": true, @@ -22610,6 +22610,7 @@ } }, { + "id": "def-common.KQLSyntaxError.Unnamed.$2", "type": "Any", "label": "expression", "isRequired": true, @@ -22664,6 +22665,7 @@ "description": [], "children": [ { + "id": "def-common.buildCustomFilter.$1", "type": "string", "label": "indexPatternString", "isRequired": true, @@ -22677,6 +22679,7 @@ } }, { + "id": "def-common.buildCustomFilter.$2", "type": "Any", "label": "queryDsl", "isRequired": true, @@ -22690,6 +22693,7 @@ } }, { + "id": "def-common.buildCustomFilter.$3", "type": "boolean", "label": "disabled", "isRequired": true, @@ -22703,6 +22707,7 @@ } }, { + "id": "def-common.buildCustomFilter.$4", "type": "boolean", "label": "negate", "isRequired": true, @@ -22716,6 +22721,7 @@ } }, { + "id": "def-common.buildCustomFilter.$5", "type": "CompoundType", "label": "alias", "isRequired": false, @@ -22729,6 +22735,7 @@ } }, { + "id": "def-common.buildCustomFilter.$6", "type": "Enum", "label": "store", "isRequired": true, @@ -22761,6 +22768,7 @@ "type": "Function", "children": [ { + "id": "def-common.buildEmptyFilter.$1", "type": "boolean", "label": "isPinned", "isRequired": true, @@ -22774,6 +22782,7 @@ } }, { + "id": "def-common.buildEmptyFilter.$2", "type": "string", "label": "index", "isRequired": false, @@ -22856,6 +22865,7 @@ "description": [], "children": [ { + "id": "def-common.buildEsQuery.$1", "type": "Object", "label": "indexPattern", "isRequired": false, @@ -22876,6 +22886,7 @@ } }, { + "id": "def-common.buildEsQuery.$2", "type": "CompoundType", "label": "queries", "isRequired": true, @@ -22906,6 +22917,7 @@ } }, { + "id": "def-common.buildEsQuery.$3", "type": "CompoundType", "label": "filters", "isRequired": true, @@ -22936,6 +22948,7 @@ } }, { + "id": "def-common.buildEsQuery.$4", "type": "Object", "label": "config", "isRequired": true, @@ -22970,6 +22983,7 @@ "type": "Function", "children": [ { + "id": "def-common.buildExistsFilter.$1", "type": "Object", "label": "field", "isRequired": true, @@ -22989,6 +23003,7 @@ } }, { + "id": "def-common.buildExistsFilter.$2", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -23093,6 +23108,7 @@ "description": [], "children": [ { + "id": "def-common.buildFilter.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -23112,6 +23128,7 @@ } }, { + "id": "def-common.buildFilter.$2", "type": "Object", "label": "field", "isRequired": true, @@ -23131,6 +23148,7 @@ } }, { + "id": "def-common.buildFilter.$3", "type": "Enum", "label": "type", "isRequired": true, @@ -23150,6 +23168,7 @@ } }, { + "id": "def-common.buildFilter.$4", "type": "boolean", "label": "negate", "isRequired": true, @@ -23163,6 +23182,7 @@ } }, { + "id": "def-common.buildFilter.$5", "type": "boolean", "label": "disabled", "isRequired": true, @@ -23176,6 +23196,7 @@ } }, { + "id": "def-common.buildFilter.$6", "type": "Any", "label": "params", "isRequired": true, @@ -23189,6 +23210,7 @@ } }, { + "id": "def-common.buildFilter.$7", "type": "CompoundType", "label": "alias", "isRequired": false, @@ -23202,6 +23224,7 @@ } }, { + "id": "def-common.buildFilter.$8", "type": "CompoundType", "label": "store", "isRequired": false, @@ -23235,6 +23258,7 @@ "type": "Function", "children": [ { + "id": "def-common.buildPhraseFilter.$1", "type": "Object", "label": "field", "isRequired": true, @@ -23254,6 +23278,7 @@ } }, { + "id": "def-common.buildPhraseFilter.$2", "type": "Any", "label": "value", "isRequired": true, @@ -23267,6 +23292,7 @@ } }, { + "id": "def-common.buildPhraseFilter.$3", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -23327,6 +23353,7 @@ "type": "Function", "children": [ { + "id": "def-common.buildPhrasesFilter.$1", "type": "Object", "label": "field", "isRequired": true, @@ -23346,6 +23373,7 @@ } }, { + "id": "def-common.buildPhrasesFilter.$2", "type": "Array", "label": "params", "isRequired": true, @@ -23359,6 +23387,7 @@ } }, { + "id": "def-common.buildPhrasesFilter.$3", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -23419,6 +23448,7 @@ "type": "Function", "children": [ { + "id": "def-common.buildQueryFilter.$1", "type": "Any", "label": "query", "isRequired": true, @@ -23432,6 +23462,7 @@ } }, { + "id": "def-common.buildQueryFilter.$2", "type": "string", "label": "index", "isRequired": true, @@ -23445,6 +23476,7 @@ } }, { + "id": "def-common.buildQueryFilter.$3", "type": "string", "label": "alias", "isRequired": true, @@ -23483,6 +23515,7 @@ "type": "Function", "children": [ { + "id": "def-common.buildQueryFromFilters.$1", "type": "Array", "label": "filters", "isRequired": true, @@ -23503,6 +23536,7 @@ } }, { + "id": "def-common.buildQueryFromFilters.$2", "type": "Object", "label": "indexPattern", "isRequired": false, @@ -23523,6 +23557,7 @@ } }, { + "id": "def-common.buildQueryFromFilters.$3", "type": "boolean", "label": "ignoreFilterIfFieldNotInIndex", "isRequired": true, @@ -23586,6 +23621,7 @@ "type": "Function", "children": [ { + "id": "def-common.buildRangeFilter.$1", "type": "Object", "label": "field", "isRequired": true, @@ -23605,6 +23641,7 @@ } }, { + "id": "def-common.buildRangeFilter.$2", "type": "Object", "label": "params", "isRequired": true, @@ -23624,6 +23661,7 @@ } }, { + "id": "def-common.buildRangeFilter.$3", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -23643,6 +23681,7 @@ } }, { + "id": "def-common.buildRangeFilter.$4", "type": "string", "label": "formattedValue", "isRequired": false, @@ -23705,6 +23744,7 @@ "type": "Function", "children": [ { + "id": "def-common.castEsToKbnFieldTypeName.$1", "type": "string", "label": "esType", "isRequired": true, @@ -23747,6 +23787,7 @@ "type": "Function", "children": [ { + "id": "def-common.cleanFilter.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -23814,6 +23855,7 @@ "description": [], "children": [ { + "id": "def-common.datatableToCSV.$1", "type": "Object", "label": "{ columns, rows }", "isRequired": true, @@ -23833,6 +23875,7 @@ } }, { + "id": "def-common.datatableToCSV.$2", "type": "Object", "label": "{ csvSeparator, quoteValues, formatFactory, raw }", "isRequired": true, @@ -23881,6 +23924,7 @@ ], "children": [ { + "id": "def-common.decorateQuery.$1", "type": "CompoundType", "label": "query", "isRequired": true, @@ -23902,6 +23946,7 @@ } }, { + "id": "def-common.decorateQuery.$2", "type": "CompoundType", "label": "queryStringOptions", "isRequired": true, @@ -23917,6 +23962,7 @@ } }, { + "id": "def-common.decorateQuery.$3", "type": "string", "label": "dateFormatTZ", "isRequired": false, @@ -23945,6 +23991,7 @@ "type": "Function", "children": [ { + "id": "def-common.disableFilter.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -23997,6 +24044,7 @@ "type": "Function", "children": [ { + "id": "def-common.enableFilter.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -24049,6 +24097,7 @@ "type": "Function", "children": [ { + "id": "def-common.fromKueryExpression.$1", "type": "Any", "label": "expression", "isRequired": true, @@ -24062,6 +24111,7 @@ } }, { + "id": "def-common.fromKueryExpression.$2", "type": "Object", "label": "parseOptions", "isRequired": true, @@ -24116,6 +24166,7 @@ "type": "Function", "children": [ { + "id": "def-common.fromLiteralExpression.$1", "type": "Any", "label": "expression", "isRequired": true, @@ -24129,6 +24180,7 @@ } }, { + "id": "def-common.fromLiteralExpression.$2", "type": "Object", "label": "parseOptions", "isRequired": true, @@ -24204,6 +24256,7 @@ "description": [], "children": [ { + "id": "def-common.getDisplayValueFromFilter.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -24223,6 +24276,7 @@ } }, { + "id": "def-common.getDisplayValueFromFilter.$2", "type": "Array", "label": "indexPatterns", "isRequired": true, @@ -24268,6 +24322,7 @@ "description": [], "children": [ { + "id": "def-common.getEsQueryConfig.$1", "type": "Object", "label": "config", "isRequired": true, @@ -24294,6 +24349,7 @@ "type": "Function", "children": [ { + "id": "def-common.getExistsFilterField.$1", "type": "CompoundType", "label": "filter", "isRequired": true, @@ -24360,6 +24416,7 @@ "type": "Function", "children": [ { + "id": "def-common.getFilterField.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -24418,6 +24475,7 @@ "description": [], "children": [ { + "id": "def-common.getFilterParams.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -24450,6 +24508,7 @@ "type": "Function", "children": [ { + "id": "def-common.getGeoBoundingBoxFilterField.$1", "type": "CompoundType", "label": "filter", "isRequired": true, @@ -24495,6 +24554,7 @@ "type": "Function", "children": [ { + "id": "def-common.getGeoPolygonFilterField.$1", "type": "CompoundType", "label": "filter", "isRequired": true, @@ -24569,6 +24629,7 @@ "description": [], "children": [ { + "id": "def-common.getIndexPatternFromFilter.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -24588,6 +24649,7 @@ } }, { + "id": "def-common.getIndexPatternFromFilter.$2", "type": "Array", "label": "indexPatterns", "isRequired": true, @@ -24621,6 +24683,7 @@ "type": "Function", "children": [ { + "id": "def-common.getKbnFieldType.$1", "type": "string", "label": "typeName", "isRequired": true, @@ -24684,6 +24747,7 @@ "type": "Function", "children": [ { + "id": "def-common.getMissingFilterField.$1", "type": "CompoundType", "label": "filter", "isRequired": true, @@ -24729,6 +24793,7 @@ "type": "Function", "children": [ { + "id": "def-common.getPhraseFilterField.$1", "type": "CompoundType", "label": "filter", "isRequired": true, @@ -24774,6 +24839,7 @@ "type": "Function", "children": [ { + "id": "def-common.getPhraseFilterValue.$1", "type": "CompoundType", "label": "filter", "isRequired": true, @@ -24819,6 +24885,7 @@ "type": "Function", "children": [ { + "id": "def-common.getPhraseScript.$1", "type": "Object", "label": "field", "isRequired": true, @@ -24838,6 +24905,7 @@ } }, { + "id": "def-common.getPhraseScript.$2", "type": "string", "label": "value", "isRequired": true, @@ -24877,6 +24945,7 @@ "type": "Function", "children": [ { + "id": "def-common.getPhrasesFilterField.$1", "type": "CompoundType", "label": "filter", "isRequired": true, @@ -24922,6 +24991,7 @@ "type": "Function", "children": [ { + "id": "def-common.getRangeFilterField.$1", "type": "CompoundType", "label": "filter", "isRequired": true, @@ -24967,6 +25037,7 @@ "type": "Function", "children": [ { + "id": "def-common.getRangeScript.$1", "type": "Object", "label": "field", "isRequired": true, @@ -24986,6 +25057,7 @@ } }, { + "id": "def-common.getRangeScript.$2", "type": "Object", "label": "params", "isRequired": true, @@ -25047,6 +25119,7 @@ "type": "Function", "children": [ { + "id": "def-common.isExistsFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25085,6 +25158,7 @@ "type": "Function", "children": [ { + "id": "def-common.isFilter.$1", "type": "Unknown", "label": "x", "isRequired": true, @@ -25123,6 +25197,7 @@ "type": "Function", "children": [ { + "id": "def-common.isFilterDisabled.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -25168,6 +25243,7 @@ "type": "Function", "children": [ { + "id": "def-common.isFilterPinned.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -25213,6 +25289,7 @@ "type": "Function", "children": [ { + "id": "def-common.isFilters.$1", "type": "Unknown", "label": "x", "isRequired": true, @@ -25252,6 +25329,7 @@ "type": "Function", "children": [ { + "id": "def-common.isGeoBoundingBoxFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25290,6 +25368,7 @@ "type": "Function", "children": [ { + "id": "def-common.isGeoPolygonFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25328,6 +25407,7 @@ "type": "Function", "children": [ { + "id": "def-common.isMatchAllFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25366,6 +25446,7 @@ "type": "Function", "children": [ { + "id": "def-common.isMissingFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25404,6 +25485,7 @@ "type": "Function", "children": [ { + "id": "def-common.isPhraseFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25442,6 +25524,7 @@ "type": "Function", "children": [ { + "id": "def-common.isPhrasesFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25480,6 +25563,7 @@ "type": "Function", "children": [ { + "id": "def-common.isQueryStringFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25518,6 +25602,7 @@ "type": "Function", "children": [ { + "id": "def-common.isRangeFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25556,6 +25641,7 @@ "type": "Function", "children": [ { + "id": "def-common.isScriptedPhraseFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25594,6 +25680,7 @@ "type": "Function", "children": [ { + "id": "def-common.isScriptedRangeFilter.$1", "type": "Any", "label": "filter", "isRequired": true, @@ -25644,6 +25731,7 @@ "description": [], "children": [ { + "id": "def-common.luceneStringToDsl.$1", "type": "Any", "label": "query", "isRequired": true, @@ -25670,6 +25758,7 @@ "type": "Function", "children": [ { + "id": "def-common.pinFilter.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -25729,6 +25818,7 @@ ], "children": [ { + "id": "def-common.shortenDottedString.$1", "type": "Any", "label": "input", "isRequired": true, @@ -25757,6 +25847,7 @@ "type": "Function", "children": [ { + "id": "def-common.toElasticsearchQuery.$1", "type": "Object", "label": "node", "isRequired": true, @@ -25776,6 +25867,7 @@ } }, { + "id": "def-common.toElasticsearchQuery.$2", "type": "Object", "label": "indexPattern", "isRequired": false, @@ -25796,6 +25888,7 @@ } }, { + "id": "def-common.toElasticsearchQuery.$3", "type": "Object", "label": "config", "isRequired": false, @@ -25809,6 +25902,7 @@ } }, { + "id": "def-common.toElasticsearchQuery.$4", "type": "Object", "label": "context", "isRequired": false, @@ -25865,6 +25959,7 @@ "type": "Function", "children": [ { + "id": "def-common.toggleFilterDisabled.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -25918,6 +26013,7 @@ "type": "Function", "children": [ { + "id": "def-common.toggleFilterNegated.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -25971,6 +26067,7 @@ "type": "Function", "children": [ { + "id": "def-common.toggleFilterPinned.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -26032,6 +26129,7 @@ "type": "Function", "children": [ { + "id": "def-common.unpinFilter.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -26725,13 +26823,7 @@ "lineNumber": 78 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectError", - "text": "SavedObjectError" - }, + "SavedObjectError", " | undefined" ] }, @@ -26764,13 +26856,7 @@ "lineNumber": 82 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ] }, @@ -26787,13 +26873,7 @@ "lineNumber": 84 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectsMigrationVersion", - "text": "SavedObjectsMigrationVersion" - }, + "SavedObjectsMigrationVersion", " | undefined" ] }, @@ -27173,6 +27253,21 @@ ], "initialIsOpen": false }, + { + "tags": [], + "id": "def-common.KIBANA_USER_QUERY_LANGUAGE_KEY", + "type": "string", + "label": "KIBANA_USER_QUERY_LANGUAGE_KEY", + "description": [], + "source": { + "path": "src/plugins/data/common/constants.ts", + "lineNumber": 10 + }, + "signature": [ + "\"kibana.userQueryLanguage\"" + ], + "initialIsOpen": false + }, { "id": "def-common.MatchAllFilter", "type": "Type", @@ -27350,6 +27445,7 @@ "type": "Function", "children": [ { + "id": "def-common.nodeBuilder.is.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -27363,6 +27459,7 @@ } }, { + "id": "def-common.nodeBuilder.is.$2", "type": "CompoundType", "label": "value", "isRequired": true, @@ -27393,13 +27490,7 @@ "text": "KueryNode" }, ") => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataPluginApi", - "section": "def-common.FunctionTypeBuildNode", - "text": "FunctionTypeBuildNode" - } + "FunctionTypeBuildNode" ], "description": [], "label": "is", @@ -27415,6 +27506,7 @@ "type": "Function", "children": [ { + "id": "def-common.nodeBuilder.or.$1", "type": "Array", "label": "nodes", "isRequired": true, @@ -27467,6 +27559,7 @@ "type": "Function", "children": [ { + "id": "def-common.nodeBuilder.and.$1", "type": "Array", "label": "nodes", "isRequired": true, @@ -27542,12 +27635,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataPluginApi", - "text": "src/plugins/data/common/es_query/kuery/node_types/function" - } + "src/plugins/data/common/es_query/kuery/node_types/function" ] }, { @@ -27562,12 +27650,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataPluginApi", - "text": "src/plugins/data/common/es_query/kuery/node_types/literal" - } + "src/plugins/data/common/es_query/kuery/node_types/literal" ] }, { @@ -27582,12 +27665,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataPluginApi", - "text": "src/plugins/data/common/es_query/kuery/node_types/named_arg" - } + "src/plugins/data/common/es_query/kuery/node_types/named_arg" ] }, { @@ -27602,12 +27680,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataPluginApi", - "text": "src/plugins/data/common/es_query/kuery/node_types/wildcard" - } + "src/plugins/data/common/es_query/kuery/node_types/wildcard" ] } ], @@ -27627,7 +27700,7 @@ "description": [], "source": { "path": "src/plugins/data/common/constants.ts", - "lineNumber": 11 + "lineNumber": 12 }, "signature": [ "{ readonly META_FIELDS: \"metaFields\"; readonly DOC_HIGHLIGHT: \"doc_table:highlight\"; readonly QUERY_STRING_OPTIONS: \"query:queryString:options\"; readonly QUERY_ALLOW_LEADING_WILDCARDS: \"query:allowLeadingWildcards\"; readonly SEARCH_QUERY_LANGUAGE: \"search:queryLanguage\"; readonly SORT_OPTIONS: \"sort:options\"; readonly COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX: \"courier:ignoreFilterIfFieldNotInIndex\"; readonly COURIER_SET_REQUEST_PREFERENCE: \"courier:setRequestPreference\"; readonly COURIER_CUSTOM_REQUEST_PREFERENCE: \"courier:customRequestPreference\"; readonly COURIER_MAX_CONCURRENT_SHARD_REQUESTS: \"courier:maxConcurrentShardRequests\"; readonly COURIER_BATCH_SEARCHES: \"courier:batchSearches\"; readonly SEARCH_INCLUDE_FROZEN: \"search:includeFrozen\"; readonly SEARCH_TIMEOUT: \"search:timeout\"; readonly HISTOGRAM_BAR_TARGET: \"histogram:barTarget\"; readonly HISTOGRAM_MAX_BARS: \"histogram:maxBars\"; readonly HISTORY_LIMIT: \"history:limit\"; readonly SHORT_DOTS_ENABLE: \"shortDots:enable\"; readonly FORMAT_DEFAULT_TYPE_MAP: \"format:defaultTypeMap\"; readonly FORMAT_NUMBER_DEFAULT_PATTERN: \"format:number:defaultPattern\"; readonly FORMAT_PERCENT_DEFAULT_PATTERN: \"format:percent:defaultPattern\"; readonly FORMAT_BYTES_DEFAULT_PATTERN: \"format:bytes:defaultPattern\"; readonly FORMAT_CURRENCY_DEFAULT_PATTERN: \"format:currency:defaultPattern\"; readonly FORMAT_NUMBER_DEFAULT_LOCALE: \"format:number:defaultLocale\"; readonly TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: \"timepicker:refreshIntervalDefaults\"; readonly TIMEPICKER_QUICK_RANGES: \"timepicker:quickRanges\"; readonly TIMEPICKER_TIME_DEFAULTS: \"timepicker:timeDefaults\"; readonly INDEXPATTERN_PLACEHOLDER: \"indexPattern:placeholder\"; readonly FILTERS_PINNED_BY_DEFAULT: \"filters:pinnedByDefault\"; readonly FILTERS_EDITOR_SUGGEST_VALUES: \"filterEditor:suggestValues\"; readonly AUTOCOMPLETE_USE_TIMERANGE: \"autocomplete:useTimeRange\"; }" diff --git a/api_docs/data_enhanced.json b/api_docs/data_enhanced.json index 80f1d1fc15a5a..6ba0ca8191d10 100644 --- a/api_docs/data_enhanced.json +++ b/api_docs/data_enhanced.json @@ -79,8 +79,10 @@ "section": "def-server.Plugin", "text": "Plugin" }, - "" ], "children": [ @@ -94,6 +96,7 @@ "description": [], "children": [ { + "id": "def-server.EnhancedDataServerPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -110,7 +113,7 @@ "description": [], "source": { "path": "x-pack/plugins/data_enhanced/server/plugin.ts", - "lineNumber": 48 + "lineNumber": 33 } } ], @@ -118,7 +121,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/data_enhanced/server/plugin.ts", - "lineNumber": 48 + "lineNumber": 33 } }, { @@ -135,18 +138,15 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataPluginApi", - "section": "def-server.DataPluginStart", - "text": "DataPluginStart" - }, - ", unknown>, deps: SetupDependencies) => void" + "DataEnhancedStartDependencies", + ", unknown>, deps: ", + "DataEnhancedSetupDependencies", + ") => void" ], "description": [], "children": [ { + "id": "def-server.EnhancedDataServerPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -159,32 +159,27 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataPluginApi", - "section": "def-server.DataPluginStart", - "text": "DataPluginStart" - }, + "DataEnhancedStartDependencies", ", unknown>" ], "description": [], "source": { "path": "x-pack/plugins/data_enhanced/server/plugin.ts", - "lineNumber": 53 + "lineNumber": 38 } }, { + "id": "def-server.EnhancedDataServerPlugin.setup.$2", "type": "Object", "label": "deps", "isRequired": true, "signature": [ - "SetupDependencies" + "DataEnhancedSetupDependencies" ], "description": [], "source": { "path": "x-pack/plugins/data_enhanced/server/plugin.ts", - "lineNumber": 53 + "lineNumber": 38 } } ], @@ -192,7 +187,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/data_enhanced/server/plugin.ts", - "lineNumber": 53 + "lineNumber": 38 } }, { @@ -209,18 +204,13 @@ "text": "CoreStart" }, ", { taskManager }: ", - { - "pluginId": "dataEnhanced", - "scope": "server", - "docId": "kibDataEnhancedPluginApi", - "section": "def-server.StartDependencies", - "text": "StartDependencies" - }, + "DataEnhancedStartDependencies", ") => void" ], "description": [], "children": [ { + "id": "def-server.EnhancedDataServerPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -236,26 +226,21 @@ "description": [], "source": { "path": "x-pack/plugins/data_enhanced/server/plugin.ts", - "lineNumber": 95 + "lineNumber": 80 } }, { + "id": "def-server.EnhancedDataServerPlugin.start.$2", "type": "Object", "label": "{ taskManager }", "isRequired": true, "signature": [ - { - "pluginId": "dataEnhanced", - "scope": "server", - "docId": "kibDataEnhancedPluginApi", - "section": "def-server.StartDependencies", - "text": "StartDependencies" - } + "DataEnhancedStartDependencies" ], "description": [], "source": { "path": "x-pack/plugins/data_enhanced/server/plugin.ts", - "lineNumber": 95 + "lineNumber": 80 } } ], @@ -263,7 +248,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/data_enhanced/server/plugin.ts", - "lineNumber": 95 + "lineNumber": 80 } }, { @@ -279,13 +264,13 @@ "returnComment": [], "source": { "path": "x-pack/plugins/data_enhanced/server/plugin.ts", - "lineNumber": 101 + "lineNumber": 86 } } ], "source": { "path": "x-pack/plugins/data_enhanced/server/plugin.ts", - "lineNumber": 42 + "lineNumber": 27 }, "initialIsOpen": false } @@ -335,6 +320,7 @@ "type": "Function", "children": [ { + "id": "def-common.pollSearch.$1", "type": "Function", "label": "search", "isRequired": true, @@ -348,6 +334,7 @@ } }, { + "id": "def-common.pollSearch.$2", "type": "Function", "label": "cancel", "isRequired": false, @@ -361,6 +348,7 @@ } }, { + "id": "def-common.pollSearch.$3", "type": "Object", "label": "{ pollInterval = 1000, abortSignal }", "isRequired": true, @@ -532,7 +520,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 73 + "lineNumber": 80 } }, { @@ -545,7 +533,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 77 + "lineNumber": 84 } }, { @@ -558,7 +546,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 81 + "lineNumber": 88 } }, { @@ -571,7 +559,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 85 + "lineNumber": 92 }, "signature": [ "string | undefined" @@ -580,7 +568,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 69 + "lineNumber": 76 }, "initialIsOpen": false }, @@ -673,6 +661,22 @@ "lineNumber": 33 } }, + { + "tags": [], + "id": "def-common.SearchSessionSavedObjectAttributes.completed", + "type": "CompoundType", + "label": "completed", + "description": [ + "\nTime of transition into completed state,\n\nCan be \"null\" in case already completed session\ntransitioned into in-progress session" + ], + "source": { + "path": "src/plugins/data/common/search/session/types.ts", + "lineNumber": 40 + }, + "signature": [ + "string | null | undefined" + ] + }, { "tags": [], "id": "def-common.SearchSessionSavedObjectAttributes.status", @@ -683,7 +687,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 37 + "lineNumber": 44 }, "signature": [ { @@ -705,7 +709,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 41 + "lineNumber": 48 }, "signature": [ "string | undefined" @@ -721,7 +725,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 46 + "lineNumber": 53 }, "signature": [ "Record | undefined" @@ -737,7 +741,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 51 + "lineNumber": 58 }, "signature": [ "Record | undefined" @@ -753,7 +757,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 55 + "lineNumber": 62 }, "signature": [ "Record | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.HtmlContextTypeOptions", - "text": "HtmlContextTypeOptions" - }, + "HtmlContextTypeOptions", " | undefined) => string" ], "description": [ @@ -886,6 +862,7 @@ ], "children": [ { + "id": "def-common.FieldFormat.convert.$1", "type": "Any", "label": "value", "isRequired": true, @@ -899,6 +876,7 @@ } }, { + "id": "def-common.FieldFormat.convert.$2", "type": "CompoundType", "label": "contentType", "isRequired": true, @@ -920,18 +898,13 @@ } }, { + "id": "def-common.FieldFormat.convert.$3", "type": "CompoundType", "label": "options", "isRequired": false, "signature": [ "Record | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.HtmlContextTypeOptions", - "text": "HtmlContextTypeOptions" - }, + "HtmlContextTypeOptions", " | undefined" ], "description": [], @@ -967,19 +940,14 @@ "text": "FieldFormatsContentType" }, ") => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatConvertFunction", - "text": "FieldFormatConvertFunction" - } + "FieldFormatConvertFunction" ], "description": [ "\nGet a convert function that is bound to a specific contentType" ], "children": [ { + "id": "def-common.FieldFormat.getConverterFor.$1", "type": "CompoundType", "label": "contentType", "isRequired": true, @@ -1046,6 +1014,7 @@ ], "children": [ { + "id": "def-common.FieldFormat.param.$1", "type": "string", "label": "name", "isRequired": true, @@ -1131,17 +1100,12 @@ "description": [], "children": [ { + "id": "def-common.FieldFormat.from.$1", "type": "Function", "label": "convertFn", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatConvertFunction", - "text": "FieldFormatConvertFunction" - } + "FieldFormatConvertFunction" ], "description": [], "source": { @@ -1163,13 +1127,7 @@ "label": "setupContentType", "signature": [ "() => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatConvert", - "text": "FieldFormatConvert" - } + "FieldFormatConvert" ], "description": [], "children": [], @@ -1198,6 +1156,7 @@ "description": [], "children": [ { + "id": "def-common.FieldFormat.isInstanceOfFieldFormat.$1", "type": "Any", "label": "fieldFormat", "isRequired": true, @@ -1263,6 +1222,7 @@ "description": [], "children": [ { + "id": "def-common.FieldFormatNotFoundError.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -1276,6 +1236,7 @@ } }, { + "id": "def-common.FieldFormatNotFoundError.Unnamed.$2", "type": "string", "label": "formatId", "isRequired": true, @@ -1322,13 +1283,7 @@ }, "signature": [ "Map" ] }, @@ -1382,6 +1337,7 @@ "type": "Function", "children": [ { + "id": "def-common.FieldFormatsRegistry.deserialize.$1", "type": "Object", "label": "mapping", "isRequired": false, @@ -1443,18 +1399,13 @@ "text": "GetConfigFn" }, ", metaParamsOptions?: Record, defaultFieldConverters?: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatInstanceType", - "text": "FieldFormatInstanceType" - }, + "FieldFormatInstanceType", "[]) => void" ], "description": [], "children": [ { + "id": "def-common.FieldFormatsRegistry.init.$1", "type": "Function", "label": "getConfig", "isRequired": true, @@ -1474,6 +1425,7 @@ } }, { + "id": "def-common.FieldFormatsRegistry.init.$2", "type": "Object", "label": "metaParamsOptions", "isRequired": true, @@ -1487,17 +1439,12 @@ } }, { + "id": "def-common.FieldFormatsRegistry.init.$3", "type": "Array", "label": "defaultFieldConverters", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatInstanceType", - "text": "FieldFormatInstanceType" - }, + "FieldFormatInstanceType", "[]" ], "description": [], @@ -1519,6 +1466,7 @@ "type": "Function", "children": [ { + "id": "def-common.FieldFormatsRegistry.getDefaultConfig.$1", "type": "Enum", "label": "fieldType", "isRequired": true, @@ -1538,6 +1486,7 @@ } }, { + "id": "def-common.FieldFormatsRegistry.getDefaultConfig.$2", "type": "Array", "label": "esTypes", "isRequired": false, @@ -1602,6 +1551,7 @@ "type": "Function", "children": [ { + "id": "def-common.FieldFormatsRegistry.getType.$1", "type": "string", "label": "formatId", "isRequired": true, @@ -1617,13 +1567,7 @@ ], "signature": [ "(formatId: string) => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatInstanceType", - "text": "FieldFormatInstanceType" - }, + "FieldFormatInstanceType", " | undefined" ], "description": [ @@ -1644,6 +1588,7 @@ "type": "Function", "children": [ { + "id": "def-common.FieldFormatsRegistry.getTypeWithoutMetaParams.$1", "type": "string", "label": "formatId", "isRequired": true, @@ -1659,13 +1604,7 @@ ], "signature": [ "(formatId: string) => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatInstanceType", - "text": "FieldFormatInstanceType" - }, + "FieldFormatInstanceType", " | undefined" ], "description": [], @@ -1682,6 +1621,7 @@ "type": "Function", "children": [ { + "id": "def-common.FieldFormatsRegistry.getDefaultType.$1", "type": "Enum", "label": "fieldType", "isRequired": true, @@ -1701,6 +1641,7 @@ } }, { + "id": "def-common.FieldFormatsRegistry.getDefaultType.$2", "type": "Array", "label": "esTypes", "isRequired": false, @@ -1739,13 +1680,7 @@ "text": "ES_FIELD_TYPES" }, "[] | undefined) => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatInstanceType", - "text": "FieldFormatInstanceType" - }, + "FieldFormatInstanceType", " | undefined" ], "description": [ @@ -1766,6 +1701,7 @@ "type": "Function", "children": [ { + "id": "def-common.FieldFormatsRegistry.getTypeNameByEsTypes.$1", "type": "Array", "label": "esTypes", "isRequired": false, @@ -1823,6 +1759,7 @@ "type": "Function", "children": [ { + "id": "def-common.FieldFormatsRegistry.getDefaultTypeName.$1", "type": "Enum", "label": "fieldType", "isRequired": true, @@ -1842,6 +1779,7 @@ } }, { + "id": "def-common.FieldFormatsRegistry.getDefaultTypeName.$2", "type": "Array", "label": "esTypes", "isRequired": false, @@ -1940,6 +1878,7 @@ "type": "Function", "children": [ { + "id": "def-common.FieldFormatsRegistry.getDefaultInstancePlain.$1", "type": "Enum", "label": "fieldType", "isRequired": true, @@ -1959,6 +1898,7 @@ } }, { + "id": "def-common.FieldFormatsRegistry.getDefaultInstancePlain.$2", "type": "Array", "label": "esTypes", "isRequired": false, @@ -1979,6 +1919,7 @@ } }, { + "id": "def-common.FieldFormatsRegistry.getDefaultInstancePlain.$3", "type": "Object", "label": "params", "isRequired": true, @@ -2059,6 +2000,7 @@ ], "children": [ { + "id": "def-common.FieldFormatsRegistry.getDefaultInstanceCacheResolver.$1", "type": "Enum", "label": "fieldType", "isRequired": true, @@ -2078,6 +2020,7 @@ } }, { + "id": "def-common.FieldFormatsRegistry.getDefaultInstanceCacheResolver.$2", "type": "Array", "label": "esTypes", "isRequired": true, @@ -2121,13 +2064,7 @@ "text": "KBN_FIELD_TYPES" }, ") => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatInstanceType", - "text": "FieldFormatInstanceType" - }, + "FieldFormatInstanceType", "[]" ], "description": [ @@ -2135,6 +2072,7 @@ ], "children": [ { + "id": "def-common.FieldFormatsRegistry.getByFieldType.$1", "type": "Enum", "label": "fieldType", "isRequired": true, @@ -2215,6 +2153,7 @@ "description": [], "children": [ { + "id": "def-common.FieldFormatsRegistry.parseDefaultTypeMap.$1", "type": "Any", "label": "value", "isRequired": true, @@ -2241,29 +2180,18 @@ "label": "register", "signature": [ "(fieldFormats: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatInstanceType", - "text": "FieldFormatInstanceType" - }, + "FieldFormatInstanceType", "[]) => void" ], "description": [], "children": [ { + "id": "def-common.FieldFormatsRegistry.register.$1", "type": "Array", "label": "fieldFormats", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.FieldFormatInstanceType", - "text": "FieldFormatInstanceType" - }, + "FieldFormatInstanceType", "[]" ], "description": [], @@ -2425,6 +2353,7 @@ "type": "Function", "children": [ { + "id": "def-common.HistogramFormat.textConvert.$1", "type": "Any", "label": "val", "isRequired": true, @@ -2537,6 +2466,7 @@ "type": "Function", "children": [ { + "id": "def-common.IpFormat.textConvert.$1", "type": "Any", "label": "val", "isRequired": true, @@ -2779,6 +2709,7 @@ "type": "Function", "children": [ { + "id": "def-common.PercentFormat.textConvert.$1", "type": "Any", "label": "val", "isRequired": true, @@ -2891,6 +2822,7 @@ "type": "Function", "children": [ { + "id": "def-common.RelativeDateFormat.textConvert.$1", "type": "Any", "label": "val", "isRequired": true, @@ -2954,8 +2886,8 @@ "label": "id", "description": [], "source": { - "path": "src/plugins/data/common/field_formats/converters/source.ts", - "lineNumber": 45 + "path": "src/plugins/data/common/field_formats/converters/source.tsx", + "lineNumber": 39 }, "signature": [ { @@ -2974,8 +2906,8 @@ "label": "title", "description": [], "source": { - "path": "src/plugins/data/common/field_formats/converters/source.ts", - "lineNumber": 46 + "path": "src/plugins/data/common/field_formats/converters/source.tsx", + "lineNumber": 40 } }, { @@ -2985,8 +2917,8 @@ "label": "fieldType", "description": [], "source": { - "path": "src/plugins/data/common/field_formats/converters/source.ts", - "lineNumber": 47 + "path": "src/plugins/data/common/field_formats/converters/source.tsx", + "lineNumber": 41 }, "signature": [ { @@ -3003,6 +2935,7 @@ "type": "Function", "children": [ { + "id": "def-common.SourceFormat.textConvert.$1", "type": "Any", "label": "value", "isRequired": true, @@ -3011,8 +2944,8 @@ ], "description": [], "source": { - "path": "src/plugins/data/common/field_formats/converters/source.ts", - "lineNumber": 49 + "path": "src/plugins/data/common/field_formats/converters/source.tsx", + "lineNumber": 43 } } ], @@ -3022,8 +2955,8 @@ "description": [], "label": "textConvert", "source": { - "path": "src/plugins/data/common/field_formats/converters/source.ts", - "lineNumber": 49 + "path": "src/plugins/data/common/field_formats/converters/source.tsx", + "lineNumber": 43 }, "tags": [], "returnComment": [] @@ -3033,6 +2966,7 @@ "type": "Function", "children": [ { + "id": "def-common.SourceFormat.htmlConvert.$1", "type": "Any", "label": "value", "isRequired": true, @@ -3041,55 +2975,44 @@ ], "description": [], "source": { - "path": "src/plugins/data/common/field_formats/converters/source.ts", - "lineNumber": 51 + "path": "src/plugins/data/common/field_formats/converters/source.tsx", + "lineNumber": 45 } }, { + "id": "def-common.SourceFormat.htmlConvert.$2", "type": "Object", "label": "options", "isRequired": false, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.HtmlContextTypeOptions", - "text": "HtmlContextTypeOptions" - }, + "HtmlContextTypeOptions", " | undefined" ], "description": [], "source": { - "path": "src/plugins/data/common/field_formats/converters/source.ts", - "lineNumber": 51 + "path": "src/plugins/data/common/field_formats/converters/source.tsx", + "lineNumber": 45 } } ], "signature": [ "(value: any, options?: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.HtmlContextTypeOptions", - "text": "HtmlContextTypeOptions" - }, + "HtmlContextTypeOptions", " | undefined) => string" ], "description": [], "label": "htmlConvert", "source": { - "path": "src/plugins/data/common/field_formats/converters/source.ts", - "lineNumber": 51 + "path": "src/plugins/data/common/field_formats/converters/source.tsx", + "lineNumber": 45 }, "tags": [], "returnComment": [] } ], "source": { - "path": "src/plugins/data/common/field_formats/converters/source.ts", - "lineNumber": 44 + "path": "src/plugins/data/common/field_formats/converters/source.tsx", + "lineNumber": 38 }, "initialIsOpen": false }, @@ -3190,6 +3113,7 @@ "type": "Function", "children": [ { + "id": "def-common.StaticLookupFormat.textConvert.$1", "type": "Any", "label": "val", "isRequired": true, @@ -3333,6 +3257,7 @@ "type": "Function", "children": [ { + "id": "def-common.StringFormat.textConvert.$1", "type": "Any", "label": "val", "isRequired": true, @@ -3445,6 +3370,7 @@ "type": "Function", "children": [ { + "id": "def-common.TruncateFormat.textConvert.$1", "type": "Any", "label": "val", "isRequired": true, @@ -3577,17 +3503,12 @@ "description": [], "children": [ { + "id": "def-common.UrlFormat.Unnamed.$1", "type": "Object", "label": "params", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.IFieldFormatMetaParams", - "text": "IFieldFormatMetaParams" - } + "IFieldFormatMetaParams" ], "description": [], "source": { @@ -3624,6 +3545,7 @@ "type": "Function", "children": [ { + "id": "def-common.UrlFormat.textConvert.$1", "type": "Any", "label": "value", "isRequired": true, @@ -3654,6 +3576,7 @@ "type": "Function", "children": [ { + "id": "def-common.UrlFormat.htmlConvert.$1", "type": "Any", "label": "rawValue", "isRequired": true, @@ -3667,17 +3590,12 @@ } }, { + "id": "def-common.UrlFormat.htmlConvert.$2", "type": "Object", "label": "options", "isRequired": false, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.HtmlContextTypeOptions", - "text": "HtmlContextTypeOptions" - }, + "HtmlContextTypeOptions", " | undefined" ], "description": [], @@ -3689,13 +3607,7 @@ ], "signature": [ "(rawValue: any, options?: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataFieldFormatsPluginApi", - "section": "def-common.HtmlContextTypeOptions", - "text": "HtmlContextTypeOptions" - }, + "HtmlContextTypeOptions", " | undefined) => string" ], "description": [], @@ -3726,6 +3638,7 @@ "description": [], "children": [ { + "id": "def-common.getHighlightRequest.$1", "type": "Any", "label": "query", "isRequired": true, @@ -3739,6 +3652,7 @@ } }, { + "id": "def-common.getHighlightRequest.$2", "type": "boolean", "label": "shouldHighlight", "isRequired": true, diff --git a/api_docs/data_index_patterns.json b/api_docs/data_index_patterns.json index 8058f6a72f9c3..243f7d3a0087e 100644 --- a/api_docs/data_index_patterns.json +++ b/api_docs/data_index_patterns.json @@ -27,6 +27,7 @@ "description": [], "children": [ { + "id": "def-server.IndexPatternsFetcher.Unnamed.$1", "type": "CompoundType", "label": "elasticsearchClient", "isRequired": true, @@ -46,6 +47,7 @@ } }, { + "id": "def-server.IndexPatternsFetcher.Unnamed.$2", "type": "boolean", "label": "allowNoIndices", "isRequired": true, @@ -86,7 +88,7 @@ ], "children": [ { - "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.options", + "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.$1.options", "type": "Object", "label": "options", "tags": [], @@ -94,7 +96,7 @@ "children": [ { "tags": [], - "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.options.pattern", + "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.$1.options.pattern", "type": "CompoundType", "label": "pattern", "description": [], @@ -108,7 +110,7 @@ }, { "tags": [], - "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.options.metaFields", + "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.$1.options.metaFields", "type": "Array", "label": "metaFields", "description": [], @@ -122,7 +124,7 @@ }, { "tags": [], - "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.options.fieldCapsOptions", + "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.$1.options.fieldCapsOptions", "type": "Object", "label": "fieldCapsOptions", "description": [], @@ -136,7 +138,7 @@ }, { "tags": [], - "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.options.type", + "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.$1.options.type", "type": "string", "label": "type", "description": [], @@ -150,7 +152,7 @@ }, { "tags": [], - "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.options.rollupIndex", + "id": "def-server.IndexPatternsFetcher.getFieldsForWildcard.$1.options.rollupIndex", "type": "string", "label": "rollupIndex", "description": [], @@ -199,7 +201,7 @@ ], "children": [ { - "id": "def-server.IndexPatternsFetcher.getFieldsForTimePattern.options", + "id": "def-server.IndexPatternsFetcher.getFieldsForTimePattern.$1.options", "type": "Object", "label": "options", "tags": [], @@ -207,7 +209,7 @@ "children": [ { "tags": [], - "id": "def-server.IndexPatternsFetcher.getFieldsForTimePattern.options.pattern", + "id": "def-server.IndexPatternsFetcher.getFieldsForTimePattern.$1.options.pattern", "type": "string", "label": "pattern", "description": [], @@ -218,7 +220,7 @@ }, { "tags": [], - "id": "def-server.IndexPatternsFetcher.getFieldsForTimePattern.options.metaFields", + "id": "def-server.IndexPatternsFetcher.getFieldsForTimePattern.$1.options.metaFields", "type": "Array", "label": "metaFields", "description": [], @@ -232,7 +234,7 @@ }, { "tags": [], - "id": "def-server.IndexPatternsFetcher.getFieldsForTimePattern.options.lookBack", + "id": "def-server.IndexPatternsFetcher.getFieldsForTimePattern.$1.options.lookBack", "type": "number", "label": "lookBack", "description": [], @@ -243,7 +245,7 @@ }, { "tags": [], - "id": "def-server.IndexPatternsFetcher.getFieldsForTimePattern.options.interval", + "id": "def-server.IndexPatternsFetcher.getFieldsForTimePattern.$1.options.interval", "type": "string", "label": "interval", "description": [], @@ -281,6 +283,7 @@ ], "children": [ { + "id": "def-server.IndexPatternsFetcher.validatePatternListActive.$1", "type": "Array", "label": "patternList", "isRequired": true, @@ -353,13 +356,7 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataPluginApi", - "section": "def-server.DataPluginStartDependencies", - "text": "DataPluginStartDependencies" - }, + "IndexPatternsServiceStartDeps", ", ", { "pluginId": "data", @@ -368,19 +365,14 @@ "section": "def-server.DataPluginStart", "text": "DataPluginStart" }, - ">, { expressions }: ", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-server.IndexPatternsServiceSetupDeps", - "text": "IndexPatternsServiceSetupDeps" - }, + ">, { expressions, usageCollection }: ", + "IndexPatternsServiceSetupDeps", ") => void" ], "description": [], "children": [ { + "id": "def-server.IndexPatternsServiceProvider.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -393,13 +385,7 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataPluginApi", - "section": "def-server.DataPluginStartDependencies", - "text": "DataPluginStartDependencies" - }, + "IndexPatternsServiceStartDeps", ", ", { "pluginId": "data", @@ -413,26 +399,21 @@ "description": [], "source": { "path": "src/plugins/data/server/index_patterns/index_patterns_service.ts", - "lineNumber": 47 + "lineNumber": 81 } }, { + "id": "def-server.IndexPatternsServiceProvider.setup.$2", "type": "Object", - "label": "{ expressions }", + "label": "{ expressions, usageCollection }", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-server.IndexPatternsServiceSetupDeps", - "text": "IndexPatternsServiceSetupDeps" - } + "IndexPatternsServiceSetupDeps" ], "description": [], "source": { "path": "src/plugins/data/server/index_patterns/index_patterns_service.ts", - "lineNumber": 48 + "lineNumber": 82 } } ], @@ -440,7 +421,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/server/index_patterns/index_patterns_service.ts", - "lineNumber": 46 + "lineNumber": 80 } }, { @@ -457,13 +438,7 @@ "text": "CoreStart" }, ", { fieldFormats, logger }: ", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-server.IndexPatternsServiceStartDeps", - "text": "IndexPatternsServiceStartDeps" - }, + "IndexPatternsServiceStartDeps", ") => { indexPatternsServiceFactory: (savedObjectsClient: Pick<", { "pluginId": "core", @@ -472,7 +447,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">, elasticsearchClient: ", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">, elasticsearchClient: ", { "pluginId": "core", "scope": "server", @@ -492,6 +467,7 @@ "description": [], "children": [ { + "id": "def-server.IndexPatternsServiceProvider.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -507,26 +483,21 @@ "description": [], "source": { "path": "src/plugins/data/server/index_patterns/index_patterns_service.ts", - "lineNumber": 58 + "lineNumber": 93 } }, { + "id": "def-server.IndexPatternsServiceProvider.start.$2", "type": "Object", "label": "{ fieldFormats, logger }", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-server.IndexPatternsServiceStartDeps", - "text": "IndexPatternsServiceStartDeps" - } + "IndexPatternsServiceStartDeps" ], "description": [], "source": { "path": "src/plugins/data/server/index_patterns/index_patterns_service.ts", - "lineNumber": 58 + "lineNumber": 93 } } ], @@ -534,13 +505,13 @@ "returnComment": [], "source": { "path": "src/plugins/data/server/index_patterns/index_patterns_service.ts", - "lineNumber": 58 + "lineNumber": 93 } } ], "source": { "path": "src/plugins/data/server/index_patterns/index_patterns_service.ts", - "lineNumber": 45 + "lineNumber": 79 }, "initialIsOpen": false } @@ -556,14 +527,14 @@ "description": [], "children": [ { - "id": "def-server.getCapabilitiesForRollupIndices.indices", + "id": "def-server.getCapabilitiesForRollupIndices.$1.indices", "type": "Object", "label": "indices", "tags": [], "description": [], "children": [ { - "id": "def-server.getCapabilitiesForRollupIndices.indices.Unnamed", + "id": "def-server.getCapabilitiesForRollupIndices.$1.indices.Unnamed", "type": "Any", "label": "Unnamed", "tags": [], @@ -596,14 +567,14 @@ "type": "Function", "children": [ { - "id": "def-server.mergeCapabilitiesWithFields.rollupIndexCapabilities", + "id": "def-server.mergeCapabilitiesWithFields.$1.rollupIndexCapabilities", "type": "Object", "label": "rollupIndexCapabilities", "tags": [], "description": [], "children": [ { - "id": "def-server.mergeCapabilitiesWithFields.rollupIndexCapabilities.Unnamed", + "id": "def-server.mergeCapabilitiesWithFields.$1.rollupIndexCapabilities.Unnamed", "type": "Any", "label": "Unnamed", "tags": [], @@ -623,14 +594,14 @@ } }, { - "id": "def-server.mergeCapabilitiesWithFields.fieldsFromFieldCapsApi", + "id": "def-server.mergeCapabilitiesWithFields.$2.fieldsFromFieldCapsApi", "type": "Object", "label": "fieldsFromFieldCapsApi", "tags": [], "description": [], "children": [ { - "id": "def-server.mergeCapabilitiesWithFields.fieldsFromFieldCapsApi.Unnamed", + "id": "def-server.mergeCapabilitiesWithFields.$2.fieldsFromFieldCapsApi.Unnamed", "type": "Any", "label": "Unnamed", "tags": [], @@ -650,6 +621,7 @@ } }, { + "id": "def-server.mergeCapabilitiesWithFields.$3", "type": "Array", "label": "previousFields", "isRequired": true, @@ -709,6 +681,7 @@ "description": [], "children": [ { + "id": "def-server.shouldReadFieldFromDocValues.$1", "type": "boolean", "label": "aggregatable", "isRequired": true, @@ -722,6 +695,7 @@ } }, { + "id": "def-server.shouldReadFieldFromDocValues.$2", "type": "string", "label": "esType", "isRequired": true, @@ -973,6 +947,7 @@ "description": [], "children": [ { + "id": "def-common.DuplicateIndexPatternError.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -1277,6 +1252,7 @@ "description": [], "children": [ { + "id": "def-common.IndexPattern.Unnamed.$1", "type": "Object", "label": "{\n spec = {},\n fieldFormats,\n shortDotsEnable = false,\n metaFields = [],\n }", "isRequired": true, @@ -1436,6 +1412,7 @@ ], "children": [ { + "id": "def-common.IndexPattern.addScriptedField.$1", "type": "string", "label": "name", "isRequired": true, @@ -1451,6 +1428,7 @@ } }, { + "id": "def-common.IndexPattern.addScriptedField.$2", "type": "string", "label": "script", "isRequired": true, @@ -1466,6 +1444,7 @@ } }, { + "id": "def-common.IndexPattern.addScriptedField.$3", "type": "string", "label": "fieldType", "isRequired": true, @@ -1498,6 +1477,7 @@ ], "children": [ { + "id": "def-common.IndexPattern.removeScriptedField.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -1640,6 +1620,7 @@ "description": [], "children": [ { + "id": "def-common.IndexPattern.getFieldByName.$1", "type": "string", "label": "name", "isRequired": true, @@ -1737,6 +1718,7 @@ ], "children": [ { + "id": "def-common.IndexPattern.getFormatterForField.$1", "type": "CompoundType", "label": "field", "isRequired": true, @@ -1799,6 +1781,7 @@ ], "children": [ { + "id": "def-common.IndexPattern.addRuntimeField.$1", "type": "string", "label": "name", "isRequired": true, @@ -1814,6 +1797,7 @@ } }, { + "id": "def-common.IndexPattern.addRuntimeField.$2", "type": "Object", "label": "runtimeField", "isRequired": true, @@ -1854,6 +1838,7 @@ ], "children": [ { + "id": "def-common.IndexPattern.removeRuntimeField.$1", "type": "string", "label": "name", "isRequired": true, @@ -1896,6 +1881,7 @@ ], "children": [ { + "id": "def-common.IndexPattern.getFormatterForFieldNoDefault.$1", "type": "string", "label": "fieldname", "isRequired": true, @@ -1934,6 +1920,7 @@ "description": [], "children": [ { + "id": "def-common.IndexPattern.setFieldAttrs.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -1947,6 +1934,7 @@ } }, { + "id": "def-common.IndexPattern.setFieldAttrs.$2", "type": "Uncategorized", "label": "attrName", "isRequired": true, @@ -1960,6 +1948,7 @@ } }, { + "id": "def-common.IndexPattern.setFieldAttrs.$3", "type": "Uncategorized", "label": "value", "isRequired": true, @@ -1997,6 +1986,7 @@ "description": [], "children": [ { + "id": "def-common.IndexPattern.setFieldCustomLabel.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -2010,6 +2000,7 @@ } }, { + "id": "def-common.IndexPattern.setFieldCustomLabel.$2", "type": "CompoundType", "label": "customLabel", "isRequired": false, @@ -2040,6 +2031,7 @@ "description": [], "children": [ { + "id": "def-common.IndexPattern.setFieldCount.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -2053,6 +2045,7 @@ } }, { + "id": "def-common.IndexPattern.setFieldCount.$2", "type": "CompoundType", "label": "count", "isRequired": false, @@ -2078,6 +2071,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPattern.setFieldFormat.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -2091,6 +2085,7 @@ } }, { + "id": "def-common.IndexPattern.setFieldFormat.$2", "type": "Object", "label": "format", "isRequired": true, @@ -2136,6 +2131,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPattern.deleteFieldFormat.$1", "type": "string", "label": "fieldName", "isRequired": true, @@ -2222,6 +2218,7 @@ "description": [], "children": [ { + "id": "def-common.IndexPatternField.Unnamed.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -2682,7 +2679,7 @@ "description": [], "children": [ { - "id": "def-common.IndexPatternField.toSpec.{\n- getFormatterForField,\n }", + "id": "def-common.IndexPatternField.toSpec.$1.getFormatterForField", "type": "Object", "label": "{\n getFormatterForField,\n }", "tags": [], @@ -2690,7 +2687,7 @@ "children": [ { "tags": [], - "id": "def-common.IndexPatternField.toSpec.{\n- getFormatterForField,\n }.getFormatterForField", + "id": "def-common.IndexPatternField.toSpec.$1.getFormatterForField.getFormatterForField", "type": "Function", "label": "getFormatterForField", "description": [], @@ -2773,13 +2770,7 @@ "lineNumber": 67 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.EnsureDefaultIndexPattern", - "text": "EnsureDefaultIndexPattern" - } + "EnsureDefaultIndexPattern" ] }, { @@ -2792,6 +2783,7 @@ "description": [], "children": [ { + "id": "def-common.IndexPatternsService.Unnamed.$1", "type": "Object", "label": "{\n uiSettings,\n savedObjectsClient,\n apiClient,\n fieldFormats,\n onNotification,\n onError,\n onRedirectNoIndexPattern = () => {},\n }", "isRequired": true, @@ -2817,6 +2809,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.getIds.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -2849,6 +2842,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.getTitles.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -2881,6 +2875,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.find.$1", "type": "string", "label": "search", "isRequired": true, @@ -2894,6 +2889,7 @@ } }, { + "id": "def-common.IndexPatternsService.find.$2", "type": "number", "label": "size", "isRequired": true, @@ -2936,6 +2932,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.getIdsWithTitle.$1", "type": "boolean", "label": "refresh", "isRequired": true, @@ -2968,6 +2965,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.clearCache.$1", "type": "string", "label": "id", "isRequired": false, @@ -3001,21 +2999,9 @@ "children": [], "signature": [ "() => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.IndexPatternSavedObjectAttrs", - "text": "IndexPatternSavedObjectAttrs" - }, + "IndexPatternSavedObjectAttrs", ">[] | null | undefined>" ], "description": [], @@ -3058,6 +3044,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.setDefault.$1", "type": "string", "label": "id", "isRequired": true, @@ -3071,6 +3058,7 @@ } }, { + "id": "def-common.IndexPatternsService.setDefault.$2", "type": "boolean", "label": "force", "isRequired": true, @@ -3103,6 +3091,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.getFieldsForWildcard.$1", "type": "Object", "label": "options", "isRequired": true, @@ -3151,6 +3140,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.getFieldsForIndexPattern.$1", "type": "CompoundType", "label": "indexPattern", "isRequired": true, @@ -3178,6 +3168,7 @@ } }, { + "id": "def-common.IndexPatternsService.getFieldsForIndexPattern.$2", "type": "Object", "label": "options", "isRequired": false, @@ -3243,6 +3234,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.refreshFields.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -3289,6 +3281,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.fieldArrayToMap.$1", "type": "Array", "label": "fields", "isRequired": true, @@ -3309,6 +3302,7 @@ } }, { + "id": "def-common.IndexPatternsService.fieldArrayToMap.$2", "type": "Object", "label": "fieldAttrs", "isRequired": false, @@ -3374,17 +3368,12 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.savedObjectToSpec.$1", "type": "Object", "label": "savedObject", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", { "pluginId": "data", @@ -3404,13 +3393,7 @@ ], "signature": [ "(savedObject: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "<", { "pluginId": "data", @@ -3446,6 +3429,7 @@ "type": "Function", "children": [ { + "id": "def-common.IndexPatternsService.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -3509,6 +3493,7 @@ ], "children": [ { + "id": "def-common.IndexPatternsService.create.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -3528,6 +3513,7 @@ } }, { + "id": "def-common.IndexPatternsService.create.$2", "type": "boolean", "label": "skipFetchFields", "isRequired": true, @@ -3578,6 +3564,7 @@ ], "children": [ { + "id": "def-common.IndexPatternsService.createAndSave.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -3597,6 +3584,7 @@ } }, { + "id": "def-common.IndexPatternsService.createAndSave.$2", "type": "boolean", "label": "override", "isRequired": true, @@ -3612,6 +3600,7 @@ } }, { + "id": "def-common.IndexPatternsService.createAndSave.$3", "type": "boolean", "label": "skipFetchFields", "isRequired": true, @@ -3662,6 +3651,7 @@ ], "children": [ { + "id": "def-common.IndexPatternsService.createSavedObject.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -3681,6 +3671,7 @@ } }, { + "id": "def-common.IndexPatternsService.createSavedObject.$2", "type": "boolean", "label": "override", "isRequired": true, @@ -3723,6 +3714,7 @@ ], "children": [ { + "id": "def-common.IndexPatternsService.updateSavedObject.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -3738,10 +3730,11 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 548 + "lineNumber": 551 } }, { + "id": "def-common.IndexPatternsService.updateSavedObject.$2", "type": "number", "label": "saveAttempts", "isRequired": true, @@ -3751,10 +3744,11 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 549 + "lineNumber": 552 } }, { + "id": "def-common.IndexPatternsService.updateSavedObject.$3", "type": "boolean", "label": "ignoreErrors", "isRequired": true, @@ -3764,7 +3758,7 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 550 + "lineNumber": 553 } } ], @@ -3772,7 +3766,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 547 + "lineNumber": 550 } }, { @@ -3787,6 +3781,7 @@ ], "children": [ { + "id": "def-common.IndexPatternsService.delete.$1", "type": "string", "label": "indexPatternId", "isRequired": true, @@ -3798,7 +3793,7 @@ ], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 633 + "lineNumber": 636 } } ], @@ -3806,7 +3801,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 633 + "lineNumber": 636 } } ], @@ -3823,6 +3818,7 @@ "type": "Function", "children": [ { + "id": "def-common.fieldList.$1", "type": "Array", "label": "specs", "isRequired": true, @@ -3843,6 +3839,7 @@ } }, { + "id": "def-common.fieldList.$2", "type": "boolean", "label": "shortDotsEnable", "isRequired": true, @@ -3927,6 +3924,7 @@ "description": [], "children": [ { + "id": "def-common.isFilterable.$1", "type": "Object", "label": "field", "isRequired": true, @@ -3972,6 +3970,7 @@ "description": [], "children": [ { + "id": "def-common.isNestedField.$1", "type": "Object", "label": "field", "isRequired": true, @@ -5307,6 +5306,7 @@ "description": [], "children": [ { + "id": "def-common.IIndexPatternFieldList.add.$1", "type": "Object", "label": "field", "isRequired": true, @@ -5375,6 +5375,7 @@ "description": [], "children": [ { + "id": "def-common.IIndexPatternFieldList.getByName.$1", "type": "string", "label": "name", "isRequired": true, @@ -5413,6 +5414,7 @@ "description": [], "children": [ { + "id": "def-common.IIndexPatternFieldList.getByType.$1", "type": "string", "label": "type", "isRequired": true, @@ -5451,6 +5453,7 @@ "description": [], "children": [ { + "id": "def-common.IIndexPatternFieldList.remove.$1", "type": "Object", "label": "field", "isRequired": true, @@ -5511,6 +5514,7 @@ "description": [], "children": [ { + "id": "def-common.IIndexPatternFieldList.replaceAll.$1", "type": "Array", "label": "specs", "isRequired": true, @@ -5556,6 +5560,7 @@ "description": [], "children": [ { + "id": "def-common.IIndexPatternFieldList.update.$1", "type": "Object", "label": "field", "isRequired": true, @@ -5631,7 +5636,7 @@ "description": [], "children": [ { - "id": "def-common.IIndexPatternFieldList.toSpec.options", + "id": "def-common.IIndexPatternFieldList.toSpec.$1.options", "type": "Object", "label": "options", "tags": [], @@ -5639,7 +5644,7 @@ "children": [ { "tags": [], - "id": "def-common.IIndexPatternFieldList.toSpec.options.getFormatterForField", + "id": "def-common.IIndexPatternFieldList.toSpec.$1.options.getFormatterForField", "type": "Function", "label": "getFormatterForField", "description": [], @@ -6288,13 +6293,7 @@ "text": "SavedObjectsClientCommonFindArgs" }, ") => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "[]>" ] }, @@ -6310,13 +6309,7 @@ }, "signature": [ "(type: string, id: string) => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ] }, @@ -6332,13 +6325,7 @@ }, "signature": [ "(type: string, id: string, attributes: Record, options: Record) => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ] }, @@ -6354,13 +6341,7 @@ }, "signature": [ "(type: string, attributes: Record, options: Record) => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ] }, @@ -6710,10 +6691,10 @@ "description": [], "source": { "path": "src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts", - "lineNumber": 639 + "lineNumber": 642 }, "signature": [ - "{ get: (id: string) => Promise; delete: (indexPatternId: string) => Promise<{}>; create: (spec: IndexPatternSpec, skipFetchFields?: boolean) => Promise; ensureDefaultIndexPattern: EnsureDefaultIndexPattern; getIds: (refresh?: boolean) => Promise; getTitles: (refresh?: boolean) => Promise; find: (search: string, size?: number) => Promise; getIdsWithTitle: (refresh?: boolean) => Promise<{ id: string; title: string; }[]>; clearCache: (id?: string | undefined) => void; getCache: () => Promise[] | null | undefined>; getDefault: () => Promise; setDefault: (id: string, force?: boolean) => Promise; getFieldsForWildcard: (options: GetFieldsOptions) => Promise; getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise; refreshFields: (indexPattern: IndexPattern) => Promise; fieldArrayToMap: (fields: FieldSpec[], fieldAttrs?: FieldAttrs | undefined) => Record; savedObjectToSpec: (savedObject: SavedObject) => IndexPatternSpec; createAndSave: (spec: IndexPatternSpec, override?: boolean, skipFetchFields?: boolean) => Promise; createSavedObject: (indexPattern: IndexPattern, override?: boolean) => Promise; updateSavedObject: (indexPattern: IndexPattern, saveAttempts?: number, ignoreErrors?: boolean) => Promise; }" + "{ get: (id: string) => Promise; delete: (indexPatternId: string) => Promise<{}>; create: (spec: IndexPatternSpec, skipFetchFields?: boolean) => Promise; find: (search: string, size?: number) => Promise; ensureDefaultIndexPattern: EnsureDefaultIndexPattern; getIds: (refresh?: boolean) => Promise; getTitles: (refresh?: boolean) => Promise; getIdsWithTitle: (refresh?: boolean) => Promise<{ id: string; title: string; }[]>; clearCache: (id?: string | undefined) => void; getCache: () => Promise[] | null | undefined>; getDefault: () => Promise; setDefault: (id: string, force?: boolean) => Promise; getFieldsForWildcard: (options: GetFieldsOptions) => Promise; getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise; refreshFields: (indexPattern: IndexPattern) => Promise; fieldArrayToMap: (fields: FieldSpec[], fieldAttrs?: FieldAttrs | undefined) => Record; savedObjectToSpec: (savedObject: SavedObject) => IndexPatternSpec; createAndSave: (spec: IndexPatternSpec, override?: boolean, skipFetchFields?: boolean) => Promise; createSavedObject: (indexPattern: IndexPattern, override?: boolean) => Promise; updateSavedObject: (indexPattern: IndexPattern, saveAttempts?: number, ignoreErrors?: boolean) => Promise; }" ], "initialIsOpen": false }, diff --git a/api_docs/data_query.json b/api_docs/data_query.json index c7af23cf107bf..b9fa69bd66b22 100644 --- a/api_docs/data_query.json +++ b/api_docs/data_query.json @@ -19,6 +19,7 @@ "description": [], "children": [ { + "id": "def-public.FilterManager.Unnamed.$1", "type": "Object", "label": "uiSettings", "isRequired": true, @@ -123,13 +124,7 @@ "label": "getPartitionedFilters", "signature": [ "() => ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.PartitionedFilters", - "text": "PartitionedFilters" - } + "PartitionedFilters" ], "description": [], "children": [], @@ -202,6 +197,7 @@ "description": [], "children": [ { + "id": "def-public.FilterManager.addFilters.$1", "type": "CompoundType", "label": "filters", "isRequired": true, @@ -230,6 +226,7 @@ } }, { + "id": "def-public.FilterManager.addFilters.$2", "type": "boolean", "label": "pinFilterStatus", "isRequired": true, @@ -268,6 +265,7 @@ "description": [], "children": [ { + "id": "def-public.FilterManager.setFilters.$1", "type": "Array", "label": "newFilters", "isRequired": true, @@ -288,6 +286,7 @@ } }, { + "id": "def-public.FilterManager.setFilters.$2", "type": "boolean", "label": "pinFilterStatus", "isRequired": true, @@ -328,6 +327,7 @@ ], "children": [ { + "id": "def-public.FilterManager.setGlobalFilters.$1", "type": "Array", "label": "newGlobalFilters", "isRequired": true, @@ -375,6 +375,7 @@ ], "children": [ { + "id": "def-public.FilterManager.setAppFilters.$1", "type": "Array", "label": "newAppFilters", "isRequired": true, @@ -420,6 +421,7 @@ "description": [], "children": [ { + "id": "def-public.FilterManager.removeFilter.$1", "type": "Object", "label": "filter", "isRequired": true, @@ -480,6 +482,7 @@ "description": [], "children": [ { + "id": "def-public.FilterManager.setFiltersStore.$1", "type": "Array", "label": "filters", "isRequired": true, @@ -500,6 +503,7 @@ } }, { + "id": "def-public.FilterManager.setFiltersStore.$2", "type": "Enum", "label": "store", "isRequired": true, @@ -519,6 +523,7 @@ } }, { + "id": "def-public.FilterManager.setFiltersStore.$3", "type": "boolean", "label": "shouldOverrideStore", "isRequired": true, @@ -563,6 +568,7 @@ "description": [], "children": [ { + "id": "def-public.TimeHistory.Unnamed.$1", "type": "Object", "label": "storage", "isRequired": true, @@ -608,6 +614,7 @@ "description": [], "children": [ { + "id": "def-public.TimeHistory.add.$1", "type": "Object", "label": "time", "isRequired": true, @@ -672,6 +679,7 @@ "type": "Function", "children": [ { + "id": "def-public.connectToQueryState.$1", "type": "Object", "label": "{\n timefilter: { timefilter },\n filterManager,\n queryString,\n state$,\n }", "isRequired": true, @@ -693,13 +701,7 @@ "text": "FilterManager" }, "; queryString: Pick<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.QueryStringManager", - "text": "QueryStringManager" - }, + "QueryStringManager", ", \"getDefaultQuery\" | \"formatQuery\" | \"getUpdates$\" | \"getQuery\" | \"setQuery\" | \"clearQuery\">; savedQueries: ", { "pluginId": "data", @@ -718,6 +720,7 @@ } }, { + "id": "def-public.connectToQueryState.$2", "type": "Object", "label": "stateContainer", "isRequired": true, @@ -738,7 +741,7 @@ } }, { - "id": "def-public.connectToQueryState.syncConfig", + "id": "def-public.connectToQueryState.$3.syncConfig", "type": "Object", "label": "syncConfig", "tags": [], @@ -746,7 +749,7 @@ "children": [ { "tags": [], - "id": "def-public.connectToQueryState.syncConfig.time", + "id": "def-public.connectToQueryState.$3.syncConfig.time", "type": "CompoundType", "label": "time", "description": [], @@ -760,7 +763,7 @@ }, { "tags": [], - "id": "def-public.connectToQueryState.syncConfig.refreshInterval", + "id": "def-public.connectToQueryState.$3.syncConfig.refreshInterval", "type": "CompoundType", "label": "refreshInterval", "description": [], @@ -774,7 +777,7 @@ }, { "tags": [], - "id": "def-public.connectToQueryState.syncConfig.filters", + "id": "def-public.connectToQueryState.$3.syncConfig.filters", "type": "CompoundType", "label": "filters", "description": [], @@ -796,7 +799,7 @@ }, { "tags": [], - "id": "def-public.connectToQueryState.syncConfig.query", + "id": "def-public.connectToQueryState.$3.syncConfig.query", "type": "CompoundType", "label": "query", "description": [], @@ -868,6 +871,7 @@ "type": "Function", "children": [ { + "id": "def-public.createSavedQueryService.$1", "type": "Object", "label": "savedObjectsClient", "isRequired": true, @@ -880,7 +884,7 @@ "section": "def-public.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"find\" | \"bulkGet\" | \"update\" | \"bulkUpdate\">" ], "description": [], "source": { @@ -898,7 +902,7 @@ "section": "def-public.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\">) => ", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"find\" | \"bulkGet\" | \"update\" | \"bulkUpdate\">) => ", { "pluginId": "data", "scope": "public", @@ -931,17 +935,12 @@ "description": [], "children": [ { + "id": "def-public.getDefaultQuery.$1", "type": "CompoundType", "label": "language", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.QueryLanguage", - "text": "QueryLanguage" - } + "QueryLanguage" ], "description": [], "source": { @@ -963,6 +962,7 @@ "type": "Function", "children": [ { + "id": "def-public.syncQueryStateWithUrl.$1", "type": "Object", "label": "query", "isRequired": true, @@ -984,13 +984,7 @@ "text": "FilterManager" }, "; queryString: Pick<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.QueryStringManager", - "text": "QueryStringManager" - }, + "QueryStringManager", ", \"getDefaultQuery\" | \"formatQuery\" | \"getUpdates$\" | \"getQuery\" | \"setQuery\" | \"clearQuery\">; savedQueries: ", { "pluginId": "data", @@ -1009,6 +1003,7 @@ } }, { + "id": "def-public.syncQueryStateWithUrl.$2", "type": "Object", "label": "kbnUrlStateStorage", "isRequired": true, @@ -1253,13 +1248,7 @@ "lineNumber": 17 }, "signature": [ - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.SavedQueryAttributes", - "text": "SavedQueryAttributes" - } + "SavedQueryAttributes" ] } ], @@ -1288,13 +1277,7 @@ }, "signature": [ "(attributes: ", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.SavedQueryAttributes", - "text": "SavedQueryAttributes" - }, + "SavedQueryAttributes", ", config?: { overwrite: boolean; } | undefined) => Promise<", { "pluginId": "data", @@ -1410,6 +1393,21 @@ ], "enums": [], "misc": [ + { + "id": "def-public.AutoRefreshDoneFn", + "type": "Type", + "label": "AutoRefreshDoneFn", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/data/public/query/timefilter/lib/auto_refresh_loop.ts", + "lineNumber": 13 + }, + "signature": [ + "() => void" + ], + "initialIsOpen": false + }, { "id": "def-public.InputTimeRange", "type": "Type", @@ -1503,7 +1501,7 @@ "description": [], "source": { "path": "src/plugins/data/public/query/timefilter/timefilter.ts", - "lineNumber": 240 + "lineNumber": 242 }, "signature": [ "{ isTimeRangeSelectorEnabled: () => boolean; isAutoRefreshSelectorEnabled: () => boolean; isTimeTouched: () => boolean; getEnabledUpdated$: () => ", @@ -1514,7 +1512,7 @@ "Observable", "; getAutoRefreshFetch$: () => ", "Observable", - "; getFetch$: () => ", + "; getFetch$: () => ", "Observable" ], "initialIsOpen": false @@ -1573,6 +1571,7 @@ "description": [], "children": [ { + "id": "def-common.calculateBounds.$1", "type": "Object", "label": "timeRange", "isRequired": true, @@ -1592,6 +1591,7 @@ } }, { + "id": "def-common.calculateBounds.$2", "type": "Object", "label": "options", "isRequired": true, @@ -1618,6 +1618,7 @@ "type": "Function", "children": [ { + "id": "def-common.compareFilters.$1", "type": "CompoundType", "label": "first", "isRequired": true, @@ -1646,6 +1647,7 @@ } }, { + "id": "def-common.compareFilters.$2", "type": "CompoundType", "label": "second", "isRequired": true, @@ -1674,6 +1676,7 @@ } }, { + "id": "def-common.compareFilters.$3", "type": "Object", "label": "comparatorOptions", "isRequired": true, @@ -1754,6 +1757,7 @@ "type": "Function", "children": [ { + "id": "def-common.dedupFilters.$1", "type": "Array", "label": "existingFilters", "isRequired": true, @@ -1774,6 +1778,7 @@ } }, { + "id": "def-common.dedupFilters.$2", "type": "Array", "label": "filters", "isRequired": true, @@ -1794,6 +1799,7 @@ } }, { + "id": "def-common.dedupFilters.$3", "type": "Object", "label": "comparatorOptions", "isRequired": true, @@ -1887,6 +1893,7 @@ "description": [], "children": [ { + "id": "def-common.getAbsoluteTimeRange.$1", "type": "Object", "label": "timeRange", "isRequired": true, @@ -1906,7 +1913,7 @@ } }, { - "id": "def-common.getAbsoluteTimeRange.{-forceNow }", + "id": "def-common.getAbsoluteTimeRange.$2.forceNow", "type": "Object", "label": "{ forceNow }", "tags": [], @@ -1914,7 +1921,7 @@ "children": [ { "tags": [], - "id": "def-common.getAbsoluteTimeRange.{-forceNow }.forceNow", + "id": "def-common.getAbsoluteTimeRange.$2.forceNow.forceNow", "type": "Object", "label": "forceNow", "description": [], @@ -1975,6 +1982,7 @@ "description": [], "children": [ { + "id": "def-common.getTime.$1", "type": "Object", "label": "indexPattern", "isRequired": false, @@ -1995,6 +2003,7 @@ } }, { + "id": "def-common.getTime.$2", "type": "Object", "label": "timeRange", "isRequired": true, @@ -2014,7 +2023,7 @@ } }, { - "id": "def-common.getTime.options", + "id": "def-common.getTime.$3.options", "type": "Object", "label": "options", "tags": [], @@ -2022,7 +2031,7 @@ "children": [ { "tags": [], - "id": "def-common.getTime.options.forceNow", + "id": "def-common.getTime.$3.options.forceNow", "type": "Object", "label": "forceNow", "description": [], @@ -2036,7 +2045,7 @@ }, { "tags": [], - "id": "def-common.getTime.options.fieldName", + "id": "def-common.getTime.$3.options.fieldName", "type": "string", "label": "fieldName", "description": [], @@ -2068,6 +2077,7 @@ "type": "Function", "children": [ { + "id": "def-common.isQuery.$1", "type": "Unknown", "label": "x", "isRequired": true, @@ -2106,6 +2116,7 @@ "type": "Function", "children": [ { + "id": "def-common.isTimeRange.$1", "type": "Unknown", "label": "x", "isRequired": true, @@ -2144,6 +2155,7 @@ "type": "Function", "children": [ { + "id": "def-common.uniqFilters.$1", "type": "Array", "label": "filters", "isRequired": true, @@ -2164,6 +2176,7 @@ } }, { + "id": "def-common.uniqFilters.$2", "type": "Any", "label": "comparatorOptions", "isRequired": true, diff --git a/api_docs/data_search.json b/api_docs/data_search.json index 53b8294de02fc..b50d6d267d3f8 100644 --- a/api_docs/data_search.json +++ b/api_docs/data_search.json @@ -65,17 +65,12 @@ "description": [], "children": [ { + "id": "def-public.PainlessError.Unnamed.$1", "type": "Object", "label": "err", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataSearchPluginApi", - "section": "def-public.IEsError", - "text": "IEsError" - } + "IEsError" ], "description": [], "source": { @@ -84,6 +79,7 @@ } }, { + "id": "def-public.PainlessError.Unnamed.$2", "type": "Object", "label": "indexPattern", "isRequired": false, @@ -129,6 +125,7 @@ "description": [], "children": [ { + "id": "def-public.PainlessError.getErrorMessage.$1", "type": "Object", "label": "application", "isRequired": true, @@ -179,6 +176,7 @@ "description": [], "children": [ { + "id": "def-public.SearchInterceptor.Unnamed.$1", "type": "Object", "label": "deps", "isRequired": true, @@ -194,7 +192,7 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 75 + "lineNumber": 65 } } ], @@ -202,7 +200,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 75 + "lineNumber": 65 } }, { @@ -225,7 +223,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 91 + "lineNumber": 81 } }, { @@ -249,7 +247,7 @@ "section": "def-common.AbortError", "text": "AbortError" }, - ", timeoutSignal: AbortSignal, options?: ", + ", options?: ", { "pluginId": "data", "scope": "common", @@ -257,11 +255,12 @@ "section": "def-common.ISearchOptions", "text": "ISearchOptions" }, - " | undefined) => Error" + " | undefined, isTimeout?: boolean | undefined) => Error" ], "description": [], "children": [ { + "id": "def-public.SearchInterceptor.handleSearchError.$1", "type": "CompoundType", "label": "e", "isRequired": true, @@ -285,23 +284,11 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 100 - } - }, - { - "type": "Object", - "label": "timeoutSignal", - "isRequired": true, - "signature": [ - "AbortSignal" - ], - "description": [], - "source": { - "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 101 + "lineNumber": 90 } }, { + "id": "def-public.SearchInterceptor.handleSearchError.$2", "type": "Object", "label": "options", "isRequired": false, @@ -318,7 +305,21 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 102 + "lineNumber": 91 + } + }, + { + "id": "def-public.SearchInterceptor.handleSearchError.$3", + "type": "CompoundType", + "label": "isTimeout", + "isRequired": false, + "signature": [ + "boolean | undefined" + ], + "description": [], + "source": { + "path": "src/plugins/data/public/search/search_interceptor.ts", + "lineNumber": 92 } } ], @@ -326,7 +327,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 99 + "lineNumber": 89 } }, { @@ -350,7 +351,7 @@ "section": "def-common.ISearchOptions", "text": "ISearchOptions" }, - " | undefined) => ", + ") => ", "Observable", "<", { @@ -367,6 +368,7 @@ ], "children": [ { + "id": "def-public.SearchInterceptor.search.$1", "type": "Object", "label": "request", "isRequired": true, @@ -383,13 +385,14 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 247 + "lineNumber": 183 } }, { + "id": "def-public.SearchInterceptor.search.$2", "type": "Object", "label": "options", - "isRequired": false, + "isRequired": true, "signature": [ { "pluginId": "data", @@ -397,13 +400,12 @@ "docId": "kibDataSearchPluginApi", "section": "def-common.ISearchOptions", "text": "ISearchOptions" - }, - " | undefined" + } ], "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 248 + "lineNumber": 184 } } ], @@ -415,7 +417,7 @@ ], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 246 + "lineNumber": 182 } }, { @@ -428,6 +430,7 @@ "description": [], "children": [ { + "id": "def-public.SearchInterceptor.showError.$1", "type": "Object", "label": "e", "isRequired": true, @@ -437,7 +440,7 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 275 + "lineNumber": 207 } } ], @@ -445,13 +448,13 @@ "returnComment": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 275 + "lineNumber": 207 } } ], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 50 + "lineNumber": 46 }, "initialIsOpen": false }, @@ -511,6 +514,7 @@ "description": [], "children": [ { + "id": "def-public.SearchTimeoutError.Unnamed.$1", "type": "Object", "label": "err", "isRequired": true, @@ -524,6 +528,7 @@ } }, { + "id": "def-public.SearchTimeoutError.Unnamed.$2", "type": "Enum", "label": "mode", "isRequired": true, @@ -568,6 +573,7 @@ "description": [], "children": [ { + "id": "def-public.SearchTimeoutError.getErrorMessage.$1", "type": "Object", "label": "application", "isRequired": true, @@ -621,6 +627,7 @@ "description": [], "children": [ { + "id": "def-public.getEsPreference.$1", "type": "Object", "label": "uiSettings", "isRequired": true, @@ -640,6 +647,7 @@ } }, { + "id": "def-public.getEsPreference.$2", "type": "string", "label": "sessionId", "isRequired": true, @@ -660,6 +668,84 @@ "lineNumber": 14 }, "initialIsOpen": false + }, + { + "id": "def-public.waitUntilNextSessionCompletes$", + "type": "Function", + "label": "waitUntilNextSessionCompletes$", + "signature": [ + "(sessionService: Pick<", + "SessionService", + ", \"start\" | \"destroy\" | \"state$\" | \"sessionMeta$\" | \"hasAccess\" | \"trackSearch\" | \"getSessionId\" | \"getSession$\" | \"isStored\" | \"isRestore\" | \"restore\" | \"clear\" | \"cancel\" | \"save\" | \"renameCurrentSession\" | \"isCurrentSession\" | \"getSearchOptions\" | \"enableStorage\" | \"isSessionStorageReady\" | \"getSearchSessionIndicatorUiConfig\">, { waitForIdle = 1000 }: ", + { + "pluginId": "data", + "scope": "public", + "docId": "kibDataSearchPluginApi", + "section": "def-public.WaitUntilNextSessionCompletesOptions", + "text": "WaitUntilNextSessionCompletesOptions" + }, + ") => ", + "Observable", + "<", + { + "pluginId": "data", + "scope": "public", + "docId": "kibDataSearchPluginApi", + "section": "def-public.SearchSessionState", + "text": "SearchSessionState" + }, + ">" + ], + "description": [ + "\nCreates an observable that emits when next search session completes.\nThis utility is helpful to use in the application to delay some tasks until next session completes.\n" + ], + "children": [ + { + "id": "def-public.waitUntilNextSessionCompletes$.$1", + "type": "Object", + "label": "sessionService", + "isRequired": true, + "signature": [ + "Pick<", + "SessionService", + ", \"start\" | \"destroy\" | \"state$\" | \"sessionMeta$\" | \"hasAccess\" | \"trackSearch\" | \"getSessionId\" | \"getSession$\" | \"isStored\" | \"isRestore\" | \"restore\" | \"clear\" | \"cancel\" | \"save\" | \"renameCurrentSession\" | \"isCurrentSession\" | \"getSearchOptions\" | \"enableStorage\" | \"isSessionStorageReady\" | \"getSearchSessionIndicatorUiConfig\">" + ], + "description": [ + "- {@link ISessionService}" + ], + "source": { + "path": "src/plugins/data/public/search/session/session_helpers.ts", + "lineNumber": 31 + } + }, + { + "id": "def-public.waitUntilNextSessionCompletes$.$2", + "type": "Object", + "label": "{ waitForIdle = 1000 }", + "isRequired": true, + "signature": [ + { + "pluginId": "data", + "scope": "public", + "docId": "kibDataSearchPluginApi", + "section": "def-public.WaitUntilNextSessionCompletesOptions", + "text": "WaitUntilNextSessionCompletesOptions" + } + ], + "description": [], + "source": { + "path": "src/plugins/data/public/search/session/session_helpers.ts", + "lineNumber": 32 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "src/plugins/data/public/search/session/session_helpers.ts", + "lineNumber": 30 + }, + "initialIsOpen": false } ], "interfaces": [ @@ -683,13 +769,7 @@ "lineNumber": 29 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggsCommonSetup", - "text": "AggsCommonSetup" - } + "AggsCommonSetup" ] }, { @@ -703,13 +783,7 @@ "lineNumber": 30 }, "signature": [ - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataSearchPluginApi", - "section": "def-public.SearchUsageCollector", - "text": "SearchUsageCollector" - }, + "SearchUsageCollector", " | undefined" ] }, @@ -727,14 +801,8 @@ }, "signature": [ "Pick<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataSearchPluginApi", - "section": "def-public.SessionService", - "text": "SessionService" - }, - ", \"start\" | \"destroy\" | \"state$\" | \"searchSessionName$\" | \"hasAccess\" | \"trackSearch\" | \"getSessionId\" | \"getSession$\" | \"isStored\" | \"isRestore\" | \"restore\" | \"clear\" | \"cancel\" | \"save\" | \"renameCurrentSession\" | \"isCurrentSession\" | \"getSearchOptions\" | \"enableStorage\" | \"isSessionStorageReady\" | \"getSearchSessionIndicatorUiConfig\">" + "SessionService", + ", \"start\" | \"destroy\" | \"state$\" | \"sessionMeta$\" | \"hasAccess\" | \"trackSearch\" | \"getSessionId\" | \"getSession$\" | \"isStored\" | \"isRestore\" | \"restore\" | \"clear\" | \"cancel\" | \"save\" | \"renameCurrentSession\" | \"isCurrentSession\" | \"getSearchOptions\" | \"enableStorage\" | \"isSessionStorageReady\" | \"getSearchSessionIndicatorUiConfig\">" ] }, { @@ -751,13 +819,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataSearchPluginApi", - "section": "def-public.SessionsClient", - "text": "SessionsClient" - }, + "SessionsClient", ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"rename\" | \"extend\">" ] } @@ -793,30 +855,12 @@ }, "signature": [ "Pick & Pick<{ types: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggTypesRegistryStart", - "text": "AggTypesRegistryStart" - }, + "AggsCommonStart", + ", \"calculateAutoTimeExpression\" | \"datatableUtilities\" | \"createAggConfigs\"> & Pick<{ types: ", + "AggTypesRegistryStart", "; }, \"types\"> & Pick<{ types: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggTypesRegistryStart", - "text": "AggTypesRegistryStart" - }, - "; }, never>, \"calculateAutoTimeExpression\" | \"getDateMetaByDatatableColumn\" | \"datatableUtilities\" | \"createAggConfigs\" | \"types\">" + "AggTypesRegistryStart", + "; }, never>, \"calculateAutoTimeExpression\" | \"datatableUtilities\" | \"createAggConfigs\" | \"types\">" ] }, { @@ -891,14 +935,8 @@ }, "signature": [ "Pick<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataSearchPluginApi", - "section": "def-public.SessionService", - "text": "SessionService" - }, - ", \"start\" | \"destroy\" | \"state$\" | \"searchSessionName$\" | \"hasAccess\" | \"trackSearch\" | \"getSessionId\" | \"getSession$\" | \"isStored\" | \"isRestore\" | \"restore\" | \"clear\" | \"cancel\" | \"save\" | \"renameCurrentSession\" | \"isCurrentSession\" | \"getSearchOptions\" | \"enableStorage\" | \"isSessionStorageReady\" | \"getSearchSessionIndicatorUiConfig\">" + "SessionService", + ", \"start\" | \"destroy\" | \"state$\" | \"sessionMeta$\" | \"hasAccess\" | \"trackSearch\" | \"getSessionId\" | \"getSession$\" | \"isStored\" | \"isRestore\" | \"restore\" | \"clear\" | \"cancel\" | \"save\" | \"renameCurrentSession\" | \"isCurrentSession\" | \"getSearchOptions\" | \"enableStorage\" | \"isSessionStorageReady\" | \"getSearchSessionIndicatorUiConfig\">" ] }, { @@ -915,13 +953,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataSearchPluginApi", - "section": "def-public.SessionsClient", - "text": "SessionsClient" - }, + "SessionsClient", ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"rename\" | \"extend\">" ] } @@ -947,7 +979,7 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 41 + "lineNumber": 37 }, "signature": [ { @@ -967,7 +999,7 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 42 + "lineNumber": 38 }, "signature": [ { @@ -987,7 +1019,7 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 43 + "lineNumber": 39 }, "signature": [ { @@ -1007,7 +1039,7 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 44 + "lineNumber": 40 }, "signature": [ "Promise<[", @@ -1029,7 +1061,7 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 45 + "lineNumber": 41 }, "signature": [ "Pick<", @@ -1051,16 +1083,10 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 46 + "lineNumber": 42 }, "signature": [ - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataSearchPluginApi", - "section": "def-public.SearchUsageCollector", - "text": "SearchUsageCollector" - }, + "SearchUsageCollector", " | undefined" ] }, @@ -1072,24 +1098,18 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 47 + "lineNumber": 43 }, "signature": [ "Pick<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataSearchPluginApi", - "section": "def-public.SessionService", - "text": "SessionService" - }, - ", \"start\" | \"destroy\" | \"state$\" | \"searchSessionName$\" | \"hasAccess\" | \"trackSearch\" | \"getSessionId\" | \"getSession$\" | \"isStored\" | \"isRestore\" | \"restore\" | \"clear\" | \"cancel\" | \"save\" | \"renameCurrentSession\" | \"isCurrentSession\" | \"getSearchOptions\" | \"enableStorage\" | \"isSessionStorageReady\" | \"getSearchSessionIndicatorUiConfig\">" + "SessionService", + ", \"start\" | \"destroy\" | \"state$\" | \"sessionMeta$\" | \"hasAccess\" | \"trackSearch\" | \"getSessionId\" | \"getSession$\" | \"isStored\" | \"isRestore\" | \"restore\" | \"clear\" | \"cancel\" | \"save\" | \"renameCurrentSession\" | \"isCurrentSession\" | \"getSearchOptions\" | \"enableStorage\" | \"isSessionStorageReady\" | \"getSearchSessionIndicatorUiConfig\">" ] } ], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 40 + "lineNumber": 36 }, "initialIsOpen": false }, @@ -1122,7 +1142,7 @@ ], "source": { "path": "src/plugins/data/public/search/session/session_service.ts", - "lineNumber": 45 + "lineNumber": 46 }, "signature": [ "() => Promise" @@ -1138,7 +1158,7 @@ ], "source": { "path": "src/plugins/data/public/search/session/session_service.ts", - "lineNumber": 51 + "lineNumber": 52 }, "signature": [ "boolean | undefined" @@ -1152,7 +1172,7 @@ "description": [], "source": { "path": "src/plugins/data/public/search/session/session_service.ts", - "lineNumber": 53 + "lineNumber": 54 }, "signature": [ "() => Promise<{ urlGeneratorId: ID; initialState: ", @@ -1177,7 +1197,39 @@ ], "source": { "path": "src/plugins/data/public/search/session/session_service.ts", - "lineNumber": 40 + "lineNumber": 41 + }, + "initialIsOpen": false + }, + { + "id": "def-public.WaitUntilNextSessionCompletesOptions", + "type": "Interface", + "label": "WaitUntilNextSessionCompletesOptions", + "description": [ + "\nOptions for {@link waitUntilNextSessionCompletes$}" + ], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-public.WaitUntilNextSessionCompletesOptions.waitForIdle", + "type": "number", + "label": "waitForIdle", + "description": [ + "\nFor how long to wait between session state transitions before considering that session completed" + ], + "source": { + "path": "src/plugins/data/public/search/session/session_helpers.ts", + "lineNumber": 20 + }, + "signature": [ + "number | undefined" + ] + } + ], + "source": { + "path": "src/plugins/data/public/search/session/session_helpers.ts", + "lineNumber": 16 }, "initialIsOpen": false } @@ -1195,7 +1247,7 @@ ], "source": { "path": "src/plugins/data/public/search/session/search_session_state.ts", - "lineNumber": 20 + "lineNumber": 21 }, "initialIsOpen": false }, @@ -1213,69 +1265,6 @@ } ], "misc": [ - { - "id": "def-public.EsdslExpressionFunctionDefinition", - "type": "Type", - "label": "EsdslExpressionFunctionDefinition", - "tags": [], - "description": [], - "source": { - "path": "src/plugins/data/public/search/expressions/esdsl.ts", - "lineNumber": 30 - }, - "signature": [ - "ExpressionFunctionDefinition<\"esdsl\", ", - { - "pluginId": "expressions", - "scope": "public", - "docId": "kibExpressionsPluginApi", - "section": "def-public.ExpressionValueBoxed", - "text": "ExpressionValueBoxed" - }, - "<\"kibana_context\", ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.ExecutionContextSearch", - "text": "ExecutionContextSearch" - }, - "> | null, Arguments, Output, ", - { - "pluginId": "expressions", - "scope": "public", - "docId": "kibExpressionsPluginApi", - "section": "def-public.ExecutionContext", - "text": "ExecutionContext" - }, - "<", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Adapters", - "text": "Adapters" - }, - ", ", - "SerializableState" - ], - "initialIsOpen": false - }, - { - "id": "def-public.EsRawResponseExpressionTypeDefinition", - "type": "Type", - "label": "EsRawResponseExpressionTypeDefinition", - "tags": [], - "description": [], - "source": { - "path": "src/plugins/data/public/search/expressions/es_raw_response.ts", - "lineNumber": 57 - }, - "signature": [ - "ExpressionTypeDefinition<\"es_raw_response\", EsRawResponse, EsRawResponse>" - ], - "initialIsOpen": false - }, { "id": "def-public.ISessionsClient", "type": "Type", @@ -1299,10 +1288,10 @@ "description": [], "source": { "path": "src/plugins/data/public/search/session/session_service.ts", - "lineNumber": 31 + "lineNumber": 32 }, "signature": [ - "{ start: () => string; destroy: () => void; readonly state$: Observable; readonly searchSessionName$: Observable; hasAccess: () => boolean; trackSearch: (searchDescriptor: TrackSearchDescriptor) => () => void; getSessionId: () => string | undefined; getSession$: () => Observable; isStored: () => boolean; isRestore: () => boolean; restore: (sessionId: string) => void; clear: () => void; cancel: () => Promise; save: () => Promise; renameCurrentSession: (newName: string) => Promise; isCurrentSession: (sessionId?: string | undefined) => boolean; getSearchOptions: (sessionId?: string | undefined) => Required> | null; enableStorage: (searchSessionInfoProvider: SearchSessionInfoProvider, searchSessionIndicatorUiConfig?: SearchSessionIndicatorUiConfig | undefined) => void; isSessionStorageReady: () => boolean; getSearchSessionIndicatorUiConfig: () => SearchSessionIndicatorUiConfig; }" + "{ start: () => string; destroy: () => void; readonly state$: Observable; readonly sessionMeta$: Observable; hasAccess: () => boolean; trackSearch: (searchDescriptor: TrackSearchDescriptor) => () => void; getSessionId: () => string | undefined; getSession$: () => Observable; isStored: () => boolean; isRestore: () => boolean; restore: (sessionId: string) => void; clear: () => void; cancel: () => Promise; save: () => Promise; renameCurrentSession: (newName: string) => Promise; isCurrentSession: (sessionId?: string | undefined) => boolean; getSearchOptions: (sessionId?: string | undefined) => Required> | null; enableStorage: (searchSessionInfoProvider: SearchSessionInfoProvider, searchSessionIndicatorUiConfig?: SearchSessionIndicatorUiConfig | undefined) => void; isSessionStorageReady: () => boolean; getSearchSessionIndicatorUiConfig: () => SearchSessionIndicatorUiConfig; }" ], "initialIsOpen": false }, @@ -1363,6 +1352,7 @@ "description": [], "children": [ { + "id": "def-server.getDefaultSearchParams.$1", "type": "Object", "label": "uiSettingsClient", "isRequired": true, @@ -1409,6 +1399,7 @@ "description": [], "children": [ { + "id": "def-server.getShardTimeout.$1", "type": "Object", "label": "config", "isRequired": true, @@ -1474,6 +1465,7 @@ ], "children": [ { + "id": "def-server.searchUsageObserver.$1", "type": "Object", "label": "logger", "isRequired": true, @@ -1487,6 +1479,7 @@ } }, { + "id": "def-server.searchUsageObserver.$2", "type": "Object", "label": "usage", "isRequired": false, @@ -1507,6 +1500,7 @@ } }, { + "id": "def-server.searchUsageObserver.$3", "type": "Object", "label": "{ isRestore }", "isRequired": true, @@ -1559,6 +1553,7 @@ "description": [], "children": [ { + "id": "def-server.usageProvider.$1", "type": "Object", "label": "core", "isRequired": true, @@ -1625,13 +1620,7 @@ }, "signature": [ "(sessionId: string, attributes: Partial) => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", " | undefined>" ] }, @@ -1647,13 +1636,7 @@ }, "signature": [ "(sessionId: string) => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ] }, @@ -1811,13 +1794,7 @@ "text": "KibanaRequest" }, ") => ", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataSearchPluginApi", - "section": "def-server.IScopedSearchSessionsClient", - "text": "IScopedSearchSessionsClient" - }, + "IScopedSearchSessionsClient", "" ] } @@ -1846,13 +1823,7 @@ "lineNumber": 43 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggsCommonSetup", - "text": "AggsCommonSetup" - } + "AggsCommonSetup" ] }, { @@ -1968,13 +1939,7 @@ "lineNumber": 103 }, "signature": [ - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataSearchPluginApi", - "section": "def-server.AggsStart", - "text": "AggsStart" - } + "AggsStart" ] }, { @@ -2211,7 +2176,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ] }, { @@ -2265,13 +2230,7 @@ "lineNumber": 39 }, "signature": [ - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataSearchPluginApi", - "section": "def-server.IScopedSearchSessionsClient", - "text": "IScopedSearchSessionsClient" - }, + "IScopedSearchSessionsClient", "" ] } @@ -2315,6 +2274,7 @@ "description": [], "children": [ { + "id": "def-server.SearchUsage.trackSuccess.$1", "type": "number", "label": "duration", "isRequired": true, @@ -2392,6 +2352,7 @@ ], "children": [ { + "id": "def-common.AggConfig.ensureIds.$1", "type": "Array", "label": "list", "isRequired": true, @@ -2438,6 +2399,7 @@ ], "children": [ { + "id": "def-common.AggConfig.nextId.$1", "type": "Array", "label": "list", "isRequired": true, @@ -2584,6 +2546,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfig.Unnamed.$1", "type": "Object", "label": "aggConfigs", "isRequired": true, @@ -2603,18 +2566,13 @@ } }, { + "id": "def-common.AggConfig.Unnamed.$2", "type": "Object", "label": "opts", "isRequired": true, "signature": [ "Pick & Pick<{ type: ", { "pluginId": "data", @@ -2659,6 +2617,7 @@ ], "children": [ { + "id": "def-common.AggConfig.setParams.$1", "type": "Any", "label": "from", "isRequired": true, @@ -2693,6 +2652,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfig.getParam.$1", "type": "string", "label": "key", "isRequired": true, @@ -2731,6 +2691,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfig.write.$1", "type": "Object", "label": "aggs", "isRequired": false, @@ -2784,6 +2745,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfig.createFilter.$1", "type": "string", "label": "key", "isRequired": true, @@ -2797,6 +2759,7 @@ } }, { + "id": "def-common.AggConfig.createFilter.$2", "type": "Object", "label": "params", "isRequired": true, @@ -2845,6 +2808,7 @@ ], "children": [ { + "id": "def-common.AggConfig.onSearchRequestStart.$1", "type": "Object", "label": "searchSource", "isRequired": true, @@ -2866,6 +2830,7 @@ } }, { + "id": "def-common.AggConfig.onSearchRequestStart.$2", "type": "Object", "label": "options", "isRequired": false, @@ -2915,6 +2880,7 @@ ], "children": [ { + "id": "def-common.AggConfig.toDsl.$1", "type": "Object", "label": "aggConfigs", "isRequired": false, @@ -2954,13 +2920,7 @@ "label": "serialize", "signature": [ "() => { type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; }" ], "description": [], @@ -2980,13 +2940,7 @@ "label": "toJSON", "signature": [ "() => { type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; }" ], "description": [], @@ -3136,6 +3090,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfig.getValue.$1", "type": "Any", "label": "bucket", "isRequired": true, @@ -3166,6 +3121,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfig.getKey.$1", "type": "Any", "label": "bucket", "isRequired": true, @@ -3179,6 +3135,7 @@ } }, { + "id": "def-common.AggConfig.getKey.$2", "type": "string", "label": "key", "isRequired": false, @@ -3259,6 +3216,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfig.makeLabel.$1", "type": "boolean", "label": "percentageMode", "isRequired": true, @@ -3347,7 +3305,7 @@ "type": "Function", "label": "fieldIsTimeField", "signature": [ - "() => boolean | \"\" | undefined" + "() => boolean" ], "description": [], "children": [], @@ -3366,7 +3324,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_config.ts", - "lineNumber": 448 + "lineNumber": 452 }, "signature": [ { @@ -3386,7 +3344,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_config.ts", - "lineNumber": 452 + "lineNumber": 456 }, "signature": [ { @@ -3416,6 +3374,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfig.setType.$1", "type": "Object", "label": "type", "isRequired": true, @@ -3431,7 +3390,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_config.ts", - "lineNumber": 482 + "lineNumber": 486 } } ], @@ -3439,7 +3398,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_config.ts", - "lineNumber": 482 + "lineNumber": 486 } } ], @@ -3497,6 +3456,20 @@ " | undefined" ] }, + { + "tags": [], + "id": "def-common.AggConfigs.timeFields", + "type": "Array", + "label": "timeFields", + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/agg_configs.ts", + "lineNumber": 67 + }, + "signature": [ + "string[] | undefined" + ] + }, { "tags": [], "id": "def-common.AggConfigs.aggs", @@ -3505,7 +3478,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 69 + "lineNumber": 70 }, "signature": [ { @@ -3528,6 +3501,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.Unnamed.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -3543,22 +3517,17 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 72 + "lineNumber": 73 } }, { + "id": "def-common.AggConfigs.Unnamed.$2", "type": "Array", "label": "configStates", "isRequired": true, "signature": [ "Pick & Pick<{ type: string | ", { "pluginId": "data", @@ -3580,26 +3549,58 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 73 + "lineNumber": 74 } }, { - "type": "Object", - "label": "opts", - "isRequired": true, + "id": "def-common.AggConfigs.Unnamed.$3", + "type": "Object", + "label": "opts", + "isRequired": true, + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.AggConfigsOptions", + "text": "AggConfigsOptions" + } + ], + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/agg_configs.ts", + "lineNumber": 75 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "src/plugins/data/common/search/aggs/agg_configs.ts", + "lineNumber": 72 + } + }, + { + "id": "def-common.AggConfigs.setTimeFields", + "type": "Function", + "label": "setTimeFields", + "signature": [ + "(timeFields: string[] | undefined) => void" + ], + "description": [], + "children": [ + { + "id": "def-common.AggConfigs.setTimeFields.$1", + "type": "Array", + "label": "timeFields", + "isRequired": false, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggConfigsOptions", - "text": "AggConfigsOptions" - } + "string[] | undefined" ], "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 74 + "lineNumber": 87 } } ], @@ -3607,7 +3608,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 71 + "lineNumber": 87 } }, { @@ -3628,6 +3629,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.setTimeRange.$1", "type": "Object", "label": "timeRange", "isRequired": true, @@ -3643,7 +3645,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 86 + "lineNumber": 91 } } ], @@ -3651,7 +3653,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 86 + "lineNumber": 91 } }, { @@ -3671,6 +3673,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.clone.$1", "type": "Object", "label": "{ enabledOnly = true }", "isRequired": true, @@ -3680,7 +3683,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 104 + "lineNumber": 109 } } ], @@ -3688,7 +3691,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 104 + "lineNumber": 109 } }, { @@ -3696,18 +3699,13 @@ "type": "Function", "children": [ { + "id": "def-common.AggConfigs.createAggConfig.$1", "type": "Object", "label": "params", "isRequired": true, "signature": [ "Pick & Pick<{ type: string | ", { "pluginId": "data", @@ -3729,10 +3727,11 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 118 + "lineNumber": 123 } }, { + "id": "def-common.AggConfigs.createAggConfig.$2", "type": "Object", "label": "{ addToAggConfigs = true }", "isRequired": true, @@ -3742,7 +3741,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 119 + "lineNumber": 124 } } ], @@ -3764,13 +3763,7 @@ "text": "AggConfig" }, ">(params: Pick & Pick<{ type: string | ", { "pluginId": "data", @@ -3792,7 +3785,7 @@ "label": "createAggConfig", "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 117 + "lineNumber": 122 }, "tags": [], "returnComment": [] @@ -3817,6 +3810,7 @@ ], "children": [ { + "id": "def-common.AggConfigs.jsonDataEquals.$1", "type": "Array", "label": "aggConfigs", "isRequired": true, @@ -3835,7 +3829,7 @@ ], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 160 + "lineNumber": 165 } } ], @@ -3843,7 +3837,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 160 + "lineNumber": 165 } }, { @@ -3856,6 +3850,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.toDsl.$1", "type": "boolean", "label": "hierarchical", "isRequired": true, @@ -3865,7 +3860,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 172 + "lineNumber": 177 } } ], @@ -3873,7 +3868,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 172 + "lineNumber": 177 } }, { @@ -3897,7 +3892,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 241 + "lineNumber": 246 } }, { @@ -3917,6 +3912,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.byIndex.$1", "type": "number", "label": "index", "isRequired": true, @@ -3926,7 +3922,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 245 + "lineNumber": 250 } } ], @@ -3934,7 +3930,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 245 + "lineNumber": 250 } }, { @@ -3955,6 +3951,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.byId.$1", "type": "string", "label": "id", "isRequired": true, @@ -3964,7 +3961,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 249 + "lineNumber": 254 } } ], @@ -3972,7 +3969,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 249 + "lineNumber": 254 } }, { @@ -3993,6 +3990,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.byName.$1", "type": "string", "label": "name", "isRequired": true, @@ -4002,7 +4000,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 253 + "lineNumber": 258 } } ], @@ -4010,7 +4008,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 253 + "lineNumber": 258 } }, { @@ -4031,6 +4029,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.byType.$1", "type": "string", "label": "type", "isRequired": true, @@ -4040,7 +4039,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 257 + "lineNumber": 262 } } ], @@ -4048,7 +4047,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 257 + "lineNumber": 262 } }, { @@ -4069,6 +4068,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.byTypeName.$1", "type": "string", "label": "type", "isRequired": true, @@ -4078,7 +4078,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 261 + "lineNumber": 266 } } ], @@ -4086,7 +4086,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 261 + "lineNumber": 266 } }, { @@ -4107,6 +4107,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.bySchemaName.$1", "type": "string", "label": "schema", "isRequired": true, @@ -4116,7 +4117,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 265 + "lineNumber": 270 } } ], @@ -4124,7 +4125,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 265 + "lineNumber": 270 } }, { @@ -4148,7 +4149,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 269 + "lineNumber": 274 } }, { @@ -4169,6 +4170,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.getRequestAggById.$1", "type": "string", "label": "id", "isRequired": true, @@ -4178,7 +4180,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 283 + "lineNumber": 288 } } ], @@ -4186,7 +4188,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 283 + "lineNumber": 288 } }, { @@ -4214,7 +4216,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 298 + "lineNumber": 303 } }, { @@ -4237,6 +4239,7 @@ ], "children": [ { + "id": "def-common.AggConfigs.getResponseAggById.$1", "type": "string", "label": "id", "isRequired": true, @@ -4248,7 +4251,7 @@ ], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 312 + "lineNumber": 317 } } ], @@ -4258,7 +4261,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 312 + "lineNumber": 317 } }, { @@ -4287,6 +4290,7 @@ "description": [], "children": [ { + "id": "def-common.AggConfigs.onSearchRequestStart.$1", "type": "Object", "label": "searchSource", "isRequired": true, @@ -4304,10 +4308,11 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 321 + "lineNumber": 326 } }, { + "id": "def-common.AggConfigs.onSearchRequestStart.$2", "type": "Object", "label": "options", "isRequired": false, @@ -4324,7 +4329,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 321 + "lineNumber": 326 } } ], @@ -4332,7 +4337,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/agg_configs.ts", - "lineNumber": 321 + "lineNumber": 326 } } ], @@ -4379,13 +4384,7 @@ }, "signature": [ "(agg: TAggConfig, state?: { type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined) => TAggConfig" ] }, @@ -4413,6 +4412,7 @@ "description": [], "children": [ { + "id": "def-common.AggParamType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -4455,41 +4455,24 @@ "label": "setup", "signature": [ "({ registerFunction }: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggsCommonSetupDependencies", - "text": "AggsCommonSetupDependencies" - }, + "AggsCommonSetupDependencies", ") => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggsCommonSetup", - "text": "AggsCommonSetup" - } + "AggsCommonSetup" ], "description": [], "children": [ { + "id": "def-common.AggsCommonService.setup.$1", "type": "Object", "label": "{ registerFunction }", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggsCommonSetupDependencies", - "text": "AggsCommonSetupDependencies" - } + "AggsCommonSetupDependencies" ], "description": [], "source": { "path": "src/plugins/data/common/search/aggs/aggs_service.ts", - "lineNumber": 56 + "lineNumber": 55 } } ], @@ -4497,7 +4480,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/aggs_service.ts", - "lineNumber": 56 + "lineNumber": 55 } }, { @@ -4506,41 +4489,24 @@ "label": "start", "signature": [ "({ getConfig, getIndexPattern, isDefaultTimezone, }: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggsCommonStartDependencies", - "text": "AggsCommonStartDependencies" - }, + "AggsCommonStartDependencies", ") => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggsCommonStart", - "text": "AggsCommonStart" - } + "AggsCommonStart" ], "description": [], "children": [ { + "id": "def-common.AggsCommonService.start.$1", "type": "Object", "label": "{\n getConfig,\n getIndexPattern,\n isDefaultTimezone,\n }", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggsCommonStartDependencies", - "text": "AggsCommonStartDependencies" - } + "AggsCommonStartDependencies" ], "description": [], "source": { "path": "src/plugins/data/common/search/aggs/aggs_service.ts", - "lineNumber": 73 + "lineNumber": 72 } } ], @@ -4548,13 +4514,13 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/aggs_service.ts", - "lineNumber": 73 + "lineNumber": 72 } } ], "source": { "path": "src/plugins/data/common/search/aggs/aggs_service.ts", - "lineNumber": 53 + "lineNumber": 52 }, "initialIsOpen": false }, @@ -4935,6 +4901,7 @@ "type": "Function", "children": [ { + "id": "def-common.AggType.paramByName.$1", "type": "string", "label": "name", "isRequired": true, @@ -4965,6 +4932,7 @@ "type": "Function", "children": [ { + "id": "def-common.AggType.getValueBucketPath.$1", "type": "Uncategorized", "label": "agg", "isRequired": true, @@ -5002,6 +4970,7 @@ ], "children": [ { + "id": "def-common.AggType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -5062,13 +5031,7 @@ "children": [], "signature": [ "() => { registerBucket: ", { "pluginId": "data", @@ -5078,13 +5041,7 @@ "text": "BucketAggType" }, ">(name: N, type: T) => void; registerMetric: ", { "pluginId": "data", @@ -5355,6 +5312,7 @@ "description": [], "children": [ { + "id": "def-common.BaseParamType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -5450,6 +5408,7 @@ "description": [], "children": [ { + "id": "def-common.BucketAggType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -5525,6 +5484,7 @@ "description": [], "children": [ { + "id": "def-common.CidrMask.Unnamed.$1", "type": "string", "label": "mask", "isRequired": true, @@ -5625,7 +5585,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 24 + "lineNumber": 27 } }, { @@ -5636,7 +5596,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 25 + "lineNumber": 28 } }, { @@ -5647,7 +5607,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 26 + "lineNumber": 29 }, "signature": [ { @@ -5667,7 +5627,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 27 + "lineNumber": 30 } }, { @@ -5680,6 +5640,7 @@ "description": [], "children": [ { + "id": "def-common.FieldParamType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -5689,7 +5650,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 29 + "lineNumber": 32 } } ], @@ -5697,7 +5658,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 29 + "lineNumber": 32 } }, { @@ -5705,6 +5666,7 @@ "type": "Function", "children": [ { + "id": "def-common.FieldParamType.getAvailableFields.$1", "type": "Object", "label": "aggConfig", "isRequired": true, @@ -5720,7 +5682,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 100 + "lineNumber": 126 } } ], @@ -5749,7 +5711,7 @@ "label": "getAvailableFields", "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 100 + "lineNumber": 126 }, "tags": [], "returnComment": [] @@ -5757,7 +5719,7 @@ ], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 23 + "lineNumber": 26 }, "initialIsOpen": false }, @@ -5788,6 +5750,7 @@ "description": [], "children": [ { + "id": "def-common.InvalidEsCalendarIntervalError.Unnamed.$1", "type": "string", "label": "interval", "isRequired": true, @@ -5801,6 +5764,7 @@ } }, { + "id": "def-common.InvalidEsCalendarIntervalError.Unnamed.$2", "type": "number", "label": "value", "isRequired": true, @@ -5814,6 +5778,7 @@ } }, { + "id": "def-common.InvalidEsCalendarIntervalError.Unnamed.$3", "type": "CompoundType", "label": "unit", "isRequired": true, @@ -5827,6 +5792,7 @@ } }, { + "id": "def-common.InvalidEsCalendarIntervalError.Unnamed.$4", "type": "string", "label": "type", "isRequired": true, @@ -5881,6 +5847,7 @@ "description": [], "children": [ { + "id": "def-common.InvalidEsIntervalFormatError.Unnamed.$1", "type": "string", "label": "interval", "isRequired": true, @@ -5925,6 +5892,7 @@ "description": [], "children": [ { + "id": "def-common.Ipv4Address.Unnamed.$1", "type": "CompoundType", "label": "ipAddress", "isRequired": true, @@ -6027,6 +5995,7 @@ "description": [], "children": [ { + "id": "def-common.JsonParamType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -6149,6 +6118,7 @@ "description": [], "children": [ { + "id": "def-common.MetricAggType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -6240,6 +6210,7 @@ "description": [], "children": [ { + "id": "def-common.OptionedParamType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -6318,6 +6289,7 @@ "description": [], "children": [ { + "id": "def-common.RequestFailure.Unnamed.$1", "type": "CompoundType", "label": "err", "isRequired": false, @@ -6338,6 +6310,7 @@ } }, { + "id": "def-common.RequestFailure.Unnamed.$2", "type": "Object", "label": "resp", "isRequired": false, @@ -6399,6 +6372,7 @@ "description": [], "children": [ { + "id": "def-common.SearchSource.Unnamed.$1", "type": "Object", "label": "fields", "isRequired": true, @@ -6418,6 +6392,7 @@ } }, { + "id": "def-common.SearchSource.Unnamed.$2", "type": "Object", "label": "dependencies", "isRequired": true, @@ -6456,6 +6431,7 @@ ], "children": [ { + "id": "def-common.SearchSource.setPreferredSearchStrategyId.$1", "type": "string", "label": "searchStrategyId", "isRequired": true, @@ -6496,6 +6472,7 @@ ], "children": [ { + "id": "def-common.SearchSource.setField.$1", "type": "Uncategorized", "label": "field", "isRequired": true, @@ -6511,6 +6488,7 @@ } }, { + "id": "def-common.SearchSource.setField.$2", "type": "Uncategorized", "label": "value", "isRequired": true, @@ -6552,6 +6530,7 @@ ], "children": [ { + "id": "def-common.SearchSource.removeField.$1", "type": "Uncategorized", "label": "field", "isRequired": true, @@ -6594,6 +6573,7 @@ ], "children": [ { + "id": "def-common.SearchSource.setFields.$1", "type": "Object", "label": "newFields", "isRequired": true, @@ -6687,6 +6667,7 @@ ], "children": [ { + "id": "def-common.SearchSource.getField.$1", "type": "Uncategorized", "label": "field", "isRequired": true, @@ -6700,6 +6681,7 @@ } }, { + "id": "def-common.SearchSource.getField.$2", "type": "boolean", "label": "recurse", "isRequired": true, @@ -6740,6 +6722,7 @@ ], "children": [ { + "id": "def-common.SearchSource.getOwnField.$1", "type": "Uncategorized", "label": "field", "isRequired": true, @@ -6829,6 +6812,7 @@ ], "children": [ { + "id": "def-common.SearchSource.createChild.$1", "type": "Object", "label": "options", "isRequired": true, @@ -6877,6 +6861,7 @@ ], "children": [ { + "id": "def-common.SearchSource.setParent.$1", "type": "Object", "label": "parent", "isRequired": false, @@ -6900,6 +6885,7 @@ } }, { + "id": "def-common.SearchSource.setParent.$2", "type": "Object", "label": "options", "isRequired": true, @@ -6984,6 +6970,7 @@ ], "children": [ { + "id": "def-common.SearchSource.fetch$.$1", "type": "Object", "label": "options", "isRequired": true, @@ -7032,6 +7019,7 @@ ], "children": [ { + "id": "def-common.SearchSource.fetch.$1", "type": "Object", "label": "options", "isRequired": true, @@ -7088,6 +7076,7 @@ ], "children": [ { + "id": "def-common.SearchSource.onRequestStart.$1", "type": "Function", "label": "handler", "isRequired": true, @@ -7183,6 +7172,7 @@ ], "children": [ { + "id": "def-common.SearchSource.getSerializedFields.$1", "type": "boolean", "label": "recurse", "isRequired": true, @@ -7209,13 +7199,7 @@ "label": "serialize", "signature": [ "() => { searchSourceJSON: string; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ], "description": [ @@ -7274,7 +7258,7 @@ "section": "def-common.IndexPatternsService", "text": "IndexPatternsService" }, - ", \"get\" | \"delete\" | \"create\" | \"ensureDefaultIndexPattern\" | \"getIds\" | \"getTitles\" | \"find\" | \"getIdsWithTitle\" | \"clearCache\" | \"getCache\" | \"getDefault\" | \"setDefault\" | \"getFieldsForWildcard\" | \"getFieldsForIndexPattern\" | \"refreshFields\" | \"fieldArrayToMap\" | \"savedObjectToSpec\" | \"createAndSave\" | \"createSavedObject\" | \"updateSavedObject\">, dependencies: ", + ", \"get\" | \"delete\" | \"create\" | \"find\" | \"ensureDefaultIndexPattern\" | \"getIds\" | \"getTitles\" | \"getIdsWithTitle\" | \"clearCache\" | \"getCache\" | \"getDefault\" | \"setDefault\" | \"getFieldsForWildcard\" | \"getFieldsForIndexPattern\" | \"refreshFields\" | \"fieldArrayToMap\" | \"savedObjectToSpec\" | \"createAndSave\" | \"createSavedObject\" | \"updateSavedObject\">, dependencies: ", { "pluginId": "data", "scope": "common", @@ -7310,6 +7294,7 @@ "description": [], "children": [ { + "id": "def-common.SearchSourceService.start.$1", "type": "Object", "label": "indexPatterns", "isRequired": true, @@ -7322,7 +7307,7 @@ "section": "def-common.IndexPatternsService", "text": "IndexPatternsService" }, - ", \"get\" | \"delete\" | \"create\" | \"ensureDefaultIndexPattern\" | \"getIds\" | \"getTitles\" | \"find\" | \"getIdsWithTitle\" | \"clearCache\" | \"getCache\" | \"getDefault\" | \"setDefault\" | \"getFieldsForWildcard\" | \"getFieldsForIndexPattern\" | \"refreshFields\" | \"fieldArrayToMap\" | \"savedObjectToSpec\" | \"createAndSave\" | \"createSavedObject\" | \"updateSavedObject\">" + ", \"get\" | \"delete\" | \"create\" | \"find\" | \"ensureDefaultIndexPattern\" | \"getIds\" | \"getTitles\" | \"getIdsWithTitle\" | \"clearCache\" | \"getCache\" | \"getDefault\" | \"setDefault\" | \"getFieldsForWildcard\" | \"getFieldsForIndexPattern\" | \"refreshFields\" | \"fieldArrayToMap\" | \"savedObjectToSpec\" | \"createAndSave\" | \"createSavedObject\" | \"updateSavedObject\">" ], "description": [], "source": { @@ -7331,6 +7316,7 @@ } }, { + "id": "def-common.SearchSourceService.start.$2", "type": "Object", "label": "dependencies", "isRequired": true, @@ -7423,6 +7409,7 @@ "description": [], "children": [ { + "id": "def-common.StringParamType.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -7945,6 +7932,23 @@ "returnComment": [], "initialIsOpen": false }, + { + "id": "def-common.aggSinglePercentile", + "type": "Function", + "children": [], + "signature": [ + "() => FunctionDefinition" + ], + "description": [], + "label": "aggSinglePercentile", + "source": { + "path": "src/plugins/data/common/search/aggs/metrics/single_percentile_fn.ts", + "lineNumber": 25 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + }, { "id": "def-common.aggStdDeviation", "type": "Function", @@ -8025,6 +8029,7 @@ ], "children": [ { + "id": "def-common.calcAutoIntervalLessThan.$1", "type": "number", "label": "maxBucketCount", "isRequired": true, @@ -8040,6 +8045,7 @@ } }, { + "id": "def-common.calcAutoIntervalLessThan.$2", "type": "number", "label": "duration", "isRequired": true, @@ -8075,6 +8081,7 @@ ], "children": [ { + "id": "def-common.calcAutoIntervalNear.$1", "type": "number", "label": "targetBucketCount", "isRequired": true, @@ -8090,6 +8097,7 @@ } }, { + "id": "def-common.calcAutoIntervalNear.$2", "type": "number", "label": "duration", "isRequired": true, @@ -8131,6 +8139,7 @@ "description": [], "children": [ { + "id": "def-common.convertDateRangeToString.$1", "type": "Object", "label": "{ from, to }", "isRequired": true, @@ -8150,6 +8159,7 @@ } }, { + "id": "def-common.convertDateRangeToString.$2", "type": "Function", "label": "format", "isRequired": true, @@ -8176,6 +8186,7 @@ "type": "Function", "children": [ { + "id": "def-common.convertIPRangeToString.$1", "type": "CompoundType", "label": "range", "isRequired": true, @@ -8195,6 +8206,7 @@ } }, { + "id": "def-common.convertIPRangeToString.$2", "type": "Function", "label": "format", "isRequired": true, @@ -8234,6 +8246,7 @@ "type": "Function", "children": [ { + "id": "def-common.createSearchSource.$1", "type": "Object", "label": "indexPatterns", "isRequired": true, @@ -8246,7 +8259,7 @@ "section": "def-common.IndexPatternsService", "text": "IndexPatternsService" }, - ", \"get\" | \"delete\" | \"create\" | \"ensureDefaultIndexPattern\" | \"getIds\" | \"getTitles\" | \"find\" | \"getIdsWithTitle\" | \"clearCache\" | \"getCache\" | \"getDefault\" | \"setDefault\" | \"getFieldsForWildcard\" | \"getFieldsForIndexPattern\" | \"refreshFields\" | \"fieldArrayToMap\" | \"savedObjectToSpec\" | \"createAndSave\" | \"createSavedObject\" | \"updateSavedObject\">" + ", \"get\" | \"delete\" | \"create\" | \"find\" | \"ensureDefaultIndexPattern\" | \"getIds\" | \"getTitles\" | \"getIdsWithTitle\" | \"clearCache\" | \"getCache\" | \"getDefault\" | \"setDefault\" | \"getFieldsForWildcard\" | \"getFieldsForIndexPattern\" | \"refreshFields\" | \"fieldArrayToMap\" | \"savedObjectToSpec\" | \"createAndSave\" | \"createSavedObject\" | \"updateSavedObject\">" ], "description": [], "source": { @@ -8255,6 +8268,7 @@ } }, { + "id": "def-common.createSearchSource.$2", "type": "Object", "label": "searchSourceDependencies", "isRequired": true, @@ -8283,7 +8297,7 @@ "section": "def-common.IndexPatternsService", "text": "IndexPatternsService" }, - ", \"get\" | \"delete\" | \"create\" | \"ensureDefaultIndexPattern\" | \"getIds\" | \"getTitles\" | \"find\" | \"getIdsWithTitle\" | \"clearCache\" | \"getCache\" | \"getDefault\" | \"setDefault\" | \"getFieldsForWildcard\" | \"getFieldsForIndexPattern\" | \"refreshFields\" | \"fieldArrayToMap\" | \"savedObjectToSpec\" | \"createAndSave\" | \"createSavedObject\" | \"updateSavedObject\">, searchSourceDependencies: ", + ", \"get\" | \"delete\" | \"create\" | \"find\" | \"ensureDefaultIndexPattern\" | \"getIds\" | \"getTitles\" | \"getIdsWithTitle\" | \"clearCache\" | \"getCache\" | \"getDefault\" | \"setDefault\" | \"getFieldsForWildcard\" | \"getFieldsForIndexPattern\" | \"refreshFields\" | \"fieldArrayToMap\" | \"savedObjectToSpec\" | \"createAndSave\" | \"createSavedObject\" | \"updateSavedObject\">, searchSourceDependencies: ", { "pluginId": "data", "scope": "common", @@ -8338,6 +8352,7 @@ ], "children": [ { + "id": "def-common.dateHistogramInterval.$1", "type": "string", "label": "interval", "isRequired": true, @@ -8366,6 +8381,7 @@ "type": "Function", "children": [ { + "id": "def-common.extractReferences.$1", "type": "Object", "label": "state", "isRequired": true, @@ -8446,6 +8462,7 @@ ], "children": [ { + "id": "def-common.fetchSoon.$1", "type": "Object", "label": "request", "isRequired": true, @@ -8459,6 +8476,7 @@ } }, { + "id": "def-common.fetchSoon.$2", "type": "Object", "label": "options", "isRequired": true, @@ -8478,6 +8496,7 @@ } }, { + "id": "def-common.fetchSoon.$3", "type": "Object", "label": "fetchHandlers", "isRequired": true, @@ -8510,6 +8529,7 @@ "type": "Function", "children": [ { + "id": "def-common.filtersToAst.$1", "type": "CompoundType", "label": "filters", "isRequired": true, @@ -8580,6 +8600,7 @@ "type": "Function", "children": [ { + "id": "def-common.functionWrapper.$1", "type": "Object", "label": "spec", "isRequired": true, @@ -8823,6 +8844,7 @@ "description": [], "children": [ { + "id": "def-common.getCalculateAutoTimeExpression.$1", "type": "Function", "label": "getConfig", "isRequired": true, @@ -8948,6 +8970,7 @@ "type": "Function", "children": [ { + "id": "def-common.getDateHistogramBucketAgg.$1", "type": "Object", "label": "{\n calculateBounds,\n isDefaultTimezone,\n getConfig,\n}", "isRequired": true, @@ -8963,7 +8986,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", - "lineNumber": 74 + "lineNumber": 76 } } ], @@ -8998,7 +9021,63 @@ "label": "getDateHistogramBucketAgg", "source": { "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", - "lineNumber": 74 + "lineNumber": 76 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + }, + { + "id": "def-common.getDateHistogramMetaDataByDatatableColumn", + "type": "Function", + "children": [ + { + "id": "def-common.getDateHistogramMetaDataByDatatableColumn.$1", + "type": "Object", + "label": "column", + "isRequired": true, + "signature": [ + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.DatatableColumn", + "text": "DatatableColumn" + } + ], + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/utils/get_date_histogram_meta.ts", + "lineNumber": 20 + } + } + ], + "signature": [ + "(column: ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.DatatableColumn", + "text": "DatatableColumn" + }, + ") => { interval: string | undefined; timeZone: string | undefined; timeRange: ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataQueryPluginApi", + "section": "def-common.TimeRange", + "text": "TimeRange" + }, + " | undefined; } | undefined" + ], + "description": [ + "\nHelper function returning the used interval, used time zone and applied time filters for data table column created by the date_histogramm agg type.\n\"auto\" will get expanded to the actually used interval.\nIf the column is not a column created by a date_histogram aggregation of the esaggs data source,\nthis function will return undefined." + ], + "label": "getDateHistogramMetaDataByDatatableColumn", + "source": { + "path": "src/plugins/data/common/search/aggs/utils/get_date_histogram_meta.ts", + "lineNumber": 20 }, "tags": [], "returnComment": [], @@ -9009,6 +9088,7 @@ "type": "Function", "children": [ { + "id": "def-common.getDateRangeBucketAgg.$1", "type": "Object", "label": "{\n isDefaultTimezone,\n getConfig,\n}", "isRequired": true, @@ -9098,12 +9178,68 @@ "returnComment": [], "initialIsOpen": false }, + { + "id": "def-common.getEsdslFn", + "type": "Function", + "children": [ + { + "id": "def-common.getEsdslFn.$1.getStartDependencies", + "type": "Object", + "label": "{\n getStartDependencies,\n}", + "tags": [], + "description": [], + "children": [ + { + "tags": [], + "id": "def-common.getEsdslFn.$1.getStartDependencies.getStartDependencies", + "type": "Function", + "label": "getStartDependencies", + "description": [], + "source": { + "path": "src/plugins/data/common/search/expressions/esdsl.ts", + "lineNumber": 45 + }, + "signature": [ + "(getKibanaRequest: any) => Promise<", + "EsdslStartDependencies", + ">" + ] + } + ], + "source": { + "path": "src/plugins/data/common/search/expressions/esdsl.ts", + "lineNumber": 44 + } + } + ], + "signature": [ + "({ getStartDependencies, }: { getStartDependencies: (getKibanaRequest: any) => Promise<", + "EsdslStartDependencies", + ">; }) => ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.EsdslExpressionFunctionDefinition", + "text": "EsdslExpressionFunctionDefinition" + } + ], + "description": [], + "label": "getEsdslFn", + "source": { + "path": "src/plugins/data/common/search/expressions/esdsl.ts", + "lineNumber": 42 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + }, { "id": "def-common.getFilterBucketAgg", "type": "Function", "children": [ { - "id": "def-common.getFilterBucketAgg.{-getConfig }", + "id": "def-common.getFilterBucketAgg.$1.getConfig", "type": "Object", "label": "{ getConfig }", "tags": [], @@ -9111,7 +9247,7 @@ "children": [ { "tags": [], - "id": "def-common.getFilterBucketAgg.{-getConfig }.getConfig", + "id": "def-common.getFilterBucketAgg.$1.getConfig.getConfig", "type": "Function", "label": "getConfig", "description": [], @@ -9197,6 +9333,7 @@ "type": "Function", "children": [ { + "id": "def-common.getFiltersBucketAgg.$1", "type": "Object", "label": "{ getConfig }", "isRequired": true, @@ -9382,6 +9519,7 @@ "type": "Function", "children": [ { + "id": "def-common.getHistogramBucketAgg.$1", "type": "Object", "label": "{\n getConfig,\n getFieldFormatsStart,\n}", "isRequired": true, @@ -9476,6 +9614,7 @@ "type": "Function", "children": [ { + "id": "def-common.getKibanaContextFn.$1", "type": "Function", "label": "getStartDependencies", "isRequired": true, @@ -9489,13 +9628,7 @@ "text": "KibanaRequest" }, ") | undefined) => Promise<", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.KibanaContextStartDependencies", - "text": "KibanaContextStartDependencies" - }, + "KibanaContextStartDependencies", ">" ], "description": [], @@ -9672,6 +9805,7 @@ "type": "Function", "children": [ { + "id": "def-common.getNumberHistogramIntervalByDatatableColumn.$1", "type": "Object", "label": "column", "isRequired": true, @@ -9719,6 +9853,7 @@ "type": "Function", "children": [ { + "id": "def-common.getPercentileRanksMetricAgg.$1", "type": "Object", "label": "{\n getFieldFormatsStart,\n}", "isRequired": true, @@ -9814,6 +9949,7 @@ "description": [], "children": [ { + "id": "def-common.getPreference.$1", "type": "Function", "label": "getConfig", "isRequired": true, @@ -9846,6 +9982,7 @@ "type": "Function", "children": [ { + "id": "def-common.getRangeBucketAgg.$1", "type": "Object", "label": "{ getFieldFormatsStart }", "isRequired": true, @@ -9927,6 +10064,7 @@ "description": [], "children": [ { + "id": "def-common.getRequestInspectorStats.$1", "type": "Object", "label": "searchSource", "isRequired": true, @@ -9985,6 +10123,7 @@ "description": [], "children": [ { + "id": "def-common.getResponseInspectorStats.$1", "type": "Object", "label": "resp", "isRequired": true, @@ -9999,6 +10138,7 @@ } }, { + "id": "def-common.getResponseInspectorStats.$2", "type": "Object", "label": "searchSource", "isRequired": false, @@ -10048,6 +10188,7 @@ "description": [], "children": [ { + "id": "def-common.getSearchParams.$1", "type": "Function", "label": "getConfig", "isRequired": true, @@ -10100,6 +10241,7 @@ "description": [], "children": [ { + "id": "def-common.getSearchParamsFromRequest.$1", "type": "Object", "label": "searchRequest", "isRequired": true, @@ -10113,7 +10255,7 @@ } }, { - "id": "def-common.getSearchParamsFromRequest.dependencies", + "id": "def-common.getSearchParamsFromRequest.$2.dependencies", "type": "Object", "label": "dependencies", "tags": [], @@ -10121,7 +10263,7 @@ "children": [ { "tags": [], - "id": "def-common.getSearchParamsFromRequest.dependencies.getConfig", + "id": "def-common.getSearchParamsFromRequest.$2.dependencies.getConfig", "type": "Function", "label": "getConfig", "description": [], @@ -10222,6 +10364,39 @@ "returnComment": [], "initialIsOpen": false }, + { + "id": "def-common.getSinglePercentileMetricAgg", + "type": "Function", + "children": [], + "signature": [ + "() => ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.MetricAggType", + "text": "MetricAggType" + }, + "<", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.IMetricAggConfig", + "text": "IMetricAggConfig" + }, + ">" + ], + "description": [], + "label": "getSinglePercentileMetricAgg", + "source": { + "path": "src/plugins/data/common/search/aggs/metrics/single_percentile.ts", + "lineNumber": 25 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + }, { "id": "def-common.getStdDeviationMetricAgg", "type": "Function", @@ -10351,17 +10526,12 @@ "type": "Function", "children": [ { + "id": "def-common.handleRequest.$1", "type": "Object", "label": "{\n abortSignal,\n aggs,\n filters,\n indexPattern,\n inspectorAdapters,\n metricsAtAllLevels,\n partialRows,\n query,\n searchSessionId,\n searchSourceService,\n timeFields,\n timeRange,\n getNow,\n}", - "isRequired": true, - "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.RequestHandlerParams", - "text": "RequestHandlerParams" - } + "isRequired": true, + "signature": [ + "RequestHandlerParams" ], "description": [], "source": { @@ -10419,6 +10589,7 @@ "description": [], "children": [ { + "id": "def-common.inferTimeZone.$1", "type": "Object", "label": "params", "isRequired": true, @@ -10438,6 +10609,7 @@ } }, { + "id": "def-common.inferTimeZone.$2", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -10457,6 +10629,7 @@ } }, { + "id": "def-common.inferTimeZone.$3", "type": "Function", "label": "isDefaultTimezone", "isRequired": true, @@ -10470,6 +10643,7 @@ } }, { + "id": "def-common.inferTimeZone.$4", "type": "Function", "label": "getConfig", "isRequired": true, @@ -10496,6 +10670,7 @@ "type": "Function", "children": [ { + "id": "def-common.injectReferences.$1", "type": "CompoundType", "label": "searchSourceFields", "isRequired": true, @@ -10516,17 +10691,12 @@ } }, { + "id": "def-common.injectReferences.$2", "type": "Array", "label": "references", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [], @@ -10571,6 +10741,7 @@ "type": "Function", "children": [ { + "id": "def-common.isAutoInterval.$1", "type": "Unknown", "label": "value", "isRequired": true, @@ -10607,6 +10778,7 @@ "description": [], "children": [ { + "id": "def-common.isBucketAggType.$1", "type": "Any", "label": "aggConfig", "isRequired": true, @@ -10633,6 +10805,7 @@ "type": "Function", "children": [ { + "id": "def-common.isCompleteResponse.$1", "type": "Object", "label": "response", "isRequired": false, @@ -10686,6 +10859,7 @@ "description": [], "children": [ { + "id": "def-common.isDateHistogramBucketAggConfig.$1", "type": "Any", "label": "agg", "isRequired": true, @@ -10712,6 +10886,7 @@ "type": "Function", "children": [ { + "id": "def-common.isErrorResponse.$1", "type": "Object", "label": "response", "isRequired": false, @@ -10765,6 +10940,7 @@ "description": [], "children": [ { + "id": "def-common.isMetricAggType.$1", "type": "Any", "label": "aggConfig", "isRequired": true, @@ -10814,6 +10990,7 @@ "type": "Function", "children": [ { + "id": "def-common.isPartialResponse.$1", "type": "Object", "label": "response", "isRequired": false, @@ -10908,6 +11085,7 @@ "type": "Function", "children": [ { + "id": "def-common.isType.$1", "type": "Array", "label": "types", "isRequired": true, @@ -10954,6 +11132,7 @@ ], "children": [ { + "id": "def-common.isValidEsInterval.$1", "type": "string", "label": "interval", "isRequired": true, @@ -10989,6 +11168,7 @@ "description": [], "children": [ { + "id": "def-common.isValidInterval.$1", "type": "string", "label": "value", "isRequired": true, @@ -11002,6 +11182,7 @@ } }, { + "id": "def-common.isValidInterval.$2", "type": "string", "label": "baseInterval", "isRequired": false, @@ -11037,6 +11218,7 @@ ], "children": [ { + "id": "def-common.parseEsInterval.$1", "type": "string", "label": "interval", "isRequired": true, @@ -11068,6 +11250,7 @@ "description": [], "children": [ { + "id": "def-common.parseInterval.$1", "type": "string", "label": "interval", "isRequired": true, @@ -11094,6 +11277,7 @@ "type": "Function", "children": [ { + "id": "def-common.parseSearchSourceJSON.$1", "type": "string", "label": "searchSourceJSON", "isRequired": true, @@ -11139,6 +11323,7 @@ ], "children": [ { + "id": "def-common.propFilter.$1", "type": "Uncategorized", "label": "prop", "isRequired": true, @@ -11167,6 +11352,7 @@ "type": "Function", "children": [ { + "id": "def-common.queryToAst.$1", "type": "Object", "label": "query", "isRequired": true, @@ -11219,6 +11405,7 @@ "type": "Function", "children": [ { + "id": "def-common.splitStringInterval.$1", "type": "string", "label": "interval", "isRequired": true, @@ -11252,6 +11439,7 @@ "type": "Function", "children": [ { + "id": "def-common.tabify.$1", "type": "Object", "label": "searchSource", "isRequired": true, @@ -11271,6 +11459,7 @@ } }, { + "id": "def-common.tabify.$2", "type": "Object", "label": "esResponse", "isRequired": true, @@ -11285,26 +11474,15 @@ } }, { + "id": "def-common.tabify.$3", "type": "CompoundType", "label": "opts", "isRequired": true, "signature": [ "Partial<", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.TabbedResponseWriterOptions", - "text": "TabbedResponseWriterOptions" - }, + "TabbedResponseWriterOptions", "> | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.TabifyDocsOptions", - "text": "TabifyDocsOptions" - } + "TabifyDocsOptions" ], "description": [], "source": { @@ -11376,6 +11554,7 @@ ], "children": [ { + "id": "def-common.tabifyAggResponse.$1", "type": "Object", "label": "aggConfigs", "isRequired": true, @@ -11395,6 +11574,7 @@ } }, { + "id": "def-common.tabifyAggResponse.$2", "type": "Object", "label": "esResponse", "isRequired": true, @@ -11408,18 +11588,13 @@ } }, { + "id": "def-common.tabifyAggResponse.$3", "type": "Object", "label": "respOpts", "isRequired": false, "signature": [ "Partial<", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.TabbedResponseWriterOptions", - "text": "TabbedResponseWriterOptions" - }, + "TabbedResponseWriterOptions", "> | undefined" ], "description": [], @@ -11442,6 +11617,7 @@ "type": "Function", "children": [ { + "id": "def-common.tabifyDocs.$1", "type": "Object", "label": "esResponse", "isRequired": true, @@ -11456,6 +11632,7 @@ } }, { + "id": "def-common.tabifyDocs.$2", "type": "Object", "label": "index", "isRequired": false, @@ -11476,17 +11653,12 @@ } }, { + "id": "def-common.tabifyDocs.$3", "type": "Object", "label": "params", "isRequired": true, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.TabifyDocsOptions", - "text": "TabifyDocsOptions" - } + "TabifyDocsOptions" ], "description": [], "source": { @@ -11549,6 +11721,7 @@ ], "children": [ { + "id": "def-common.tabifyGetColumns.$1", "type": "Array", "label": "aggs", "isRequired": true, @@ -11571,6 +11744,7 @@ } }, { + "id": "def-common.tabifyGetColumns.$2", "type": "boolean", "label": "minimalColumns", "isRequired": true, @@ -11599,6 +11773,7 @@ "type": "Function", "children": [ { + "id": "def-common.timerangeToAst.$1", "type": "Object", "label": "timerange", "isRequired": true, @@ -11673,6 +11848,7 @@ "description": [], "children": [ { + "id": "def-common.toAbsoluteDates.$1", "type": "Object", "label": "range", "isRequired": true, @@ -11720,13 +11896,7 @@ "lineNumber": 45 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.AggTypesRegistryStart", - "text": "AggTypesRegistryStart" - } + "AggTypesRegistryStart" ] } ], @@ -11753,7 +11923,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 207 + "lineNumber": 196 }, "signature": [ "FunctionDefinition" @@ -11767,7 +11937,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 208 + "lineNumber": 197 }, "signature": [ "FunctionDefinition" @@ -11781,7 +11951,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 209 + "lineNumber": 198 }, "signature": [ "FunctionDefinition" @@ -11795,7 +11965,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 210 + "lineNumber": 199 }, "signature": [ "FunctionDefinition" @@ -11809,7 +11979,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 211 + "lineNumber": 200 }, "signature": [ "FunctionDefinition" @@ -11823,7 +11993,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 212 + "lineNumber": 201 }, "signature": [ "FunctionDefinition" @@ -11837,7 +12007,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 213 + "lineNumber": 202 }, "signature": [ "FunctionDefinition" @@ -11851,7 +12021,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 214 + "lineNumber": 203 }, "signature": [ "FunctionDefinition" @@ -11865,7 +12035,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 215 + "lineNumber": 204 }, "signature": [ "FunctionDefinition" @@ -11879,7 +12049,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 216 + "lineNumber": 205 }, "signature": [ "FunctionDefinition" @@ -11893,7 +12063,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 217 + "lineNumber": 206 }, "signature": [ "FunctionDefinition" @@ -11907,7 +12077,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 218 + "lineNumber": 207 }, "signature": [ "FunctionDefinition" @@ -11921,7 +12091,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 219 + "lineNumber": 208 }, "signature": [ "FunctionDefinition" @@ -11935,7 +12105,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 220 + "lineNumber": 209 }, "signature": [ "FunctionDefinition" @@ -11949,7 +12119,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 221 + "lineNumber": 210 }, "signature": [ "FunctionDefinition" @@ -11963,7 +12133,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 222 + "lineNumber": 211 }, "signature": [ "FunctionDefinition" @@ -11977,7 +12147,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 223 + "lineNumber": 212 }, "signature": [ "FunctionDefinition" @@ -11991,7 +12161,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 224 + "lineNumber": 213 }, "signature": [ "FunctionDefinition" @@ -12005,7 +12175,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 225 + "lineNumber": 214 }, "signature": [ "FunctionDefinition" @@ -12019,7 +12189,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 226 + "lineNumber": 215 }, "signature": [ "FunctionDefinition" @@ -12033,7 +12203,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 227 + "lineNumber": 216 }, "signature": [ "FunctionDefinition" @@ -12047,7 +12217,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 228 + "lineNumber": 217 }, "signature": [ "FunctionDefinition" @@ -12061,7 +12231,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 229 + "lineNumber": 218 }, "signature": [ "FunctionDefinition" @@ -12075,7 +12245,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 230 + "lineNumber": 219 }, "signature": [ "FunctionDefinition" @@ -12089,7 +12259,21 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 231 + "lineNumber": 220 + }, + "signature": [ + "FunctionDefinition" + ] + }, + { + "tags": [], + "id": "def-common.AggFunctionsMapping.aggSinglePercentile", + "type": "Object", + "label": "aggSinglePercentile", + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/types.ts", + "lineNumber": 221 }, "signature": [ "FunctionDefinition" @@ -12103,7 +12287,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 232 + "lineNumber": 222 }, "signature": [ "FunctionDefinition" @@ -12117,7 +12301,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 233 + "lineNumber": 223 }, "signature": [ "FunctionDefinition" @@ -12131,7 +12315,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 234 + "lineNumber": 224 }, "signature": [ "FunctionDefinition" @@ -12145,7 +12329,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 235 + "lineNumber": 225 }, "signature": [ "FunctionDefinition" @@ -12159,7 +12343,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 236 + "lineNumber": 226 }, "signature": [ "FunctionDefinition" @@ -12173,7 +12357,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 237 + "lineNumber": 227 }, "signature": [ "FunctionDefinition" @@ -12187,7 +12371,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 238 + "lineNumber": 228 }, "signature": [ "FunctionDefinition" @@ -12201,7 +12385,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 239 + "lineNumber": 229 }, "signature": [ "FunctionDefinition" @@ -12210,7 +12394,7 @@ ], "source": { "path": "src/plugins/data/common/search/aggs/types.ts", - "lineNumber": 206 + "lineNumber": 195 }, "initialIsOpen": false }, @@ -12261,6 +12445,7 @@ "description": [], "children": [ { + "id": "def-common.AggParamOption.enabled.$1", "type": "Object", "label": "agg", "isRequired": true, @@ -12360,13 +12545,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] }, @@ -12382,13 +12561,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] } @@ -12429,13 +12602,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] }, @@ -12451,13 +12618,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] } @@ -12498,13 +12659,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] }, @@ -12520,13 +12675,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] } @@ -12567,13 +12716,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] }, @@ -12589,13 +12732,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] } @@ -12686,13 +12823,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] }, @@ -12820,6 +12951,20 @@ "string | undefined" ] }, + { + "tags": [], + "id": "def-common.AggParamsDateHistogram.used_interval", + "type": "string", + "label": "used_interval", + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", + "lineNumber": 67 + }, + "signature": [ + "string | undefined" + ] + }, { "tags": [], "id": "def-common.AggParamsDateHistogram.time_zone", @@ -12828,7 +12973,21 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", - "lineNumber": 67 + "lineNumber": 68 + }, + "signature": [ + "string | undefined" + ] + }, + { + "tags": [], + "id": "def-common.AggParamsDateHistogram.used_time_zone", + "type": "string", + "label": "used_time_zone", + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", + "lineNumber": 69 }, "signature": [ "string | undefined" @@ -12842,7 +13001,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", - "lineNumber": 68 + "lineNumber": 70 }, "signature": [ "boolean | undefined" @@ -12856,7 +13015,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", - "lineNumber": 69 + "lineNumber": 71 }, "signature": [ "string | undefined" @@ -12870,7 +13029,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", - "lineNumber": 70 + "lineNumber": 72 }, "signature": [ "number | undefined" @@ -12884,16 +13043,10 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", - "lineNumber": 71 + "lineNumber": 73 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.ExtendedBounds", - "text": "ExtendedBounds" - }, + "ExtendedBounds", " | undefined" ] } @@ -13022,13 +13175,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] }, @@ -13122,13 +13269,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] }, @@ -13144,13 +13285,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] } @@ -13575,13 +13710,7 @@ "lineNumber": 48 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.ExtendedBounds", - "text": "ExtendedBounds" - }, + "ExtendedBounds", " | undefined" ] } @@ -13859,13 +13988,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] }, @@ -14084,13 +14207,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] }, @@ -14193,6 +14310,53 @@ }, "initialIsOpen": false }, + { + "id": "def-common.AggParamsSinglePercentile", + "type": "Interface", + "label": "AggParamsSinglePercentile", + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.AggParamsSinglePercentile", + "text": "AggParamsSinglePercentile" + }, + " extends ", + "BaseAggParams" + ], + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-common.AggParamsSinglePercentile.field", + "type": "string", + "label": "field", + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/metrics/single_percentile.ts", + "lineNumber": 21 + } + }, + { + "tags": [], + "id": "def-common.AggParamsSinglePercentile.percentile", + "type": "number", + "label": "percentile", + "description": [], + "source": { + "path": "src/plugins/data/common/search/aggs/metrics/single_percentile.ts", + "lineNumber": 22 + } + } + ], + "source": { + "path": "src/plugins/data/common/search/aggs/metrics/single_percentile.ts", + "lineNumber": 20 + }, + "initialIsOpen": false + }, { "id": "def-common.AggParamsStdDeviation", "type": "Interface", @@ -14317,13 +14481,7 @@ }, "signature": [ "{ type: string; enabled?: boolean | undefined; id?: string | undefined; params?: {} | ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined; schema?: string | undefined; } | undefined" ] }, @@ -15060,14 +15218,8 @@ "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", "lineNumber": 48 }, - "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.CalculateBoundsFn", - "text": "CalculateBoundsFn" - } + "signature": [ + "CalculateBoundsFn" ] }, { @@ -15189,6 +15341,59 @@ }, "initialIsOpen": false }, + { + "id": "def-common.EsRawResponse", + "type": "Interface", + "label": "EsRawResponse", + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.EsRawResponse", + "text": "EsRawResponse" + }, + "" + ], + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-common.EsRawResponse.type", + "type": "string", + "label": "type", + "description": [], + "source": { + "path": "src/plugins/data/common/search/expressions/es_raw_response.ts", + "lineNumber": 15 + }, + "signature": [ + "\"es_raw_response\"" + ] + }, + { + "tags": [], + "id": "def-common.EsRawResponse.body", + "type": "Object", + "label": "body", + "description": [], + "source": { + "path": "src/plugins/data/common/search/expressions/es_raw_response.ts", + "lineNumber": 16 + }, + "signature": [ + "SearchResponse", + "" + ] + } + ], + "source": { + "path": "src/plugins/data/common/search/expressions/es_raw_response.ts", + "lineNumber": 14 + }, + "initialIsOpen": false + }, { "id": "def-common.FetchHandlers", "type": "Interface", @@ -15438,13 +15643,7 @@ "lineNumber": 54 }, "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.TimeBuckets", - "text": "TimeBuckets" - } + "TimeBuckets" ] } ], @@ -16770,7 +16969,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 89 + "lineNumber": 96 }, "signature": [ "number | undefined" @@ -16784,7 +16983,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 90 + "lineNumber": 97 }, "signature": [ "number | undefined" @@ -16798,7 +16997,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 91 + "lineNumber": 98 }, "signature": [ "string | undefined" @@ -16812,7 +17011,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 92 + "lineNumber": 99 }, "signature": [ "string | undefined" @@ -16826,7 +17025,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 93 + "lineNumber": 100 }, "signature": [ "string | undefined" @@ -16835,7 +17034,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 88 + "lineNumber": 95 }, "initialIsOpen": false }, @@ -16856,7 +17055,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 73 + "lineNumber": 80 } }, { @@ -16869,7 +17068,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 77 + "lineNumber": 84 } }, { @@ -16882,7 +17081,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 81 + "lineNumber": 88 } }, { @@ -16895,7 +17094,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 85 + "lineNumber": 92 }, "signature": [ "string | undefined" @@ -16904,7 +17103,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 69 + "lineNumber": 76 }, "initialIsOpen": false }, @@ -16997,6 +17196,22 @@ "lineNumber": 33 } }, + { + "tags": [], + "id": "def-common.SearchSessionSavedObjectAttributes.completed", + "type": "CompoundType", + "label": "completed", + "description": [ + "\nTime of transition into completed state,\n\nCan be \"null\" in case already completed session\ntransitioned into in-progress session" + ], + "source": { + "path": "src/plugins/data/common/search/session/types.ts", + "lineNumber": 40 + }, + "signature": [ + "string | null | undefined" + ] + }, { "tags": [], "id": "def-common.SearchSessionSavedObjectAttributes.status", @@ -17007,7 +17222,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 37 + "lineNumber": 44 }, "signature": [ { @@ -17029,7 +17244,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 41 + "lineNumber": 48 }, "signature": [ "string | undefined" @@ -17045,7 +17260,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 46 + "lineNumber": 53 }, "signature": [ "Record | undefined" @@ -17061,7 +17276,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 51 + "lineNumber": 58 }, "signature": [ "Record | undefined" @@ -17077,7 +17292,7 @@ ], "source": { "path": "src/plugins/data/common/search/session/types.ts", - "lineNumber": 55 + "lineNumber": 62 }, "signature": [ "Record string | undefined; getDateMetaByDatatableColumn: (column: DatatableColumn) => Promise<{ timeZone: string; timeRange?: TimeRange | undefined; interval: string; } | undefined>; datatableUtilities: { getIndexPattern: (column: DatatableColumn) => Promise; getAggConfig: (column: DatatableColumn) => Promise; isFilterable: (column: DatatableColumn) => boolean; }; createAggConfigs: (indexPattern: IndexPattern, configStates?: Pick string | undefined; datatableUtilities: { getIndexPattern: (column: DatatableColumn) => Promise; getAggConfig: (column: DatatableColumn) => Promise; isFilterable: (column: DatatableColumn) => boolean; }; createAggConfigs: (indexPattern: IndexPattern, configStates?: Pick & Pick<{ type: string | ", { @@ -18770,6 +19008,54 @@ ], "initialIsOpen": false }, + { + "id": "def-common.EsdslExpressionFunctionDefinition", + "type": "Type", + "label": "EsdslExpressionFunctionDefinition", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/data/common/search/expressions/esdsl.ts", + "lineNumber": 29 + }, + "signature": [ + "ExpressionFunctionDefinition<\"esdsl\", ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_context\", ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.ExecutionContextSearch", + "text": "ExecutionContextSearch" + }, + "> | null, Arguments, Output, ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExecutionContext", + "text": "ExecutionContext" + }, + "<", + { + "pluginId": "inspector", + "scope": "common", + "docId": "kibInspectorPluginApi", + "section": "def-common.Adapters", + "text": "Adapters" + }, + ", ", + "SerializableState" + ], + "initialIsOpen": false + }, { "id": "def-common.EsQuerySearchAfter", "type": "Type", @@ -18804,6 +19090,21 @@ ], "initialIsOpen": false }, + { + "id": "def-common.EsRawResponseExpressionTypeDefinition", + "type": "Type", + "label": "EsRawResponseExpressionTypeDefinition", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/data/common/search/expressions/es_raw_response.ts", + "lineNumber": 57 + }, + "signature": [ + "ExpressionTypeDefinition<\"es_raw_response\", EsRawResponse, EsRawResponse>" + ], + "initialIsOpen": false + }, { "id": "def-common.ExecutionContextSearch", "type": "Type", @@ -19306,7 +19607,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 19 + "lineNumber": 22 }, "signature": [ { @@ -19407,7 +19708,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/param_types/field.ts", - "lineNumber": 21 + "lineNumber": 24 }, "signature": [ "FieldParamType" @@ -19448,7 +19749,7 @@ "section": "def-common.IBucketAggConfig", "text": "IBucketAggConfig" }, - "): boolean | \"\" | undefined; } | { display: string; val: string; })[]" + "): boolean; } | { display: string; val: string; })[]" ], "initialIsOpen": false }, @@ -19767,7 +20068,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts", - "lineNumber": 27 + "lineNumber": 28 }, "initialIsOpen": false }, @@ -19839,7 +20140,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts", - "lineNumber": 34 + "lineNumber": 35 }, "initialIsOpen": false }, @@ -19867,7 +20168,7 @@ "children": [ { "tags": [], - "id": "def-common.AggGroupLabels.[AggGroupNames.Buckets]", + "id": "def-common.AggGroupLabels.AggGroupNames.Buckets", "type": "string", "label": "[AggGroupNames.Buckets]", "description": [], @@ -19878,7 +20179,7 @@ }, { "tags": [], - "id": "def-common.AggGroupLabels.[AggGroupNames.Metrics]", + "id": "def-common.AggGroupLabels.AggGroupNames.Metrics", "type": "string", "label": "[AggGroupNames.Metrics]", "description": [], @@ -19889,7 +20190,7 @@ }, { "tags": [], - "id": "def-common.AggGroupLabels.[AggGroupNames.None]", + "id": "def-common.AggGroupLabels.AggGroupNames.None", "type": "string", "label": "[AggGroupNames.None]", "description": [], @@ -19922,6 +20223,93 @@ ], "initialIsOpen": false }, + { + "id": "def-common.esRawResponse", + "type": "Object", + "tags": [], + "children": [ + { + "tags": [], + "id": "def-common.esRawResponse.name", + "type": "string", + "label": "name", + "description": [], + "source": { + "path": "src/plugins/data/common/search/expressions/es_raw_response.ts", + "lineNumber": 64 + }, + "signature": [ + "\"es_raw_response\"" + ] + }, + { + "id": "def-common.esRawResponse.to", + "type": "Object", + "tags": [], + "children": [ + { + "id": "def-common.esRawResponse.to.datatable", + "type": "Function", + "children": [ + { + "id": "def-common.esRawResponse.to.datatable.$1", + "type": "Object", + "label": "context", + "isRequired": true, + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.EsRawResponse", + "text": "EsRawResponse" + }, + "" + ], + "description": [], + "source": { + "path": "src/plugins/data/common/search/expressions/es_raw_response.ts", + "lineNumber": 66 + } + } + ], + "signature": [ + "(context: ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.EsRawResponse", + "text": "EsRawResponse" + }, + ") => { type: string; meta: { type: string; source: string; }; columns: { id: string; name: string; meta: { type: \"string\" | \"number\" | \"bigint\" | \"boolean\" | \"symbol\" | \"undefined\" | \"object\" | \"function\"; field: string; params: {}; }; }[]; rows: any[]; }" + ], + "description": [], + "label": "datatable", + "source": { + "path": "src/plugins/data/common/search/expressions/es_raw_response.ts", + "lineNumber": 66 + }, + "tags": [], + "returnComment": [] + } + ], + "description": [], + "label": "to", + "source": { + "path": "src/plugins/data/common/search/expressions/es_raw_response.ts", + "lineNumber": 65 + } + } + ], + "description": [], + "label": "esRawResponse", + "source": { + "path": "src/plugins/data/common/search/expressions/es_raw_response.ts", + "lineNumber": 63 + }, + "initialIsOpen": false + }, { "id": "def-common.existsFilterFunction", "type": "Object", @@ -20123,6 +20511,7 @@ "description": [], "children": [ { + "id": "def-common.existsFilterFunction.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -20136,6 +20525,7 @@ } }, { + "id": "def-common.existsFilterFunction.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -20404,6 +20794,7 @@ "description": [], "children": [ { + "id": "def-common.fieldFunction.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -20417,6 +20808,7 @@ } }, { + "id": "def-common.fieldFunction.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -20565,6 +20957,7 @@ "description": [], "children": [ { + "id": "def-common.kibana.fn.$1", "type": "CompoundType", "label": "input", "isRequired": false, @@ -20578,6 +20971,7 @@ } }, { + "id": "def-common.kibana.fn.$2", "type": "Uncategorized", "label": "_", "isRequired": true, @@ -20591,6 +20985,7 @@ } }, { + "id": "def-common.kibana.fn.$3", "type": "Object", "label": "{ getSearchContext }", "isRequired": true, @@ -20925,6 +21320,7 @@ "description": [], "children": [ { + "id": "def-common.kibanaFilterFunction.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -20938,6 +21334,7 @@ } }, { + "id": "def-common.kibanaFilterFunction.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -21212,6 +21609,7 @@ "description": [], "children": [ { + "id": "def-common.kibanaTimerangeFunction.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -21225,6 +21623,7 @@ } }, { + "id": "def-common.kibanaTimerangeFunction.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -21407,6 +21806,7 @@ "description": [], "children": [ { + "id": "def-common.kqlFunction.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -21420,6 +21820,7 @@ } }, { + "id": "def-common.kqlFunction.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -21596,6 +21997,7 @@ "description": [], "children": [ { + "id": "def-common.luceneFunction.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -21609,6 +22011,7 @@ } }, { + "id": "def-common.luceneFunction.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -21682,7 +22085,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts", - "lineNumber": 35 + "lineNumber": 36 } }, { @@ -21714,7 +22117,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts", - "lineNumber": 36 + "lineNumber": 37 } }, { @@ -21735,6 +22138,7 @@ "description": [], "children": [ { + "id": "def-common.parentPipelineAggHelper.getSerializedFormat.$1", "type": "Object", "label": "agg", "isRequired": true, @@ -21750,7 +22154,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts", - "lineNumber": 64 + "lineNumber": 65 } } ], @@ -21758,7 +22162,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts", - "lineNumber": 64 + "lineNumber": 65 } } ], @@ -21766,7 +22170,7 @@ "label": "parentPipelineAggHelper", "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts", - "lineNumber": 34 + "lineNumber": 35 }, "initialIsOpen": false }, @@ -22037,6 +22441,7 @@ "description": [], "children": [ { + "id": "def-common.phraseFilterFunction.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -22050,6 +22455,7 @@ } }, { + "id": "def-common.phraseFilterFunction.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -22332,6 +22738,7 @@ "description": [], "children": [ { + "id": "def-common.rangeFilterFunction.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -22345,6 +22752,7 @@ } }, { + "id": "def-common.rangeFilterFunction.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -22607,6 +23015,7 @@ "description": [], "children": [ { + "id": "def-common.rangeFunction.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -22620,6 +23029,7 @@ } }, { + "id": "def-common.rangeFunction.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -22662,7 +23072,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts", - "lineNumber": 42 + "lineNumber": 43 } }, { @@ -22691,6 +23101,7 @@ "description": [], "children": [ { + "id": "def-common.siblingPipelineAggHelper.params.$1", "type": "Array", "label": "bucketFilter", "isRequired": true, @@ -22700,7 +23111,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts", - "lineNumber": 43 + "lineNumber": 44 } } ], @@ -22708,7 +23119,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts", - "lineNumber": 43 + "lineNumber": 44 } }, { @@ -22729,6 +23140,7 @@ "description": [], "children": [ { + "id": "def-common.siblingPipelineAggHelper.getSerializedFormat.$1", "type": "Object", "label": "agg", "isRequired": true, @@ -22744,7 +23156,7 @@ "description": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts", - "lineNumber": 79 + "lineNumber": 80 } } ], @@ -22752,7 +23164,7 @@ "returnComment": [], "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts", - "lineNumber": 79 + "lineNumber": 80 } } ], @@ -22760,7 +23172,7 @@ "label": "siblingPipelineAggHelper", "source": { "path": "src/plugins/data/common/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts", - "lineNumber": 41 + "lineNumber": 42 }, "initialIsOpen": false } diff --git a/api_docs/data_ui.json b/api_docs/data_ui.json index 63956cdcb3799..e121f55bd6bbf 100644 --- a/api_docs/data_ui.json +++ b/api_docs/data_ui.json @@ -8,6 +8,7 @@ "type": "Function", "children": [ { + "id": "def-public.QueryStringInput.$1", "type": "Object", "label": "props", "isRequired": true, @@ -65,7 +66,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 42 + "lineNumber": 43 }, "signature": [ "(string | ", @@ -87,7 +88,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 43 + "lineNumber": 44 }, "signature": [ { @@ -107,7 +108,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 44 + "lineNumber": 45 }, "signature": [ "boolean | undefined" @@ -121,7 +122,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 45 + "lineNumber": 46 }, "signature": [ "string | undefined" @@ -135,7 +136,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 46 + "lineNumber": 47 }, "signature": [ "any" @@ -149,16 +150,10 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 47 + "lineNumber": 48 }, "signature": [ - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.PersistedLog", - "text": "PersistedLog" - }, + "PersistedLog", " | undefined" ] }, @@ -170,7 +165,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 48 + "lineNumber": 49 }, "signature": [ "boolean | undefined" @@ -184,7 +179,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 49 + "lineNumber": 50 }, "signature": [ "string | undefined" @@ -198,7 +193,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 50 + "lineNumber": 51 }, "signature": [ "boolean | undefined" @@ -212,7 +207,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 51 + "lineNumber": 52 }, "signature": [ "\"upCenter\" | \"upLeft\" | \"upRight\" | \"downCenter\" | \"downLeft\" | \"downRight\" | \"leftCenter\" | \"leftUp\" | \"leftDown\" | \"rightCenter\" | \"rightUp\" | \"rightDown\" | undefined" @@ -226,7 +221,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 52 + "lineNumber": 53 }, "signature": [ "(() => void) | undefined" @@ -240,7 +235,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 53 + "lineNumber": 54 }, "signature": [ "((query: ", @@ -262,7 +257,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 54 + "lineNumber": 55 }, "signature": [ "((isFocused: boolean) => void) | undefined" @@ -276,7 +271,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 55 + "lineNumber": 56 }, "signature": [ "((query: ", @@ -298,7 +293,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 56 + "lineNumber": 57 }, "signature": [ "boolean | undefined" @@ -312,7 +307,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 57 + "lineNumber": 58 }, "signature": [ "string | undefined" @@ -326,7 +321,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 58 + "lineNumber": 59 }, "signature": [ "\"s\" | \"l\" | undefined" @@ -340,7 +335,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 59 + "lineNumber": 60 }, "signature": [ "string | undefined" @@ -354,7 +349,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 60 + "lineNumber": 61 }, "signature": [ "boolean | undefined" @@ -368,7 +363,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 61 + "lineNumber": 62 }, "signature": [ "boolean | undefined" @@ -382,7 +377,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 62 + "lineNumber": 63 }, "signature": [ "string | React.ComponentClass<{}, any> | React.FunctionComponent<{}> | undefined" @@ -396,7 +391,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 68 + "lineNumber": 69 }, "signature": [ "\"text\" | \"lucene\" | undefined" @@ -410,7 +405,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 69 + "lineNumber": 70 }, "signature": [ "string | undefined" @@ -424,7 +419,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 72 + "lineNumber": 74 }, "signature": [ "boolean | undefined" @@ -438,7 +433,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 76 + "lineNumber": 78 }, "signature": [ "string | undefined" @@ -447,7 +442,7 @@ ], "source": { "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "lineNumber": 41 + "lineNumber": 42 }, "initialIsOpen": false } @@ -465,7 +460,7 @@ "lineNumber": 17 }, "signature": [ - "Pick, \"children\" | \"onClick\" | \"color\" | \"onKeyDown\" | \"title\" | \"id\" | \"placeholder\" | \"isClearable\" | \"async\" | \"compressed\" | \"fullWidth\" | \"singleSelection\" | \"prepend\" | \"append\" | \"sortMatchesBy\" | \"defaultChecked\" | \"defaultValue\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"className\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"hidden\" | \"lang\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"security\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onError\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"css\" | \"data-test-subj\" | \"customOptionText\" | \"onCreateOption\" | \"renderOption\" | \"inputRef\" | \"isDisabled\" | \"isInvalid\" | \"noSuggestions\" | \"rowHeight\" | \"delimiter\">, \"children\" | \"onClick\" | \"color\" | \"onKeyDown\" | \"title\" | \"id\" | \"isClearable\" | \"async\" | \"compressed\" | \"fullWidth\" | \"singleSelection\" | \"prepend\" | \"append\" | \"sortMatchesBy\" | \"defaultChecked\" | \"defaultValue\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"className\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"hidden\" | \"lang\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"security\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onError\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"css\" | \"data-test-subj\" | \"customOptionText\" | \"onCreateOption\" | \"renderOption\" | \"inputRef\" | \"isDisabled\" | \"isInvalid\" | \"noSuggestions\" | \"rowHeight\" | \"delimiter\"> & globalThis.Required, \"children\" | \"onClick\" | \"color\" | \"onKeyDown\" | \"title\" | \"id\" | \"placeholder\" | \"isClearable\" | \"async\" | \"compressed\" | \"fullWidth\" | \"singleSelection\" | \"prepend\" | \"append\" | \"sortMatchesBy\" | \"defaultChecked\" | \"defaultValue\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"className\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"hidden\" | \"lang\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"security\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onError\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"css\" | \"data-test-subj\" | \"customOptionText\" | \"onCreateOption\" | \"renderOption\" | \"inputRef\" | \"isDisabled\" | \"isInvalid\" | \"noSuggestions\" | \"rowHeight\" | \"delimiter\">, \"placeholder\">> & { onChange: (indexPatternId?: string | undefined) => void; indexPatternId: string; fieldTypes?: string[] | undefined; onNoIndexPatterns?: (() => void) | undefined; maxIndexPatterns?: number | undefined; }" + "Pick, \"children\" | \"onClick\" | \"color\" | \"onKeyDown\" | \"title\" | \"id\" | \"placeholder\" | \"isClearable\" | \"async\" | \"compressed\" | \"fullWidth\" | \"singleSelection\" | \"prepend\" | \"append\" | \"sortMatchesBy\" | \"defaultChecked\" | \"defaultValue\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"className\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"hidden\" | \"lang\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"security\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onError\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"css\" | \"data-test-subj\" | \"customOptionText\" | \"onCreateOption\" | \"renderOption\" | \"inputRef\" | \"isDisabled\" | \"isInvalid\" | \"noSuggestions\" | \"rowHeight\" | \"delimiter\">, \"children\" | \"onClick\" | \"color\" | \"onKeyDown\" | \"title\" | \"id\" | \"isClearable\" | \"async\" | \"compressed\" | \"fullWidth\" | \"singleSelection\" | \"prepend\" | \"append\" | \"sortMatchesBy\" | \"defaultChecked\" | \"defaultValue\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"className\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"hidden\" | \"lang\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"security\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onError\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"css\" | \"data-test-subj\" | \"customOptionText\" | \"onCreateOption\" | \"renderOption\" | \"inputRef\" | \"isDisabled\" | \"isInvalid\" | \"noSuggestions\" | \"rowHeight\" | \"delimiter\"> & globalThis.Required, \"children\" | \"onClick\" | \"color\" | \"onKeyDown\" | \"title\" | \"id\" | \"placeholder\" | \"isClearable\" | \"async\" | \"compressed\" | \"fullWidth\" | \"singleSelection\" | \"prepend\" | \"append\" | \"sortMatchesBy\" | \"defaultChecked\" | \"defaultValue\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"className\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"hidden\" | \"lang\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"security\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onError\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"css\" | \"data-test-subj\" | \"customOptionText\" | \"onCreateOption\" | \"renderOption\" | \"inputRef\" | \"isDisabled\" | \"isInvalid\" | \"noSuggestions\" | \"rowHeight\" | \"delimiter\">, \"placeholder\">> & { onChange: (indexPatternId?: string | undefined) => void; indexPatternId: string; fieldTypes?: string[] | undefined; onNoIndexPatterns?: (() => void) | undefined; }" ], "initialIsOpen": false }, @@ -488,7 +483,7 @@ "section": "def-public.SearchBarProps", "text": "SearchBarProps" }, - ", \"filters\" | \"query\" | \"intl\" | \"indexPatterns\" | \"isLoading\" | \"customSubmitButton\" | \"screenTitle\" | \"dataTestSubj\" | \"showQueryBar\" | \"showQueryInput\" | \"showFilterBar\" | \"showDatePicker\" | \"showAutoRefreshOnly\" | \"isRefreshPaused\" | \"refreshInterval\" | \"dateRangeFrom\" | \"dateRangeTo\" | \"showSaveQuery\" | \"savedQuery\" | \"onQueryChange\" | \"onQuerySubmit\" | \"onSaved\" | \"onSavedQueryUpdated\" | \"onClearSavedQuery\" | \"onRefresh\" | \"indicateNoData\" | \"placeholder\" | \"isClearable\" | \"iconType\" | \"nonKqlMode\" | \"nonKqlModeHelpText\" | \"storageKey\" | \"disableLanguageSwitcher\" | \"isInvalid\" | \"autoSubmit\" | \"timeHistory\" | \"onFiltersUpdated\" | \"onRefreshChange\">, \"filters\" | \"query\" | \"indexPatterns\" | \"isLoading\" | \"customSubmitButton\" | \"screenTitle\" | \"dataTestSubj\" | \"showQueryBar\" | \"showQueryInput\" | \"showFilterBar\" | \"showDatePicker\" | \"showAutoRefreshOnly\" | \"isRefreshPaused\" | \"refreshInterval\" | \"dateRangeFrom\" | \"dateRangeTo\" | \"showSaveQuery\" | \"savedQuery\" | \"onQueryChange\" | \"onQuerySubmit\" | \"onSaved\" | \"onSavedQueryUpdated\" | \"onClearSavedQuery\" | \"onRefresh\" | \"indicateNoData\" | \"placeholder\" | \"isClearable\" | \"iconType\" | \"nonKqlMode\" | \"nonKqlModeHelpText\" | \"storageKey\" | \"disableLanguageSwitcher\" | \"isInvalid\" | \"autoSubmit\" | \"timeHistory\" | \"onFiltersUpdated\" | \"onRefreshChange\">, any> & { WrappedComponent: React.ComponentType, \"filters\" | \"query\" | \"indexPatterns\" | \"isLoading\" | \"customSubmitButton\" | \"screenTitle\" | \"dataTestSubj\" | \"showQueryBar\" | \"showQueryInput\" | \"showFilterBar\" | \"showDatePicker\" | \"showAutoRefreshOnly\" | \"isRefreshPaused\" | \"refreshInterval\" | \"dateRangeFrom\" | \"dateRangeTo\" | \"showSaveQuery\" | \"savedQuery\" | \"onQueryChange\" | \"onQuerySubmit\" | \"onSaved\" | \"onSavedQueryUpdated\" | \"onClearSavedQuery\" | \"onRefresh\" | \"indicateNoData\" | \"placeholder\" | \"isClearable\" | \"iconType\" | \"nonKqlMode\" | \"nonKqlModeHelpText\" | \"timeHistory\" | \"onFiltersUpdated\" | \"onRefreshChange\">, any> & { WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>; }" + ", \"filters\" | \"query\" | \"intl\" | \"indexPatterns\" | \"isLoading\" | \"customSubmitButton\" | \"screenTitle\" | \"dataTestSubj\" | \"showQueryBar\" | \"showQueryInput\" | \"showFilterBar\" | \"showDatePicker\" | \"showAutoRefreshOnly\" | \"isRefreshPaused\" | \"refreshInterval\" | \"dateRangeFrom\" | \"dateRangeTo\" | \"showSaveQuery\" | \"savedQuery\" | \"onQueryChange\" | \"onQuerySubmit\" | \"onSaved\" | \"onSavedQueryUpdated\" | \"onClearSavedQuery\" | \"onRefresh\" | \"indicateNoData\" | \"placeholder\" | \"isClearable\" | \"iconType\" | \"nonKqlMode\" | \"nonKqlModeHelpText\" | \"timeHistory\" | \"onFiltersUpdated\" | \"onRefreshChange\"> & ReactIntl.InjectedIntlProps>; }" ], "initialIsOpen": false }, @@ -508,7 +503,7 @@ "description": [], "source": { "path": "src/plugins/data/public/ui/search_bar/search_bar.tsx", - "lineNumber": 84 + "lineNumber": 80 }, "signature": [ "SearchBarOwnProps & SearchBarInjectedDeps" @@ -549,4 +544,4 @@ "misc": [], "objects": [] } -} +} \ No newline at end of file diff --git a/api_docs/dev_tools.json b/api_docs/dev_tools.json index 39ddaf5d93b81..a2215041f27cd 100644 --- a/api_docs/dev_tools.json +++ b/api_docs/dev_tools.json @@ -49,26 +49,15 @@ "text": "CoreSetup" }, ", { urlForwarding }: { urlForwarding: { forwardApp: (legacyAppId: string, newAppId: string, rewritePath?: ((legacyPath: string) => string) | undefined) => void; }; }) => { register: (devToolArgs: ", - { - "pluginId": "devTools", - "scope": "public", - "docId": "kibDevToolsPluginApi", - "section": "def-public.CreateDevToolArgs", - "text": "CreateDevToolArgs" - }, + "CreateDevToolArgs", ") => ", - { - "pluginId": "devTools", - "scope": "public", - "docId": "kibDevToolsPluginApi", - "section": "def-public.DevToolApp", - "text": "DevToolApp" - }, + "DevToolApp", "; }" ], "description": [], "children": [ { + "id": "def-public.DevToolsPlugin.setup.$1", "type": "Object", "label": "coreSetup", "isRequired": true, @@ -89,7 +78,7 @@ } }, { - "id": "def-public.DevToolsPlugin.setup.{-urlForwarding }", + "id": "def-public.DevToolsPlugin.setup.$2.urlForwarding", "type": "Object", "label": "{ urlForwarding }", "tags": [], @@ -97,7 +86,7 @@ "children": [ { "tags": [], - "id": "def-public.DevToolsPlugin.setup.{-urlForwarding }.urlForwarding", + "id": "def-public.DevToolsPlugin.setup.$2.urlForwarding.urlForwarding", "type": "Object", "label": "urlForwarding", "description": [], @@ -189,21 +178,9 @@ }, "signature": [ "(devTool: ", - { - "pluginId": "devTools", - "scope": "public", - "docId": "kibDevToolsPluginApi", - "section": "def-public.CreateDevToolArgs", - "text": "CreateDevToolArgs" - }, + "CreateDevToolArgs", ") => ", - { - "pluginId": "devTools", - "scope": "public", - "docId": "kibDevToolsPluginApi", - "section": "def-public.DevToolApp", - "text": "DevToolApp" - } + "DevToolApp" ] } ], diff --git a/api_docs/discover.json b/api_docs/discover.json index a785c254efeab..246382a449fc3 100644 --- a/api_docs/discover.json +++ b/api_docs/discover.json @@ -20,6 +20,7 @@ "description": [], "children": [ { + "id": "def-public.createSavedSearchesLoader.$1", "type": "Object", "label": "{ savedObjectsClient, savedObjects }", "isRequired": true, @@ -449,13 +450,7 @@ "lineNumber": 20 }, "signature": [ - { - "pluginId": "discover", - "scope": "public", - "docId": "kibDiscoverPluginApi", - "section": "def-public.SortOrder", - "text": "SortOrder" - }, + "SortOrder", "[]" ] }, @@ -470,13 +465,7 @@ "lineNumber": 21 }, "signature": [ - { - "pluginId": "discover", - "scope": "public", - "docId": "kibDiscoverPluginApi", - "section": "def-public.DiscoverGridSettings", - "text": "DiscoverGridSettings" - } + "DiscoverGridSettings" ] }, { @@ -739,13 +728,7 @@ "lineNumber": 25 }, "signature": [ - { - "pluginId": "discover", - "scope": "public", - "docId": "kibDiscoverPluginApi", - "section": "def-public.SortOrder", - "text": "SortOrder" - }, + "SortOrder", "[] | undefined" ] } @@ -812,21 +795,9 @@ }, "signature": [ "{ addDocView(docViewRaw: ", - { - "pluginId": "discover", - "scope": "public", - "docId": "kibDiscoverPluginApi", - "section": "def-public.DocViewInput", - "text": "DocViewInput" - }, + "DocViewInput", " | ", - { - "pluginId": "discover", - "scope": "public", - "docId": "kibDiscoverPluginApi", - "section": "def-public.DocViewInputFn", - "text": "DocViewInputFn" - }, + "DocViewInputFn", "): void; }" ] } diff --git a/api_docs/discover_enhanced.json b/api_docs/discover_enhanced.json index ffb733e0c656d..6ff98fb2b2efa 100644 --- a/api_docs/discover_enhanced.json +++ b/api_docs/discover_enhanced.json @@ -73,6 +73,7 @@ "description": [], "children": [ { + "id": "def-public.DiscoverEnhancedPlugin.Unnamed.$1", "type": "Object", "label": "context", "isRequired": true, @@ -134,6 +135,7 @@ "description": [], "children": [ { + "id": "def-public.DiscoverEnhancedPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -162,6 +164,7 @@ } }, { + "id": "def-public.DiscoverEnhancedPlugin.setup.$2", "type": "Object", "label": "{ uiActions, share }", "isRequired": true, @@ -214,6 +217,7 @@ "description": [], "children": [ { + "id": "def-public.DiscoverEnhancedPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -233,6 +237,7 @@ } }, { + "id": "def-public.DiscoverEnhancedPlugin.start.$2", "type": "Object", "label": "plugins", "isRequired": true, @@ -362,29 +367,18 @@ "label": "isCompatible", "signature": [ "(context: ", - { - "pluginId": "discoverEnhanced", - "scope": "public", - "docId": "kibDiscoverEnhancedPluginApi", - "section": "def-public.ExploreDataChartActionContext", - "text": "ExploreDataChartActionContext" - }, + "ExploreDataChartActionContext", ") => Promise" ], "description": [], "children": [ { + "id": "def-public.ExploreDataChartAction.isCompatible.$1", "type": "Object", "label": "context", "isRequired": true, "signature": [ - { - "pluginId": "discoverEnhanced", - "scope": "public", - "docId": "kibDiscoverEnhancedPluginApi", - "section": "def-public.ExploreDataChartActionContext", - "text": "ExploreDataChartActionContext" - } + "ExploreDataChartActionContext" ], "description": [], "source": { @@ -405,17 +399,12 @@ "type": "Function", "children": [ { + "id": "def-public.ExploreDataChartAction.getUrl.$1", "type": "Object", "label": "context", "isRequired": true, "signature": [ - { - "pluginId": "discoverEnhanced", - "scope": "public", - "docId": "kibDiscoverEnhancedPluginApi", - "section": "def-public.ExploreDataChartActionContext", - "text": "ExploreDataChartActionContext" - } + "ExploreDataChartActionContext" ], "description": [], "source": { @@ -426,13 +415,7 @@ ], "signature": [ "(context: ", - { - "pluginId": "discoverEnhanced", - "scope": "public", - "docId": "kibDiscoverEnhancedPluginApi", - "section": "def-public.ExploreDataChartActionContext", - "text": "ExploreDataChartActionContext" - }, + "ExploreDataChartActionContext", ") => Promise<", { "pluginId": "share", @@ -535,6 +518,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExploreDataContextMenuAction.getUrl.$1", "type": "Object", "label": "context", "isRequired": true, @@ -748,13 +732,7 @@ }, "signature": [ "{ dashboardConfig: ", - { - "pluginId": "kibanaLegacy", - "scope": "public", - "docId": "kibKibanaLegacyPluginApi", - "section": "def-public.DashboardConfig", - "text": "DashboardConfig" - }, + "DashboardConfig", "; loadFontAwesome: () => Promise; config: Readonly<{} & { defaultAppId: string; }>; } | undefined" ] }, diff --git a/api_docs/embeddable.json b/api_docs/embeddable.json index 5b02c5e0c9cbd..c1b8313259aee 100644 --- a/api_docs/embeddable.json +++ b/api_docs/embeddable.json @@ -65,6 +65,7 @@ "description": [], "children": [ { + "id": "def-public.AddPanelAction.Unnamed.$1", "type": "Function", "label": "getFactory", "isRequired": true, @@ -117,6 +118,7 @@ } }, { + "id": "def-public.AddPanelAction.Unnamed.$2", "type": "Function", "label": "getAllFactories", "isRequired": true, @@ -169,6 +171,7 @@ } }, { + "id": "def-public.AddPanelAction.Unnamed.$3", "type": "Object", "label": "overlays", "isRequired": true, @@ -188,6 +191,7 @@ } }, { + "id": "def-public.AddPanelAction.Unnamed.$4", "type": "Object", "label": "notifications", "isRequired": true, @@ -207,6 +211,7 @@ } }, { + "id": "def-public.AddPanelAction.Unnamed.$5", "type": "CompoundType", "label": "SavedObjectFinder", "isRequired": true, @@ -277,6 +282,7 @@ "description": [], "children": [ { + "id": "def-public.AddPanelAction.isCompatible.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -322,6 +328,7 @@ "description": [], "children": [ { + "id": "def-public.AddPanelAction.execute.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -383,6 +390,7 @@ "description": [], "children": [ { + "id": "def-public.AttributeService.Unnamed.$1", "type": "string", "label": "type", "isRequired": true, @@ -396,6 +404,7 @@ } }, { + "id": "def-public.AttributeService.Unnamed.$2", "type": "Function", "label": "showSaveModal", "isRequired": true, @@ -409,6 +418,7 @@ } }, { + "id": "def-public.AttributeService.Unnamed.$3", "type": "Function", "label": "i18nContext", "isRequired": true, @@ -422,6 +432,7 @@ } }, { + "id": "def-public.AttributeService.Unnamed.$4", "type": "Object", "label": "toasts", "isRequired": true, @@ -443,17 +454,12 @@ } }, { + "id": "def-public.AttributeService.Unnamed.$5", "type": "Object", "label": "options", "isRequired": true, "signature": [ - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.AttributeServiceOptions", - "text": "AttributeServiceOptions" - }, + "AttributeServiceOptions", "" ], "description": [], @@ -463,6 +469,7 @@ } }, { + "id": "def-public.AttributeService.Unnamed.$6", "type": "Function", "label": "getEmbeddableFactory", "isRequired": false, @@ -532,6 +539,7 @@ "description": [], "children": [ { + "id": "def-public.AttributeService.unwrapAttributes.$1", "type": "CompoundType", "label": "input", "isRequired": true, @@ -562,6 +570,7 @@ "description": [], "children": [ { + "id": "def-public.AttributeService.wrapAttributes.$1", "type": "Uncategorized", "label": "newAttributes", "isRequired": true, @@ -575,6 +584,7 @@ } }, { + "id": "def-public.AttributeService.wrapAttributes.$2", "type": "boolean", "label": "useRefType", "isRequired": true, @@ -588,6 +598,7 @@ } }, { + "id": "def-public.AttributeService.wrapAttributes.$3", "type": "CompoundType", "label": "input", "isRequired": false, @@ -613,6 +624,7 @@ "type": "Function", "children": [ { + "id": "def-public.AttributeService.inputIsRefType.$1", "type": "CompoundType", "label": "input", "isRequired": true, @@ -672,6 +684,7 @@ "description": [], "children": [ { + "id": "def-public.AttributeService.getExplicitInputFromEmbeddable.$1", "type": "Object", "label": "embeddable", "isRequired": true, @@ -720,6 +733,7 @@ "type": "Function", "children": [ { + "id": "def-public.AttributeService.getInputAsValueType.$1", "type": "CompoundType", "label": "input", "isRequired": true, @@ -750,6 +764,7 @@ "type": "Function", "children": [ { + "id": "def-public.AttributeService.getInputAsRefType.$1", "type": "CompoundType", "label": "input", "isRequired": true, @@ -763,6 +778,7 @@ } }, { + "id": "def-public.AttributeService.getInputAsRefType.$2", "type": "CompoundType", "label": "saveOptions", "isRequired": false, @@ -861,6 +877,7 @@ "description": [], "children": [ { + "id": "def-public.Container.Unnamed.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -874,6 +891,7 @@ } }, { + "id": "def-public.Container.Unnamed.$2", "type": "Uncategorized", "label": "output", "isRequired": true, @@ -887,6 +905,7 @@ } }, { + "id": "def-public.Container.Unnamed.$3", "type": "Function", "label": "getFactory", "isRequired": true, @@ -939,6 +958,7 @@ } }, { + "id": "def-public.Container.Unnamed.$4", "type": "Object", "label": "parent", "isRequired": false, @@ -1008,6 +1028,7 @@ "description": [], "children": [ { + "id": "def-public.Container.updateInputForChild.$1", "type": "string", "label": "id", "isRequired": true, @@ -1021,6 +1042,7 @@ } }, { + "id": "def-public.Container.updateInputForChild.$2", "type": "Object", "label": "changes", "isRequired": true, @@ -1106,6 +1128,7 @@ "description": [], "children": [ { + "id": "def-public.Container.addNewEmbeddable.$1", "type": "string", "label": "type", "isRequired": true, @@ -1119,6 +1142,7 @@ } }, { + "id": "def-public.Container.addNewEmbeddable.$2", "type": "Object", "label": "explicitInput", "isRequired": true, @@ -1149,6 +1173,7 @@ "description": [], "children": [ { + "id": "def-public.Container.removeEmbeddable.$1", "type": "string", "label": "embeddableId", "isRequired": true, @@ -1219,6 +1244,7 @@ "description": [], "children": [ { + "id": "def-public.Container.getChild.$1", "type": "string", "label": "id", "isRequired": true, @@ -1265,6 +1291,7 @@ "description": [], "children": [ { + "id": "def-public.Container.getInputForChild.$1", "type": "string", "label": "embeddableId", "isRequired": true, @@ -1343,6 +1370,7 @@ "description": [], "children": [ { + "id": "def-public.Container.untilEmbeddableLoaded.$1", "type": "string", "label": "id", "isRequired": true, @@ -1393,13 +1421,7 @@ "text": "EmbeddableFactory" }, ", partial?: Partial) => ", { "pluginId": "embeddable", @@ -1412,6 +1434,7 @@ "description": [], "children": [ { + "id": "def-public.Container.createNewPanelState.$1", "type": "Object", "label": "factory", "isRequired": true, @@ -1424,13 +1447,7 @@ "text": "EmbeddableFactory" }, "" ], "description": [], @@ -1440,6 +1457,7 @@ } }, { + "id": "def-public.Container.createNewPanelState.$2", "type": "Object", "label": "partial", "isRequired": true, @@ -1494,6 +1512,7 @@ "description": [], "children": [ { + "id": "def-public.Container.getPanelState.$1", "type": "string", "label": "embeddableId", "isRequired": true, @@ -1526,6 +1545,7 @@ ], "children": [ { + "id": "def-public.Container.getInheritedInput.$1", "type": "string", "label": "id", "isRequired": true, @@ -1641,6 +1661,7 @@ "description": [], "children": [ { + "id": "def-public.EditPanelAction.Unnamed.$1", "type": "Function", "label": "getEmbeddableFactory", "isRequired": true, @@ -1693,6 +1714,7 @@ } }, { + "id": "def-public.EditPanelAction.Unnamed.$2", "type": "Object", "label": "application", "isRequired": true, @@ -1712,6 +1734,7 @@ } }, { + "id": "def-public.EditPanelAction.Unnamed.$3", "type": "Object", "label": "stateTransfer", "isRequired": false, @@ -1749,6 +1772,7 @@ "description": [], "children": [ { + "id": "def-public.EditPanelAction.getDisplayName.$1", "type": "Object", "label": "{ embeddable }", "isRequired": true, @@ -1795,6 +1819,7 @@ "description": [], "children": [ { + "id": "def-public.EditPanelAction.isCompatible.$1", "type": "Object", "label": "{ embeddable }", "isRequired": true, @@ -1825,6 +1850,7 @@ "description": [], "children": [ { + "id": "def-public.EditPanelAction.execute.$1", "type": "Object", "label": "context", "isRequired": true, @@ -1855,6 +1881,7 @@ "description": [], "children": [ { + "id": "def-public.EditPanelAction.getAppTarget.$1", "type": "Object", "label": "{ embeddable }", "isRequired": true, @@ -1885,6 +1912,7 @@ "description": [], "children": [ { + "id": "def-public.EditPanelAction.getHref.$1", "type": "Object", "label": "{ embeddable }", "isRequired": true, @@ -2101,6 +2129,7 @@ "description": [], "children": [ { + "id": "def-public.Embeddable.Unnamed.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -2114,6 +2143,7 @@ } }, { + "id": "def-public.Embeddable.Unnamed.$2", "type": "Uncategorized", "label": "output", "isRequired": true, @@ -2127,6 +2157,7 @@ } }, { + "id": "def-public.Embeddable.Unnamed.$3", "type": "Object", "label": "parent", "isRequired": false, @@ -2235,7 +2266,7 @@ "signature": [ "() => Readonly<", "Observable", - ">" + ">" ], "description": [ "\nMerges input$ and output$ streams and debounces emit till next macro-task.\nCould be useful to batch reactions to input$ and output$ updates that happen separately but synchronously.\nIn case corresponding state change triggered `reload` this stream is guarantied to emit later,\nwhich allows to skip any state handling in case `reload` already handled it." @@ -2263,7 +2294,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 121 + "lineNumber": 120 } }, { @@ -2281,7 +2312,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 125 + "lineNumber": 124 } }, { @@ -2297,7 +2328,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 129 + "lineNumber": 128 } }, { @@ -2313,7 +2344,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 133 + "lineNumber": 132 } }, { @@ -2329,7 +2360,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 137 + "lineNumber": 136 } }, { @@ -2386,7 +2417,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 145 + "lineNumber": 144 } }, { @@ -2399,6 +2430,7 @@ "description": [], "children": [ { + "id": "def-public.Embeddable.updateInput.$1", "type": "Object", "label": "changes", "isRequired": true, @@ -2408,7 +2440,7 @@ "description": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 153 + "lineNumber": 152 } } ], @@ -2416,7 +2448,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 153 + "lineNumber": 152 } }, { @@ -2429,6 +2461,7 @@ "description": [], "children": [ { + "id": "def-public.Embeddable.render.$1", "type": "Object", "label": "el", "isRequired": true, @@ -2438,7 +2471,7 @@ "description": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 165 + "lineNumber": 164 } } ], @@ -2446,7 +2479,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 165 + "lineNumber": 164 } }, { @@ -2476,7 +2509,7 @@ ], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 180 + "lineNumber": 179 } }, { @@ -2494,7 +2527,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 188 + "lineNumber": 187 } }, { @@ -2507,6 +2540,7 @@ "description": [], "children": [ { + "id": "def-public.Embeddable.updateOutput.$1", "type": "Object", "label": "outputChanges", "isRequired": true, @@ -2516,7 +2550,7 @@ "description": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 200 + "lineNumber": 199 } } ], @@ -2524,7 +2558,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 200 + "lineNumber": 199 } }, { @@ -2537,6 +2571,7 @@ "description": [], "children": [ { + "id": "def-public.Embeddable.onFatalError.$1", "type": "Object", "label": "e", "isRequired": true, @@ -2546,7 +2581,7 @@ "description": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 211 + "lineNumber": 210 } } ], @@ -2554,7 +2589,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 211 + "lineNumber": 210 } }, { @@ -2570,7 +2605,7 @@ "returnComment": [], "source": { "path": "src/plugins/embeddable/public/lib/embeddables/embeddable.tsx", - "lineNumber": 239 + "lineNumber": 238 } } ], @@ -2672,6 +2707,7 @@ "description": [], "children": [ { + "id": "def-public.EmbeddableChildPanel.Unnamed.$1", "type": "Object", "label": "props", "isRequired": true, @@ -2791,6 +2827,7 @@ "description": [], "children": [ { + "id": "def-public.EmbeddableFactoryNotFoundError.Unnamed.$1", "type": "string", "label": "type", "isRequired": true, @@ -2845,6 +2882,7 @@ "description": [], "children": [ { + "id": "def-public.EmbeddablePanel.Unnamed.$1", "type": "Object", "label": "props", "isRequired": true, @@ -2902,6 +2940,7 @@ "type": "Function", "children": [ { + "id": "def-public.EmbeddablePanel.onFocus.$1", "type": "string", "label": "focusedPanelIndex", "isRequired": true, @@ -2932,6 +2971,7 @@ "type": "Function", "children": [ { + "id": "def-public.EmbeddablePanel.onBlur.$1", "type": "string", "label": "blurredPanelIndex", "isRequired": true, @@ -3039,6 +3079,7 @@ "description": [], "children": [ { + "id": "def-public.EmbeddableRoot.Unnamed.$1", "type": "Object", "label": "props", "isRequired": true, @@ -3085,6 +3126,7 @@ "description": [], "children": [ { + "id": "def-public.EmbeddableRoot.componentDidUpdate.$1", "type": "Object", "label": "prevProps", "isRequired": false, @@ -3115,6 +3157,7 @@ "description": [], "children": [ { + "id": "def-public.EmbeddableRoot.shouldComponentUpdate.$1", "type": "Object", "label": "newProps", "isRequired": true, @@ -3190,6 +3233,7 @@ "description": [], "children": [ { + "id": "def-public.EmbeddableStateTransfer.Unnamed.$1", "type": "Function", "label": "navigateToApp", "isRequired": true, @@ -3211,6 +3255,7 @@ } }, { + "id": "def-public.EmbeddableStateTransfer.Unnamed.$2", "type": "Object", "label": "currentAppId$", "isRequired": true, @@ -3225,6 +3270,7 @@ } }, { + "id": "def-public.EmbeddableStateTransfer.Unnamed.$3", "type": "Object", "label": "appList", "isRequired": false, @@ -3246,6 +3292,7 @@ } }, { + "id": "def-public.EmbeddableStateTransfer.Unnamed.$4", "type": "Object", "label": "customStorage", "isRequired": false, @@ -3278,6 +3325,7 @@ "type": "Function", "children": [ { + "id": "def-public.EmbeddableStateTransfer.getAppNameFromId.$1", "type": "string", "label": "appId", "isRequired": true, @@ -3325,6 +3373,7 @@ ], "children": [ { + "id": "def-public.EmbeddableStateTransfer.getIncomingEditorState.$1", "type": "string", "label": "appId", "isRequired": true, @@ -3340,6 +3389,7 @@ } }, { + "id": "def-public.EmbeddableStateTransfer.getIncomingEditorState.$2", "type": "CompoundType", "label": "removeAfterFetch", "isRequired": false, @@ -3374,6 +3424,7 @@ ], "children": [ { + "id": "def-public.EmbeddableStateTransfer.clearEditorState.$1", "type": "string", "label": "appId", "isRequired": false, @@ -3416,6 +3467,7 @@ ], "children": [ { + "id": "def-public.EmbeddableStateTransfer.getIncomingEmbeddablePackage.$1", "type": "string", "label": "appId", "isRequired": true, @@ -3431,6 +3483,7 @@ } }, { + "id": "def-public.EmbeddableStateTransfer.getIncomingEmbeddablePackage.$2", "type": "CompoundType", "label": "removeAfterFetch", "isRequired": false, @@ -3473,6 +3526,7 @@ ], "children": [ { + "id": "def-public.EmbeddableStateTransfer.navigateToEditor.$1", "type": "string", "label": "appId", "isRequired": true, @@ -3486,7 +3540,7 @@ } }, { - "id": "def-public.EmbeddableStateTransfer.navigateToEditor.options", + "id": "def-public.EmbeddableStateTransfer.navigateToEditor.$2.options", "type": "Object", "label": "options", "tags": [], @@ -3494,7 +3548,7 @@ "children": [ { "tags": [], - "id": "def-public.EmbeddableStateTransfer.navigateToEditor.options.path", + "id": "def-public.EmbeddableStateTransfer.navigateToEditor.$2.options.path", "type": "string", "label": "path", "description": [], @@ -3508,7 +3562,7 @@ }, { "tags": [], - "id": "def-public.EmbeddableStateTransfer.navigateToEditor.options.state", + "id": "def-public.EmbeddableStateTransfer.navigateToEditor.$2.options.state", "type": "Object", "label": "state", "description": [], @@ -3560,6 +3614,7 @@ ], "children": [ { + "id": "def-public.EmbeddableStateTransfer.navigateToWithEmbeddablePackage.$1", "type": "string", "label": "appId", "isRequired": true, @@ -3573,7 +3628,7 @@ } }, { - "id": "def-public.EmbeddableStateTransfer.navigateToWithEmbeddablePackage.options", + "id": "def-public.EmbeddableStateTransfer.navigateToWithEmbeddablePackage.$2.options", "type": "Object", "label": "options", "tags": [], @@ -3581,7 +3636,7 @@ "children": [ { "tags": [], - "id": "def-public.EmbeddableStateTransfer.navigateToWithEmbeddablePackage.options.path", + "id": "def-public.EmbeddableStateTransfer.navigateToWithEmbeddablePackage.$2.options.path", "type": "string", "label": "path", "description": [], @@ -3595,7 +3650,7 @@ }, { "tags": [], - "id": "def-public.EmbeddableStateTransfer.navigateToWithEmbeddablePackage.options.state", + "id": "def-public.EmbeddableStateTransfer.navigateToWithEmbeddablePackage.$2.options.state", "type": "Object", "label": "state", "description": [], @@ -3713,6 +3768,7 @@ "description": [], "children": [ { + "id": "def-public.ErrorEmbeddable.Unnamed.$1", "type": "CompoundType", "label": "error", "isRequired": true, @@ -3726,6 +3782,7 @@ } }, { + "id": "def-public.ErrorEmbeddable.Unnamed.$2", "type": "Object", "label": "input", "isRequired": true, @@ -3745,6 +3802,7 @@ } }, { + "id": "def-public.ErrorEmbeddable.Unnamed.$3", "type": "Object", "label": "parent", "isRequired": false, @@ -3814,6 +3872,7 @@ "description": [], "children": [ { + "id": "def-public.ErrorEmbeddable.render.$1", "type": "Object", "label": "dom", "isRequired": true, @@ -3915,6 +3974,7 @@ "type": "Function", "children": [ { + "id": "def-public.defaultEmbeddableFactoryProvider.$1", "type": "CompoundType", "label": "def", "isRequired": true, @@ -3992,6 +4052,7 @@ "type": "Function", "children": [ { + "id": "def-public.EmbeddableRenderer.$1", "type": "CompoundType", "label": "props", "isRequired": true, @@ -4050,6 +4111,7 @@ "type": "Function", "children": [ { + "id": "def-public.isContextMenuTriggerContext.$1", "type": "Unknown", "label": "context", "isRequired": true, @@ -4113,6 +4175,7 @@ "type": "Function", "children": [ { + "id": "def-public.isEmbeddable.$1", "type": "Unknown", "label": "x", "isRequired": true, @@ -4181,6 +4244,7 @@ "description": [], "children": [ { + "id": "def-public.isErrorEmbeddable.$1", "type": "CompoundType", "label": "embeddable", "isRequired": true, @@ -4214,6 +4278,7 @@ "type": "Function", "children": [ { + "id": "def-public.isRangeSelectTriggerContext.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -4320,6 +4385,7 @@ "description": [], "children": [ { + "id": "def-public.isReferenceOrValueEmbeddable.$1", "type": "Unknown", "label": "incoming", "isRequired": true, @@ -4346,6 +4412,7 @@ "type": "Function", "children": [ { + "id": "def-public.isRowClickTriggerContext.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -4468,6 +4535,7 @@ "description": [], "children": [ { + "id": "def-public.isSavedObjectEmbeddableInput.$1", "type": "CompoundType", "label": "input", "isRequired": true, @@ -4508,6 +4576,7 @@ "type": "Function", "children": [ { + "id": "def-public.isValueClickTriggerContext.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -4653,7 +4722,7 @@ "description": [], "children": [ { - "id": "def-public.openAddPanelFlyout.options", + "id": "def-public.openAddPanelFlyout.$1.options", "type": "Object", "label": "options", "tags": [], @@ -4661,7 +4730,7 @@ "children": [ { "tags": [], - "id": "def-public.openAddPanelFlyout.options.embeddable", + "id": "def-public.openAddPanelFlyout.$1.options.embeddable", "type": "Object", "label": "embeddable", "description": [], @@ -4698,7 +4767,7 @@ }, { "tags": [], - "id": "def-public.openAddPanelFlyout.options.getFactory", + "id": "def-public.openAddPanelFlyout.$1.options.getFactory", "type": "Function", "label": "getFactory", "description": [], @@ -4751,7 +4820,7 @@ }, { "tags": [], - "id": "def-public.openAddPanelFlyout.options.getAllFactories", + "id": "def-public.openAddPanelFlyout.$1.options.getAllFactories", "type": "Function", "label": "getAllFactories", "description": [], @@ -4804,7 +4873,7 @@ }, { "tags": [], - "id": "def-public.openAddPanelFlyout.options.overlays", + "id": "def-public.openAddPanelFlyout.$1.options.overlays", "type": "Object", "label": "overlays", "description": [], @@ -4824,7 +4893,7 @@ }, { "tags": [], - "id": "def-public.openAddPanelFlyout.options.notifications", + "id": "def-public.openAddPanelFlyout.$1.options.notifications", "type": "Object", "label": "notifications", "description": [], @@ -4844,7 +4913,7 @@ }, { "tags": [], - "id": "def-public.openAddPanelFlyout.options.SavedObjectFinder", + "id": "def-public.openAddPanelFlyout.$1.options.SavedObjectFinder", "type": "CompoundType", "label": "SavedObjectFinder", "description": [], @@ -4876,6 +4945,7 @@ "type": "Function", "children": [ { + "id": "def-public.withEmbeddableSubscription.$1", "type": "CompoundType", "label": "WrappedComponent", "isRequired": true, @@ -5467,6 +5537,7 @@ ], "children": [ { + "id": "def-public.EmbeddableFactory.getDefaultInput.$1", "type": "Object", "label": "partial", "isRequired": true, @@ -5549,6 +5620,7 @@ ], "children": [ { + "id": "def-public.EmbeddableFactory.createFromSavedObject.$1", "type": "string", "label": "savedObjectId", "isRequired": true, @@ -5562,6 +5634,7 @@ } }, { + "id": "def-public.EmbeddableFactory.createFromSavedObject.$2", "type": "Object", "label": "input", "isRequired": true, @@ -5577,6 +5650,7 @@ } }, { + "id": "def-public.EmbeddableFactory.createFromSavedObject.$3", "type": "Object", "label": "parent", "isRequired": false, @@ -5664,6 +5738,7 @@ ], "children": [ { + "id": "def-public.EmbeddableFactory.create.$1", "type": "Uncategorized", "label": "initialInput", "isRequired": true, @@ -5677,6 +5752,7 @@ } }, { + "id": "def-public.EmbeddableFactory.create.$2", "type": "Object", "label": "parent", "isRequired": false, @@ -5798,13 +5874,7 @@ "lineNumber": 25 }, "signature": [ - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.EmbeddableError", - "text": "EmbeddableError" - }, + "EmbeddableError", " | undefined" ] }, @@ -6203,6 +6273,7 @@ ], "children": [ { + "id": "def-public.IContainer.untilEmbeddableLoaded.$1", "type": "string", "label": "id", "isRequired": true, @@ -6243,6 +6314,7 @@ ], "children": [ { + "id": "def-public.IContainer.getInputForChild.$1", "type": "string", "label": "id", "isRequired": true, @@ -6283,6 +6355,7 @@ ], "children": [ { + "id": "def-public.IContainer.updateInputForChild.$1", "type": "string", "label": "id", "isRequired": true, @@ -6296,6 +6369,7 @@ } }, { + "id": "def-public.IContainer.updateInputForChild.$2", "type": "Object", "label": "changes", "isRequired": true, @@ -6367,6 +6441,7 @@ ], "children": [ { + "id": "def-public.IContainer.getChild.$1", "type": "string", "label": "id", "isRequired": true, @@ -6399,6 +6474,7 @@ ], "children": [ { + "id": "def-public.IContainer.removeEmbeddable.$1", "type": "string", "label": "embeddableId", "isRequired": true, @@ -6470,6 +6546,7 @@ ], "children": [ { + "id": "def-public.IContainer.addNewEmbeddable.$1", "type": "string", "label": "type", "isRequired": true, @@ -6483,6 +6560,7 @@ } }, { + "id": "def-public.IContainer.addNewEmbeddable.$2", "type": "Object", "label": "explicitInput", "isRequired": true, @@ -6743,6 +6821,7 @@ ], "children": [ { + "id": "def-public.IEmbeddable.updateInput.$1", "type": "Object", "label": "changes", "isRequired": true, @@ -6890,6 +6969,7 @@ ], "children": [ { + "id": "def-public.IEmbeddable.render.$1", "type": "CompoundType", "label": "domNode", "isRequired": true, @@ -7895,13 +7975,7 @@ }, "signature": [ "(customProvider: ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.EmbeddableFactoryProvider", - "text": "EmbeddableFactoryProvider" - }, + "EmbeddableFactoryProvider", ") => void" ] } @@ -8163,13 +8237,7 @@ "text": "SavedObjectEmbeddableInput" }, ">(type: string, options: ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.AttributeServiceOptions", - "text": "AttributeServiceOptions" - } + "AttributeServiceOptions" ] } ], @@ -8385,6 +8453,7 @@ "type": "Function", "children": [ { + "id": "def-common.extractBaseEmbeddableInput.$1", "type": "CompoundType", "label": "state", "isRequired": true, @@ -8440,6 +8509,7 @@ "type": "Function", "children": [ { + "id": "def-common.getExtractFunction.$1", "type": "Object", "label": "embeddables", "isRequired": true, @@ -8503,6 +8573,7 @@ "type": "Function", "children": [ { + "id": "def-common.getInjectFunction.$1", "type": "Object", "label": "embeddables", "isRequired": true, @@ -8565,6 +8636,7 @@ "type": "Function", "children": [ { + "id": "def-common.getMigrateFunction.$1", "type": "Object", "label": "embeddables", "isRequired": true, @@ -8625,6 +8697,7 @@ "type": "Function", "children": [ { + "id": "def-common.getTelemetryFunction.$1", "type": "Object", "label": "embeddables", "isRequired": true, @@ -8678,6 +8751,7 @@ "type": "Function", "children": [ { + "id": "def-common.injectBaseEmbeddableInput.$1", "type": "CompoundType", "label": "state", "isRequired": true, @@ -8697,17 +8771,12 @@ } }, { + "id": "def-common.injectBaseEmbeddableInput.$2", "type": "Array", "label": "references", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [], @@ -8773,6 +8842,7 @@ "description": [], "children": [ { + "id": "def-common.isSavedObjectEmbeddableInput.$1", "type": "CompoundType", "label": "input", "isRequired": true, @@ -8813,6 +8883,7 @@ "type": "Function", "children": [ { + "id": "def-common.telemetryBaseEmbeddableInput.$1", "type": "CompoundType", "label": "state", "isRequired": true, @@ -8832,6 +8903,7 @@ } }, { + "id": "def-common.telemetryBaseEmbeddableInput.$2", "type": "Object", "label": "telemetryData", "isRequired": true, diff --git a/api_docs/embeddable_enhanced.json b/api_docs/embeddable_enhanced.json index 8c5d5a1de4ca2..93aeac4994739 100644 --- a/api_docs/embeddable_enhanced.json +++ b/api_docs/embeddable_enhanced.json @@ -8,6 +8,7 @@ "type": "Function", "children": [ { + "id": "def-public.isEnhancedEmbeddable.$1", "type": "Uncategorized", "label": "maybeEnhancedEmbeddable", "isRequired": true, diff --git a/api_docs/encrypted_saved_objects.json b/api_docs/encrypted_saved_objects.json index 6de5870d05230..9487ccee9f32d 100644 --- a/api_docs/encrypted_saved_objects.json +++ b/api_docs/encrypted_saved_objects.json @@ -37,6 +37,7 @@ "description": [], "children": [ { + "id": "def-server.EncryptionError.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -50,6 +51,7 @@ } }, { + "id": "def-server.EncryptionError.Unnamed.$2", "type": "string", "label": "attributeName", "isRequired": true, @@ -63,17 +65,12 @@ } }, { + "id": "def-server.EncryptionError.Unnamed.$3", "type": "Enum", "label": "operation", "isRequired": true, "signature": [ - { - "pluginId": "encryptedSavedObjects", - "scope": "server", - "docId": "kibEncryptedSavedObjectsPluginApi", - "section": "def-server.EncryptionErrorOperation", - "text": "EncryptionErrorOperation" - } + "EncryptionErrorOperation" ], "description": [], "source": { @@ -82,6 +79,7 @@ } }, { + "id": "def-server.EncryptionError.Unnamed.$4", "type": "Object", "label": "cause", "isRequired": false, @@ -155,13 +153,7 @@ "text": "SavedObjectsBaseOptions" }, " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ] } @@ -204,13 +196,7 @@ }, "signature": [ "ReadonlySet" ] }, @@ -292,13 +278,7 @@ "lineNumber": 37 }, "signature": [ - { - "pluginId": "encryptedSavedObjects", - "scope": "server", - "docId": "kibEncryptedSavedObjectsPluginApi", - "section": "def-server.CreateEncryptedSavedObjectsMigrationFn", - "text": "CreateEncryptedSavedObjectsMigrationFn" - } + "CreateEncryptedSavedObjectsMigrationFn" ] } ], @@ -341,13 +321,7 @@ "lineNumber": 42 }, "signature": [ - { - "pluginId": "encryptedSavedObjects", - "scope": "server", - "docId": "kibEncryptedSavedObjectsPluginApi", - "section": "def-server.ClientInstanciator", - "text": "ClientInstanciator" - } + "ClientInstanciator" ] } ], diff --git a/api_docs/es_ui_shared.json b/api_docs/es_ui_shared.json index c3b2b042f9875..ac32be544759c 100644 --- a/api_docs/es_ui_shared.json +++ b/api_docs/es_ui_shared.json @@ -39,6 +39,7 @@ "description": [], "children": [ { + "id": "def-public.CronEditor.getDerivedStateFromProps.$1", "type": "Object", "label": "props", "isRequired": true, @@ -69,6 +70,7 @@ "description": [], "children": [ { + "id": "def-public.CronEditor.Unnamed.$1", "type": "Object", "label": "props", "isRequired": true, @@ -94,6 +96,7 @@ "type": "Function", "children": [ { + "id": "def-public.CronEditor.onChangeFrequency.$1", "type": "CompoundType", "label": "frequency", "isRequired": true, @@ -138,17 +141,12 @@ "type": "Function", "children": [ { + "id": "def-public.CronEditor.onChangeFields.$1", "type": "Object", "label": "fields", "isRequired": true, "signature": [ - { - "pluginId": "esUiShared", - "scope": "public", - "docId": "kibEsUiSharedPluginApi", - "section": "def-public.FieldToValueMap", - "text": "FieldToValueMap" - } + "FieldToValueMap" ], "description": [], "source": { @@ -159,13 +157,7 @@ ], "signature": [ "(fields: ", - { - "pluginId": "esUiShared", - "scope": "public", - "docId": "kibEsUiSharedPluginApi", - "section": "def-public.FieldToValueMap", - "text": "FieldToValueMap" - }, + "FieldToValueMap", ") => void" ], "description": [], @@ -223,6 +215,7 @@ "type": "Function", "children": [ { + "id": "def-public.attemptToURIDecode.$1", "type": "string", "label": "value", "isRequired": false, @@ -254,6 +247,7 @@ "type": "Function", "children": [ { + "id": "def-public.AuthorizationProvider.$1", "type": "Object", "label": "{ privilegesEndpoint, httpClient, children }", "isRequired": true, @@ -292,6 +286,7 @@ "description": [], "children": [ { + "id": "def-public.extractQueryParams.$1", "type": "string", "label": "queryString", "isRequired": true, @@ -333,6 +328,7 @@ "type": "Function", "children": [ { + "id": "def-public.NotAuthorizedSection.$1", "type": "Object", "label": "{ title, message }", "isRequired": true, @@ -364,6 +360,7 @@ "type": "Function", "children": [ { + "id": "def-public.SectionError.$1", "type": "CompoundType", "label": "{\n title,\n error,\n actions,\n ...rest\n}", "isRequired": true, @@ -395,6 +392,7 @@ "type": "Function", "children": [ { + "id": "def-public.SectionLoading.$1", "type": "CompoundType", "label": "{ inline, children, ...rest }", "isRequired": true, @@ -426,6 +424,7 @@ "type": "Function", "children": [ { + "id": "def-public.sendRequest.$1", "type": "Object", "label": "httpClient", "isRequired": true, @@ -445,6 +444,7 @@ } }, { + "id": "def-public.sendRequest.$2", "type": "Object", "label": "{ path, method, body, query, asSystemRequest }", "isRequired": true, @@ -523,6 +523,7 @@ "type": "Function", "children": [ { + "id": "def-public.useRequest.$1", "type": "Object", "label": "httpClient", "isRequired": true, @@ -542,6 +543,7 @@ } }, { + "id": "def-public.useRequest.$2", "type": "Object", "label": "{ path, method, query, body, pollIntervalMs, initialData, deserializer }", "isRequired": true, @@ -603,6 +605,7 @@ "type": "Function", "children": [ { + "id": "def-public.WithPrivileges.$1", "type": "Object", "label": "{ privileges: requiredPrivileges, children }", "isRequired": true, @@ -1217,13 +1220,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "esUiShared", - "scope": "public", - "docId": "kibEsUiSharedPluginApi", - "section": "def-public.indexNameBeginsWithPeriod", - "text": "indexNameBeginsWithPeriod" - } + "indexNameBeginsWithPeriod" ] }, { @@ -1238,13 +1235,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "esUiShared", - "scope": "public", - "docId": "kibEsUiSharedPluginApi", - "section": "def-public.findIllegalCharactersInIndexName", - "text": "findIllegalCharactersInIndexName" - } + "findIllegalCharactersInIndexName" ] }, { @@ -1259,13 +1250,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "esUiShared", - "scope": "public", - "docId": "kibEsUiSharedPluginApi", - "section": "def-public.indexNameContainsSpaces", - "text": "indexNameContainsSpaces" - } + "indexNameContainsSpaces" ] } ], @@ -1287,6 +1272,7 @@ "type": "Function", "children": [ { + "id": "def-server.handleEsError.$1", "type": "Object", "label": "{\n error,\n response,\n handleCustomError,\n}", "isRequired": true, @@ -1331,6 +1317,7 @@ "description": [], "children": [ { + "id": "def-server.isEsError.$1", "type": "Object", "label": "err", "isRequired": true, @@ -1357,6 +1344,7 @@ "type": "Function", "children": [ { + "id": "def-server.parseEsError.$1", "type": "string", "label": "err", "isRequired": true, diff --git a/api_docs/event_log.json b/api_docs/event_log.json index aea4d0c001913..5523b3eb60b4b 100644 --- a/api_docs/event_log.json +++ b/api_docs/event_log.json @@ -9,8 +9,487 @@ "objects": [] }, "server": { - "classes": [], - "functions": [], + "classes": [ + { + "id": "def-server.ClusterClientAdapter", + "type": "Class", + "tags": [], + "label": "ClusterClientAdapter", + "description": [], + "signature": [ + { + "pluginId": "eventLog", + "scope": "server", + "docId": "kibEventLogPluginApi", + "section": "def-server.ClusterClientAdapter", + "text": "ClusterClientAdapter" + }, + "" + ], + "children": [ + { + "id": "def-server.ClusterClientAdapter.Unnamed", + "type": "Function", + "label": "Constructor", + "signature": [ + "any" + ], + "description": [], + "children": [ + { + "id": "def-server.ClusterClientAdapter.Unnamed.$1", + "type": "Object", + "label": "opts", + "isRequired": true, + "signature": [ + "ConstructorOpts" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 54 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 54 + } + }, + { + "id": "def-server.ClusterClientAdapter.shutdown", + "type": "Function", + "label": "shutdown", + "signature": [ + "() => Promise" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 78 + } + }, + { + "id": "def-server.ClusterClientAdapter.indexDocument", + "type": "Function", + "label": "indexDocument", + "signature": [ + "(doc: TDoc) => void" + ], + "description": [], + "children": [ + { + "id": "def-server.ClusterClientAdapter.indexDocument.$1", + "type": "Uncategorized", + "label": "doc", + "isRequired": true, + "signature": [ + "TDoc" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 83 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 83 + } + }, + { + "id": "def-server.ClusterClientAdapter.indexDocuments", + "type": "Function", + "label": "indexDocuments", + "signature": [ + "(docs: TDoc[]) => Promise" + ], + "description": [], + "children": [ + { + "id": "def-server.ClusterClientAdapter.indexDocuments.$1", + "type": "Array", + "label": "docs", + "isRequired": true, + "signature": [ + "TDoc[]" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 87 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 87 + } + }, + { + "id": "def-server.ClusterClientAdapter.doesIlmPolicyExist", + "type": "Function", + "label": "doesIlmPolicyExist", + "signature": [ + "(policyName: string) => Promise" + ], + "description": [], + "children": [ + { + "id": "def-server.ClusterClientAdapter.doesIlmPolicyExist.$1", + "type": "string", + "label": "policyName", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 123 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 123 + } + }, + { + "id": "def-server.ClusterClientAdapter.createIlmPolicy", + "type": "Function", + "label": "createIlmPolicy", + "signature": [ + "(policyName: string, policy: Record) => Promise" + ], + "description": [], + "children": [ + { + "id": "def-server.ClusterClientAdapter.createIlmPolicy.$1", + "type": "string", + "label": "policyName", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 138 + } + }, + { + "id": "def-server.ClusterClientAdapter.createIlmPolicy.$2", + "type": "Object", + "label": "policy", + "isRequired": true, + "signature": [ + "Record" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 138 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 138 + } + }, + { + "id": "def-server.ClusterClientAdapter.doesIndexTemplateExist", + "type": "Function", + "label": "doesIndexTemplateExist", + "signature": [ + "(name: string) => Promise" + ], + "description": [], + "children": [ + { + "id": "def-server.ClusterClientAdapter.doesIndexTemplateExist.$1", + "type": "string", + "label": "name", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 152 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 152 + } + }, + { + "id": "def-server.ClusterClientAdapter.createIndexTemplate", + "type": "Function", + "label": "createIndexTemplate", + "signature": [ + "(name: string, template: Record) => Promise" + ], + "description": [], + "children": [ + { + "id": "def-server.ClusterClientAdapter.createIndexTemplate.$1", + "type": "string", + "label": "name", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 162 + } + }, + { + "id": "def-server.ClusterClientAdapter.createIndexTemplate.$2", + "type": "Object", + "label": "template", + "isRequired": true, + "signature": [ + "Record" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 162 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 162 + } + }, + { + "id": "def-server.ClusterClientAdapter.doesAliasExist", + "type": "Function", + "label": "doesAliasExist", + "signature": [ + "(name: string) => Promise" + ], + "description": [], + "children": [ + { + "id": "def-server.ClusterClientAdapter.doesAliasExist.$1", + "type": "string", + "label": "name", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 180 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 180 + } + }, + { + "id": "def-server.ClusterClientAdapter.createIndex", + "type": "Function", + "label": "createIndex", + "signature": [ + "(name: string, body?: Record) => Promise" + ], + "description": [], + "children": [ + { + "id": "def-server.ClusterClientAdapter.createIndex.$1", + "type": "string", + "label": "name", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 190 + } + }, + { + "id": "def-server.ClusterClientAdapter.createIndex.$2", + "type": "Object", + "label": "body", + "isRequired": true, + "signature": [ + "Record" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 190 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 190 + } + }, + { + "id": "def-server.ClusterClientAdapter.queryEventsBySavedObjects", + "type": "Function", + "label": "queryEventsBySavedObjects", + "signature": [ + "(index: string, namespace: string | undefined, type: string, ids: string[], { page, per_page: perPage, start, end, sort_field, sort_order, filter }: ", + "FindOptionsType", + ") => Promise<", + { + "pluginId": "eventLog", + "scope": "server", + "docId": "kibEventLogPluginApi", + "section": "def-server.QueryEventsBySavedObjectResult", + "text": "QueryEventsBySavedObjectResult" + }, + ">" + ], + "description": [], + "children": [ + { + "id": "def-server.ClusterClientAdapter.queryEventsBySavedObjects.$1", + "type": "string", + "label": "index", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 205 + } + }, + { + "id": "def-server.ClusterClientAdapter.queryEventsBySavedObjects.$2", + "type": "string", + "label": "namespace", + "isRequired": false, + "signature": [ + "string | undefined" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 206 + } + }, + { + "id": "def-server.ClusterClientAdapter.queryEventsBySavedObjects.$3", + "type": "string", + "label": "type", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 207 + } + }, + { + "id": "def-server.ClusterClientAdapter.queryEventsBySavedObjects.$4", + "type": "Array", + "label": "ids", + "isRequired": true, + "signature": [ + "string[]" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 208 + } + }, + { + "id": "def-server.ClusterClientAdapter.queryEventsBySavedObjects.$5", + "type": "CompoundType", + "label": "{ page, per_page: perPage, start, end, sort_field, sort_order, filter }", + "isRequired": true, + "signature": [ + "FindOptionsType" + ], + "description": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 210 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 204 + } + } + ], + "source": { + "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", + "lineNumber": 47 + }, + "initialIsOpen": false + } + ], + "functions": [ + { + "id": "def-server.createReadySignal", + "type": "Function", + "label": "createReadySignal", + "signature": [ + "() => ", + "ReadySignal", + "" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/event_log/server/lib/ready_signal.ts", + "lineNumber": 13 + }, + "initialIsOpen": false + } + ], "interfaces": [ { "id": "def-server.IEventLogClient", @@ -25,13 +504,7 @@ "label": "findEventsBySavedObjectIds", "signature": [ "(type: string, ids: string[], options?: Partial<", - { - "pluginId": "eventLog", - "scope": "server", - "docId": "kibEventLogPluginApi", - "section": "def-server.FindOptionsType", - "text": "FindOptionsType" - }, + "FindOptionsType", "> | undefined) => Promise<", { "pluginId": "eventLog", @@ -45,6 +518,7 @@ "description": [], "children": [ { + "id": "def-server.IEventLogClient.findEventsBySavedObjectIds.$1", "type": "string", "label": "type", "isRequired": true, @@ -58,6 +532,7 @@ } }, { + "id": "def-server.IEventLogClient.findEventsBySavedObjectIds.$2", "type": "Array", "label": "ids", "isRequired": true, @@ -71,18 +546,13 @@ } }, { + "id": "def-server.IEventLogClient.findEventsBySavedObjectIds.$3", "type": "Object", "label": "options", "isRequired": false, "signature": [ "Partial<", - { - "pluginId": "eventLog", - "scope": "server", - "docId": "kibEventLogPluginApi", - "section": "def-server.FindOptionsType", - "text": "FindOptionsType" - }, + "FindOptionsType", "> | undefined" ], "description": [], @@ -118,16 +588,17 @@ "type": "Function", "label": "logEvent", "signature": [ - "(properties: DeepPartial | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}>>> | undefined) => void" + "(properties: DeepPartial | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}>>> | undefined) => void" ], "description": [], "children": [ { + "id": "def-server.IEventLogger.logEvent.$1", "type": "Object", "label": "properties", "isRequired": false, "signature": [ - "DeepPartial | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}>>> | undefined" + "DeepPartial | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}>>> | undefined" ], "description": [], "source": { @@ -148,16 +619,17 @@ "type": "Function", "label": "startTiming", "signature": [ - "(event: DeepPartial | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}>>> | undefined) => void" + "(event: DeepPartial | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}>>> | undefined) => void" ], "description": [], "children": [ { + "id": "def-server.IEventLogger.startTiming.$1", "type": "Object", "label": "event", "isRequired": false, "signature": [ - "DeepPartial | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}>>> | undefined" + "DeepPartial | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}>>> | undefined" ], "description": [], "source": { @@ -178,16 +650,17 @@ "type": "Function", "label": "stopTiming", "signature": [ - "(event: DeepPartial | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}>>> | undefined) => void" + "(event: DeepPartial | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}>>> | undefined) => void" ], "description": [], "children": [ { + "id": "def-server.IEventLogger.stopTiming.$1", "type": "Object", "label": "event", "isRequired": false, "signature": [ - "DeepPartial | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}>>> | undefined" + "DeepPartial | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}>>> | undefined" ], "description": [], "source": { @@ -225,7 +698,7 @@ "description": [], "source": { "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", - "lineNumber": 36 + "lineNumber": 38 } }, { @@ -236,7 +709,7 @@ "description": [], "source": { "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", - "lineNumber": 37 + "lineNumber": 39 } }, { @@ -247,7 +720,7 @@ "description": [], "source": { "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", - "lineNumber": 38 + "lineNumber": 40 } }, { @@ -258,16 +731,16 @@ "description": [], "source": { "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", - "lineNumber": 39 + "lineNumber": 41 }, "signature": [ - "(Readonly<{ '@timestamp'?: string | undefined; kibana?: Readonly<{ server_uuid?: string | undefined; alerting?: Readonly<{ status?: string | undefined; instance_id?: string | undefined; action_group_id?: string | undefined; action_subgroup?: string | undefined; } & {}> | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}> | undefined)[]" + "(Readonly<{ '@timestamp'?: string | undefined; kibana?: Readonly<{ alerting?: Readonly<{ status?: string | undefined; instance_id?: string | undefined; action_group_id?: string | undefined; action_subgroup?: string | undefined; } & {}> | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}> | undefined)[]" ] } ], "source": { "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", - "lineNumber": 35 + "lineNumber": 37 }, "initialIsOpen": false } @@ -285,7 +758,7 @@ "lineNumber": 26 }, "signature": [ - "undefined | DeepPartial | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}>>>" + "undefined | DeepPartial | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}>>>" ], "initialIsOpen": false }, @@ -300,7 +773,7 @@ "lineNumber": 25 }, "signature": [ - "undefined | Readonly<{ '@timestamp'?: string | undefined; kibana?: Readonly<{ server_uuid?: string | undefined; alerting?: Readonly<{ status?: string | undefined; instance_id?: string | undefined; action_group_id?: string | undefined; action_subgroup?: string | undefined; } & {}> | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}>" + "undefined | Readonly<{ '@timestamp'?: string | undefined; kibana?: Readonly<{ alerting?: Readonly<{ status?: string | undefined; instance_id?: string | undefined; action_group_id?: string | undefined; action_subgroup?: string | undefined; } & {}> | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}>" ], "initialIsOpen": false }, @@ -386,6 +859,7 @@ "description": [], "children": [ { + "id": "def-server.IEventLogService.registerProviderActions.$1", "type": "string", "label": "provider", "isRequired": true, @@ -399,6 +873,7 @@ } }, { + "id": "def-server.IEventLogService.registerProviderActions.$2", "type": "Array", "label": "actions", "isRequired": true, @@ -429,6 +904,7 @@ "description": [], "children": [ { + "id": "def-server.IEventLogService.isProviderActionRegistered.$1", "type": "string", "label": "provider", "isRequired": true, @@ -442,6 +918,7 @@ } }, { + "id": "def-server.IEventLogService.isProviderActionRegistered.$2", "type": "string", "label": "action", "isRequired": true, @@ -484,18 +961,13 @@ "label": "registerSavedObjectProvider", "signature": [ "(type: string, provider: ", - { - "pluginId": "eventLog", - "scope": "server", - "docId": "kibEventLogPluginApi", - "section": "def-server.SavedObjectProvider", - "text": "SavedObjectProvider" - }, + "SavedObjectProvider", ") => void" ], "description": [], "children": [ { + "id": "def-server.IEventLogService.registerSavedObjectProvider.$1", "type": "string", "label": "type", "isRequired": true, @@ -509,17 +981,12 @@ } }, { + "id": "def-server.IEventLogService.registerSavedObjectProvider.$2", "type": "Function", "label": "provider", "isRequired": true, "signature": [ - { - "pluginId": "eventLog", - "scope": "server", - "docId": "kibEventLogPluginApi", - "section": "def-server.SavedObjectProvider", - "text": "SavedObjectProvider" - } + "SavedObjectProvider" ], "description": [], "source": { @@ -540,7 +1007,7 @@ "type": "Function", "label": "getLogger", "signature": [ - "(properties: DeepPartial | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}>>> | undefined) => ", + "(properties: DeepPartial | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}>>> | undefined) => ", { "pluginId": "eventLog", "scope": "server", @@ -552,11 +1019,12 @@ "description": [], "children": [ { + "id": "def-server.IEventLogService.getLogger.$1", "type": "Object", "label": "properties", "isRequired": false, "signature": [ - "DeepPartial | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ message?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; end?: string | undefined; action?: string | undefined; provider?: string | undefined; duration?: number | undefined; outcome?: string | undefined; reason?: string | undefined; } & {}> | undefined; } & {}>>> | undefined" + "DeepPartial | undefined; server_uuid?: string | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; rel?: string | undefined; namespace?: string | undefined; } & {}>[] | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; message?: string | undefined; tags?: string[] | undefined; event?: Readonly<{ start?: string | undefined; type?: string[] | undefined; id?: string | undefined; end?: string | undefined; category?: string[] | undefined; url?: string | undefined; code?: string | undefined; action?: string | undefined; kind?: string | undefined; original?: string | undefined; severity?: number | undefined; hash?: string | undefined; provider?: string | undefined; created?: string | undefined; dataset?: string | undefined; duration?: number | undefined; ingested?: string | undefined; module?: string | undefined; outcome?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: number | undefined; timezone?: string | undefined; } & {}> | undefined; rule?: Readonly<{ description?: string | undefined; id?: string | undefined; name?: string | undefined; version?: string | undefined; license?: string | undefined; category?: string | undefined; uuid?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; } & {}>>> | undefined" ], "description": [], "source": { @@ -612,6 +1080,7 @@ "description": [], "children": [ { + "id": "def-server.IEventLogClientService.getClient.$1", "type": "Object", "label": "request", "isRequired": true, diff --git a/api_docs/event_log.mdx b/api_docs/event_log.mdx index 2c212e5099f00..6948a63cf85c9 100644 --- a/api_docs/event_log.mdx +++ b/api_docs/event_log.mdx @@ -19,6 +19,12 @@ import eventLogObj from './event_log.json'; ### Start +### Functions + + +### Classes + + ### Interfaces diff --git a/api_docs/expressions.json b/api_docs/expressions.json index 06c97e497ae41..7355d2904e63b 100644 --- a/api_docs/expressions.json +++ b/api_docs/expressions.json @@ -103,13 +103,7 @@ "text": "ExecutionContext" }, "" ] }, @@ -209,6 +203,7 @@ "description": [], "children": [ { + "id": "def-public.Execution.Unnamed.$1", "type": "Object", "label": "execution", "isRequired": true, @@ -265,6 +260,7 @@ ], "children": [ { + "id": "def-public.Execution.start.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -303,6 +299,7 @@ "description": [], "children": [ { + "id": "def-public.Execution.invokeChain.$1", "type": "Array", "label": "chainArr", "isRequired": true, @@ -323,6 +320,7 @@ } }, { + "id": "def-public.Execution.invokeChain.$2", "type": "Unknown", "label": "input", "isRequired": true, @@ -361,6 +359,7 @@ "description": [], "children": [ { + "id": "def-public.Execution.invokeFunction.$1", "type": "Object", "label": "fn", "isRequired": true, @@ -380,6 +379,7 @@ } }, { + "id": "def-public.Execution.invokeFunction.$2", "type": "Unknown", "label": "input", "isRequired": true, @@ -393,6 +393,7 @@ } }, { + "id": "def-public.Execution.invokeFunction.$3", "type": "Object", "label": "args", "isRequired": true, @@ -423,6 +424,7 @@ "description": [], "children": [ { + "id": "def-public.Execution.cast.$1", "type": "Any", "label": "value", "isRequired": true, @@ -436,6 +438,7 @@ } }, { + "id": "def-public.Execution.cast.$2", "type": "Array", "label": "toTypeNames", "isRequired": false, @@ -474,6 +477,7 @@ "description": [], "children": [ { + "id": "def-public.Execution.resolveArgs.$1", "type": "Object", "label": "fnDef", "isRequired": true, @@ -493,6 +497,7 @@ } }, { + "id": "def-public.Execution.resolveArgs.$2", "type": "Unknown", "label": "input", "isRequired": true, @@ -506,6 +511,7 @@ } }, { + "id": "def-public.Execution.resolveArgs.$3", "type": "Any", "label": "argAsts", "isRequired": true, @@ -544,6 +550,7 @@ "description": [], "children": [ { + "id": "def-public.Execution.interpret.$1", "type": "CompoundType", "label": "ast", "isRequired": true, @@ -563,6 +570,7 @@ } }, { + "id": "def-public.Execution.interpret.$2", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -630,6 +638,7 @@ "description": [], "children": [ { + "id": "def-public.ExecutionContract.Unnamed.$1", "type": "Object", "label": "execution", "isRequired": true, @@ -836,6 +845,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.createWithDefaults.$1", "type": "Object", "label": "state", "isRequired": false, @@ -938,6 +948,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.Unnamed.$1", "type": "Object", "label": "state", "isRequired": false, @@ -991,6 +1002,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.registerFunction.$1", "type": "CompoundType", "label": "functionDefinition", "isRequired": true, @@ -1044,6 +1056,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.getFunction.$1", "type": "string", "label": "name", "isRequired": true, @@ -1114,6 +1127,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.registerType.$1", "type": "CompoundType", "label": "typeDefinition", "isRequired": true, @@ -1167,6 +1181,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.getType.$1", "type": "string", "label": "name", "isRequired": true, @@ -1221,6 +1236,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.extendContext.$1", "type": "Object", "label": "extraContext", "isRequired": true, @@ -1283,6 +1299,7 @@ ], "children": [ { + "id": "def-public.Executor.run.$1", "type": "CompoundType", "label": "ast", "isRequired": true, @@ -1305,6 +1322,7 @@ } }, { + "id": "def-public.Executor.run.$2", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -1320,6 +1338,7 @@ } }, { + "id": "def-public.Executor.run.$3", "type": "Object", "label": "params", "isRequired": true, @@ -1388,6 +1407,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.createExecution.$1", "type": "CompoundType", "label": "ast", "isRequired": true, @@ -1408,6 +1428,7 @@ } }, { + "id": "def-public.Executor.createExecution.$2", "type": "Object", "label": "params", "isRequired": true, @@ -1448,13 +1469,7 @@ "text": "ExpressionAstExpression" }, ", references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => ", { "pluginId": "expressions", @@ -1467,6 +1482,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.inject.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -1486,17 +1502,12 @@ } }, { + "id": "def-public.Executor.inject.$2", "type": "Array", "label": "references", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [], @@ -1535,18 +1546,13 @@ "text": "ExpressionAstExpression" }, "; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ], "description": [], "children": [ { + "id": "def-public.Executor.extract.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -1591,6 +1597,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.telemetry.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -1610,6 +1617,7 @@ } }, { + "id": "def-public.Executor.telemetry.$2", "type": "Object", "label": "telemetryData", "isRequired": true, @@ -1655,6 +1663,7 @@ "description": [], "children": [ { + "id": "def-public.Executor.migrate.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -1674,6 +1683,7 @@ } }, { + "id": "def-public.Executor.migrate.$2", "type": "string", "label": "version", "isRequired": true, @@ -1920,13 +1930,7 @@ "text": "ExpressionAstArgument" }, "[]>; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ] }, @@ -1950,13 +1954,7 @@ "text": "ExpressionAstArgument" }, "[]>, references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => Record false,\n }", "isRequired": true, "signature": [ - { - "pluginId": "expressions", - "scope": "public", - "docId": "kibExpressionsPluginApi", - "section": "def-public.ExpressionRenderHandlerParams", - "text": "ExpressionRenderHandlerParams" - } + "ExpressionRenderHandlerParams" ], "description": [], "source": { @@ -2718,6 +2720,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionRenderHandler.render.$1", "type": "Any", "label": "value", "isRequired": true, @@ -2731,6 +2734,7 @@ } }, { + "id": "def-public.ExpressionRenderHandler.render.$2", "type": "Any", "label": "uiState", "isRequired": true, @@ -2793,6 +2797,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionRenderHandler.handleRenderError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -2867,6 +2872,7 @@ "description": [], "children": [ { + "id": "def-public.ExpressionsInspectorAdapter.logAST.$1", "type": "Any", "label": "ast", "isRequired": true, @@ -2959,6 +2965,7 @@ "description": [], "children": [ { + "id": "def-public.ExpressionsPublicPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -3012,6 +3019,7 @@ "description": [], "children": [ { + "id": "def-public.ExpressionsPublicPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -3064,6 +3072,7 @@ "description": [], "children": [ { + "id": "def-public.ExpressionsPublicPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -3164,6 +3173,7 @@ "description": [], "children": [ { + "id": "def-public.ExpressionsPublicPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -3217,6 +3227,7 @@ "description": [], "children": [ { + "id": "def-public.ExpressionsPublicPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -3269,6 +3280,7 @@ "description": [], "children": [ { + "id": "def-public.ExpressionsPublicPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -3404,6 +3416,7 @@ "description": [], "children": [ { + "id": "def-public.ExpressionsService.Unnamed.$1", "type": "Object", "label": "{\n executor = Executor.createWithDefaults(),\n renderers = new ExpressionRendererRegistry(),\n }", "isRequired": true, @@ -3435,6 +3448,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.registerFunction.$1", "type": "CompoundType", "label": "functionDefinition", "isRequired": true, @@ -3498,6 +3512,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.registerType.$1", "type": "CompoundType", "label": "typeDefinition", "isRequired": true, @@ -3559,6 +3574,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.registerRenderer.$1", "type": "CompoundType", "label": "definition", "isRequired": true, @@ -3620,6 +3636,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.run.$1", "type": "CompoundType", "label": "ast", "isRequired": true, @@ -3640,6 +3657,7 @@ } }, { + "id": "def-public.ExpressionsService.run.$2", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -3653,6 +3671,7 @@ } }, { + "id": "def-public.ExpressionsService.run.$3", "type": "Object", "label": "params", "isRequired": false, @@ -3706,6 +3725,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.getFunction.$1", "type": "string", "label": "name", "isRequired": true, @@ -3770,6 +3790,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.getRenderer.$1", "type": "string", "label": "name", "isRequired": true, @@ -3834,6 +3855,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.getType.$1", "type": "string", "label": "name", "isRequired": true, @@ -3959,6 +3981,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.telemetry.$1", "type": "Object", "label": "state", "isRequired": true, @@ -3978,6 +4001,7 @@ } }, { + "id": "def-public.ExpressionsService.telemetry.$2", "type": "Object", "label": "telemetryData", "isRequired": true, @@ -4018,6 +4042,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.extract.$1", "type": "Object", "label": "state", "isRequired": true, @@ -4055,13 +4080,7 @@ "text": "ExpressionAstExpression" }, "; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ], "description": [ @@ -4082,6 +4101,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.inject.$1", "type": "Object", "label": "state", "isRequired": true, @@ -4101,17 +4121,12 @@ } }, { + "id": "def-public.ExpressionsService.inject.$2", "type": "Array", "label": "references", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [], @@ -4131,13 +4146,7 @@ "text": "ExpressionAstExpression" }, ", references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => ", { "pluginId": "expressions", @@ -4165,6 +4174,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionsService.migrate.$1", "type": "Object", "label": "state", "isRequired": true, @@ -4184,6 +4194,7 @@ } }, { + "id": "def-public.ExpressionsService.migrate.$2", "type": "string", "label": "version", "isRequired": true, @@ -4403,6 +4414,7 @@ "description": [], "children": [ { + "id": "def-public.ExpressionType.Unnamed.$1", "type": "Object", "label": "definition", "isRequired": true, @@ -4434,6 +4446,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionType.getToFn.$1", "type": "string", "label": "typeName", "isRequired": true, @@ -4472,6 +4485,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionType.getFromFn.$1", "type": "string", "label": "typeName", "isRequired": true, @@ -4510,6 +4524,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionType.castsTo.$1", "type": "Any", "label": "value", "isRequired": true, @@ -4540,6 +4555,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionType.castsFrom.$1", "type": "Any", "label": "value", "isRequired": true, @@ -4570,6 +4586,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionType.to.$1", "type": "Any", "label": "value", "isRequired": true, @@ -4583,6 +4600,7 @@ } }, { + "id": "def-public.ExpressionType.to.$2", "type": "string", "label": "toTypeName", "isRequired": true, @@ -4596,6 +4614,7 @@ } }, { + "id": "def-public.ExpressionType.to.$3", "type": "Object", "label": "types", "isRequired": true, @@ -4642,6 +4661,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExpressionType.from.$1", "type": "Any", "label": "value", "isRequired": true, @@ -4655,6 +4675,7 @@ } }, { + "id": "def-public.ExpressionType.from.$2", "type": "Object", "label": "types", "isRequired": true, @@ -4746,6 +4767,7 @@ "description": [], "children": [ { + "id": "def-public.FunctionsRegistry.Unnamed.$1", "type": "Object", "label": "executor", "isRequired": true, @@ -4799,6 +4821,7 @@ "description": [], "children": [ { + "id": "def-public.FunctionsRegistry.register.$1", "type": "CompoundType", "label": "functionDefinition", "isRequired": true, @@ -4852,6 +4875,7 @@ "description": [], "children": [ { + "id": "def-public.FunctionsRegistry.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -4963,6 +4987,7 @@ "description": [], "children": [ { + "id": "def-public.TablesAdapter.logDatatable.$1", "type": "string", "label": "name", "isRequired": true, @@ -4976,6 +5001,7 @@ } }, { + "id": "def-public.TablesAdapter.logDatatable.$2", "type": "Object", "label": "datatable", "isRequired": true, @@ -5074,6 +5100,7 @@ "description": [], "children": [ { + "id": "def-public.TypesRegistry.Unnamed.$1", "type": "Object", "label": "executor", "isRequired": true, @@ -5127,6 +5154,7 @@ "description": [], "children": [ { + "id": "def-public.TypesRegistry.register.$1", "type": "CompoundType", "label": "typeDefinition", "isRequired": true, @@ -5180,6 +5208,7 @@ "description": [], "children": [ { + "id": "def-public.TypesRegistry.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -5300,6 +5329,7 @@ ], "children": [ { + "id": "def-public.buildExpression.$1", "type": "CompoundType", "label": "initialState", "isRequired": false, @@ -5395,6 +5425,7 @@ ], "children": [ { + "id": "def-public.buildExpressionFunction.$1", "type": "Uncategorized", "label": "fnName", "isRequired": true, @@ -5417,6 +5448,7 @@ } }, { + "id": "def-public.buildExpressionFunction.$2", "type": "Object", "label": "initialArgs", "isRequired": true, @@ -5478,6 +5510,7 @@ "description": [], "children": [ { + "id": "def-public.format.$1", "type": "Uncategorized", "label": "ast", "isRequired": true, @@ -5491,6 +5524,7 @@ } }, { + "id": "def-public.format.$2", "type": "Uncategorized", "label": "type", "isRequired": true, @@ -5540,6 +5574,7 @@ ], "children": [ { + "id": "def-public.formatExpression.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -5581,6 +5616,7 @@ ], "children": [ { + "id": "def-public.isExpressionAstBuilder.$1", "type": "Any", "label": "val", "isRequired": true, @@ -5633,6 +5669,7 @@ "description": [], "children": [ { + "id": "def-public.parse.$1", "type": "Uncategorized", "label": "expression", "isRequired": true, @@ -5646,6 +5683,7 @@ } }, { + "id": "def-public.parse.$2", "type": "Uncategorized", "label": "startRule", "isRequired": true, @@ -5686,6 +5724,7 @@ ], "children": [ { + "id": "def-public.parseExpression.$1", "type": "string", "label": "expression", "isRequired": true, @@ -5714,6 +5753,7 @@ "type": "Function", "children": [ { + "id": "def-public.ReactExpressionRenderer.$1", "type": "Object", "label": "{\n className,\n dataAttrs,\n padding,\n renderError,\n expression,\n onEvent,\n onData$,\n reload$,\n debounce,\n ...expressionLoaderOptions\n}", "isRequired": true, @@ -6713,13 +6753,7 @@ "lineNumber": 25 }, "signature": [ - { - "pluginId": "expressions", - "scope": "public", - "docId": "kibExpressionsPluginApi", - "section": "def-public.ExpressionInterpreter", - "text": "ExpressionInterpreter" - } + "ExpressionInterpreter" ] } ], @@ -6910,6 +6944,7 @@ ], "children": [ { + "id": "def-public.ExpressionFunctionDefinition.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -6925,6 +6960,7 @@ } }, { + "id": "def-public.ExpressionFunctionDefinition.fn.$2", "type": "Uncategorized", "label": "args", "isRequired": true, @@ -6940,6 +6976,7 @@ } }, { + "id": "def-public.ExpressionFunctionDefinition.fn.$3", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -7872,13 +7909,7 @@ "lineNumber": 36 }, "signature": [ - { - "pluginId": "expressions", - "scope": "common", - "docId": "kibExpressionsPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined" ] }, @@ -8012,13 +8043,7 @@ "lineNumber": 46 }, "signature": [ - { - "pluginId": "expressions", - "scope": "public", - "docId": "kibExpressionsPluginApi", - "section": "def-public.RenderErrorHandlerFnType", - "text": "RenderErrorHandlerFnType" - }, + "RenderErrorHandlerFnType", " | undefined" ] }, @@ -8271,6 +8296,7 @@ "description": [], "children": [ { + "id": "def-public.IRegistry.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -9526,13 +9552,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "expressions", - "scope": "public", - "docId": "kibExpressionsPluginApi", - "section": "def-public.ExpressionLoader", - "text": "ExpressionLoader" - } + "ExpressionLoader" ] }, { @@ -9567,13 +9587,7 @@ "lineNumber": 27 }, "signature": [ - { - "pluginId": "expressions", - "scope": "public", - "docId": "kibExpressionsPluginApi", - "section": "def-public.IExpressionLoader", - "text": "IExpressionLoader" - } + "IExpressionLoader" ] }, { @@ -9610,13 +9624,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "expressions", - "scope": "public", - "docId": "kibExpressionsPluginApi", - "section": "def-public.render", - "text": "render" - } + "render" ] } ], @@ -9731,13 +9739,7 @@ "text": "ExecutionContext" }, "" ] }, @@ -9837,6 +9839,7 @@ "description": [], "children": [ { + "id": "def-server.Execution.Unnamed.$1", "type": "Object", "label": "execution", "isRequired": true, @@ -9893,6 +9896,7 @@ ], "children": [ { + "id": "def-server.Execution.start.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -9931,6 +9935,7 @@ "description": [], "children": [ { + "id": "def-server.Execution.invokeChain.$1", "type": "Array", "label": "chainArr", "isRequired": true, @@ -9951,6 +9956,7 @@ } }, { + "id": "def-server.Execution.invokeChain.$2", "type": "Unknown", "label": "input", "isRequired": true, @@ -9989,6 +9995,7 @@ "description": [], "children": [ { + "id": "def-server.Execution.invokeFunction.$1", "type": "Object", "label": "fn", "isRequired": true, @@ -10008,6 +10015,7 @@ } }, { + "id": "def-server.Execution.invokeFunction.$2", "type": "Unknown", "label": "input", "isRequired": true, @@ -10021,6 +10029,7 @@ } }, { + "id": "def-server.Execution.invokeFunction.$3", "type": "Object", "label": "args", "isRequired": true, @@ -10051,6 +10060,7 @@ "description": [], "children": [ { + "id": "def-server.Execution.cast.$1", "type": "Any", "label": "value", "isRequired": true, @@ -10064,6 +10074,7 @@ } }, { + "id": "def-server.Execution.cast.$2", "type": "Array", "label": "toTypeNames", "isRequired": false, @@ -10102,6 +10113,7 @@ "description": [], "children": [ { + "id": "def-server.Execution.resolveArgs.$1", "type": "Object", "label": "fnDef", "isRequired": true, @@ -10121,6 +10133,7 @@ } }, { + "id": "def-server.Execution.resolveArgs.$2", "type": "Unknown", "label": "input", "isRequired": true, @@ -10134,6 +10147,7 @@ } }, { + "id": "def-server.Execution.resolveArgs.$3", "type": "Any", "label": "argAsts", "isRequired": true, @@ -10172,6 +10186,7 @@ "description": [], "children": [ { + "id": "def-server.Execution.interpret.$1", "type": "CompoundType", "label": "ast", "isRequired": true, @@ -10191,6 +10206,7 @@ } }, { + "id": "def-server.Execution.interpret.$2", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -10269,6 +10285,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.createWithDefaults.$1", "type": "Object", "label": "state", "isRequired": false, @@ -10371,6 +10388,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.Unnamed.$1", "type": "Object", "label": "state", "isRequired": false, @@ -10424,6 +10442,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.registerFunction.$1", "type": "CompoundType", "label": "functionDefinition", "isRequired": true, @@ -10477,6 +10496,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.getFunction.$1", "type": "string", "label": "name", "isRequired": true, @@ -10547,6 +10567,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.registerType.$1", "type": "CompoundType", "label": "typeDefinition", "isRequired": true, @@ -10600,6 +10621,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.getType.$1", "type": "string", "label": "name", "isRequired": true, @@ -10654,6 +10676,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.extendContext.$1", "type": "Object", "label": "extraContext", "isRequired": true, @@ -10716,6 +10739,7 @@ ], "children": [ { + "id": "def-server.Executor.run.$1", "type": "CompoundType", "label": "ast", "isRequired": true, @@ -10738,6 +10762,7 @@ } }, { + "id": "def-server.Executor.run.$2", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -10753,6 +10778,7 @@ } }, { + "id": "def-server.Executor.run.$3", "type": "Object", "label": "params", "isRequired": true, @@ -10821,6 +10847,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.createExecution.$1", "type": "CompoundType", "label": "ast", "isRequired": true, @@ -10841,6 +10868,7 @@ } }, { + "id": "def-server.Executor.createExecution.$2", "type": "Object", "label": "params", "isRequired": true, @@ -10881,13 +10909,7 @@ "text": "ExpressionAstExpression" }, ", references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => ", { "pluginId": "expressions", @@ -10900,6 +10922,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.inject.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -10919,17 +10942,12 @@ } }, { + "id": "def-server.Executor.inject.$2", "type": "Array", "label": "references", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [], @@ -10968,18 +10986,13 @@ "text": "ExpressionAstExpression" }, "; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ], "description": [], "children": [ { + "id": "def-server.Executor.extract.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -11024,6 +11037,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.telemetry.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -11043,6 +11057,7 @@ } }, { + "id": "def-server.Executor.telemetry.$2", "type": "Object", "label": "telemetryData", "isRequired": true, @@ -11088,6 +11103,7 @@ "description": [], "children": [ { + "id": "def-server.Executor.migrate.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -11107,6 +11123,7 @@ } }, { + "id": "def-server.Executor.migrate.$2", "type": "string", "label": "version", "isRequired": true, @@ -11353,13 +11370,7 @@ "text": "ExpressionAstArgument" }, "[]>; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ] }, @@ -11383,13 +11394,7 @@ "text": "ExpressionAstArgument" }, "[]>, references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => Record" ] }, @@ -16962,6 +17005,7 @@ "description": [], "children": [ { + "id": "def-common.Execution.Unnamed.$1", "type": "Object", "label": "execution", "isRequired": true, @@ -17018,6 +17062,7 @@ ], "children": [ { + "id": "def-common.Execution.start.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -17056,6 +17101,7 @@ "description": [], "children": [ { + "id": "def-common.Execution.invokeChain.$1", "type": "Array", "label": "chainArr", "isRequired": true, @@ -17076,6 +17122,7 @@ } }, { + "id": "def-common.Execution.invokeChain.$2", "type": "Unknown", "label": "input", "isRequired": true, @@ -17114,6 +17161,7 @@ "description": [], "children": [ { + "id": "def-common.Execution.invokeFunction.$1", "type": "Object", "label": "fn", "isRequired": true, @@ -17133,6 +17181,7 @@ } }, { + "id": "def-common.Execution.invokeFunction.$2", "type": "Unknown", "label": "input", "isRequired": true, @@ -17146,6 +17195,7 @@ } }, { + "id": "def-common.Execution.invokeFunction.$3", "type": "Object", "label": "args", "isRequired": true, @@ -17176,6 +17226,7 @@ "description": [], "children": [ { + "id": "def-common.Execution.cast.$1", "type": "Any", "label": "value", "isRequired": true, @@ -17189,6 +17240,7 @@ } }, { + "id": "def-common.Execution.cast.$2", "type": "Array", "label": "toTypeNames", "isRequired": false, @@ -17227,6 +17279,7 @@ "description": [], "children": [ { + "id": "def-common.Execution.resolveArgs.$1", "type": "Object", "label": "fnDef", "isRequired": true, @@ -17246,6 +17299,7 @@ } }, { + "id": "def-common.Execution.resolveArgs.$2", "type": "Unknown", "label": "input", "isRequired": true, @@ -17259,6 +17313,7 @@ } }, { + "id": "def-common.Execution.resolveArgs.$3", "type": "Any", "label": "argAsts", "isRequired": true, @@ -17297,6 +17352,7 @@ "description": [], "children": [ { + "id": "def-common.Execution.interpret.$1", "type": "CompoundType", "label": "ast", "isRequired": true, @@ -17316,6 +17372,7 @@ } }, { + "id": "def-common.Execution.interpret.$2", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -17383,6 +17440,7 @@ "description": [], "children": [ { + "id": "def-common.ExecutionContract.Unnamed.$1", "type": "Object", "label": "execution", "isRequired": true, @@ -17589,6 +17647,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.createWithDefaults.$1", "type": "Object", "label": "state", "isRequired": false, @@ -17691,6 +17750,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.Unnamed.$1", "type": "Object", "label": "state", "isRequired": false, @@ -17744,6 +17804,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.registerFunction.$1", "type": "CompoundType", "label": "functionDefinition", "isRequired": true, @@ -17797,6 +17858,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.getFunction.$1", "type": "string", "label": "name", "isRequired": true, @@ -17867,6 +17929,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.registerType.$1", "type": "CompoundType", "label": "typeDefinition", "isRequired": true, @@ -17920,6 +17983,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.getType.$1", "type": "string", "label": "name", "isRequired": true, @@ -17974,6 +18038,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.extendContext.$1", "type": "Object", "label": "extraContext", "isRequired": true, @@ -18036,6 +18101,7 @@ ], "children": [ { + "id": "def-common.Executor.run.$1", "type": "CompoundType", "label": "ast", "isRequired": true, @@ -18058,6 +18124,7 @@ } }, { + "id": "def-common.Executor.run.$2", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -18073,6 +18140,7 @@ } }, { + "id": "def-common.Executor.run.$3", "type": "Object", "label": "params", "isRequired": true, @@ -18141,6 +18209,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.createExecution.$1", "type": "CompoundType", "label": "ast", "isRequired": true, @@ -18161,6 +18230,7 @@ } }, { + "id": "def-common.Executor.createExecution.$2", "type": "Object", "label": "params", "isRequired": true, @@ -18201,13 +18271,7 @@ "text": "ExpressionAstExpression" }, ", references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => ", { "pluginId": "expressions", @@ -18220,6 +18284,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.inject.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -18239,17 +18304,12 @@ } }, { + "id": "def-common.Executor.inject.$2", "type": "Array", "label": "references", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [], @@ -18288,18 +18348,13 @@ "text": "ExpressionAstExpression" }, "; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ], "description": [], "children": [ { + "id": "def-common.Executor.extract.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -18344,6 +18399,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.telemetry.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -18363,6 +18419,7 @@ } }, { + "id": "def-common.Executor.telemetry.$2", "type": "Object", "label": "telemetryData", "isRequired": true, @@ -18408,6 +18465,7 @@ "description": [], "children": [ { + "id": "def-common.Executor.migrate.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -18427,6 +18485,7 @@ } }, { + "id": "def-common.Executor.migrate.$2", "type": "string", "label": "version", "isRequired": true, @@ -18673,13 +18732,7 @@ "text": "ExpressionAstArgument" }, "[]>; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ] }, @@ -18703,13 +18756,7 @@ "text": "ExpressionAstArgument" }, "[]>, references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => Record ", { "pluginId": "expressions", @@ -20273,6 +20326,7 @@ "type": "Function", "children": [ { + "id": "def-common.ExpressionsService.migrate.$1", "type": "Object", "label": "state", "isRequired": true, @@ -20292,6 +20346,7 @@ } }, { + "id": "def-common.ExpressionsService.migrate.$2", "type": "string", "label": "version", "isRequired": true, @@ -20511,6 +20566,7 @@ "description": [], "children": [ { + "id": "def-common.ExpressionType.Unnamed.$1", "type": "Object", "label": "definition", "isRequired": true, @@ -20542,6 +20598,7 @@ "type": "Function", "children": [ { + "id": "def-common.ExpressionType.getToFn.$1", "type": "string", "label": "typeName", "isRequired": true, @@ -20580,6 +20637,7 @@ "type": "Function", "children": [ { + "id": "def-common.ExpressionType.getFromFn.$1", "type": "string", "label": "typeName", "isRequired": true, @@ -20618,6 +20676,7 @@ "type": "Function", "children": [ { + "id": "def-common.ExpressionType.castsTo.$1", "type": "Any", "label": "value", "isRequired": true, @@ -20648,6 +20707,7 @@ "type": "Function", "children": [ { + "id": "def-common.ExpressionType.castsFrom.$1", "type": "Any", "label": "value", "isRequired": true, @@ -20678,6 +20738,7 @@ "type": "Function", "children": [ { + "id": "def-common.ExpressionType.to.$1", "type": "Any", "label": "value", "isRequired": true, @@ -20691,6 +20752,7 @@ } }, { + "id": "def-common.ExpressionType.to.$2", "type": "string", "label": "toTypeName", "isRequired": true, @@ -20704,6 +20766,7 @@ } }, { + "id": "def-common.ExpressionType.to.$3", "type": "Object", "label": "types", "isRequired": true, @@ -20750,6 +20813,7 @@ "type": "Function", "children": [ { + "id": "def-common.ExpressionType.from.$1", "type": "Any", "label": "value", "isRequired": true, @@ -20763,6 +20827,7 @@ } }, { + "id": "def-common.ExpressionType.from.$2", "type": "Object", "label": "types", "isRequired": true, @@ -20854,6 +20919,7 @@ "description": [], "children": [ { + "id": "def-common.FunctionsRegistry.Unnamed.$1", "type": "Object", "label": "executor", "isRequired": true, @@ -20907,6 +20973,7 @@ "description": [], "children": [ { + "id": "def-common.FunctionsRegistry.register.$1", "type": "CompoundType", "label": "functionDefinition", "isRequired": true, @@ -20960,6 +21027,7 @@ "description": [], "children": [ { + "id": "def-common.FunctionsRegistry.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -21071,6 +21139,7 @@ "description": [], "children": [ { + "id": "def-common.TablesAdapter.logDatatable.$1", "type": "string", "label": "name", "isRequired": true, @@ -21084,6 +21153,7 @@ } }, { + "id": "def-common.TablesAdapter.logDatatable.$2", "type": "Object", "label": "datatable", "isRequired": true, @@ -21182,6 +21252,7 @@ "description": [], "children": [ { + "id": "def-common.TypesRegistry.Unnamed.$1", "type": "Object", "label": "executor", "isRequired": true, @@ -21235,6 +21306,7 @@ "description": [], "children": [ { + "id": "def-common.TypesRegistry.register.$1", "type": "CompoundType", "label": "typeDefinition", "isRequired": true, @@ -21288,6 +21360,7 @@ "description": [], "children": [ { + "id": "def-common.TypesRegistry.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -21408,6 +21481,7 @@ ], "children": [ { + "id": "def-common.buildExpression.$1", "type": "CompoundType", "label": "initialState", "isRequired": false, @@ -21503,6 +21577,7 @@ ], "children": [ { + "id": "def-common.buildExpressionFunction.$1", "type": "Uncategorized", "label": "fnName", "isRequired": true, @@ -21525,6 +21600,7 @@ } }, { + "id": "def-common.buildExpressionFunction.$2", "type": "Object", "label": "initialArgs", "isRequired": true, @@ -21596,6 +21672,7 @@ ], "children": [ { + "id": "def-common.buildResultColumns.$1", "type": "Object", "label": "input", "isRequired": true, @@ -21617,6 +21694,7 @@ } }, { + "id": "def-common.buildResultColumns.$2", "type": "string", "label": "outputColumnId", "isRequired": true, @@ -21632,6 +21710,7 @@ } }, { + "id": "def-common.buildResultColumns.$3", "type": "string", "label": "inputColumnId", "isRequired": true, @@ -21647,6 +21726,7 @@ } }, { + "id": "def-common.buildResultColumns.$4", "type": "string", "label": "outputColumnName", "isRequired": false, @@ -21662,7 +21742,7 @@ } }, { - "id": "def-common.buildResultColumns.options", + "id": "def-common.buildResultColumns.$5.options", "type": "Object", "label": "options", "tags": [], @@ -21670,7 +21750,7 @@ "children": [ { "tags": [], - "id": "def-common.buildResultColumns.options.allowColumnOverwrite", + "id": "def-common.buildResultColumns.$5.options.allowColumnOverwrite", "type": "boolean", "label": "allowColumnOverwrite", "description": [], @@ -21699,6 +21779,7 @@ "type": "Function", "children": [ { + "id": "def-common.createError.$1", "type": "CompoundType", "label": "err", "isRequired": true, @@ -21769,6 +21850,7 @@ "type": "Function", "children": [ { + "id": "def-common.createExecutionContainer.$1", "type": "Object", "label": "state", "isRequired": true, @@ -21823,6 +21905,7 @@ "type": "Function", "children": [ { + "id": "def-common.createExecutorContainer.$1", "type": "Object", "label": "state", "isRequired": true, @@ -21925,6 +22008,7 @@ "description": [], "children": [ { + "id": "def-common.format.$1", "type": "Uncategorized", "label": "ast", "isRequired": true, @@ -21938,6 +22022,7 @@ } }, { + "id": "def-common.format.$2", "type": "Uncategorized", "label": "type", "isRequired": true, @@ -21987,6 +22072,7 @@ ], "children": [ { + "id": "def-common.formatExpression.$1", "type": "Object", "label": "ast", "isRequired": true, @@ -22028,6 +22114,7 @@ ], "children": [ { + "id": "def-common.getBucketIdentifier.$1", "type": "Object", "label": "row", "isRequired": true, @@ -22041,6 +22128,7 @@ } }, { + "id": "def-common.getBucketIdentifier.$2", "type": "Array", "label": "groupColumns", "isRequired": false, @@ -22074,6 +22162,7 @@ ], "children": [ { + "id": "def-common.getByAlias.$1", "type": "CompoundType", "label": "node", "isRequired": true, @@ -22087,6 +22176,7 @@ } }, { + "id": "def-common.getByAlias.$2", "type": "string", "label": "nodeName", "isRequired": true, @@ -22118,6 +22208,7 @@ "description": [], "children": [ { + "id": "def-common.getType.$1", "type": "Any", "label": "node", "isRequired": true, @@ -22144,6 +22235,7 @@ "type": "Function", "children": [ { + "id": "def-common.isDatatable.$1", "type": "Unknown", "label": "datatable", "isRequired": true, @@ -22191,6 +22283,7 @@ ], "children": [ { + "id": "def-common.isExpressionAstBuilder.$1", "type": "Any", "label": "val", "isRequired": true, @@ -22223,6 +22316,7 @@ "type": "Function", "children": [ { + "id": "def-common.isExpressionValueError.$1", "type": "Any", "label": "value", "isRequired": true, @@ -22298,6 +22392,7 @@ "description": [], "children": [ { + "id": "def-common.parse.$1", "type": "Uncategorized", "label": "expression", "isRequired": true, @@ -22311,6 +22406,7 @@ } }, { + "id": "def-common.parse.$2", "type": "Uncategorized", "label": "startRule", "isRequired": true, @@ -22351,6 +22447,7 @@ ], "children": [ { + "id": "def-common.parseExpression.$1", "type": "string", "label": "expression", "isRequired": true, @@ -22379,6 +22476,7 @@ "type": "Function", "children": [ { + "id": "def-common.serializeProvider.$1", "type": "Object", "label": "types", "isRequired": true, @@ -22439,6 +22537,7 @@ "description": [], "children": [ { + "id": "def-common.unboxExpressionValue.$1", "type": "CompoundType", "label": "{\n type,\n ...value\n}", "isRequired": true, @@ -23099,13 +23198,7 @@ "lineNumber": 83 }, "signature": [ - { - "pluginId": "expressions", - "scope": "common", - "docId": "kibExpressionsPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", " | undefined" ] } @@ -24745,6 +24838,7 @@ ], "children": [ { + "id": "def-common.ExpressionFunctionDefinition.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -24760,6 +24854,7 @@ } }, { + "id": "def-common.ExpressionFunctionDefinition.fn.$2", "type": "Uncategorized", "label": "args", "isRequired": true, @@ -24775,6 +24870,7 @@ } }, { + "id": "def-common.ExpressionFunctionDefinition.fn.$3", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -25832,6 +25928,7 @@ "description": [], "children": [ { + "id": "def-common.IRegistry.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -27580,6 +27677,7 @@ "type": "Function", "children": [ { + "id": "def-common.boolean.from.number.$1", "type": "Any", "label": "n", "isRequired": true, @@ -27610,6 +27708,7 @@ "type": "Function", "children": [ { + "id": "def-common.boolean.from.string.$1", "type": "Any", "label": "s", "isRequired": true, @@ -27653,6 +27752,7 @@ "type": "Function", "children": [ { + "id": "def-common.boolean.to.render.$1", "type": "boolean", "label": "value", "isRequired": true, @@ -27691,6 +27791,7 @@ "type": "Function", "children": [ { + "id": "def-common.boolean.to.datatable.$1", "type": "boolean", "label": "value", "isRequired": true, @@ -27817,6 +27918,7 @@ "type": "Function", "children": [ { + "id": "def-common.clog.fn.$1", "type": "Unknown", "label": "input", "isRequired": true, @@ -28177,6 +28279,7 @@ "description": [], "children": [ { + "id": "def-common.cumulativeSum.fn.$1", "type": "Object", "label": "input", "isRequired": true, @@ -28196,6 +28299,7 @@ } }, { + "id": "def-common.cumulativeSum.fn.$2", "type": "Object", "label": "{ by, inputColumnId, outputColumnId, outputColumnName }", "isRequired": true, @@ -28257,6 +28361,7 @@ "type": "Function", "children": [ { + "id": "def-common.datatable.validate.$1", "type": "Any", "label": "table", "isRequired": true, @@ -28287,6 +28392,7 @@ "type": "Function", "children": [ { + "id": "def-common.datatable.serialize.$1", "type": "Object", "label": "table", "isRequired": true, @@ -28339,6 +28445,7 @@ "type": "Function", "children": [ { + "id": "def-common.datatable.deserialize.$1", "type": "Object", "label": "table", "isRequired": true, @@ -28412,6 +28519,7 @@ "type": "Function", "children": [ { + "id": "def-common.datatable.from.pointseries.$1", "type": "CompoundType", "label": "value", "isRequired": true, @@ -28486,6 +28594,7 @@ "type": "Function", "children": [ { + "id": "def-common.datatable.to.render.$1", "type": "Object", "label": "table", "isRequired": true, @@ -28538,6 +28647,7 @@ "type": "Function", "children": [ { + "id": "def-common.datatable.to.pointseries.$1", "type": "Object", "label": "table", "isRequired": true, @@ -28986,6 +29096,7 @@ "description": [], "children": [ { + "id": "def-common.derivative.fn.$1", "type": "Object", "label": "input", "isRequired": true, @@ -29005,6 +29116,7 @@ } }, { + "id": "def-common.derivative.fn.$2", "type": "Object", "label": "{ by, inputColumnId, outputColumnId, outputColumnName }", "isRequired": true, @@ -29086,6 +29198,7 @@ "type": "Function", "children": [ { + "id": "def-common.error.to.render.$1", "type": "CompoundType", "label": "input", "isRequired": true, @@ -29200,6 +29313,7 @@ "type": "Function", "children": [ { + "id": "def-common.executionPureTransitions.start.$1", "type": "Object", "label": "state", "isRequired": true, @@ -29269,6 +29383,7 @@ "type": "Function", "children": [ { + "id": "def-common.executionPureTransitions.setResult.$1", "type": "Object", "label": "state", "isRequired": true, @@ -29338,6 +29453,7 @@ "type": "Function", "children": [ { + "id": "def-common.executionPureTransitions.setError.$1", "type": "Object", "label": "state", "isRequired": true, @@ -30034,6 +30150,7 @@ "type": "Function", "children": [ { + "id": "def-common.font.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -30047,6 +30164,7 @@ } }, { + "id": "def-common.font.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -30178,6 +30296,7 @@ "type": "Function", "children": [ { + "id": "def-common.image.to.render.$1", "type": "Object", "label": "input", "isRequired": true, @@ -30633,6 +30752,7 @@ "type": "Function", "children": [ { + "id": "def-common.mapColumn.fn.$1", "type": "Object", "label": "input", "isRequired": true, @@ -30652,6 +30772,7 @@ } }, { + "id": "def-common.mapColumn.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -30896,6 +31017,7 @@ "type": "Function", "children": [ { + "id": "def-common.math.fn.$1", "type": "CompoundType", "label": "input", "isRequired": true, @@ -30915,6 +31037,7 @@ } }, { + "id": "def-common.math.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -31346,6 +31469,7 @@ "description": [], "children": [ { + "id": "def-common.movingAverage.fn.$1", "type": "Object", "label": "input", "isRequired": true, @@ -31365,6 +31489,7 @@ } }, { + "id": "def-common.movingAverage.fn.$2", "type": "Object", "label": "{ by, inputColumnId, outputColumnId, outputColumnName, window }", "isRequired": true, @@ -31442,7 +31567,7 @@ "tags": [], "children": [ { - "id": "def-common.nullType.from.'*'", + "id": "def-common.nullType.from.", "type": "Function", "children": [], "signature": [ @@ -31519,6 +31644,7 @@ "type": "Function", "children": [ { + "id": "def-common.num.from.boolean.$1", "type": "Any", "label": "b", "isRequired": true, @@ -31549,6 +31675,7 @@ "type": "Function", "children": [ { + "id": "def-common.num.from.string.$1", "type": "Any", "label": "n", "isRequired": true, @@ -31575,10 +31702,11 @@ "returnComment": [] }, { - "id": "def-common.num.from.'*'", + "id": "def-common.num.from.", "type": "Function", "children": [ { + "id": "def-common.num.from..$1", "type": "Any", "label": "value", "isRequired": true, @@ -31622,6 +31750,7 @@ "type": "Function", "children": [ { + "id": "def-common.num.to.render.$1", "type": "CompoundType", "label": "{ value }", "isRequired": true, @@ -31675,6 +31804,7 @@ "type": "Function", "children": [ { + "id": "def-common.num.to.datatable.$1", "type": "CompoundType", "label": "{ value }", "isRequired": true, @@ -31784,6 +31914,7 @@ "type": "Function", "children": [ { + "id": "def-common.number.from.boolean.$1", "type": "Any", "label": "b", "isRequired": true, @@ -31814,6 +31945,7 @@ "type": "Function", "children": [ { + "id": "def-common.number.from.string.$1", "type": "Any", "label": "n", "isRequired": true, @@ -31857,6 +31989,7 @@ "type": "Function", "children": [ { + "id": "def-common.number.to.render.$1", "type": "number", "label": "value", "isRequired": true, @@ -31895,6 +32028,7 @@ "type": "Function", "children": [ { + "id": "def-common.number.to.datatable.$1", "type": "number", "label": "value", "isRequired": true, @@ -32047,6 +32181,7 @@ "type": "Function", "children": [ { + "id": "def-common.pointseries.to.render.$1", "type": "CompoundType", "label": "pseries", "isRequired": true, @@ -32075,6 +32210,7 @@ } }, { + "id": "def-common.pointseries.to.render.$2", "type": "Object", "label": "types", "isRequired": true, @@ -32159,6 +32295,7 @@ "type": "Function", "children": [ { + "id": "def-common.pureSelectors.getFunction.$1", "type": "Object", "label": "state", "isRequired": true, @@ -32211,6 +32348,7 @@ "type": "Function", "children": [ { + "id": "def-common.pureSelectors.getType.$1", "type": "Object", "label": "state", "isRequired": true, @@ -32263,6 +32401,7 @@ "type": "Function", "children": [ { + "id": "def-common.pureSelectors.getContext.$1", "type": "Object", "label": "{ context }", "isRequired": true, @@ -32322,6 +32461,7 @@ "type": "Function", "children": [ { + "id": "def-common.pureTransitions.addFunction.$1", "type": "Object", "label": "state", "isRequired": true, @@ -32391,6 +32531,7 @@ "type": "Function", "children": [ { + "id": "def-common.pureTransitions.addType.$1", "type": "Object", "label": "state", "isRequired": true, @@ -32460,6 +32601,7 @@ "type": "Function", "children": [ { + "id": "def-common.pureTransitions.extendContext.$1", "type": "Object", "label": "state", "isRequired": true, @@ -32590,6 +32732,7 @@ "type": "Function", "children": [ { + "id": "def-common.range.to.render.$1", "type": "Object", "label": "value", "isRequired": true, @@ -32679,10 +32822,11 @@ "tags": [], "children": [ { - "id": "def-common.render.from.'*'", + "id": "def-common.render.from.", "type": "Function", "children": [ { + "id": "def-common.render.from..$1", "type": "Uncategorized", "label": "v", "isRequired": true, @@ -32762,6 +32906,7 @@ "type": "Function", "children": [ { + "id": "def-common.shape.to.render.$1", "type": "CompoundType", "label": "input", "isRequired": true, @@ -32872,6 +33017,7 @@ "type": "Function", "children": [ { + "id": "def-common.string.from.boolean.$1", "type": "Any", "label": "b", "isRequired": true, @@ -32902,6 +33048,7 @@ "type": "Function", "children": [ { + "id": "def-common.string.from.number.$1", "type": "Any", "label": "n", "isRequired": true, @@ -32945,6 +33092,7 @@ "type": "Function", "children": [ { + "id": "def-common.string.to.render.$1", "type": "Uncategorized", "label": "text", "isRequired": true, @@ -32983,6 +33131,7 @@ "type": "Function", "children": [ { + "id": "def-common.string.to.datatable.$1", "type": "string", "label": "value", "isRequired": true, @@ -33255,6 +33404,7 @@ "type": "Function", "children": [ { + "id": "def-common.theme.fn.$1", "type": "Uncategorized", "label": "input", "isRequired": true, @@ -33268,6 +33418,7 @@ } }, { + "id": "def-common.theme.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -33281,6 +33432,7 @@ } }, { + "id": "def-common.theme.fn.$3", "type": "Object", "label": "handlers", "isRequired": true, @@ -33301,13 +33453,7 @@ "text": "Adapters" }, ", ", - { - "pluginId": "expressions", - "scope": "common", - "docId": "kibExpressionsPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", ">" ], "description": [], @@ -33335,13 +33481,7 @@ "text": "Adapters" }, ", ", - { - "pluginId": "expressions", - "scope": "common", - "docId": "kibExpressionsPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", ">) => any" ], "description": [], @@ -33493,18 +33633,13 @@ "text": "Adapters" }, ", ", - { - "pluginId": "expressions", - "scope": "common", - "docId": "kibExpressionsPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", ">) => any" ], "description": [], "children": [ { + "id": "def-common.variable.fn.$1", "type": "Unknown", "label": "input", "isRequired": true, @@ -33518,6 +33653,7 @@ } }, { + "id": "def-common.variable.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -33531,6 +33667,7 @@ } }, { + "id": "def-common.variable.fn.$3", "type": "Object", "label": "context", "isRequired": true, @@ -33551,13 +33688,7 @@ "text": "Adapters" }, ", ", - { - "pluginId": "expressions", - "scope": "common", - "docId": "kibExpressionsPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", ">" ], "description": [], @@ -33752,18 +33883,13 @@ "text": "Adapters" }, ", ", - { - "pluginId": "expressions", - "scope": "common", - "docId": "kibExpressionsPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", ">) => unknown" ], "description": [], "children": [ { + "id": "def-common.variableSet.fn.$1", "type": "Unknown", "label": "input", "isRequired": true, @@ -33777,6 +33903,7 @@ } }, { + "id": "def-common.variableSet.fn.$2", "type": "Object", "label": "args", "isRequired": true, @@ -33790,6 +33917,7 @@ } }, { + "id": "def-common.variableSet.fn.$3", "type": "Object", "label": "context", "isRequired": true, @@ -33810,13 +33938,7 @@ "text": "Adapters" }, ", ", - { - "pluginId": "expressions", - "scope": "common", - "docId": "kibExpressionsPluginApi", - "section": "def-common.SerializableState", - "text": "SerializableState" - }, + "SerializableState", ">" ], "description": [], diff --git a/api_docs/features.json b/api_docs/features.json index 967dd11ffca34..3755e99beb3b0 100644 --- a/api_docs/features.json +++ b/api_docs/features.json @@ -40,6 +40,7 @@ "description": [], "children": [ { + "id": "def-public.KibanaFeature.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -52,7 +53,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; ui: readonly string[]; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" ], "description": [], "source": { @@ -456,13 +457,7 @@ "lineNumber": 40 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.AppCategory", - "text": "AppCategory" - } + "AppCategory" ] }, { @@ -665,13 +660,7 @@ }, "signature": [ "{ description: string; privileges: readonly ", - { - "pluginId": "features", - "scope": "common", - "docId": "kibFeaturesPluginApi", - "section": "def-common.ReservedKibanaPrivilege", - "text": "ReservedKibanaPrivilege" - }, + "ReservedKibanaPrivilege", "[]; } | undefined" ] } @@ -755,7 +744,7 @@ "section": "def-common.FeatureKibanaPrivileges", "text": "FeatureKibanaPrivileges" }, - ", \"management\" | \"catalogue\" | \"ui\" | \"alerting\" | \"app\" | \"api\" | \"savedObject\">" + ", \"management\" | \"catalogue\" | \"alerting\" | \"ui\" | \"app\" | \"api\" | \"savedObject\">" ], "description": [ "\nConfiguration for a sub-feature privilege." @@ -891,6 +880,7 @@ "description": [], "children": [ { + "id": "def-server.ElasticsearchFeature.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -1058,6 +1048,7 @@ "description": [], "children": [ { + "id": "def-server.KibanaFeature.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -1070,7 +1061,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; ui: readonly string[]; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" ], "description": [], "source": { @@ -1646,13 +1637,7 @@ "lineNumber": 40 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.AppCategory", - "text": "AppCategory" - } + "AppCategory" ] }, { @@ -1855,13 +1840,7 @@ }, "signature": [ "{ description: string; privileges: readonly ", - { - "pluginId": "features", - "scope": "common", - "docId": "kibFeaturesPluginApi", - "section": "def-common.ReservedKibanaPrivilege", - "text": "ReservedKibanaPrivilege" - }, + "ReservedKibanaPrivilege", "[]; } | undefined" ] } @@ -1899,6 +1878,7 @@ "description": [], "children": [ { + "id": "def-server.PluginSetupContract.registerKibanaFeature.$1", "type": "Object", "label": "feature", "isRequired": true, @@ -1943,6 +1923,7 @@ "description": [], "children": [ { + "id": "def-server.PluginSetupContract.registerElasticsearchFeature.$1", "type": "Object", "label": "feature", "isRequired": true, @@ -2023,13 +2004,7 @@ "label": "getFeaturesUICapabilities", "signature": [ "() => ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.Capabilities", - "text": "Capabilities" - } + "Capabilities" ], "description": [], "children": [], @@ -2149,6 +2124,7 @@ "description": [], "children": [ { + "id": "def-common.ElasticsearchFeature.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -2316,6 +2292,7 @@ "description": [], "children": [ { + "id": "def-common.KibanaFeature.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -2328,7 +2305,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; ui: readonly string[]; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" ], "description": [], "source": { @@ -2550,6 +2527,7 @@ "description": [], "children": [ { + "id": "def-common.SubFeature.Unnamed.$1", "type": "Object", "label": "config", "isRequired": true, @@ -2562,7 +2540,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; ui: readonly string[]; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>" ], "description": [], "source": { @@ -2608,7 +2586,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; ui: readonly string[]; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]" ] }, { @@ -2624,7 +2602,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; ui: readonly string[]; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"read\" | \"all\" | \"none\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }" ], "description": [], "children": [], @@ -3013,13 +2991,7 @@ "lineNumber": 40 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.AppCategory", - "text": "AppCategory" - } + "AppCategory" ] }, { @@ -3222,13 +3194,7 @@ }, "signature": [ "{ description: string; privileges: readonly ", - { - "pluginId": "features", - "scope": "common", - "docId": "kibFeaturesPluginApi", - "section": "def-common.ReservedKibanaPrivilege", - "text": "ReservedKibanaPrivilege" - }, + "ReservedKibanaPrivilege", "[]; } | undefined" ] } @@ -3312,7 +3278,7 @@ "section": "def-common.FeatureKibanaPrivileges", "text": "FeatureKibanaPrivileges" }, - ", \"management\" | \"catalogue\" | \"ui\" | \"alerting\" | \"app\" | \"api\" | \"savedObject\">" + ", \"management\" | \"catalogue\" | \"alerting\" | \"ui\" | \"app\" | \"api\" | \"savedObject\">" ], "description": [ "\nConfiguration for a sub-feature privilege." diff --git a/api_docs/file_upload.json b/api_docs/file_upload.json index 6a624f87bfcd2..09b3b11040a69 100644 --- a/api_docs/file_upload.json +++ b/api_docs/file_upload.json @@ -19,7 +19,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 21 + "lineNumber": 26 }, "signature": [ { @@ -39,7 +39,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 22 + "lineNumber": 27 }, "signature": [ { @@ -55,7 +55,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 20 + "lineNumber": 25 }, "initialIsOpen": false }, @@ -145,13 +145,13 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 93 + "lineNumber": 100 } } ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 92 + "lineNumber": 99 }, "initialIsOpen": false }, @@ -170,7 +170,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "lineNumber": 14 + "lineNumber": 16 } }, { @@ -181,7 +181,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "lineNumber": 15 + "lineNumber": 17 }, "signature": [ "(geojsonFile: GeoJSON.FeatureCollection, name: string, previewCoverage: number) => void" @@ -195,7 +195,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "lineNumber": 16 + "lineNumber": 18 }, "signature": [ "() => void" @@ -209,7 +209,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "lineNumber": 17 + "lineNumber": 19 }, "signature": [ "(indexReady: boolean) => void" @@ -223,7 +223,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "lineNumber": 18 + "lineNumber": 20 }, "signature": [ "(results: { indexDataResp: ", @@ -253,7 +253,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "lineNumber": 22 + "lineNumber": 24 }, "signature": [ "() => void" @@ -262,7 +262,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "lineNumber": 13 + "lineNumber": 15 }, "initialIsOpen": false }, @@ -281,7 +281,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 26 + "lineNumber": 31 } }, { @@ -292,7 +292,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 27 + "lineNumber": 32 } }, { @@ -303,7 +303,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 28 + "lineNumber": 33 } }, { @@ -314,7 +314,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 29 + "lineNumber": 34 } }, { @@ -325,7 +325,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 30 + "lineNumber": 35 }, "signature": [ "{ [fieldName: string]: { count: number; cardinality: number; top_hits: { count: number; value: any; }[]; mean_value?: number | undefined; median_value?: number | undefined; max_value?: number | undefined; min_value?: number | undefined; earliest?: string | undefined; latest?: string | undefined; }; }" @@ -339,7 +339,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 43 + "lineNumber": 48 } }, { @@ -350,7 +350,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 44 + "lineNumber": 49 } }, { @@ -361,7 +361,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 45 + "lineNumber": 50 }, "signature": [ "{ properties: { [fieldName: string]: { type: ", @@ -414,7 +414,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 58 + "lineNumber": 63 } }, { @@ -425,7 +425,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 59 + "lineNumber": 64 } }, { @@ -436,7 +436,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 60 + "lineNumber": 65 } }, { @@ -447,7 +447,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 61 + "lineNumber": 66 } }, { @@ -458,7 +458,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 62 + "lineNumber": 67 }, "signature": [ "string[] | undefined" @@ -472,7 +472,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 63 + "lineNumber": 68 }, "signature": [ "string[] | undefined" @@ -486,7 +486,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 64 + "lineNumber": 69 }, "signature": [ "string | undefined" @@ -500,7 +500,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 65 + "lineNumber": 70 }, "signature": [ "string | undefined" @@ -514,7 +514,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 66 + "lineNumber": 71 }, "signature": [ "string | undefined" @@ -528,7 +528,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 67 + "lineNumber": 72 }, "signature": [ "string[] | undefined" @@ -542,7 +542,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 68 + "lineNumber": 73 }, "signature": [ "string[] | undefined" @@ -556,7 +556,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 69 + "lineNumber": 74 }, "signature": [ "string | undefined" @@ -570,7 +570,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 70 + "lineNumber": 75 }, "signature": [ "boolean | undefined" @@ -579,7 +579,32 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 25 + "lineNumber": 30 + }, + "initialIsOpen": false + }, + { + "id": "def-public.HasImportPermission", + "type": "Interface", + "label": "HasImportPermission", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-public.HasImportPermission.hasImportPermission", + "type": "boolean", + "label": "hasImportPermission", + "description": [], + "source": { + "path": "x-pack/plugins/file_upload/common/types.ts", + "lineNumber": 12 + } + } + ], + "source": { + "path": "x-pack/plugins/file_upload/common/types.ts", + "lineNumber": 11 }, "initialIsOpen": false }, @@ -600,6 +625,7 @@ "description": [], "children": [ { + "id": "def-public.IImporter.read.$1", "type": "Object", "label": "data", "isRequired": true, @@ -662,6 +688,7 @@ "description": [], "children": [ { + "id": "def-public.IImporter.initializeImport.$1", "type": "string", "label": "index", "isRequired": true, @@ -675,6 +702,7 @@ } }, { + "id": "def-public.IImporter.initializeImport.$2", "type": "Object", "label": "settings", "isRequired": true, @@ -694,6 +722,7 @@ } }, { + "id": "def-public.IImporter.initializeImport.$3", "type": "Object", "label": "mappings", "isRequired": true, @@ -713,6 +742,7 @@ } }, { + "id": "def-public.IImporter.initializeImport.$4", "type": "Object", "label": "pipeline", "isRequired": true, @@ -757,6 +787,7 @@ "description": [], "children": [ { + "id": "def-public.IImporter.import.$1", "type": "string", "label": "id", "isRequired": true, @@ -770,6 +801,7 @@ } }, { + "id": "def-public.IImporter.import.$2", "type": "string", "label": "index", "isRequired": true, @@ -783,6 +815,7 @@ } }, { + "id": "def-public.IImporter.import.$3", "type": "string", "label": "pipelineId", "isRequired": false, @@ -796,6 +829,7 @@ } }, { + "id": "def-public.IImporter.import.$4", "type": "Function", "label": "setImportProgress", "isRequired": true, @@ -974,7 +1008,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 87 + "lineNumber": 94 } }, { @@ -985,7 +1019,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 88 + "lineNumber": 95 } }, { @@ -996,7 +1030,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 89 + "lineNumber": 96 }, "signature": [ { @@ -1011,7 +1045,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 86 + "lineNumber": 93 }, "initialIsOpen": false }, @@ -1030,7 +1064,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 76 + "lineNumber": 81 } }, { @@ -1041,7 +1075,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 77 + "lineNumber": 82 } }, { @@ -1052,7 +1086,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 78 + "lineNumber": 83 }, "signature": [ "string | undefined" @@ -1066,7 +1100,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 79 + "lineNumber": 84 }, "signature": [ "string | undefined" @@ -1080,7 +1114,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 80 + "lineNumber": 85 } }, { @@ -1091,7 +1125,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 81 + "lineNumber": 86 }, "signature": [ { @@ -1107,15 +1141,17 @@ { "tags": [], "id": "def-public.ImportResponse.error", - "type": "Any", + "type": "Object", "label": "error", "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 82 + "lineNumber": 87 }, "signature": [ - "any" + "{ error: ", + "ErrorCause", + "; } | undefined" ] }, { @@ -1126,7 +1162,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 83 + "lineNumber": 90 }, "signature": [ "boolean | undefined" @@ -1135,7 +1171,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 75 + "lineNumber": 80 }, "initialIsOpen": false }, @@ -1228,7 +1264,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 120 + "lineNumber": 127 } }, { @@ -1239,7 +1275,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 121 + "lineNumber": 128 }, "signature": [ "any[]" @@ -1248,7 +1284,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 119 + "lineNumber": 126 }, "initialIsOpen": false }, @@ -1267,7 +1303,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 115 + "lineNumber": 122 } }, { @@ -1278,7 +1314,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 116 + "lineNumber": 123 }, "signature": [ { @@ -1293,7 +1329,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 114 + "lineNumber": 121 }, "initialIsOpen": false }, @@ -1312,7 +1348,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 11 + "lineNumber": 16 }, "signature": [ "any" @@ -1321,7 +1357,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 10 + "lineNumber": 15 }, "initialIsOpen": false }, @@ -1340,7 +1376,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 106 + "lineNumber": 113 }, "signature": [ "{ created_by: string; } | undefined" @@ -1354,7 +1390,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 109 + "lineNumber": 116 }, "signature": [ "{ [key: string]: any; }" @@ -1363,7 +1399,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 105 + "lineNumber": 112 }, "initialIsOpen": false }, @@ -1382,7 +1418,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 99 + "lineNumber": 106 }, "signature": [ "string | undefined" @@ -1396,7 +1432,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 100 + "lineNumber": 107 } }, { @@ -1407,7 +1443,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 101 + "lineNumber": 108 }, "signature": [ "any[]" @@ -1421,7 +1457,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 102 + "lineNumber": 109 }, "signature": [ "any" @@ -1430,7 +1466,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 98 + "lineNumber": 105 }, "initialIsOpen": false } @@ -1475,7 +1511,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 14 + "lineNumber": 19 }, "signature": [ "InputOverrides & { column_names: string[]; has_header_row: boolean; should_trim_fields: boolean; }" @@ -1490,7 +1526,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 96 + "lineNumber": 103 }, "signature": [ "string | object | ", @@ -1527,7 +1563,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 73 + "lineNumber": 78 }, "signature": [ "any[]" @@ -1601,7 +1637,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/public/plugin.ts", - "lineNumber": 21 + "lineNumber": 26 }, "signature": [ "FileUploadStartApi" @@ -1637,7 +1673,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 21 + "lineNumber": 26 }, "signature": [ { @@ -1657,7 +1693,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 22 + "lineNumber": 27 }, "signature": [ { @@ -1673,7 +1709,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 20 + "lineNumber": 25 }, "initialIsOpen": false }, @@ -1692,13 +1728,13 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 93 + "lineNumber": 100 } } ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 92 + "lineNumber": 99 }, "initialIsOpen": false }, @@ -1717,7 +1753,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 26 + "lineNumber": 31 } }, { @@ -1728,7 +1764,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 27 + "lineNumber": 32 } }, { @@ -1739,7 +1775,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 28 + "lineNumber": 33 } }, { @@ -1750,7 +1786,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 29 + "lineNumber": 34 } }, { @@ -1761,7 +1797,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 30 + "lineNumber": 35 }, "signature": [ "{ [fieldName: string]: { count: number; cardinality: number; top_hits: { count: number; value: any; }[]; mean_value?: number | undefined; median_value?: number | undefined; max_value?: number | undefined; min_value?: number | undefined; earliest?: string | undefined; latest?: string | undefined; }; }" @@ -1775,7 +1811,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 43 + "lineNumber": 48 } }, { @@ -1786,7 +1822,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 44 + "lineNumber": 49 } }, { @@ -1797,7 +1833,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 45 + "lineNumber": 50 }, "signature": [ "{ properties: { [fieldName: string]: { type: ", @@ -1850,7 +1886,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 58 + "lineNumber": 63 } }, { @@ -1861,7 +1897,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 59 + "lineNumber": 64 } }, { @@ -1872,7 +1908,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 60 + "lineNumber": 65 } }, { @@ -1883,7 +1919,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 61 + "lineNumber": 66 } }, { @@ -1894,7 +1930,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 62 + "lineNumber": 67 }, "signature": [ "string[] | undefined" @@ -1908,7 +1944,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 63 + "lineNumber": 68 }, "signature": [ "string[] | undefined" @@ -1922,7 +1958,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 64 + "lineNumber": 69 }, "signature": [ "string | undefined" @@ -1936,7 +1972,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 65 + "lineNumber": 70 }, "signature": [ "string | undefined" @@ -1950,7 +1986,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 66 + "lineNumber": 71 }, "signature": [ "string | undefined" @@ -1964,7 +2000,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 67 + "lineNumber": 72 }, "signature": [ "string[] | undefined" @@ -1978,7 +2014,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 68 + "lineNumber": 73 }, "signature": [ "string[] | undefined" @@ -1992,7 +2028,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 69 + "lineNumber": 74 }, "signature": [ "string | undefined" @@ -2006,7 +2042,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 70 + "lineNumber": 75 }, "signature": [ "boolean | undefined" @@ -2015,7 +2051,32 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 25 + "lineNumber": 30 + }, + "initialIsOpen": false + }, + { + "id": "def-common.HasImportPermission", + "type": "Interface", + "label": "HasImportPermission", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-common.HasImportPermission.hasImportPermission", + "type": "boolean", + "label": "hasImportPermission", + "description": [], + "source": { + "path": "x-pack/plugins/file_upload/common/types.ts", + "lineNumber": 12 + } + } + ], + "source": { + "path": "x-pack/plugins/file_upload/common/types.ts", + "lineNumber": 11 }, "initialIsOpen": false }, @@ -2034,7 +2095,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 87 + "lineNumber": 94 } }, { @@ -2045,7 +2106,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 88 + "lineNumber": 95 } }, { @@ -2056,7 +2117,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 89 + "lineNumber": 96 }, "signature": [ { @@ -2071,7 +2132,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 86 + "lineNumber": 93 }, "initialIsOpen": false }, @@ -2090,7 +2151,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 76 + "lineNumber": 81 } }, { @@ -2101,7 +2162,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 77 + "lineNumber": 82 } }, { @@ -2112,7 +2173,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 78 + "lineNumber": 83 }, "signature": [ "string | undefined" @@ -2126,7 +2187,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 79 + "lineNumber": 84 }, "signature": [ "string | undefined" @@ -2140,7 +2201,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 80 + "lineNumber": 85 } }, { @@ -2151,7 +2212,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 81 + "lineNumber": 86 }, "signature": [ { @@ -2167,15 +2228,17 @@ { "tags": [], "id": "def-common.ImportResponse.error", - "type": "Any", + "type": "Object", "label": "error", "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 82 + "lineNumber": 87 }, "signature": [ - "any" + "{ error: ", + "ErrorCause", + "; } | undefined" ] }, { @@ -2186,7 +2249,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 83 + "lineNumber": 90 }, "signature": [ "boolean | undefined" @@ -2195,7 +2258,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 75 + "lineNumber": 80 }, "initialIsOpen": false }, @@ -2214,7 +2277,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 120 + "lineNumber": 127 } }, { @@ -2225,7 +2288,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 121 + "lineNumber": 128 }, "signature": [ "any[]" @@ -2234,7 +2297,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 119 + "lineNumber": 126 }, "initialIsOpen": false }, @@ -2253,7 +2316,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 115 + "lineNumber": 122 } }, { @@ -2264,7 +2327,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 116 + "lineNumber": 123 }, "signature": [ { @@ -2279,7 +2342,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 114 + "lineNumber": 121 }, "initialIsOpen": false }, @@ -2298,7 +2361,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 11 + "lineNumber": 16 }, "signature": [ "any" @@ -2307,7 +2370,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 10 + "lineNumber": 15 }, "initialIsOpen": false }, @@ -2326,7 +2389,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 106 + "lineNumber": 113 }, "signature": [ "{ created_by: string; } | undefined" @@ -2340,7 +2403,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 109 + "lineNumber": 116 }, "signature": [ "{ [key: string]: any; }" @@ -2349,7 +2412,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 105 + "lineNumber": 112 }, "initialIsOpen": false }, @@ -2368,7 +2431,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 99 + "lineNumber": 106 }, "signature": [ "string | undefined" @@ -2382,7 +2445,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 100 + "lineNumber": 107 } }, { @@ -2393,7 +2456,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 101 + "lineNumber": 108 }, "signature": [ "any[]" @@ -2407,7 +2470,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 102 + "lineNumber": 109 }, "signature": [ "any" @@ -2416,7 +2479,7 @@ ], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 98 + "lineNumber": 105 }, "initialIsOpen": false } @@ -2461,7 +2524,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 14 + "lineNumber": 19 }, "signature": [ "InputOverrides & { column_names: string[]; has_header_row: boolean; should_trim_fields: boolean; }" @@ -2476,7 +2539,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 96 + "lineNumber": 103 }, "signature": [ "string | object | ", @@ -2513,7 +2576,7 @@ "description": [], "source": { "path": "x-pack/plugins/file_upload/common/types.ts", - "lineNumber": 73 + "lineNumber": 78 }, "signature": [ "any[]" diff --git a/api_docs/fleet.json b/api_docs/fleet.json index 60d0dca4d8a10..a0f9d248fc94c 100644 --- a/api_docs/fleet.json +++ b/api_docs/fleet.json @@ -8,6 +8,7 @@ "type": "Function", "children": [ { + "id": "def-public.pkgKeyFromPackageInfo.$1", "type": "Uncategorized", "label": "packageInfo", "isRequired": true, @@ -1042,17 +1043,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.integration_details_overview.$1", "type": "Object", "label": "{ pkgkey }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1063,13 +1059,7 @@ ], "signature": [ "({ pkgkey }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1086,17 +1076,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.integration_details_policies.$1", "type": "Object", "label": "{ pkgkey }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1107,13 +1092,7 @@ ], "signature": [ "({ pkgkey }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1130,17 +1109,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.integration_details_settings.$1", "type": "Object", "label": "{ pkgkey }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1151,13 +1125,7 @@ ], "signature": [ "({ pkgkey }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1174,17 +1142,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.integration_details_custom.$1", "type": "Object", "label": "{ pkgkey }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1195,13 +1158,7 @@ ], "signature": [ "({ pkgkey }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1218,17 +1175,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.integration_policy_edit.$1", "type": "Object", "label": "{ packagePolicyId }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1239,13 +1191,7 @@ ], "signature": [ "({ packagePolicyId }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1294,17 +1240,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.policy_details.$1", "type": "Object", "label": "{ policyId, tabId }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1315,13 +1256,7 @@ ], "signature": [ "({ policyId, tabId }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1338,17 +1273,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.add_integration_from_policy.$1", "type": "Object", "label": "{ policyId }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1359,13 +1289,7 @@ ], "signature": [ "({ policyId }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1382,17 +1306,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.add_integration_to_policy.$1", "type": "Object", "label": "{ pkgkey }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1403,13 +1322,7 @@ ], "signature": [ "({ pkgkey }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1426,17 +1339,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.edit_integration.$1", "type": "Object", "label": "{ policyId, packagePolicyId }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1447,13 +1355,7 @@ ], "signature": [ "({ policyId, packagePolicyId }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1486,17 +1388,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.fleet_agent_list.$1", "type": "Object", "label": "{ kuery }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1507,13 +1404,7 @@ ], "signature": [ "({ kuery }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1530,17 +1421,12 @@ "type": "Function", "children": [ { + "id": "def-public.pagePathGetters.fleet_agent_details.$1", "type": "Object", "label": "{ agentId, tabId, logQuery }", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - } + "DynamicPagePathValues" ], "description": [], "source": { @@ -1551,13 +1437,7 @@ ], "signature": [ "({ agentId, tabId, logQuery }: ", - { - "pluginId": "fleet", - "scope": "public", - "docId": "kibFleetPluginApi", - "section": "def-public.DynamicPagePathValues", - "text": "DynamicPagePathValues" - }, + "DynamicPagePathValues", ") => string" ], "description": [], @@ -1727,6 +1607,7 @@ "type": "Function", "children": [ { + "id": "def-server.relativeDownloadUrlFromArtifact.$1", "type": "Uncategorized", "label": "{\n identifier,\n decodedSha256,\n}", "isRequired": true, @@ -1789,7 +1670,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">, id: string, withPackagePolicies?: boolean) => Promise<", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">, id: string, withPackagePolicies?: boolean) => Promise<", { "pluginId": "fleet", "scope": "common", @@ -1819,7 +1700,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">, options: Readonly<{ page?: number | undefined; perPage?: number | undefined; sortField?: string | undefined; sortOrder?: \"asc\" | \"desc\" | undefined; kuery?: any; showUpgradeable?: boolean | undefined; } & {}> & { withPackagePolicies?: boolean | undefined; }) => Promise<{ items: ", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">, options: Readonly<{ page?: number | undefined; perPage?: number | undefined; sortField?: string | undefined; sortOrder?: \"asc\" | \"desc\" | undefined; kuery?: any; showUpgradeable?: boolean | undefined; } & {}> & { withPackagePolicies?: boolean | undefined; }) => Promise<{ items: ", { "pluginId": "fleet", "scope": "common", @@ -1849,7 +1730,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">) => Promise" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">) => Promise" ] }, { @@ -1871,7 +1752,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">, id: string, options?: { standalone: boolean; } | undefined) => Promise<", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">, id: string, options?: { standalone: boolean; } | undefined) => Promise<", { "pluginId": "fleet", "scope": "common", @@ -1912,13 +1793,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "fleet", - "scope": "server", - "docId": "kibFleetPluginApi", - "section": "def-server.getAgentById", - "text": "getAgentById" - } + "getAgentById" ] }, { @@ -1957,6 +1832,7 @@ ], "children": [ { + "id": "def-server.AgentService.authenticateAgentWithAccessToken.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -1976,6 +1852,7 @@ } }, { + "id": "def-server.AgentService.authenticateAgentWithAccessToken.$2", "type": "Object", "label": "request", "isRequired": true, @@ -2031,6 +1908,7 @@ ], "children": [ { + "id": "def-server.AgentService.getAgentStatusById.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -2050,6 +1928,7 @@ } }, { + "id": "def-server.AgentService.getAgentStatusById.$2", "type": "string", "label": "agentId", "isRequired": true, @@ -2084,13 +1963,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "fleet", - "scope": "server", - "docId": "kibFleetPluginApi", - "section": "def-server.getAgentsByKuery", - "text": "getAgentsByKuery" - } + "getAgentsByKuery" ] } ], @@ -2174,6 +2047,7 @@ "description": [], "children": [ { + "id": "def-server.ArtifactsClientInterface.getArtifact.$1", "type": "string", "label": "id", "isRequired": true, @@ -2200,13 +2074,7 @@ "label": "createArtifact", "signature": [ "(options: ", - { - "pluginId": "fleet", - "scope": "server", - "docId": "kibFleetPluginApi", - "section": "def-server.ArtifactsClientCreateOptions", - "text": "ArtifactsClientCreateOptions" - }, + "ArtifactsClientCreateOptions", ") => Promise<", { "pluginId": "fleet", @@ -2220,17 +2088,12 @@ "description": [], "children": [ { + "id": "def-server.ArtifactsClientInterface.createArtifact.$1", "type": "CompoundType", "label": "options", "isRequired": true, "signature": [ - { - "pluginId": "fleet", - "scope": "server", - "docId": "kibFleetPluginApi", - "section": "def-server.ArtifactsClientCreateOptions", - "text": "ArtifactsClientCreateOptions" - } + "ArtifactsClientCreateOptions" ], "description": [], "source": { @@ -2256,6 +2119,7 @@ "description": [], "children": [ { + "id": "def-server.ArtifactsClientInterface.deleteArtifact.$1", "type": "string", "label": "id", "isRequired": true, @@ -2282,13 +2146,7 @@ "label": "listArtifacts", "signature": [ "(options?: ", - { - "pluginId": "fleet", - "scope": "server", - "docId": "kibFleetPluginApi", - "section": "def-server.ListArtifactsProps", - "text": "ListArtifactsProps" - }, + "ListArtifactsProps", " | undefined) => Promise<", { "pluginId": "fleet", @@ -2310,17 +2168,12 @@ "description": [], "children": [ { + "id": "def-server.ArtifactsClientInterface.listArtifacts.$1", "type": "CompoundType", "label": "options", "isRequired": false, "signature": [ - { - "pluginId": "fleet", - "scope": "server", - "docId": "kibFleetPluginApi", - "section": "def-server.ListArtifactsProps", - "text": "ListArtifactsProps" - }, + "ListArtifactsProps", " | undefined" ], "description": [], @@ -2355,6 +2208,7 @@ "description": [], "children": [ { + "id": "def-server.ArtifactsClientInterface.encodeContent.$1", "type": "string", "label": "content", "isRequired": true, @@ -2385,6 +2239,7 @@ "description": [], "children": [ { + "id": "def-server.ArtifactsClientInterface.generateHash.$1", "type": "string", "label": "content", "isRequired": true, @@ -2434,11 +2289,12 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">, pkgName: string, datasetPath: string) => Promise" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">, pkgName: string, datasetPath: string) => Promise" ], "description": [], "children": [ { + "id": "def-server.ESIndexPatternService.getESIndexPattern.$1", "type": "Object", "label": "savedObjectsClient", "isRequired": true, @@ -2451,7 +2307,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ], "description": [], "source": { @@ -2460,6 +2316,7 @@ } }, { + "id": "def-server.ESIndexPatternService.getESIndexPattern.$2", "type": "string", "label": "pkgName", "isRequired": true, @@ -2473,6 +2330,7 @@ } }, { + "id": "def-server.ESIndexPatternService.getESIndexPattern.$3", "type": "string", "label": "datasetPath", "isRequired": true, @@ -2515,7 +2373,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 95 + "lineNumber": 96 }, "signature": [ { @@ -2535,7 +2393,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 96 + "lineNumber": 97 }, "signature": [ { @@ -2556,7 +2414,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 97 + "lineNumber": 98 }, "signature": [ { @@ -2577,7 +2435,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 98 + "lineNumber": 99 }, "signature": [ { @@ -2597,7 +2455,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 99 + "lineNumber": 100 }, "signature": [ { @@ -2618,24 +2476,18 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 100 + "lineNumber": 101 }, "signature": [ "Pick<", - { - "pluginId": "usageCollection", - "scope": "server", - "docId": "kibUsageCollectionPluginApi", - "section": "def-server.CollectorSet", - "text": "CollectorSet" - }, + "CollectorSet", ", \"makeStatsCollector\" | \"makeUsageCollector\" | \"registerCollector\" | \"getCollectorByType\" | \"areAllCollectorsReady\" | \"bulkFetch\" | \"bulkFetchUsage\" | \"toObject\" | \"toApiFieldNames\"> | undefined" ] } ], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 94 + "lineNumber": 95 }, "initialIsOpen": false }, @@ -2661,7 +2513,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">, pkgName: string) => Promise<", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">, pkgName: string) => Promise<", { "pluginId": "fleet", "scope": "common", @@ -2674,6 +2526,7 @@ "description": [], "children": [ { + "id": "def-server.PackageService.getInstalledEsAssetReferences.$1", "type": "Object", "label": "savedObjectsClient", "isRequired": true, @@ -2686,7 +2539,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ], "description": [], "source": { @@ -2695,6 +2548,7 @@ } }, { + "id": "def-server.PackageService.getInstalledEsAssetReferences.$2", "type": "string", "label": "pkgName", "isRequired": true, @@ -2735,7 +2589,7 @@ ], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 140 + "lineNumber": 141 }, "signature": [ "[\"packagePolicyCreate\", (newPackagePolicy: ", @@ -2789,7 +2643,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/index.ts", - "lineNumber": 78 + "lineNumber": 83 }, "signature": [ "any" @@ -2837,7 +2691,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 125 + "lineNumber": 126 }, "signature": [ "void" @@ -2854,6 +2708,22 @@ ], "tags": [], "children": [ + { + "tags": [], + "id": "def-server.FleetStartContract.fleetSetupCompleted", + "type": "Function", + "label": "fleetSetupCompleted", + "description": [ + "\nreturns a promise that resolved when fleet setup has been completed regardless if it was successful or failed).\nAny consumer of fleet start services should first `await` for this promise to be resolved before using those\nservices" + ], + "source": { + "path": "x-pack/plugins/fleet/server/plugin.ts", + "lineNumber": 170 + }, + "signature": [ + "() => Promise" + ] + }, { "tags": [], "id": "def-server.FleetStartContract.esIndexPatternService", @@ -2862,7 +2732,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 164 + "lineNumber": 171 }, "signature": [ { @@ -2882,7 +2752,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 165 + "lineNumber": 172 }, "signature": [ { @@ -2902,7 +2772,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 166 + "lineNumber": 173 }, "signature": [ { @@ -2924,16 +2794,10 @@ ], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 170 + "lineNumber": 177 }, "signature": [ - { - "pluginId": "fleet", - "scope": "server", - "docId": "kibFleetPluginApi", - "section": "def-server.PackagePolicyService", - "text": "PackagePolicyService" - } + "PackagePolicyService" ] }, { @@ -2944,7 +2808,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 171 + "lineNumber": 178 }, "signature": [ { @@ -2966,7 +2830,7 @@ ], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 176 + "lineNumber": 183 }, "signature": [ "(...args: ", @@ -2990,23 +2854,17 @@ ], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 182 + "lineNumber": 189 }, "signature": [ "(packageName: string) => ", - { - "pluginId": "fleet", - "scope": "server", - "docId": "kibFleetPluginApi", - "section": "def-server.FleetArtifactsClient", - "text": "FleetArtifactsClient" - } + "FleetArtifactsClient" ] } ], "source": { "path": "x-pack/plugins/fleet/server/plugin.ts", - "lineNumber": 163 + "lineNumber": 164 }, "lifecycle": "start", "initialIsOpen": true @@ -3029,31 +2887,20 @@ "(license$: ", "Observable", "<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">) => void" ], "description": [], "children": [ { + "id": "def-common.LicenseService.start.$1", "type": "Object", "label": "license$", "isRequired": true, "signature": [ "Observable", "<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">" ], "description": [], @@ -3092,13 +2939,7 @@ "label": "getLicenseInformation", "signature": [ "() => ", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", " | null" ], "description": [], @@ -3118,13 +2959,7 @@ "() => ", "Observable", "<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", "> | null" ], "description": [], @@ -3187,6 +3022,7 @@ "description": [], "children": [ { + "id": "def-common.decodeCloudId.$1", "type": "string", "label": "cid", "isRequired": true, @@ -3213,6 +3049,7 @@ "type": "Function", "children": [ { + "id": "def-common.doesAgentPolicyAlreadyIncludePackage.$1", "type": "Object", "label": "agentPolicy", "isRequired": true, @@ -3232,6 +3069,7 @@ } }, { + "id": "def-common.doesAgentPolicyAlreadyIncludePackage.$2", "type": "string", "label": "packageName", "isRequired": true, @@ -3274,7 +3112,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/index.ts", - "lineNumber": 39 + "lineNumber": 42 }, "signature": [ "(o: T) => [keyof T, T[keyof T]][]" @@ -3286,6 +3124,7 @@ "type": "Function", "children": [ { + "id": "def-common.fullAgentPolicyToYaml.$1", "type": "Object", "label": "policy", "isRequired": true, @@ -3301,7 +3140,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/services/full_agent_policy_to_yaml.ts", - "lineNumber": 27 + "lineNumber": 28 } } ], @@ -3320,7 +3159,7 @@ "label": "fullAgentPolicyToYaml", "source": { "path": "x-pack/plugins/fleet/common/services/full_agent_policy_to_yaml.ts", - "lineNumber": 27 + "lineNumber": 28 }, "tags": [], "returnComment": [], @@ -3344,6 +3183,7 @@ "description": [], "children": [ { + "id": "def-common.isAgentUpgradeable.$1", "type": "Object", "label": "agent", "isRequired": true, @@ -3363,6 +3203,7 @@ } }, { + "id": "def-common.isAgentUpgradeable.$2", "type": "string", "label": "kibanaVersion", "isRequired": true, @@ -3394,6 +3235,7 @@ "description": [], "children": [ { + "id": "def-common.isDiffPathProtocol.$1", "type": "Array", "label": "kibanaUrls", "isRequired": true, @@ -3420,6 +3262,7 @@ "type": "Function", "children": [ { + "id": "def-common.isPackageLimited.$1", "type": "CompoundType", "label": "packageInfo", "isRequired": true, @@ -3470,6 +3313,7 @@ "description": [], "children": [ { + "id": "def-common.isValidNamespace.$1", "type": "string", "label": "namespace", "isRequired": true, @@ -3496,6 +3340,7 @@ "type": "Function", "children": [ { + "id": "def-common.packageToPackagePolicy.$1", "type": "CompoundType", "label": "packageInfo", "isRequired": true, @@ -3515,6 +3360,7 @@ } }, { + "id": "def-common.packageToPackagePolicy.$2", "type": "string", "label": "agentPolicyId", "isRequired": true, @@ -3528,6 +3374,7 @@ } }, { + "id": "def-common.packageToPackagePolicy.$3", "type": "string", "label": "outputId", "isRequired": true, @@ -3541,6 +3388,7 @@ } }, { + "id": "def-common.packageToPackagePolicy.$4", "type": "string", "label": "namespace", "isRequired": true, @@ -3554,6 +3402,7 @@ } }, { + "id": "def-common.packageToPackagePolicy.$5", "type": "string", "label": "packagePolicyName", "isRequired": false, @@ -3567,6 +3416,7 @@ } }, { + "id": "def-common.packageToPackagePolicy.$6", "type": "string", "label": "description", "isRequired": false, @@ -3615,6 +3465,7 @@ "type": "Function", "children": [ { + "id": "def-common.packageToPackagePolicyInputs.$1", "type": "CompoundType", "label": "packageInfo", "isRequired": true, @@ -3668,6 +3519,7 @@ "type": "Function", "children": [ { + "id": "def-common.storedPackagePoliciesToAgentInputs.$1", "type": "Array", "label": "packagePolicies", "isRequired": true, @@ -4045,7 +3897,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 27 + "lineNumber": 28 } }, { @@ -4056,7 +3908,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 28 + "lineNumber": 29 }, "signature": [ { @@ -4077,7 +3929,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 29 + "lineNumber": 30 }, "signature": [ "string[] | ", @@ -4099,7 +3951,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 30 + "lineNumber": 31 } }, { @@ -4110,7 +3962,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 31 + "lineNumber": 32 } }, { @@ -4121,7 +3973,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 32 + "lineNumber": 33 } }, { @@ -4132,13 +3984,13 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 33 + "lineNumber": 34 } } ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 26 + "lineNumber": 27 }, "initialIsOpen": false }, @@ -4340,7 +4192,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 213 + "lineNumber": 217 } }, { @@ -4351,7 +4203,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 214 + "lineNumber": 218 }, "signature": [ "string | undefined" @@ -4365,7 +4217,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 215 + "lineNumber": 219 }, "signature": [ { @@ -4385,7 +4237,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 216 + "lineNumber": 220 }, "signature": [ { @@ -4405,13 +4257,13 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 217 + "lineNumber": 221 } } ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 212 + "lineNumber": 216 }, "initialIsOpen": false }, @@ -4424,44 +4276,58 @@ "children": [ { "tags": [], - "id": "def-common.BaseSettings.kibana_urls", - "type": "Array", - "label": "kibana_urls", + "id": "def-common.BaseSettings.has_seen_add_data_notice", + "type": "CompoundType", + "label": "has_seen_add_data_notice", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/settings.ts", "lineNumber": 11 }, "signature": [ - "string[]" + "boolean | undefined" ] }, { "tags": [], - "id": "def-common.BaseSettings.kibana_ca_sha256", - "type": "string", - "label": "kibana_ca_sha256", + "id": "def-common.BaseSettings.fleet_server_hosts", + "type": "Array", + "label": "fleet_server_hosts", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/settings.ts", "lineNumber": 12 }, "signature": [ - "string | undefined" + "string[]" ] }, { "tags": [], - "id": "def-common.BaseSettings.has_seen_add_data_notice", - "type": "CompoundType", - "label": "has_seen_add_data_notice", + "id": "def-common.BaseSettings.kibana_urls", + "type": "Array", + "label": "kibana_urls", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/settings.ts", - "lineNumber": 13 + "lineNumber": 14 }, "signature": [ - "boolean | undefined" + "string[]" + ] + }, + { + "tags": [], + "id": "def-common.BaseSettings.kibana_ca_sha256", + "type": "string", + "label": "kibana_ca_sha256", + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/types/models/settings.ts", + "lineNumber": 15 + }, + "signature": [ + "string | undefined" ] } ], @@ -4614,7 +4480,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 206 + "lineNumber": 210 } }, { @@ -4625,7 +4491,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 207 + "lineNumber": 211 } }, { @@ -4636,13 +4502,13 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 208 + "lineNumber": 212 } } ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 205 + "lineNumber": 209 }, "initialIsOpen": false }, @@ -5111,7 +4977,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 200 + "lineNumber": 205 }, "signature": [ "{ agentId: string; }" @@ -5120,7 +4986,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 199 + "lineNumber": 204 }, "initialIsOpen": false }, @@ -5380,7 +5246,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 312 + "lineNumber": 316 } }, { @@ -5391,7 +5257,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 313 + "lineNumber": 317 } }, { @@ -5402,7 +5268,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 314 + "lineNumber": 318 }, "signature": [ { @@ -5422,7 +5288,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 315 + "lineNumber": 319 }, "signature": [ "boolean | undefined" @@ -5431,7 +5297,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 311 + "lineNumber": 315 }, "initialIsOpen": false }, @@ -5492,7 +5358,7 @@ "lineNumber": 15 }, "signature": [ - "{ enabled: boolean; fleetServerEnabled: boolean; tlsCheckDisabled: boolean; pollingRequestTimeout: number; maxConcurrentConnections: number; kibana: { host?: string | string[] | undefined; ca_sha256?: string | undefined; }; elasticsearch: { host?: string | undefined; ca_sha256?: string | undefined; }; agentPolicyRolloutRateLimitIntervalMs: number; agentPolicyRolloutRateLimitRequestPerInterval: number; }" + "{ enabled: boolean; fleetServerEnabled: boolean; tlsCheckDisabled: boolean; pollingRequestTimeout: number; maxConcurrentConnections: number; kibana: { host?: string | string[] | undefined; ca_sha256?: string | undefined; }; elasticsearch: { host?: string | undefined; ca_sha256?: string | undefined; }; fleet_server?: { hosts?: string[] | undefined; } | undefined; agentPolicyRolloutRateLimitIntervalMs: number; agentPolicyRolloutRateLimitRequestPerInterval: number; }" ] } ], @@ -5978,7 +5844,7 @@ }, { "tags": [], - "id": "def-common.FleetServerAgentAction.'@timestamp'", + "id": "def-common.FleetServerAgentAction.timestamp", "type": "string", "label": "'@timestamp'", "description": [ @@ -6290,7 +6156,7 @@ "children": [ { "tags": [], - "id": "def-common.FleetServerPolicy.'@timestamp'", + "id": "def-common.FleetServerPolicy.timestamp", "type": "string", "label": "'@timestamp'", "description": [ @@ -6298,7 +6164,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 99 + "lineNumber": 117 }, "signature": [ "string | undefined" @@ -6314,7 +6180,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 103 + "lineNumber": 121 } }, { @@ -6327,7 +6193,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 107 + "lineNumber": 125 } }, { @@ -6340,7 +6206,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 111 + "lineNumber": 129 } }, { @@ -6353,7 +6219,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 115 + "lineNumber": 133 }, "signature": [ "{ [k: string]: unknown; }" @@ -6369,13 +6235,13 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 121 + "lineNumber": 139 } } ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 95 + "lineNumber": 113 }, "initialIsOpen": false }, @@ -6394,7 +6260,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 63 + "lineNumber": 74 } }, { @@ -6405,7 +6271,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 64 + "lineNumber": 75 }, "signature": [ "{ [key: string]: Pick<", @@ -6421,16 +6287,38 @@ }, { "tags": [], - "id": "def-common.FullAgentPolicy.fleet", + "id": "def-common.FullAgentPolicy.output_permissions", "type": "Object", + "label": "output_permissions", + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", + "lineNumber": 80 + }, + "signature": [ + "{ [output: string]: ", + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.FullAgentPolicyOutputPermissions", + "text": "FullAgentPolicyOutputPermissions" + }, + "; } | undefined" + ] + }, + { + "tags": [], + "id": "def-common.FullAgentPolicy.fleet", + "type": "CompoundType", "label": "fleet", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 69 + "lineNumber": 83 }, "signature": [ - "{ kibana: ", + "{ hosts: string[]; } | { kibana: ", { "pluginId": "fleet", "scope": "common", @@ -6449,7 +6337,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 72 + "lineNumber": 90 }, "signature": [ { @@ -6470,7 +6358,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 73 + "lineNumber": 91 }, "signature": [ "number | undefined" @@ -6484,7 +6372,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 74 + "lineNumber": 92 }, "signature": [ "{ monitoring: { use_output?: string | undefined; enabled: boolean; metrics: boolean; logs: boolean; }; } | undefined" @@ -6493,7 +6381,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 62 + "lineNumber": 73 }, "initialIsOpen": false }, @@ -6512,7 +6400,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 48 + "lineNumber": 49 } }, { @@ -6523,7 +6411,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 49 + "lineNumber": 50 } }, { @@ -6534,7 +6422,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 50 + "lineNumber": 51 } }, { @@ -6545,7 +6433,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 51 + "lineNumber": 52 } }, { @@ -6556,7 +6444,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 52 + "lineNumber": 53 }, "signature": [ "{ namespace: string; }" @@ -6570,7 +6458,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 53 + "lineNumber": 54 } }, { @@ -6581,7 +6469,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 54 + "lineNumber": 55 }, "signature": [ "{ [key: string]: unknown; package?: Pick<", @@ -6603,7 +6491,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 58 + "lineNumber": 59 }, "signature": [ { @@ -6624,7 +6512,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 59 + "lineNumber": 60 }, "signature": [ "any" @@ -6633,7 +6521,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 47 + "lineNumber": 48 }, "initialIsOpen": false }, @@ -6652,7 +6540,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 39 + "lineNumber": 40 } }, { @@ -6663,7 +6551,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 40 + "lineNumber": 41 }, "signature": [ "{ dataset: string; type: string; }" @@ -6677,7 +6565,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 44 + "lineNumber": 45 }, "signature": [ "any" @@ -6686,7 +6574,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 38 + "lineNumber": 39 }, "initialIsOpen": false }, @@ -6705,7 +6593,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 85 + "lineNumber": 103 }, "signature": [ "string[]" @@ -6719,7 +6607,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 86 + "lineNumber": 104 } }, { @@ -6730,7 +6618,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 87 + "lineNumber": 105 }, "signature": [ "string | undefined" @@ -6739,7 +6627,35 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 84 + "lineNumber": 102 + }, + "initialIsOpen": false + }, + { + "id": "def-common.FullAgentPolicyOutputPermissions", + "type": "Interface", + "label": "FullAgentPolicyOutputPermissions", + "description": [], + "tags": [], + "children": [ + { + "id": "def-common.FullAgentPolicyOutputPermissions.Unnamed", + "type": "Any", + "label": "Unnamed", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", + "lineNumber": 64 + }, + "signature": [ + "any" + ] + } + ], + "source": { + "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", + "lineNumber": 63 }, "initialIsOpen": false }, @@ -6968,7 +6884,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 215 + "lineNumber": 220 }, "signature": [ "{ kuery?: string | undefined; policyId?: string | undefined; }" @@ -6977,7 +6893,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 214 + "lineNumber": 219 }, "initialIsOpen": false }, @@ -6996,7 +6912,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 222 + "lineNumber": 227 }, "signature": [ "{ events: number; total: number; online: number; error: number; offline: number; other: number; updating: number; }" @@ -7005,7 +6921,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 221 + "lineNumber": 226 }, "initialIsOpen": false }, @@ -7436,7 +7352,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 182 + "lineNumber": 187 }, "signature": [ "{ agentId: string; }" @@ -7450,7 +7366,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 185 + "lineNumber": 190 }, "signature": [ "{ page: number; perPage: number; kuery?: string | undefined; }" @@ -7459,7 +7375,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 181 + "lineNumber": 186 }, "initialIsOpen": false }, @@ -7478,7 +7394,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 193 + "lineNumber": 198 }, "signature": [ { @@ -7499,7 +7415,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 194 + "lineNumber": 199 } }, { @@ -7510,7 +7426,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 195 + "lineNumber": 200 } }, { @@ -7521,13 +7437,13 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 196 + "lineNumber": 201 } } ], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 192 + "lineNumber": 197 }, "initialIsOpen": false }, @@ -8066,7 +7982,7 @@ "section": "def-common.RegistryPackage", "text": "RegistryPackage" }, - ", \"type\" | \"description\" | \"title\" | \"name\" | \"version\" | \"path\" | \"download\" | \"data_streams\" | \"release\" | \"icons\" | \"policy_templates\" | \"internal\">>[]" + ", \"type\" | \"description\" | \"title\" | \"name\" | \"version\" | \"path\" | \"download\" | \"internal\" | \"data_streams\" | \"release\" | \"icons\" | \"policy_templates\">>[]" ] } ], @@ -8237,7 +8153,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 383 + "lineNumber": 387 } }, { @@ -8248,7 +8164,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 384 + "lineNumber": 388 }, "signature": [ "string[]" @@ -8262,7 +8178,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 385 + "lineNumber": 389 }, "signature": [ "{ settings: any; mappings: any; }" @@ -8276,7 +8192,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 389 + "lineNumber": 393 }, "signature": [ "{ hidden?: boolean | undefined; }" @@ -8290,7 +8206,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 390 + "lineNumber": 394 }, "signature": [ "string[]" @@ -8304,7 +8220,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 391 + "lineNumber": 395 }, "signature": [ "object" @@ -8313,7 +8229,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 382 + "lineNumber": 386 }, "initialIsOpen": false }, @@ -8332,7 +8248,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 376 + "lineNumber": 380 }, "signature": [ "any" @@ -8341,7 +8257,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 375 + "lineNumber": 379 }, "initialIsOpen": false }, @@ -8371,7 +8287,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 331 + "lineNumber": 335 }, "signature": [ { @@ -8392,7 +8308,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 332 + "lineNumber": 336 }, "signature": [ { @@ -8413,7 +8329,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 333 + "lineNumber": 337 }, "signature": [ { @@ -8434,7 +8350,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 334 + "lineNumber": 338 }, "signature": [ "Record" @@ -8448,7 +8364,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 335 + "lineNumber": 339 } }, { @@ -8459,7 +8375,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 336 + "lineNumber": 340 } }, { @@ -8470,7 +8386,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 337 + "lineNumber": 341 }, "signature": [ { @@ -8490,7 +8406,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 338 + "lineNumber": 342 } }, { @@ -8501,7 +8417,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 339 + "lineNumber": 343 } }, { @@ -8512,7 +8428,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 340 + "lineNumber": 344 }, "signature": [ { @@ -8527,7 +8443,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 330 + "lineNumber": 334 }, "initialIsOpen": false }, @@ -9159,6 +9075,20 @@ "signature": [ "(\"metrics\" | \"logs\")[] | undefined" ] + }, + { + "tags": [], + "id": "def-common.NewAgentPolicy.preconfiguration_id", + "type": "string", + "label": "preconfiguration_id", + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", + "lineNumber": 24 + }, + "signature": [ + "string | undefined" + ] } ], "source": { @@ -10151,7 +10081,7 @@ "lineNumber": 20 }, "signature": [ - "(\"custom\" | \"security\" | \"monitoring\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"support\" | \"ticketing\" | \"version_control\" | \"web\" | undefined)[] | undefined" + "(\"custom\" | \"security\" | \"monitoring\" | \"cloud\" | \"network\" | \"aws\" | \"azure\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"notification\" | \"os_system\" | \"productivity\" | \"support\" | \"ticketing\" | \"version_control\" | \"web\" | undefined)[] | undefined" ] }, { @@ -10331,13 +10261,13 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 344 + "lineNumber": 348 } } ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 343 + "lineNumber": 347 }, "initialIsOpen": false }, @@ -10672,7 +10602,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 128 + "lineNumber": 133 }, "signature": [ "{ agentId: string; }" @@ -10686,7 +10616,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 131 + "lineNumber": 136 }, "signature": [ "{ source_uri?: string | undefined; version: string; }" @@ -10695,7 +10625,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 127 + "lineNumber": 132 }, "initialIsOpen": false }, @@ -10708,7 +10638,7 @@ "children": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 154 + "lineNumber": 159 }, "initialIsOpen": false }, @@ -10727,7 +10657,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 167 + "lineNumber": 172 }, "signature": [ "{ policy_id: string; agents: string | string[]; }" @@ -10736,7 +10666,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 166 + "lineNumber": 171 }, "initialIsOpen": false }, @@ -10768,19 +10698,6 @@ }, "initialIsOpen": false }, - { - "id": "def-common.PostBulkAgentUnenrollResponse", - "type": "Interface", - "label": "PostBulkAgentUnenrollResponse", - "description": [], - "tags": [], - "children": [], - "source": { - "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 125 - }, - "initialIsOpen": false - }, { "id": "def-common.PostBulkAgentUpgradeRequest", "type": "Interface", @@ -10796,7 +10713,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 138 + "lineNumber": 143 }, "signature": [ "{ agents: string | string[]; source_uri?: string | undefined; version: string; }" @@ -10805,7 +10722,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 137 + "lineNumber": 142 }, "initialIsOpen": false }, @@ -10921,73 +10838,217 @@ "label": "body", "description": [], "source": { - "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 93 + "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", + "lineNumber": 93 + }, + "signature": [ + "{ action: ", + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.NewAgentAction", + "text": "NewAgentAction" + }, + "; }" + ] + }, + { + "tags": [], + "id": "def-common.PostNewAgentActionRequest.params", + "type": "Object", + "label": "params", + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", + "lineNumber": 96 + }, + "signature": [ + "{ agentId: string; }" + ] + } + ], + "source": { + "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", + "lineNumber": 92 + }, + "initialIsOpen": false + }, + { + "id": "def-common.PostNewAgentActionResponse", + "type": "Interface", + "label": "PostNewAgentActionResponse", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-common.PostNewAgentActionResponse.item", + "type": "Object", + "label": "item", + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", + "lineNumber": 102 + }, + "signature": [ + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.AgentAction", + "text": "AgentAction" + } + ] + } + ], + "source": { + "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", + "lineNumber": 101 + }, + "initialIsOpen": false + }, + { + "id": "def-common.PreconfiguredAgentPolicy", + "type": "Interface", + "label": "PreconfiguredAgentPolicy", + "signature": [ + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.PreconfiguredAgentPolicy", + "text": "PreconfiguredAgentPolicy" + }, + " extends Pick<", + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.NewAgentPolicy", + "text": "NewAgentPolicy" + }, + ", \"description\" | \"name\" | \"is_default\" | \"is_managed\" | \"is_default_fleet_server\" | \"monitoring_enabled\" | \"preconfiguration_id\">" + ], + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-common.PreconfiguredAgentPolicy.id", + "type": "CompoundType", + "label": "id", + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/types/models/preconfiguration.ts", + "lineNumber": 20 + }, + "signature": [ + "React.ReactText" + ] + }, + { + "tags": [], + "id": "def-common.PreconfiguredAgentPolicy.namespace", + "type": "string", + "label": "namespace", + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/types/models/preconfiguration.ts", + "lineNumber": 21 }, "signature": [ - "{ action: ", - { - "pluginId": "fleet", - "scope": "common", - "docId": "kibFleetPluginApi", - "section": "def-common.NewAgentAction", - "text": "NewAgentAction" - }, - "; }" + "string | undefined" ] }, { "tags": [], - "id": "def-common.PostNewAgentActionRequest.params", - "type": "Object", - "label": "params", + "id": "def-common.PreconfiguredAgentPolicy.package_policies", + "type": "Array", + "label": "package_policies", "description": [], "source": { - "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 96 + "path": "x-pack/plugins/fleet/common/types/models/preconfiguration.ts", + "lineNumber": 22 }, "signature": [ - "{ agentId: string; }" + "(Partial> & { name: string; package: Partial<", + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.PackagePolicyPackage", + "text": "PackagePolicyPackage" + }, + ">; inputs?: ", + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.InputsOverride", + "text": "InputsOverride" + }, + "[] | undefined; })[]" ] } ], "source": { - "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 92 + "path": "x-pack/plugins/fleet/common/types/models/preconfiguration.ts", + "lineNumber": 19 }, "initialIsOpen": false }, { - "id": "def-common.PostNewAgentActionResponse", + "id": "def-common.PreconfiguredPackage", "type": "Interface", - "label": "PostNewAgentActionResponse", + "label": "PreconfiguredPackage", + "signature": [ + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.PreconfiguredPackage", + "text": "PreconfiguredPackage" + }, + " extends Pick<", + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.PackagePolicyPackage", + "text": "PackagePolicyPackage" + }, + ", \"name\" | \"version\">" + ], "description": [], "tags": [], "children": [ { "tags": [], - "id": "def-common.PostNewAgentActionResponse.item", - "type": "Object", - "label": "item", + "id": "def-common.PreconfiguredPackage.force", + "type": "CompoundType", + "label": "force", "description": [], "source": { - "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 102 + "path": "x-pack/plugins/fleet/common/types/models/preconfiguration.ts", + "lineNumber": 32 }, "signature": [ - { - "pluginId": "fleet", - "scope": "common", - "docId": "kibFleetPluginApi", - "section": "def-common.AgentAction", - "text": "AgentAction" - } + "boolean | undefined" ] } ], "source": { - "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 101 + "path": "x-pack/plugins/fleet/common/types/models/preconfiguration.ts", + "lineNumber": 31 }, "initialIsOpen": false }, @@ -11006,7 +11067,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 157 + "lineNumber": 162 }, "signature": [ "{ agentId: string; }" @@ -11020,7 +11081,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 160 + "lineNumber": 165 }, "signature": [ "{ policy_id: string; }" @@ -11029,7 +11090,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 156 + "lineNumber": 161 }, "initialIsOpen": false }, @@ -11042,7 +11103,7 @@ "children": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 164 + "lineNumber": 169 }, "initialIsOpen": false }, @@ -11148,7 +11209,7 @@ "section": "def-common.Settings", "text": "Settings" }, - ", \"kibana_urls\" | \"kibana_ca_sha256\" | \"has_seen_add_data_notice\">>" + ", \"has_seen_add_data_notice\" | \"fleet_server_hosts\" | \"kibana_urls\" | \"kibana_ca_sha256\">>" ] } ], @@ -11201,24 +11262,24 @@ "children": [ { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.type]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.type", "type": "string", "label": "[RegistryDataStreamKeys.type]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 258 + "lineNumber": 262 } }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.ilm_policy]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.ilm_policy", "type": "string", "label": "[RegistryDataStreamKeys.ilm_policy]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 259 + "lineNumber": 263 }, "signature": [ "string | undefined" @@ -11226,13 +11287,13 @@ }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.hidden]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.hidden", "type": "CompoundType", "label": "[RegistryDataStreamKeys.hidden]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 260 + "lineNumber": 264 }, "signature": [ "boolean | undefined" @@ -11240,46 +11301,46 @@ }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.dataset]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.dataset", "type": "string", "label": "[RegistryDataStreamKeys.dataset]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 261 + "lineNumber": 265 } }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.title]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.title", "type": "string", "label": "[RegistryDataStreamKeys.title]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 262 + "lineNumber": 266 } }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.release]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.release", "type": "string", "label": "[RegistryDataStreamKeys.release]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 263 + "lineNumber": 267 } }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.streams]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.streams", "type": "Array", "label": "[RegistryDataStreamKeys.streams]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 264 + "lineNumber": 268 }, "signature": [ { @@ -11294,46 +11355,46 @@ }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.package]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.package", "type": "string", "label": "[RegistryDataStreamKeys.package]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 265 + "lineNumber": 269 } }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.path]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.path", "type": "string", "label": "[RegistryDataStreamKeys.path]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 266 + "lineNumber": 270 } }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.ingest_pipeline]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.ingest_pipeline", "type": "string", "label": "[RegistryDataStreamKeys.ingest_pipeline]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 267 + "lineNumber": 271 } }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.elasticsearch]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.elasticsearch", "type": "Object", "label": "[RegistryDataStreamKeys.elasticsearch]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 268 + "lineNumber": 272 }, "signature": [ { @@ -11348,13 +11409,13 @@ }, { "tags": [], - "id": "def-common.RegistryDataStream.[RegistryDataStreamKeys.dataset_is_prefix]", + "id": "def-common.RegistryDataStream.RegistryDataStreamKeys.dataset_is_prefix", "type": "CompoundType", "label": "[RegistryDataStreamKeys.dataset_is_prefix]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 269 + "lineNumber": 273 }, "signature": [ "boolean | undefined" @@ -11363,7 +11424,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 257 + "lineNumber": 261 }, "initialIsOpen": false }, @@ -11376,13 +11437,13 @@ "children": [ { "tags": [], - "id": "def-common.RegistryElasticsearch.'index_template.settings'", + "id": "def-common.RegistryElasticsearch.index_template.settings", "type": "Uncategorized", "label": "'index_template.settings'", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 273 + "lineNumber": 277 }, "signature": [ "object | undefined" @@ -11390,13 +11451,13 @@ }, { "tags": [], - "id": "def-common.RegistryElasticsearch.'index_template.mappings'", + "id": "def-common.RegistryElasticsearch.index_template.mappings", "type": "Uncategorized", "label": "'index_template.mappings'", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 274 + "lineNumber": 278 }, "signature": [ "object | undefined" @@ -11405,7 +11466,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 272 + "lineNumber": 276 }, "initialIsOpen": false }, @@ -11424,7 +11485,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 113 + "lineNumber": 117 } }, { @@ -11435,7 +11496,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 114 + "lineNumber": 118 } }, { @@ -11446,7 +11507,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 115 + "lineNumber": 119 }, "signature": [ "string | undefined" @@ -11460,7 +11521,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 116 + "lineNumber": 120 }, "signature": [ "string | undefined" @@ -11474,7 +11535,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 117 + "lineNumber": 121 }, "signature": [ "string | undefined" @@ -11483,7 +11544,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 112 + "lineNumber": 116 }, "initialIsOpen": false }, @@ -11496,46 +11557,46 @@ "children": [ { "tags": [], - "id": "def-common.RegistryInput.[RegistryInputKeys.type]", + "id": "def-common.RegistryInput.RegistryInputKeys.type", "type": "string", "label": "[RegistryInputKeys.type]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 146 + "lineNumber": 150 } }, { "tags": [], - "id": "def-common.RegistryInput.[RegistryInputKeys.title]", + "id": "def-common.RegistryInput.RegistryInputKeys.title", "type": "string", "label": "[RegistryInputKeys.title]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 147 + "lineNumber": 151 } }, { "tags": [], - "id": "def-common.RegistryInput.[RegistryInputKeys.description]", + "id": "def-common.RegistryInput.RegistryInputKeys.description", "type": "string", "label": "[RegistryInputKeys.description]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 148 + "lineNumber": 152 } }, { "tags": [], - "id": "def-common.RegistryInput.[RegistryInputKeys.template_path]", + "id": "def-common.RegistryInput.RegistryInputKeys.template_path", "type": "string", "label": "[RegistryInputKeys.template_path]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 149 + "lineNumber": 153 }, "signature": [ "string | undefined" @@ -11543,13 +11604,13 @@ }, { "tags": [], - "id": "def-common.RegistryInput.[RegistryInputKeys.condition]", + "id": "def-common.RegistryInput.RegistryInputKeys.condition", "type": "string", "label": "[RegistryInputKeys.condition]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 150 + "lineNumber": 154 }, "signature": [ "string | undefined" @@ -11557,13 +11618,13 @@ }, { "tags": [], - "id": "def-common.RegistryInput.[RegistryInputKeys.vars]", + "id": "def-common.RegistryInput.RegistryInputKeys.vars", "type": "Array", "label": "[RegistryInputKeys.vars]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 151 + "lineNumber": 155 }, "signature": [ { @@ -11579,7 +11640,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 145 + "lineNumber": 149 }, "initialIsOpen": false }, @@ -11592,46 +11653,46 @@ "children": [ { "tags": [], - "id": "def-common.RegistryPolicyTemplate.[RegistryPolicyTemplateKeys.name]", + "id": "def-common.RegistryPolicyTemplate.RegistryPolicyTemplateKeys.name", "type": "string", "label": "[RegistryPolicyTemplateKeys.name]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 129 + "lineNumber": 133 } }, { "tags": [], - "id": "def-common.RegistryPolicyTemplate.[RegistryPolicyTemplateKeys.title]", + "id": "def-common.RegistryPolicyTemplate.RegistryPolicyTemplateKeys.title", "type": "string", "label": "[RegistryPolicyTemplateKeys.title]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 130 + "lineNumber": 134 } }, { "tags": [], - "id": "def-common.RegistryPolicyTemplate.[RegistryPolicyTemplateKeys.description]", + "id": "def-common.RegistryPolicyTemplate.RegistryPolicyTemplateKeys.description", "type": "string", "label": "[RegistryPolicyTemplateKeys.description]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 131 + "lineNumber": 135 } }, { "tags": [], - "id": "def-common.RegistryPolicyTemplate.[RegistryPolicyTemplateKeys.inputs]", + "id": "def-common.RegistryPolicyTemplate.RegistryPolicyTemplateKeys.inputs", "type": "Array", "label": "[RegistryPolicyTemplateKeys.inputs]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 132 + "lineNumber": 136 }, "signature": [ { @@ -11646,13 +11707,13 @@ }, { "tags": [], - "id": "def-common.RegistryPolicyTemplate.[RegistryPolicyTemplateKeys.multiple]", + "id": "def-common.RegistryPolicyTemplate.RegistryPolicyTemplateKeys.multiple", "type": "CompoundType", "label": "[RegistryPolicyTemplateKeys.multiple]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 133 + "lineNumber": 137 }, "signature": [ "boolean | undefined" @@ -11661,7 +11722,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 128 + "lineNumber": 132 }, "initialIsOpen": false }, @@ -11674,35 +11735,35 @@ "children": [ { "tags": [], - "id": "def-common.RegistryStream.[RegistryStreamKeys.input]", + "id": "def-common.RegistryStream.RegistryStreamKeys.input", "type": "string", "label": "[RegistryStreamKeys.input]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 164 + "lineNumber": 168 } }, { "tags": [], - "id": "def-common.RegistryStream.[RegistryStreamKeys.title]", + "id": "def-common.RegistryStream.RegistryStreamKeys.title", "type": "string", "label": "[RegistryStreamKeys.title]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 165 + "lineNumber": 169 } }, { "tags": [], - "id": "def-common.RegistryStream.[RegistryStreamKeys.description]", + "id": "def-common.RegistryStream.RegistryStreamKeys.description", "type": "string", "label": "[RegistryStreamKeys.description]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 166 + "lineNumber": 170 }, "signature": [ "string | undefined" @@ -11710,13 +11771,13 @@ }, { "tags": [], - "id": "def-common.RegistryStream.[RegistryStreamKeys.enabled]", + "id": "def-common.RegistryStream.RegistryStreamKeys.enabled", "type": "CompoundType", "label": "[RegistryStreamKeys.enabled]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 167 + "lineNumber": 171 }, "signature": [ "boolean | undefined" @@ -11724,13 +11785,13 @@ }, { "tags": [], - "id": "def-common.RegistryStream.[RegistryStreamKeys.vars]", + "id": "def-common.RegistryStream.RegistryStreamKeys.vars", "type": "Array", "label": "[RegistryStreamKeys.vars]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 168 + "lineNumber": 172 }, "signature": [ { @@ -11745,19 +11806,19 @@ }, { "tags": [], - "id": "def-common.RegistryStream.[RegistryStreamKeys.template_path]", + "id": "def-common.RegistryStream.RegistryStreamKeys.template_path", "type": "string", "label": "[RegistryStreamKeys.template_path]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 169 + "lineNumber": 173 } } ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 163 + "lineNumber": 167 }, "initialIsOpen": false }, @@ -11770,24 +11831,24 @@ "children": [ { "tags": [], - "id": "def-common.RegistryVarsEntry.[RegistryVarsEntryKeys.name]", + "id": "def-common.RegistryVarsEntry.RegistryVarsEntryKeys.name", "type": "string", "label": "[RegistryVarsEntryKeys.name]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 294 + "lineNumber": 298 } }, { "tags": [], - "id": "def-common.RegistryVarsEntry.[RegistryVarsEntryKeys.title]", + "id": "def-common.RegistryVarsEntry.RegistryVarsEntryKeys.title", "type": "string", "label": "[RegistryVarsEntryKeys.title]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 295 + "lineNumber": 299 }, "signature": [ "string | undefined" @@ -11795,13 +11856,13 @@ }, { "tags": [], - "id": "def-common.RegistryVarsEntry.[RegistryVarsEntryKeys.description]", + "id": "def-common.RegistryVarsEntry.RegistryVarsEntryKeys.description", "type": "string", "label": "[RegistryVarsEntryKeys.description]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 296 + "lineNumber": 300 }, "signature": [ "string | undefined" @@ -11809,13 +11870,13 @@ }, { "tags": [], - "id": "def-common.RegistryVarsEntry.[RegistryVarsEntryKeys.type]", + "id": "def-common.RegistryVarsEntry.RegistryVarsEntryKeys.type", "type": "CompoundType", "label": "[RegistryVarsEntryKeys.type]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 297 + "lineNumber": 301 }, "signature": [ { @@ -11829,13 +11890,13 @@ }, { "tags": [], - "id": "def-common.RegistryVarsEntry.[RegistryVarsEntryKeys.required]", + "id": "def-common.RegistryVarsEntry.RegistryVarsEntryKeys.required", "type": "CompoundType", "label": "[RegistryVarsEntryKeys.required]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 298 + "lineNumber": 302 }, "signature": [ "boolean | undefined" @@ -11843,13 +11904,13 @@ }, { "tags": [], - "id": "def-common.RegistryVarsEntry.[RegistryVarsEntryKeys.show_user]", + "id": "def-common.RegistryVarsEntry.RegistryVarsEntryKeys.show_user", "type": "CompoundType", "label": "[RegistryVarsEntryKeys.show_user]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 299 + "lineNumber": 303 }, "signature": [ "boolean | undefined" @@ -11857,13 +11918,13 @@ }, { "tags": [], - "id": "def-common.RegistryVarsEntry.[RegistryVarsEntryKeys.multi]", + "id": "def-common.RegistryVarsEntry.RegistryVarsEntryKeys.multi", "type": "CompoundType", "label": "[RegistryVarsEntryKeys.multi]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 300 + "lineNumber": 304 }, "signature": [ "boolean | undefined" @@ -11871,13 +11932,13 @@ }, { "tags": [], - "id": "def-common.RegistryVarsEntry.[RegistryVarsEntryKeys.default]", + "id": "def-common.RegistryVarsEntry.RegistryVarsEntryKeys.default", "type": "CompoundType", "label": "[RegistryVarsEntryKeys.default]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 301 + "lineNumber": 305 }, "signature": [ "string | string[] | undefined" @@ -11885,13 +11946,13 @@ }, { "tags": [], - "id": "def-common.RegistryVarsEntry.[RegistryVarsEntryKeys.os]", + "id": "def-common.RegistryVarsEntry.RegistryVarsEntryKeys.os", "type": "Object", "label": "[RegistryVarsEntryKeys.os]", "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 302 + "lineNumber": 306 }, "signature": [ "{ [key: string]: { default: string | string[]; }; } | undefined" @@ -11900,7 +11961,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 293 + "lineNumber": 297 }, "initialIsOpen": false }, @@ -11919,13 +11980,13 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 175 + "lineNumber": 179 } } ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 174 + "lineNumber": 178 }, "initialIsOpen": false }, @@ -11961,13 +12022,13 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/settings.ts", - "lineNumber": 17 + "lineNumber": 19 } } ], "source": { "path": "x-pack/plugins/fleet/common/types/models/settings.ts", - "lineNumber": 16 + "lineNumber": 18 }, "initialIsOpen": false }, @@ -11999,7 +12060,7 @@ "children": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/settings.ts", - "lineNumber": 20 + "lineNumber": 22 }, "initialIsOpen": false }, @@ -12018,7 +12079,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 395 + "lineNumber": 399 } }, { @@ -12029,7 +12090,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 396 + "lineNumber": 400 }, "signature": [ { @@ -12044,7 +12105,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 394 + "lineNumber": 398 }, "initialIsOpen": false }, @@ -12097,7 +12158,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 206 + "lineNumber": 211 }, "signature": [ "{ agentId: string; }" @@ -12111,7 +12172,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 209 + "lineNumber": 214 }, "signature": [ "{ user_provided_metadata: Record; }" @@ -12120,7 +12181,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 205 + "lineNumber": 210 }, "initialIsOpen": false }, @@ -12179,7 +12240,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 67 + "lineNumber": 71 }, "initialIsOpen": false }, @@ -12215,7 +12276,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 58 + "lineNumber": 60 }, "initialIsOpen": false }, @@ -12227,7 +12288,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 242 + "lineNumber": 246 }, "initialIsOpen": false }, @@ -12239,7 +12300,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 136 + "lineNumber": 140 }, "initialIsOpen": false }, @@ -12251,7 +12312,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 120 + "lineNumber": 124 }, "initialIsOpen": false }, @@ -12263,7 +12324,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 154 + "lineNumber": 158 }, "initialIsOpen": false }, @@ -12275,7 +12336,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 278 + "lineNumber": 282 }, "initialIsOpen": false } @@ -12646,10 +12707,10 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", - "lineNumber": 36 + "lineNumber": 37 }, "signature": [ - "{ status: ValueOf<{ readonly Active: \"active\"; readonly Inactive: \"inactive\"; }>; description?: string | undefined; name: string; updated_at: string; namespace: string; is_default?: boolean | undefined; updated_by: string; revision: number; package_policies: string[] | PackagePolicy[]; is_managed: boolean; is_default_fleet_server?: boolean | undefined; monitoring_enabled?: (\"metrics\" | \"logs\")[] | undefined; }" + "{ status: ValueOf<{ readonly Active: \"active\"; readonly Inactive: \"inactive\"; }>; description?: string | undefined; name: string; updated_at: string; namespace: string; is_default?: boolean | undefined; updated_by: string; revision: number; package_policies: string[] | PackagePolicy[]; is_managed: boolean; is_default_fleet_server?: boolean | undefined; monitoring_enabled?: (\"metrics\" | \"logs\")[] | undefined; preconfiguration_id?: string | undefined; }" ], "initialIsOpen": false }, @@ -12736,10 +12797,10 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 80 + "lineNumber": 84 }, "signature": [ - "PackageSpecManifest & Pick" + "PackageSpecManifest & Pick" ], "initialIsOpen": false }, @@ -12751,7 +12812,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 358 + "lineNumber": 362 }, "signature": [ { @@ -12795,7 +12856,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 220 + "lineNumber": 224 }, "signature": [ "Record<\"kibana\", Record> & Record<\"elasticsearch\", Record>" @@ -12864,7 +12925,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 219 + "lineNumber": 223 }, "signature": [ "Record & Record" @@ -12908,7 +12969,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 204 + "lineNumber": 208 }, "signature": [ "string" @@ -12923,7 +12984,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 203 + "lineNumber": 207 }, "signature": [ "CategorySummaryItem[]" @@ -12950,7 +13011,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 76 + "lineNumber": 80 }, "signature": [ "{ readonly Logs: \"logs\"; readonly Metrics: \"metrics\"; }" @@ -12980,7 +13041,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 373 + "lineNumber": 377 }, "signature": [ "{ readonly System: \"system\"; readonly Endpoint: \"endpoint\"; readonly ElasticAgent: \"elastic_agent\"; }" @@ -13013,7 +13074,7 @@ "lineNumber": 38 }, "signature": [ - "\"custom\" | \"overview\" | \"policies\" | \"settings\"" + "\"custom\" | \"settings\" | \"overview\" | \"policies\"" ], "initialIsOpen": false }, @@ -13025,7 +13086,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 231 + "lineNumber": 235 }, "signature": [ "AssetParts & { service: Extract; type: ElasticsearchAssetType; }" @@ -13040,7 +13101,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 237 + "lineNumber": 241 }, "signature": [ "{ component_template: ElasticsearchAssetParts[]; ingest_pipeline: ElasticsearchAssetParts[]; index_template: ElasticsearchAssetParts[]; ilm_policy: ElasticsearchAssetParts[]; transform: ElasticsearchAssetParts[]; data_stream_ilm_policy: ElasticsearchAssetParts[]; }" @@ -13127,7 +13188,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 363 + "lineNumber": 367 }, "signature": [ "Pick & { type: ElasticsearchAssetType; }" @@ -13239,6 +13300,29 @@ ], "initialIsOpen": false }, + { + "id": "def-common.InputsOverride", + "type": "Type", + "label": "InputsOverride", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/types/models/preconfiguration.ts", + "lineNumber": 15 + }, + "signature": [ + "Partial & { vars?: (Record & { name: string; })[] | undefined; }" + ], + "initialIsOpen": false + }, { "tags": [], "id": "def-common.INSTALL_SCRIPT_API_ROUTES", @@ -13259,7 +13343,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 347 + "lineNumber": 351 }, "signature": [ { @@ -13289,7 +13373,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 78 + "lineNumber": 82 }, "signature": [ { @@ -13333,7 +13417,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 349 + "lineNumber": 353 }, "signature": [ "T & { status: InstallationStatus['Installed']; savedObject: SavedObject; }" @@ -13378,7 +13462,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 226 + "lineNumber": 230 }, "signature": [ "AssetParts & { service: Extract; type: KibanaAssetType; }" @@ -13393,7 +13477,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 360 + "lineNumber": 364 }, "signature": [ "Pick & { type: KibanaSavedObjectType; }" @@ -13408,10 +13492,10 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 236 + "lineNumber": 240 }, "signature": [ - "{ dashboard: KibanaAssetParts[]; visualization: KibanaAssetParts[]; search: KibanaAssetParts[]; index_pattern: KibanaAssetParts[]; map: KibanaAssetParts[]; lens: KibanaAssetParts[]; }" + "{ dashboard: KibanaAssetParts[]; visualization: KibanaAssetParts[]; search: KibanaAssetParts[]; index_pattern: KibanaAssetParts[]; map: KibanaAssetParts[]; lens: KibanaAssetParts[]; security_rule: KibanaAssetParts[]; ml_module: KibanaAssetParts[]; }" ], "initialIsOpen": false }, @@ -13453,7 +13537,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 354 + "lineNumber": 358 }, "signature": [ "T & { status: InstallationStatus['NotInstalled']; }" @@ -13555,7 +13639,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 367 + "lineNumber": 371 }, "signature": [ "Pick & { type: typeof ASSETS_SAVED_OBJECT_TYPE; }" @@ -13570,7 +13654,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 326 + "lineNumber": 330 }, "signature": [ { @@ -13623,10 +13707,10 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 322 + "lineNumber": 326 }, "signature": [ - "Installable>[]" + "Installable>[]" ], "initialIsOpen": false }, @@ -13638,7 +13722,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 324 + "lineNumber": 328 }, "signature": [ { @@ -13656,7 +13740,7 @@ "section": "def-common.RegistryPackage", "text": "RegistryPackage" }, - ", \"type\" | \"description\" | \"title\" | \"name\" | \"version\" | \"path\" | \"download\" | \"data_streams\" | \"release\" | \"icons\" | \"policy_templates\" | \"internal\">> | ", + ", \"type\" | \"description\" | \"title\" | \"name\" | \"version\" | \"path\" | \"download\" | \"internal\" | \"data_streams\" | \"release\" | \"icons\" | \"policy_templates\">> | ", { "pluginId": "fleet", "scope": "common", @@ -13672,7 +13756,7 @@ "section": "def-common.RegistryPackage", "text": "RegistryPackage" }, - ", \"type\" | \"description\" | \"title\" | \"name\" | \"version\" | \"path\" | \"download\" | \"data_streams\" | \"release\" | \"icons\" | \"policy_templates\" | \"internal\">>" + ", \"type\" | \"description\" | \"title\" | \"name\" | \"version\" | \"path\" | \"download\" | \"internal\" | \"data_streams\" | \"release\" | \"icons\" | \"policy_templates\">>" ], "initialIsOpen": false }, @@ -13729,7 +13813,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 325 + "lineNumber": 329 }, "signature": [ "{ installed: PackageList; not_installed: PackageList; }" @@ -13747,7 +13831,7 @@ "lineNumber": 28 }, "signature": [ - "\"custom\" | \"security\" | \"monitoring\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"support\" | \"ticketing\" | \"version_control\" | \"web\"" + "\"custom\" | \"security\" | \"monitoring\" | \"cloud\" | \"network\" | \"aws\" | \"azure\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"notification\" | \"os_system\" | \"productivity\" | \"support\" | \"ticketing\" | \"version_control\" | \"web\"" ], "initialIsOpen": false }, @@ -13789,7 +13873,22 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 173 + "lineNumber": 178 + }, + "signature": [ + "{ [x: string]: { success: boolean; error?: string | undefined; }; }" + ], + "initialIsOpen": false + }, + { + "id": "def-common.PostBulkAgentUnenrollResponse", + "type": "Type", + "label": "PostBulkAgentUnenrollResponse", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", + "lineNumber": 124 }, "signature": [ "{ [x: string]: { success: boolean; error?: string | undefined; }; }" @@ -13804,7 +13903,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/rest_spec/agent.ts", - "lineNumber": 145 + "lineNumber": 150 }, "signature": [ "{ [x: string]: { success: boolean; error?: string | undefined; }; }" @@ -13819,7 +13918,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 84 + "lineNumber": 88 }, "signature": [ "PackageSpecManifest & Partial> & RegistryAdditionalProperties & RegistryOverridePropertyValue" @@ -13834,7 +13933,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 111 + "lineNumber": 115 }, "signature": [ "\"experimental\" | \"beta\" | \"ga\"" @@ -13849,10 +13948,10 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 183 + "lineNumber": 187 }, "signature": [ - "{ type?: \"integration\" | undefined; description: string; title: string; name: string; version: string; path: string; download: string; data_streams?: RegistryDataStream[] | undefined; release: \"experimental\" | \"beta\" | \"ga\"; icons?: (", + "{ type?: \"integration\" | undefined; description: string; title: string; name: string; version: string; path: string; download: string; internal?: boolean | undefined; data_streams?: RegistryDataStream[] | undefined; release: \"experimental\" | \"beta\" | \"ga\"; icons?: (", { "pluginId": "fleet", "scope": "common", @@ -13860,7 +13959,7 @@ "section": "def-common.PackageSpecIcon", "text": "PackageSpecIcon" }, - "[] & RegistryImage[]) | undefined; policy_templates?: RegistryPolicyTemplate[] | undefined; internal?: boolean | undefined; }" + "[] & RegistryImage[]) | undefined; policy_templates?: RegistryPolicyTemplate[] | undefined; }" ], "initialIsOpen": false }, @@ -13872,10 +13971,10 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 181 + "lineNumber": 185 }, "signature": [ - "Pick[]" + "Pick[]" ], "initialIsOpen": false }, @@ -13887,7 +13986,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 277 + "lineNumber": 281 }, "signature": [ "\"string\" | \"text\" | \"password\" | \"integer\" | \"bool\" | \"yaml\"" @@ -13902,7 +14001,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 371 + "lineNumber": 375 }, "signature": [ "{ readonly System: \"system\"; readonly Endpoint: \"endpoint\"; readonly ElasticAgent: \"elastic_agent\"; }" @@ -13917,7 +14016,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 211 + "lineNumber": 215 }, "signature": [ "undefined | Record<\"kibana\", { version: string; }>" @@ -13932,7 +14031,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 172 + "lineNumber": 176 }, "signature": [ "string" @@ -13947,7 +14046,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 173 + "lineNumber": 177 }, "signature": [ "string" @@ -13962,7 +14061,7 @@ "description": [], "source": { "path": "x-pack/plugins/fleet/common/types/models/epm.ts", - "lineNumber": 199 + "lineNumber": 203 }, "signature": [ { @@ -14095,7 +14194,7 @@ ], "source": { "path": "x-pack/plugins/fleet/common/types/index.ts", - "lineNumber": 44 + "lineNumber": 47 }, "signature": [ "T[keyof T]" @@ -14484,6 +14583,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentPolicyRouteService.getInfoPath.$1", "type": "string", "label": "agentPolicyId", "isRequired": true, @@ -14530,6 +14630,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentPolicyRouteService.getUpdatePath.$1", "type": "string", "label": "agentPolicyId", "isRequired": true, @@ -14560,6 +14661,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentPolicyRouteService.getCopyPath.$1", "type": "string", "label": "agentPolicyId", "isRequired": true, @@ -14606,6 +14708,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentPolicyRouteService.getInfoFullPath.$1", "type": "string", "label": "agentPolicyId", "isRequired": true, @@ -14636,6 +14739,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentPolicyRouteService.getInfoFullDownloadPath.$1", "type": "string", "label": "agentPolicyId", "isRequired": true, @@ -14695,6 +14799,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentRouteService.getInfoPath.$1", "type": "string", "label": "agentId", "isRequired": true, @@ -14725,6 +14830,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentRouteService.getUpdatePath.$1", "type": "string", "label": "agentId", "isRequired": true, @@ -14755,6 +14861,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentRouteService.getEventsPath.$1", "type": "string", "label": "agentId", "isRequired": true, @@ -14785,6 +14892,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentRouteService.getUnenrollPath.$1", "type": "string", "label": "agentId", "isRequired": true, @@ -14831,6 +14939,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentRouteService.getReassignPath.$1", "type": "string", "label": "agentId", "isRequired": true, @@ -14877,6 +14986,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentRouteService.getUpgradePath.$1", "type": "string", "label": "agentId", "isRequired": true, @@ -14955,6 +15065,7 @@ "type": "Function", "children": [ { + "id": "def-common.agentRouteService.getCreateActionPath.$1", "type": "string", "label": "agentId", "isRequired": true, @@ -15596,6 +15707,7 @@ "type": "Function", "children": [ { + "id": "def-common.enrollmentAPIKeyRouteService.getInfoPath.$1", "type": "string", "label": "keyId", "isRequired": true, @@ -15626,6 +15738,7 @@ "type": "Function", "children": [ { + "id": "def-common.enrollmentAPIKeyRouteService.getDeletePath.$1", "type": "string", "label": "keyId", "isRequired": true, @@ -15842,6 +15955,7 @@ "type": "Function", "children": [ { + "id": "def-common.epmRouteService.getInfoPath.$1", "type": "string", "label": "pkgkey", "isRequired": true, @@ -15872,6 +15986,7 @@ "type": "Function", "children": [ { + "id": "def-common.epmRouteService.getStatsPath.$1", "type": "string", "label": "pkgName", "isRequired": true, @@ -15902,6 +16017,7 @@ "type": "Function", "children": [ { + "id": "def-common.epmRouteService.getFilePath.$1", "type": "string", "label": "filePath", "isRequired": true, @@ -15932,6 +16048,7 @@ "type": "Function", "children": [ { + "id": "def-common.epmRouteService.getInstallPath.$1", "type": "string", "label": "pkgkey", "isRequired": true, @@ -15978,6 +16095,7 @@ "type": "Function", "children": [ { + "id": "def-common.epmRouteService.getRemovePath.$1", "type": "string", "label": "pkgkey", "isRequired": true, @@ -16130,6 +16248,7 @@ "type": "Function", "children": [ { + "id": "def-common.outputRoutesService.getInfoPath.$1", "type": "string", "label": "outputId", "isRequired": true, @@ -16160,6 +16279,7 @@ "type": "Function", "children": [ { + "id": "def-common.outputRoutesService.getUpdatePath.$1", "type": "string", "label": "outputId", "isRequired": true, @@ -16320,6 +16440,7 @@ "type": "Function", "children": [ { + "id": "def-common.packagePolicyRouteService.getInfoPath.$1", "type": "string", "label": "packagePolicyId", "isRequired": true, @@ -16366,6 +16487,7 @@ "type": "Function", "children": [ { + "id": "def-common.packagePolicyRouteService.getUpdatePath.$1", "type": "string", "label": "packagePolicyId", "isRequired": true, @@ -16416,6 +16538,31 @@ }, "initialIsOpen": false }, + { + "id": "def-common.PRECONFIGURATION_API_ROUTES", + "type": "Object", + "tags": [], + "children": [ + { + "tags": [], + "id": "def-common.PRECONFIGURATION_API_ROUTES.PUT_PRECONFIG", + "type": "string", + "label": "PUT_PRECONFIG", + "description": [], + "source": { + "path": "x-pack/plugins/fleet/common/constants/routes.ts", + "lineNumber": 125 + } + } + ], + "description": [], + "label": "PRECONFIGURATION_API_ROUTES", + "source": { + "path": "x-pack/plugins/fleet/common/constants/routes.ts", + "lineNumber": 124 + }, + "initialIsOpen": false + }, { "tags": [], "id": "def-common.requiredPackages", diff --git a/api_docs/global_search.json b/api_docs/global_search.json index 0cb40be77a7ae..25bdddff95616 100644 --- a/api_docs/global_search.json +++ b/api_docs/global_search.json @@ -28,13 +28,7 @@ "lineNumber": 89 }, "signature": [ - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchResult", - "text": "GlobalSearchResult" - }, + "GlobalSearchResult", "[]" ] } @@ -296,13 +290,7 @@ "lineNumber": 62 }, "signature": [ - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchProviderResultUrl", - "text": "GlobalSearchProviderResultUrl" - } + "GlobalSearchProviderResultUrl" ] }, { @@ -332,13 +320,7 @@ }, "signature": [ "Record | undefined" ] } @@ -377,31 +359,13 @@ "label": "find", "signature": [ "(search: ", - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchFindParams", - "text": "GlobalSearchFindParams" - }, + "GlobalSearchFindParams", ", options: ", - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchProviderFindOptions", - "text": "GlobalSearchProviderFindOptions" - }, + "GlobalSearchProviderFindOptions", ") => ", "Observable", "<", - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchProviderResult", - "text": "GlobalSearchProviderResult" - }, + "GlobalSearchProviderResult", "[]>" ], "description": [ @@ -409,17 +373,12 @@ ], "children": [ { + "id": "def-public.GlobalSearchResultProvider.find.$1", "type": "Object", "label": "search", "isRequired": true, "signature": [ - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchFindParams", - "text": "GlobalSearchFindParams" - } + "GlobalSearchFindParams" ], "description": [], "source": { @@ -428,17 +387,12 @@ } }, { + "id": "def-public.GlobalSearchResultProvider.find.$2", "type": "Object", "label": "options", "isRequired": true, "signature": [ - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchProviderFindOptions", - "text": "GlobalSearchProviderFindOptions" - } + "GlobalSearchProviderFindOptions" ], "description": [], "source": { @@ -606,13 +560,7 @@ "lineNumber": 89 }, "signature": [ - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchResult", - "text": "GlobalSearchResult" - }, + "GlobalSearchResult", "[]" ] } @@ -704,7 +652,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">; typeRegistry: Pick<", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">; typeRegistry: Pick<", { "pluginId": "core", "scope": "server", @@ -875,13 +823,7 @@ "lineNumber": 62 }, "signature": [ - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchProviderResultUrl", - "text": "GlobalSearchProviderResultUrl" - } + "GlobalSearchProviderResultUrl" ] }, { @@ -911,13 +853,7 @@ }, "signature": [ "Record | undefined" ] } @@ -958,21 +894,9 @@ "label": "find", "signature": [ "(search: ", - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchFindParams", - "text": "GlobalSearchFindParams" - }, + "GlobalSearchFindParams", ", options: ", - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchProviderFindOptions", - "text": "GlobalSearchProviderFindOptions" - }, + "GlobalSearchProviderFindOptions", ", context: ", { "pluginId": "globalSearch", @@ -984,30 +908,19 @@ ") => ", "Observable", "<", - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchProviderResult", - "text": "GlobalSearchProviderResult" - } + "GlobalSearchProviderResult" ], "description": [ "\nMethod that should return an observable used to emit new results from the provider.\n\nSee {@GlobalSearchProviderResult | the result type} for the expected result structure.\n" ], "children": [ { + "id": "def-server.GlobalSearchResultProvider.find.$1", "type": "Object", "label": "search", "isRequired": true, "signature": [ - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchFindParams", - "text": "GlobalSearchFindParams" - } + "GlobalSearchFindParams" ], "description": [], "source": { @@ -1016,17 +929,12 @@ } }, { + "id": "def-server.GlobalSearchResultProvider.find.$2", "type": "Object", "label": "options", "isRequired": true, "signature": [ - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchProviderFindOptions", - "text": "GlobalSearchProviderFindOptions" - } + "GlobalSearchProviderFindOptions" ], "description": [], "source": { @@ -1035,6 +943,7 @@ } }, { + "id": "def-server.GlobalSearchResultProvider.find.$3", "type": "Object", "label": "context", "isRequired": true, @@ -1109,13 +1018,7 @@ "label": "find", "signature": [ "(params: ", - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchFindParams", - "text": "GlobalSearchFindParams" - }, + "GlobalSearchFindParams", ", options: ", { "pluginId": "globalSearch", @@ -1127,13 +1030,7 @@ ") => ", "Observable", "<", - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchBatchedResults", - "text": "GlobalSearchBatchedResults" - }, + "GlobalSearchBatchedResults", ">" ], "description": [ @@ -1141,17 +1038,12 @@ ], "children": [ { + "id": "def-server.RouteHandlerGlobalSearchContext.find.$1", "type": "Object", "label": "params", "isRequired": true, "signature": [ - { - "pluginId": "globalSearch", - "scope": "common", - "docId": "kibGlobalSearchPluginApi", - "section": "def-common.GlobalSearchFindParams", - "text": "GlobalSearchFindParams" - } + "GlobalSearchFindParams" ], "description": [], "source": { @@ -1160,6 +1052,7 @@ } }, { + "id": "def-server.RouteHandlerGlobalSearchContext.find.$2", "type": "Object", "label": "options", "isRequired": true, diff --git a/api_docs/home.json b/api_docs/home.json index 9f2c7929503d1..4e9ab0466f91e 100644 --- a/api_docs/home.json +++ b/api_docs/home.json @@ -15,6 +15,7 @@ ], "children": [ { + "id": "def-public.getDisplayText.$1", "type": "CompoundType", "label": "id", "isRequired": true, @@ -889,13 +890,7 @@ "lineNumber": 179 }, "signature": [ - { - "pluginId": "home", - "scope": "public", - "docId": "kibHomePluginApi", - "section": "def-public.FeatureCatalogueRegistry", - "text": "FeatureCatalogueRegistry" - } + "FeatureCatalogueRegistry" ] } ], @@ -943,13 +938,7 @@ "lineNumber": 63 }, "signature": [ - { - "pluginId": "home", - "scope": "server", - "docId": "kibHomePluginApi", - "section": "def-server.DashboardSchema", - "text": "DashboardSchema" - }, + "DashboardSchema", "[]" ] }, @@ -1285,13 +1274,7 @@ "text": "TutorialProvider" }, ") => void; addScopedTutorialContextFactory: (scopedTutorialContextFactory: ", - { - "pluginId": "home", - "scope": "server", - "docId": "kibHomePluginApi", - "section": "def-server.ScopedTutorialContextFactory", - "text": "ScopedTutorialContextFactory" - }, + "ScopedTutorialContextFactory", ") => void; }" ] }, @@ -1315,37 +1298,13 @@ "text": "SampleDatasetProvider" }, ") => void; getSampleDatasets: () => ", - { - "pluginId": "home", - "scope": "server", - "docId": "kibHomePluginApi", - "section": "def-server.SampleDatasetSchema", - "text": "SampleDatasetSchema" - }, + "SampleDatasetSchema", "[]; addSavedObjectsToSampleDataset: (id: string, savedObjects: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "[]) => void; addAppLinksToSampleDataset: (id: string, appLinks: ", - { - "pluginId": "home", - "scope": "server", - "docId": "kibHomePluginApi", - "section": "def-server.AppLinkSchema", - "text": "AppLinkSchema" - }, + "AppLinkSchema", "[]) => void; replacePanelInSampleDatasetDashboard: ({ sampleDataId, dashboardId, oldEmbeddableId, embeddableId, embeddableType, embeddableConfig, }: ", - { - "pluginId": "home", - "scope": "server", - "docId": "kibHomePluginApi", - "section": "def-server.SampleDatasetDashboardPanel", - "text": "SampleDatasetDashboardPanel" - } + "SampleDatasetDashboardPanel" ] } ], diff --git a/api_docs/index_management.json b/api_docs/index_management.json index 6c66a94bf59f5..cea9783521373 100644 --- a/api_docs/index_management.json +++ b/api_docs/index_management.json @@ -8,6 +8,7 @@ "type": "Function", "children": [ { + "id": "def-public.getIndexListUri.$1", "type": "string", "label": "filter", "isRequired": false, @@ -21,6 +22,7 @@ } }, { + "id": "def-public.getIndexListUri.$2", "type": "CompoundType", "label": "includeHiddenIndices", "isRequired": false, @@ -228,13 +230,7 @@ "lineNumber": 14 }, "signature": [ - { - "pluginId": "indexManagement", - "scope": "public", - "docId": "kibIndexManagementPluginApi", - "section": "def-public.ExtensionsSetup", - "text": "ExtensionsSetup" - } + "ExtensionsSetup" ] } ], @@ -648,13 +644,7 @@ }, "signature": [ "{ add: (enricher: ", - { - "pluginId": "indexManagement", - "scope": "server", - "docId": "kibIndexManagementPluginApi", - "section": "def-server.Enricher", - "text": "Enricher" - }, + "Enricher", ") => void; }" ] } @@ -675,6 +665,7 @@ "type": "Function", "children": [ { + "id": "def-common.getTemplateParameter.$1", "type": "CompoundType", "label": "template", "isRequired": true, @@ -702,6 +693,7 @@ } }, { + "id": "def-common.getTemplateParameter.$2", "type": "CompoundType", "label": "setting", "isRequired": true, @@ -1280,13 +1272,7 @@ "lineNumber": 33 }, "signature": [ - { - "pluginId": "indexManagement", - "scope": "common", - "docId": "kibIndexManagementPluginApi", - "section": "def-common.DataStreamIndexFromEs", - "text": "DataStreamIndexFromEs" - }, + "DataStreamIndexFromEs", "[]" ] }, @@ -1326,13 +1312,7 @@ "lineNumber": 36 }, "signature": [ - { - "pluginId": "indexManagement", - "scope": "common", - "docId": "kibIndexManagementPluginApi", - "section": "def-common.HealthFromEs", - "text": "HealthFromEs" - } + "HealthFromEs" ] }, { diff --git a/api_docs/index_pattern_field_editor.json b/api_docs/index_pattern_field_editor.json index f2ff1bea4733d..00d77023c0410 100644 --- a/api_docs/index_pattern_field_editor.json +++ b/api_docs/index_pattern_field_editor.json @@ -45,13 +45,7 @@ "lineNumber": 76 }, "signature": [ - { - "pluginId": "indexPatternFieldEditor", - "scope": "public", - "docId": "kibIndexPatternFieldEditorPluginApi", - "section": "def-public.FormatEditorState", - "text": "FormatEditorState" - }, + "FormatEditorState", " & S" ] }, @@ -73,17 +67,12 @@ "description": [], "children": [ { + "id": "def-public.DefaultFormatEditor.getDerivedStateFromProps.$1", "type": "Object", "label": "nextProps", "isRequired": true, "signature": [ - { - "pluginId": "indexPatternFieldEditor", - "scope": "public", - "docId": "kibIndexPatternFieldEditorPluginApi", - "section": "def-public.FormatEditorProps", - "text": "FormatEditorProps" - }, + "FormatEditorProps", "<{}>" ], "description": [], @@ -93,17 +82,12 @@ } }, { + "id": "def-public.DefaultFormatEditor.getDerivedStateFromProps.$2", "type": "Object", "label": "state", "isRequired": true, "signature": [ - { - "pluginId": "indexPatternFieldEditor", - "scope": "public", - "docId": "kibIndexPatternFieldEditorPluginApi", - "section": "def-public.FormatEditorState", - "text": "FormatEditorState" - } + "FormatEditorState" ], "description": [], "source": { @@ -124,6 +108,7 @@ "type": "Function", "children": [ { + "id": "def-public.DefaultFormatEditor.onChange.$1", "type": "Object", "label": "newParams", "isRequired": true, @@ -215,13 +200,7 @@ "lineNumber": 33 }, "signature": [ - { - "pluginId": "indexPatternFieldEditor", - "scope": "public", - "docId": "kibIndexPatternFieldEditorPluginApi", - "section": "def-public.InternalFieldType", - "text": "InternalFieldType" - } + "InternalFieldType" ] }, { @@ -418,6 +397,7 @@ "description": [], "children": [ { + "id": "def-public.PluginStart.openEditor.$1", "type": "Object", "label": "options", "isRequired": true, @@ -462,6 +442,7 @@ "description": [], "children": [ { + "id": "def-public.PluginStart.openDeleteModal.$1", "type": "Object", "label": "options", "isRequired": true, @@ -544,13 +525,7 @@ }, "signature": [ "React.FunctionComponent<", - { - "pluginId": "indexPatternFieldEditor", - "scope": "public", - "docId": "kibIndexPatternFieldEditorPluginApi", - "section": "def-public.Props", - "text": "Props" - }, + "Props", ">" ] } diff --git a/api_docs/index_pattern_management.json b/api_docs/index_pattern_management.json index 8a1a9bbdf10bb..4ce56a42df205 100644 --- a/api_docs/index_pattern_management.json +++ b/api_docs/index_pattern_management.json @@ -94,7 +94,7 @@ "description": [], "children": [ { - "id": "def-public.IndexPatternCreationConfig.Unnamed.{\n- type = undefined,\n name = indexPatternTypeName,\n showSystemIndices = true,\n httpClient = null,\n isBeta = false,\n }", + "id": "def-public.IndexPatternCreationConfig.Unnamed.$1.typeundefinednameindexPatternTypeNameshowSystemIndicestruehttpClientnullisBetafalse", "type": "Object", "label": "{\n type = undefined,\n name = indexPatternTypeName,\n showSystemIndices = true,\n httpClient = null,\n isBeta = false,\n }", "tags": [], @@ -102,7 +102,7 @@ "children": [ { "tags": [], - "id": "def-public.IndexPatternCreationConfig.Unnamed.{\n- type = undefined,\n name = indexPatternTypeName,\n showSystemIndices = true,\n httpClient = null,\n isBeta = false,\n }.type", + "id": "def-public.IndexPatternCreationConfig.Unnamed.$1.typeundefinednameindexPatternTypeNameshowSystemIndicestruehttpClientnullisBetafalse.type", "type": "string", "label": "type", "description": [], @@ -116,7 +116,7 @@ }, { "tags": [], - "id": "def-public.IndexPatternCreationConfig.Unnamed.{\n- type = undefined,\n name = indexPatternTypeName,\n showSystemIndices = true,\n httpClient = null,\n isBeta = false,\n }.name", + "id": "def-public.IndexPatternCreationConfig.Unnamed.$1.typeundefinednameindexPatternTypeNameshowSystemIndicestruehttpClientnullisBetafalse.name", "type": "string", "label": "name", "description": [], @@ -130,7 +130,7 @@ }, { "tags": [], - "id": "def-public.IndexPatternCreationConfig.Unnamed.{\n- type = undefined,\n name = indexPatternTypeName,\n showSystemIndices = true,\n httpClient = null,\n isBeta = false,\n }.showSystemIndices", + "id": "def-public.IndexPatternCreationConfig.Unnamed.$1.typeundefinednameindexPatternTypeNameshowSystemIndicestruehttpClientnullisBetafalse.showSystemIndices", "type": "CompoundType", "label": "showSystemIndices", "description": [], @@ -144,7 +144,7 @@ }, { "tags": [], - "id": "def-public.IndexPatternCreationConfig.Unnamed.{\n- type = undefined,\n name = indexPatternTypeName,\n showSystemIndices = true,\n httpClient = null,\n isBeta = false,\n }.httpClient", + "id": "def-public.IndexPatternCreationConfig.Unnamed.$1.typeundefinednameindexPatternTypeNameshowSystemIndicestruehttpClientnullisBetafalse.httpClient", "type": "CompoundType", "label": "httpClient", "description": [], @@ -158,7 +158,7 @@ }, { "tags": [], - "id": "def-public.IndexPatternCreationConfig.Unnamed.{\n- type = undefined,\n name = indexPatternTypeName,\n showSystemIndices = true,\n httpClient = null,\n isBeta = false,\n }.isBeta", + "id": "def-public.IndexPatternCreationConfig.Unnamed.$1.typeundefinednameindexPatternTypeNameshowSystemIndicestruehttpClientnullisBetafalse.isBeta", "type": "CompoundType", "label": "isBeta", "description": [], @@ -190,13 +190,7 @@ "label": "getIndexPatternCreationOption", "signature": [ "(urlHandler: ", - { - "pluginId": "indexPatternManagement", - "scope": "public", - "docId": "kibIndexPatternManagementPluginApi", - "section": "def-public.UrlHandler", - "text": "UrlHandler" - }, + "UrlHandler", ") => ", { "pluginId": "indexPatternManagement", @@ -209,17 +203,12 @@ "description": [], "children": [ { + "id": "def-public.IndexPatternCreationConfig.getIndexPatternCreationOption.$1", "type": "Function", "label": "urlHandler", "isRequired": true, "signature": [ - { - "pluginId": "indexPatternManagement", - "scope": "public", - "docId": "kibIndexPatternManagementPluginApi", - "section": "def-public.UrlHandler", - "text": "UrlHandler" - } + "UrlHandler" ], "description": [], "source": { @@ -309,6 +298,7 @@ "description": [], "children": [ { + "id": "def-public.IndexPatternCreationConfig.getIndexTags.$1", "type": "string", "label": "indexName", "isRequired": true, @@ -335,29 +325,18 @@ "label": "checkIndicesForErrors", "signature": [ "(indices: ", - { - "pluginId": "indexPatternManagement", - "scope": "public", - "docId": "kibIndexPatternManagementPluginApi", - "section": "def-public.MatchedItem", - "text": "MatchedItem" - }, + "MatchedItem", "[]) => undefined" ], "description": [], "children": [ { + "id": "def-public.IndexPatternCreationConfig.checkIndicesForErrors.$1", "type": "Array", "label": "indices", "isRequired": true, "signature": [ - { - "pluginId": "indexPatternManagement", - "scope": "public", - "docId": "kibIndexPatternManagementPluginApi", - "section": "def-public.MatchedItem", - "text": "MatchedItem" - }, + "MatchedItem", "[]" ], "description": [], @@ -480,18 +459,13 @@ "text": "IIndexPattern" }, ">, isDefault: boolean) => ", - { - "pluginId": "indexPatternManagement", - "scope": "public", - "docId": "kibIndexPatternManagementPluginApi", - "section": "def-public.IndexPatternTag", - "text": "IndexPatternTag" - }, + "IndexPatternTag", "[]" ], "description": [], "children": [ { + "id": "def-public.IndexPatternListConfig.getIndexPatternTags.$1", "type": "CompoundType", "label": "indexPattern", "isRequired": true, @@ -528,6 +502,7 @@ } }, { + "id": "def-public.IndexPatternListConfig.getIndexPatternTags.$2", "type": "boolean", "label": "isDefault", "isRequired": true, @@ -574,6 +549,7 @@ "description": [], "children": [ { + "id": "def-public.IndexPatternListConfig.getFieldInfo.$1", "type": "Object", "label": "indexPattern", "isRequired": true, @@ -593,6 +569,7 @@ } }, { + "id": "def-public.IndexPatternListConfig.getFieldInfo.$2", "type": "Object", "label": "field", "isRequired": true, @@ -637,6 +614,7 @@ "description": [], "children": [ { + "id": "def-public.IndexPatternListConfig.areScriptedFieldsEnabled.$1", "type": "Object", "label": "indexPattern", "isRequired": true, diff --git a/api_docs/infra.json b/api_docs/infra.json index 9d64df881fc52..a9511cd9a7c80 100644 --- a/api_docs/infra.json +++ b/api_docs/infra.json @@ -8,18 +8,13 @@ "type": "Function", "children": [ { + "id": "def-public.LazyLogStreamWrapper.$1", "type": "CompoundType", "label": "props", "isRequired": true, "signature": [ "React.PropsWithChildren<", - { - "pluginId": "infra", - "scope": "public", - "docId": "kibInfraPluginApi", - "section": "def-public.LogStreamProps", - "text": "LogStreamProps" - }, + "LogStreamProps", ">" ], "description": [], @@ -198,10 +193,10 @@ "description": [], "source": { "path": "x-pack/plugins/infra/server/plugin.ts", - "lineNumber": 65 + "lineNumber": 64 }, "signature": [ - "{ readonly sources?: Readonly<{ default?: Readonly<{ fields?: Readonly<{ host?: string | undefined; message?: string[] | undefined; timestamp?: string | undefined; tiebreaker?: string | undefined; container?: string | undefined; pod?: string | undefined; } & {}> | undefined; logAlias?: string | undefined; metricAlias?: string | undefined; } & {}> | undefined; } & {}> | undefined; readonly enabled: boolean; readonly query: Readonly<{} & { partitionSize: number; partitionFactor: number; }>; }" + "{ readonly sources?: Readonly<{ default?: Readonly<{ fields?: Readonly<{ host?: string | undefined; message?: string[] | undefined; timestamp?: string | undefined; container?: string | undefined; tiebreaker?: string | undefined; pod?: string | undefined; } & {}> | undefined; logAlias?: string | undefined; metricAlias?: string | undefined; } & {}> | undefined; } & {}> | undefined; readonly enabled: boolean; readonly inventory: Readonly<{} & { compositeSize: number; }>; }" ], "initialIsOpen": false } @@ -222,24 +217,18 @@ "description": [], "source": { "path": "x-pack/plugins/infra/server/plugin.ts", - "lineNumber": 76 + "lineNumber": 75 }, "signature": [ "(sourceId: string, sourceProperties: ", - { - "pluginId": "infra", - "scope": "common", - "docId": "kibInfraPluginApi", - "section": "def-common.InfraStaticSourceConfiguration", - "text": "InfraStaticSourceConfiguration" - }, + "InfraStaticSourceConfiguration", ") => void" ] } ], "source": { "path": "x-pack/plugins/infra/server/plugin.ts", - "lineNumber": 75 + "lineNumber": 74 }, "lifecycle": "setup", "initialIsOpen": true diff --git a/api_docs/ingest_pipelines.json b/api_docs/ingest_pipelines.json index 79fe652cf4dbf..27ca7ff70a436 100644 --- a/api_docs/ingest_pipelines.json +++ b/api_docs/ingest_pipelines.json @@ -37,6 +37,7 @@ "description": [], "children": [ { + "id": "def-public.IngestPipelinesUrlGenerator.Unnamed.$1", "type": "Function", "label": "getAppBasePath", "isRequired": true, @@ -76,6 +77,7 @@ "type": "Function", "children": [ { + "id": "def-public.IngestPipelinesUrlGenerator.createUrl.$1", "type": "CompoundType", "label": "state", "isRequired": true, diff --git a/api_docs/inspector.json b/api_docs/inspector.json index 2d42ec9fbff8b..051541f2f4ac0 100644 --- a/api_docs/inspector.json +++ b/api_docs/inspector.json @@ -54,13 +54,7 @@ "lineNumber": 55 }, "signature": [ - { - "pluginId": "inspector", - "scope": "public", - "docId": "kibInspectorPluginApi", - "section": "def-public.InspectorViewRegistry", - "text": "InspectorViewRegistry" - }, + "InspectorViewRegistry", " | undefined" ] }, @@ -74,6 +68,7 @@ "description": [], "children": [ { + "id": "def-public.InspectorPublicPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -123,18 +118,13 @@ "text": "InspectorViewDescription" }, ") => void; __LEGACY: { views: ", - { - "pluginId": "inspector", - "scope": "public", - "docId": "kibInspectorPluginApi", - "section": "def-public.InspectorViewRegistry", - "text": "InspectorViewRegistry" - }, + "InspectorViewRegistry", "; }; }" ], "description": [], "children": [ { + "id": "def-public.InspectorPublicPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -211,6 +201,7 @@ "description": [], "children": [ { + "id": "def-public.InspectorPublicPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -304,13 +295,7 @@ "label": "start", "signature": [ "(name: string, params?: ", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.RequestParams", - "text": "RequestParams" - }, + "RequestParams", ") => ", { "pluginId": "inspector", @@ -325,6 +310,7 @@ ], "children": [ { + "id": "def-public.RequestAdapter.start.$1", "type": "string", "label": "name", "isRequired": true, @@ -340,17 +326,12 @@ } }, { + "id": "def-public.RequestAdapter.start.$2", "type": "Object", "label": "params", "isRequired": true, "signature": [ - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.RequestParams", - "text": "RequestParams" - } + "RequestParams" ], "description": [], "source": { @@ -396,6 +377,7 @@ "description": [], "children": [ { + "id": "def-public.RequestAdapter.resetRequest.$1", "type": "string", "label": "id", "isRequired": true, @@ -422,13 +404,7 @@ "label": "getRequests", "signature": [ "() => ", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Request", - "text": "Request" - }, + "Request", "[]" ], "description": [], @@ -466,17 +442,12 @@ "description": [], "children": [ { + "id": "def-public.RequestResponder.Unnamed.$1", "type": "Object", "label": "request", "isRequired": true, "signature": [ - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Request", - "text": "Request" - } + "Request" ], "description": [], "source": { @@ -485,6 +456,7 @@ } }, { + "id": "def-public.RequestResponder.Unnamed.$2", "type": "Function", "label": "onChange", "isRequired": true, @@ -522,6 +494,7 @@ "description": [], "children": [ { + "id": "def-public.RequestResponder.json.$1", "type": "Uncategorized", "label": "reqJson", "isRequired": true, @@ -567,6 +540,7 @@ "description": [], "children": [ { + "id": "def-public.RequestResponder.stats.$1", "type": "Object", "label": "stats", "isRequired": true, @@ -607,18 +581,13 @@ "text": "RequestStatus" }, ", response: ", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - }, + "Response", ") => void" ], "description": [], "children": [ { + "id": "def-public.RequestResponder.finish.$1", "type": "Enum", "label": "status", "isRequired": true, @@ -638,17 +607,12 @@ } }, { + "id": "def-public.RequestResponder.finish.$2", "type": "Object", "label": "response", "isRequired": true, "signature": [ - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - } + "Response" ], "description": [], "source": { @@ -670,29 +634,18 @@ "label": "ok", "signature": [ "(response: ", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - }, + "Response", ") => void" ], "description": [], "children": [ { + "id": "def-public.RequestResponder.ok.$1", "type": "Object", "label": "response", "isRequired": true, "signature": [ - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - } + "Response" ], "description": [], "source": { @@ -714,29 +667,18 @@ "label": "error", "signature": [ "(response: ", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - }, + "Response", ") => void" ], "description": [], "children": [ { + "id": "def-public.RequestResponder.error.$1", "type": "Object", "label": "response", "isRequired": true, "signature": [ - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - } + "Response" ], "description": [], "source": { @@ -1196,13 +1138,7 @@ }, "signature": [ "{ views: ", - { - "pluginId": "inspector", - "scope": "public", - "docId": "kibInspectorPluginApi", - "section": "def-public.InspectorViewRegistry", - "text": "InspectorViewRegistry" - }, + "InspectorViewRegistry", "; }" ] } @@ -1350,13 +1286,7 @@ "label": "start", "signature": [ "(name: string, params?: ", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.RequestParams", - "text": "RequestParams" - }, + "RequestParams", ") => ", { "pluginId": "inspector", @@ -1371,6 +1301,7 @@ ], "children": [ { + "id": "def-common.RequestAdapter.start.$1", "type": "string", "label": "name", "isRequired": true, @@ -1386,17 +1317,12 @@ } }, { + "id": "def-common.RequestAdapter.start.$2", "type": "Object", "label": "params", "isRequired": true, "signature": [ - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.RequestParams", - "text": "RequestParams" - } + "RequestParams" ], "description": [], "source": { @@ -1442,6 +1368,7 @@ "description": [], "children": [ { + "id": "def-common.RequestAdapter.resetRequest.$1", "type": "string", "label": "id", "isRequired": true, @@ -1468,13 +1395,7 @@ "label": "getRequests", "signature": [ "() => ", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Request", - "text": "Request" - }, + "Request", "[]" ], "description": [], @@ -1512,17 +1433,12 @@ "description": [], "children": [ { + "id": "def-common.RequestResponder.Unnamed.$1", "type": "Object", "label": "request", "isRequired": true, "signature": [ - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Request", - "text": "Request" - } + "Request" ], "description": [], "source": { @@ -1531,6 +1447,7 @@ } }, { + "id": "def-common.RequestResponder.Unnamed.$2", "type": "Function", "label": "onChange", "isRequired": true, @@ -1568,6 +1485,7 @@ "description": [], "children": [ { + "id": "def-common.RequestResponder.json.$1", "type": "Uncategorized", "label": "reqJson", "isRequired": true, @@ -1613,6 +1531,7 @@ "description": [], "children": [ { + "id": "def-common.RequestResponder.stats.$1", "type": "Object", "label": "stats", "isRequired": true, @@ -1653,18 +1572,13 @@ "text": "RequestStatus" }, ", response: ", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - }, + "Response", ") => void" ], "description": [], "children": [ { + "id": "def-common.RequestResponder.finish.$1", "type": "Enum", "label": "status", "isRequired": true, @@ -1684,17 +1598,12 @@ } }, { + "id": "def-common.RequestResponder.finish.$2", "type": "Object", "label": "response", "isRequired": true, "signature": [ - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - } + "Response" ], "description": [], "source": { @@ -1716,29 +1625,18 @@ "label": "ok", "signature": [ "(response: ", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - }, + "Response", ") => void" ], "description": [], "children": [ { + "id": "def-common.RequestResponder.ok.$1", "type": "Object", "label": "response", "isRequired": true, "signature": [ - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - } + "Response" ], "description": [], "source": { @@ -1760,29 +1658,18 @@ "label": "error", "signature": [ "(response: ", - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - }, + "Response", ") => void" ], "description": [], "children": [ { + "id": "def-common.RequestResponder.error.$1", "type": "Object", "label": "response", "isRequired": true, "signature": [ - { - "pluginId": "inspector", - "scope": "common", - "docId": "kibInspectorPluginApi", - "section": "def-common.Response", - "text": "Response" - } + "Response" ], "description": [], "source": { diff --git a/api_docs/kibana_legacy.json b/api_docs/kibana_legacy.json index f86d9eb480e59..2e4b8be78dcf3 100644 --- a/api_docs/kibana_legacy.json +++ b/api_docs/kibana_legacy.json @@ -19,6 +19,7 @@ "description": [], "children": [ { + "id": "def-public.KibanaLegacyPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -60,18 +61,13 @@ "text": "CoreSetup" }, "<{}, { dashboardConfig: ", - { - "pluginId": "kibanaLegacy", - "scope": "public", - "docId": "kibKibanaLegacyPluginApi", - "section": "def-public.DashboardConfig", - "text": "DashboardConfig" - }, + "DashboardConfig", "; loadFontAwesome: () => Promise; config: Readonly<{} & { defaultAppId: string; }>; }>) => {}" ], "description": [], "children": [ { + "id": "def-public.KibanaLegacyPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -84,13 +80,7 @@ "text": "CoreSetup" }, "<{}, { dashboardConfig: ", - { - "pluginId": "kibanaLegacy", - "scope": "public", - "docId": "kibKibanaLegacyPluginApi", - "section": "def-public.DashboardConfig", - "text": "DashboardConfig" - }, + "DashboardConfig", "; loadFontAwesome: () => Promise; config: Readonly<{} & { defaultAppId: string; }>; }>" ], "description": [], @@ -121,18 +111,13 @@ "text": "CoreStart" }, ") => { dashboardConfig: ", - { - "pluginId": "kibanaLegacy", - "scope": "public", - "docId": "kibKibanaLegacyPluginApi", - "section": "def-public.DashboardConfig", - "text": "DashboardConfig" - }, + "DashboardConfig", "; loadFontAwesome: () => Promise; config: Readonly<{} & { defaultAppId: string; }>; }" ], "description": [], "children": [ { + "id": "def-public.KibanaLegacyPlugin.start.$1", "type": "Object", "label": "{ application, http: { basePath }, uiSettings }", "isRequired": true, @@ -204,6 +189,7 @@ "description": [], "children": [ { + "id": "def-public.ToastNotifications.Unnamed.$1", "type": "Object", "label": "toasts", "isRequired": true, @@ -237,6 +223,7 @@ "type": "Function", "children": [ { + "id": "def-public.ToastNotifications.onChange.$1", "type": "Function", "label": "callback", "isRequired": true, @@ -267,6 +254,7 @@ "type": "Function", "children": [ { + "id": "def-public.ToastNotifications.add.$1", "type": "CompoundType", "label": "toastOrTitle", "isRequired": true, @@ -318,6 +306,7 @@ "type": "Function", "children": [ { + "id": "def-public.ToastNotifications.remove.$1", "type": "CompoundType", "label": "toast", "isRequired": true, @@ -362,6 +351,7 @@ "type": "Function", "children": [ { + "id": "def-public.ToastNotifications.addSuccess.$1", "type": "CompoundType", "label": "toastOrTitle", "isRequired": true, @@ -413,6 +403,7 @@ "type": "Function", "children": [ { + "id": "def-public.ToastNotifications.addWarning.$1", "type": "CompoundType", "label": "toastOrTitle", "isRequired": true, @@ -464,6 +455,7 @@ "type": "Function", "children": [ { + "id": "def-public.ToastNotifications.addDanger.$1", "type": "CompoundType", "label": "toastOrTitle", "isRequired": true, @@ -515,6 +507,7 @@ "type": "Function", "children": [ { + "id": "def-public.ToastNotifications.addError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -528,6 +521,7 @@ } }, { + "id": "def-public.ToastNotifications.addError.$2", "type": "Object", "label": "options", "isRequired": true, @@ -588,6 +582,7 @@ "type": "Function", "children": [ { + "id": "def-public.$setupXsrfRequestInterceptor.$1", "type": "string", "label": "version", "isRequired": true, @@ -640,6 +635,7 @@ "description": [], "children": [ { + "id": "def-public.addFatalError.$1", "type": "Object", "label": "fatalErrors", "isRequired": true, @@ -659,6 +655,7 @@ } }, { + "id": "def-public.addFatalError.$2", "type": "CompoundType", "label": "error", "isRequired": true, @@ -679,6 +676,7 @@ } }, { + "id": "def-public.addFatalError.$3", "type": "string", "label": "location", "isRequired": false, @@ -712,6 +710,7 @@ ], "children": [ { + "id": "def-public.addSystemApiHeader.$1", "type": "Object", "label": "originalHeaders", "isRequired": true, @@ -744,6 +743,7 @@ "type": "Function", "children": [ { + "id": "def-public.configureAppAngularModule.$1", "type": "Object", "label": "angularModule", "isRequired": true, @@ -757,7 +757,7 @@ } }, { - "id": "def-public.configureAppAngularModule.newPlatform", + "id": "def-public.configureAppAngularModule.$2.newPlatform", "type": "Object", "label": "newPlatform", "tags": [], @@ -765,7 +765,7 @@ "children": [ { "tags": [], - "id": "def-public.configureAppAngularModule.newPlatform.core", + "id": "def-public.configureAppAngularModule.$2.newPlatform.core", "type": "Object", "label": "core", "description": [], @@ -785,7 +785,7 @@ }, { "tags": [], - "id": "def-public.configureAppAngularModule.newPlatform.env", + "id": "def-public.configureAppAngularModule.$2.newPlatform.env", "type": "Object", "label": "env", "description": [], @@ -808,6 +808,7 @@ } }, { + "id": "def-public.configureAppAngularModule.$3", "type": "boolean", "label": "isLocalAngular", "isRequired": true, @@ -821,6 +822,7 @@ } }, { + "id": "def-public.configureAppAngularModule.$4", "type": "Function", "label": "getHistory", "isRequired": false, @@ -896,6 +898,7 @@ "description": [], "children": [ { + "id": "def-public.formatAngularHttpError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -928,6 +931,7 @@ "type": "Function", "children": [ { + "id": "def-public.formatESMsg.$1", "type": "CompoundType", "label": "err", "isRequired": true, @@ -968,6 +972,7 @@ ], "children": [ { + "id": "def-public.formatMsg.$1", "type": "CompoundType", "label": "err", "isRequired": true, @@ -981,6 +986,7 @@ } }, { + "id": "def-public.formatMsg.$2", "type": "string", "label": "source", "isRequired": true, @@ -1014,6 +1020,7 @@ "description": [], "children": [ { + "id": "def-public.formatStack.$1", "type": "Object", "label": "err", "isRequired": true, @@ -1060,6 +1067,7 @@ "description": [], "children": [ { + "id": "def-public.isAngularHttpError.$1", "type": "Any", "label": "error", "isRequired": true, @@ -1093,6 +1101,7 @@ ], "children": [ { + "id": "def-public.isSystemApiRequest.$1", "type": "Object", "label": "request", "isRequired": true, @@ -1130,6 +1139,7 @@ "description": [], "children": [ { + "id": "def-public.loadKbnTopNavDirectives.$1", "type": "Unknown", "label": "navUi", "isRequired": true, @@ -1178,6 +1188,7 @@ "description": [], "children": [ { + "id": "def-public.PaginateDirectiveProvider.$1", "type": "Any", "label": "$parse", "isRequired": true, @@ -1191,6 +1202,7 @@ } }, { + "id": "def-public.PaginateDirectiveProvider.$2", "type": "Any", "label": "$compile", "isRequired": true, @@ -1239,6 +1251,7 @@ "description": [], "children": [ { + "id": "def-public.PromiseServiceCreator.$1", "type": "Unknown", "label": "$q", "isRequired": true, @@ -1252,6 +1265,7 @@ } }, { + "id": "def-public.PromiseServiceCreator.$2", "type": "Unknown", "label": "$timeout", "isRequired": true, @@ -1283,6 +1297,7 @@ "description": [], "children": [ { + "id": "def-public.registerListenEventListener.$1", "type": "Unknown", "label": "$rootScope", "isRequired": true, @@ -1325,6 +1340,7 @@ ], "children": [ { + "id": "def-public.subscribeWithScope.$1", "type": "Object", "label": "$scope", "isRequired": true, @@ -1338,6 +1354,7 @@ } }, { + "id": "def-public.subscribeWithScope.$2", "type": "Object", "label": "observable", "isRequired": true, @@ -1352,6 +1369,7 @@ } }, { + "id": "def-public.subscribeWithScope.$3", "type": "CompoundType", "label": "observer", "isRequired": false, @@ -1370,6 +1388,7 @@ } }, { + "id": "def-public.subscribeWithScope.$4", "type": "Function", "label": "fatalError", "isRequired": false, @@ -1401,6 +1420,7 @@ "description": [], "children": [ { + "id": "def-public.watchMultiDecorator.$1", "type": "Unknown", "label": "$provide", "isRequired": true, diff --git a/api_docs/kibana_react.json b/api_docs/kibana_react.json index 79ea4b3f66132..1085cf8f14bbd 100644 --- a/api_docs/kibana_react.json +++ b/api_docs/kibana_react.json @@ -45,6 +45,7 @@ "description": [], "children": [ { + "id": "def-public.TableListView.Unnamed.$1", "type": "Object", "label": "props", "isRequired": true, @@ -207,7 +208,7 @@ "description": [], "children": [ { - "id": "def-public.TableListView.setFilter.{-queryText }", + "id": "def-public.TableListView.setFilter.$1.queryText", "type": "Object", "label": "{ queryText }", "tags": [], @@ -215,7 +216,7 @@ "children": [ { "tags": [], - "id": "def-public.TableListView.setFilter.{-queryText }.queryText", + "id": "def-public.TableListView.setFilter.$1.queryText.queryText", "type": "string", "label": "queryText", "description": [], @@ -302,22 +303,6 @@ "lineNumber": 319 } }, - { - "id": "def-public.TableListView.renderNoItemsMessage", - "type": "Function", - "label": "renderNoItemsMessage", - "signature": [ - "() => JSX.Element" - ], - "description": [], - "children": [], - "tags": [], - "returnComment": [], - "source": { - "path": "src/plugins/kibana_react/public/table_list_view/table_list_view.tsx", - "lineNumber": 350 - } - }, { "id": "def-public.TableListView.renderToolsLeft", "type": "Function", @@ -331,7 +316,7 @@ "returnComment": [], "source": { "path": "src/plugins/kibana_react/public/table_list_view/table_list_view.tsx", - "lineNumber": 364 + "lineNumber": 350 } }, { @@ -347,7 +332,7 @@ "returnComment": [], "source": { "path": "src/plugins/kibana_react/public/table_list_view/table_list_view.tsx", - "lineNumber": 395 + "lineNumber": 381 } }, { @@ -363,7 +348,7 @@ "returnComment": [], "source": { "path": "src/plugins/kibana_react/public/table_list_view/table_list_view.tsx", - "lineNumber": 475 + "lineNumber": 461 } }, { @@ -379,7 +364,7 @@ "returnComment": [], "source": { "path": "src/plugins/kibana_react/public/table_list_view/table_list_view.tsx", - "lineNumber": 483 + "lineNumber": 468 } }, { @@ -395,7 +380,7 @@ "returnComment": [], "source": { "path": "src/plugins/kibana_react/public/table_list_view/table_list_view.tsx", - "lineNumber": 528 + "lineNumber": 513 } }, { @@ -411,7 +396,7 @@ "returnComment": [], "source": { "path": "src/plugins/kibana_react/public/table_list_view/table_list_view.tsx", - "lineNumber": 540 + "lineNumber": 525 } } ], @@ -511,6 +496,7 @@ "description": [], "children": [ { + "id": "def-public.ValidatedDualRange.getDerivedStateFromProps.$1", "type": "Object", "label": "nextProps", "isRequired": true, @@ -524,6 +510,7 @@ } }, { + "id": "def-public.ValidatedDualRange.getDerivedStateFromProps.$2", "type": "Object", "label": "prevState", "isRequired": true, @@ -561,6 +548,7 @@ "type": "Function", "children": [ { + "id": "def-public.ValidatedDualRange._onChange.$1", "type": "Object", "label": "value", "isRequired": true, @@ -616,18 +604,13 @@ "type": "Function", "children": [ { + "id": "def-public.CodeEditor.$1", "type": "CompoundType", "label": "props", "isRequired": true, "signature": [ "React.PropsWithChildren<", - { - "pluginId": "kibanaReact", - "scope": "public", - "docId": "kibKibanaReactPluginApi", - "section": "def-public.Props", - "text": "Props" - }, + "Props", ">" ], "description": [], @@ -657,6 +640,7 @@ "type": "Function", "children": [ { + "id": "def-public.createKibanaReactContext.$1", "type": "Uncategorized", "label": "services", "isRequired": true, @@ -704,6 +688,7 @@ "type": "Function", "children": [ { + "id": "def-public.createNotifications.$1", "type": "Object", "label": "services", "isRequired": true, @@ -758,6 +743,7 @@ "type": "Function", "children": [ { + "id": "def-public.createReactOverlays.$1", "type": "Object", "label": "services", "isRequired": true, @@ -825,6 +811,7 @@ "description": [], "children": [ { + "id": "def-public.FieldButton.$1", "type": "Object", "label": "{\n size = 'm',\n isActive = false,\n fieldIcon,\n fieldName,\n fieldInfoIcon,\n fieldAction,\n className,\n isDraggable = false,\n onClick,\n dataTestSubj,\n buttonProps,\n ...rest\n}", "isRequired": true, @@ -872,6 +859,7 @@ ], "children": [ { + "id": "def-public.FieldIcon.$1", "type": "Object", "label": "{\n type,\n label,\n size = 's',\n scripted,\n className,\n ...rest\n}", "isRequired": true, @@ -919,17 +907,12 @@ "type": "Function", "children": [ { + "id": "def-public.Markdown.$1", "type": "Object", "label": "props", "isRequired": true, "signature": [ - { - "pluginId": "kibanaReact", - "scope": "public", - "docId": "kibKibanaReactPluginApi", - "section": "def-public.MarkdownProps", - "text": "MarkdownProps" - } + "MarkdownProps" ], "description": [], "source": { @@ -958,17 +941,12 @@ "type": "Function", "children": [ { + "id": "def-public.MarkdownSimple.$1", "type": "Object", "label": "props", "isRequired": true, "signature": [ - { - "pluginId": "kibanaReact", - "scope": "public", - "docId": "kibKibanaReactPluginApi", - "section": "def-public.MarkdownSimpleProps", - "text": "MarkdownSimpleProps" - } + "MarkdownSimpleProps" ], "description": [], "source": { @@ -997,6 +975,7 @@ "type": "Function", "children": [ { + "id": "def-public.MountPointPortal.$1", "type": "CompoundType", "label": "{ children, setMountPoint }", "isRequired": true, @@ -1030,6 +1009,7 @@ "type": "Function", "children": [ { + "id": "def-public.OverviewPageFooter.$1", "type": "CompoundType", "label": "{\n addBasePath,\n path,\n onSetDefaultRoute,\n onChangeDefaultRoute,\n}", "isRequired": true, @@ -1061,6 +1041,7 @@ "type": "Function", "children": [ { + "id": "def-public.OverviewPageHeader.$1", "type": "CompoundType", "label": "{\n hideToolbar,\n iconType,\n overlap,\n showDevToolsLink,\n showManagementLink,\n title,\n addBasePath,\n}", "isRequired": true, @@ -1099,17 +1080,12 @@ "description": [], "children": [ { + "id": "def-public.Panel.$1", "type": "Object", "label": "{ children, className, initialWidth = 100, style = {} }", "isRequired": true, "signature": [ - { - "pluginId": "kibanaReact", - "scope": "public", - "docId": "kibKibanaReactPluginApi", - "section": "def-public.Props", - "text": "Props" - } + "Props" ], "description": [], "source": { @@ -1138,17 +1114,12 @@ "description": [], "children": [ { + "id": "def-public.PanelsContainer.$1", "type": "Object", "label": "{\n children,\n className,\n onPanelWidthChange,\n resizerClassName,\n}", "isRequired": true, "signature": [ - { - "pluginId": "kibanaReact", - "scope": "public", - "docId": "kibKibanaReactPluginApi", - "section": "def-public.Props", - "text": "Props" - } + "Props" ], "description": [], "source": { @@ -1170,6 +1141,7 @@ "type": "Function", "children": [ { + "id": "def-public.reactRouterNavigate.$1", "type": "CompoundType", "label": "history", "isRequired": true, @@ -1192,6 +1164,7 @@ } }, { + "id": "def-public.reactRouterNavigate.$2", "type": "CompoundType", "label": "to", "isRequired": true, @@ -1205,6 +1178,7 @@ } }, { + "id": "def-public.reactRouterNavigate.$3", "type": "Object", "label": "onClickCallback", "isRequired": false, @@ -1246,6 +1220,7 @@ "type": "Function", "children": [ { + "id": "def-public.reactRouterOnClickHandler.$1", "type": "CompoundType", "label": "history", "isRequired": true, @@ -1268,6 +1243,7 @@ } }, { + "id": "def-public.reactRouterOnClickHandler.$2", "type": "CompoundType", "label": "to", "isRequired": true, @@ -1281,6 +1257,7 @@ } }, { + "id": "def-public.reactRouterOnClickHandler.$3", "type": "Object", "label": "onClickCallback", "isRequired": false, @@ -1322,6 +1299,7 @@ "type": "Function", "children": [ { + "id": "def-public.reactToUiComponent.$1", "type": "CompoundType", "label": "ReactComp", "isRequired": true, @@ -1363,6 +1341,7 @@ "type": "Function", "children": [ { + "id": "def-public.RedirectAppLinks.$1", "type": "CompoundType", "label": "{\n application,\n children,\n className,\n ...otherProps\n}", "isRequired": true, @@ -1396,6 +1375,7 @@ "type": "Function", "children": [ { + "id": "def-public.toMountPoint.$1", "type": "CompoundType", "label": "node", "isRequired": false, @@ -1437,6 +1417,7 @@ "type": "Function", "children": [ { + "id": "def-public.ToolbarButton.$1", "type": "CompoundType", "label": "{\n children,\n className,\n fontWeight = 'normal',\n size = 'm',\n hasArrow = true,\n groupPosition = 'none',\n dataTestSubj = '',\n ...rest\n}", "isRequired": true, @@ -1484,6 +1465,7 @@ "type": "Function", "children": [ { + "id": "def-public.uiToReactComponent.$1", "type": "Function", "label": "Comp", "isRequired": true, @@ -1504,6 +1486,7 @@ } }, { + "id": "def-public.uiToReactComponent.$2", "type": "string", "label": "as", "isRequired": true, @@ -1545,6 +1528,7 @@ "type": "Function", "children": [ { + "id": "def-public.UrlTemplateEditor.$1", "type": "CompoundType", "label": "{\n height = 105,\n value,\n variables,\n onChange,\n onEditor,\n Editor = CodeEditor,\n}", "isRequired": true, @@ -1625,6 +1609,7 @@ "type": "Function", "children": [ { + "id": "def-public.UseKibana.$1", "type": "CompoundType", "label": "{ children }", "isRequired": true, @@ -1672,6 +1657,7 @@ "type": "Function", "children": [ { + "id": "def-public.useUiSetting.$1", "type": "string", "label": "key", "isRequired": true, @@ -1685,6 +1671,7 @@ } }, { + "id": "def-public.useUiSetting.$2", "type": "Uncategorized", "label": "defaultValue", "isRequired": false, @@ -1718,6 +1705,7 @@ "type": "Function", "children": [ { + "id": "def-public.useUiSetting$.$1", "type": "string", "label": "key", "isRequired": true, @@ -1731,6 +1719,7 @@ } }, { + "id": "def-public.useUiSetting$.$2", "type": "Uncategorized", "label": "defaultValue", "isRequired": false, @@ -1764,6 +1753,7 @@ "type": "Function", "children": [ { + "id": "def-public.withKibana.$1", "type": "CompoundType", "label": "type", "isRequired": true, @@ -2417,6 +2407,7 @@ "description": [], "children": [ { + "id": "def-public.TableListViewProps.deleteItems.$1", "type": "Array", "label": "items", "isRequired": true, @@ -2447,6 +2438,7 @@ "description": [], "children": [ { + "id": "def-public.TableListViewProps.editItem.$1", "type": "Uncategorized", "label": "item", "isRequired": true, @@ -2499,6 +2491,7 @@ "description": [], "children": [ { + "id": "def-public.TableListViewProps.findItems.$1", "type": "string", "label": "query", "isRequired": true, @@ -2768,13 +2761,7 @@ "lineNumber": 75 }, "signature": [ - { - "pluginId": "core", - "scope": "public", - "docId": "kibCoreHttpPluginApi", - "section": "def-public.HttpFetchError", - "text": "HttpFetchError" - }, + "HttpFetchError", " | undefined" ] }, @@ -3014,21 +3001,9 @@ }, "signature": [ "React.FunctionComponent<", - { - "pluginId": "kibanaReact", - "scope": "public", - "docId": "kibKibanaReactPluginApi", - "section": "def-public.Props", - "text": "Props" - }, + "Props", "> | React.ComponentClass<", - { - "pluginId": "kibanaReact", - "scope": "public", - "docId": "kibKibanaReactPluginApi", - "section": "def-public.Props", - "text": "Props" - }, + "Props", ", any> | undefined" ] } @@ -3825,6 +3800,7 @@ "type": "Function", "children": [ { + "id": "def-common.EuiThemeProvider.$1", "type": "CompoundType", "label": "{\n darkMode = false,\n ...otherProps\n}", "isRequired": true, @@ -3939,7 +3915,7 @@ "lineNumber": 17 }, "signature": [ - "{ paddingSizes: { xs: string; s: string; m: string; l: string; xl: string; }; avatarSizing: { s: { size: string; 'font-size': string; }; m: { size: string; 'font-size': string; }; l: { size: string; 'font-size': string; }; xl: { size: string; 'font-size': string; }; }; euiBadgeGroupGutterTypes: { gutterExtraSmall: string; gutterSmall: string; }; euiBreadcrumbSpacing: string; euiBreadcrumbTruncateWidth: string; euiButtonEmptyTypes: { primary: string; danger: string; disabled: string; ghost: string; text: string; success: string; warning: string; }; euiButtonIconTypes: { accent: string; danger: string; disabled: string; ghost: string; primary: string; subdued: string; success: string; text: string; warning: string; }; euiCallOutTypes: { primary: string; success: string; warning: string; danger: string; }; euiCardSpacing: string; euiCardBottomNodeHeight: string; euiCardSelectButtonBorders: { text: string; primary: string; success: string; danger: string; ghost: string; }; euiCardSelectButtonBackgrounds: { text: string; primary: string; success: string; danger: string; ghost: string; }; euiCardPaddingModifiers: { paddingNone: number; paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiCollapsibleNavWidth: string; euiCollapsibleNavGroupLightBackgroundColor: string; euiCollapsibleNavGroupDarkBackgroundColor: string; euiCollapsibleNavGroupDarkHighContrastColor: string; euiColorPickerValueRange0: string; euiColorPickerValueRange1: string; euiColorPickerSaturationRange0: string; euiColorPickerSaturationRange1: string; euiColorPickerIndicatorSize: string; euiColorPickerWidth: string; euiColorPaletteDisplaySizes: { sizeExtraSmall: string; sizeSmall: string; sizeMedium: string; }; euiContextMenuWidth: string; euiControlBarBackground: string; euiControlBarText: string; euiControlBarBorderColor: string; euiControlBarInitialHeight: string; euiControlBarMaxHeight: string; euiControlBarHeights: { s: string; m: string; l: string; }; euiDataGridPrefix: string; euiDataGridStyles: string; euiDataGridColumnResizerWidth: string; euiDataGridPopoverMaxHeight: string; euiDataGridCellPaddingS: string; euiDataGridCellPaddingM: string; euiDataGridCellPaddingL: string; euiDataGridVerticalBorder: string; euiDatePickerCalendarWidth: string; euiSuperDatePickerWidth: string; euiSuperDatePickerButtonWidth: string; euiDragAndDropSpacing: { s: string; m: string; l: string; }; euiExpressionColors: { subdued: string; primary: string; secondary: string; warning: string; danger: string; accent: string; }; euiFacetGutterSizes: { gutterNone: number; gutterSmall: string; gutterMedium: string; gutterLarge: string; }; gutterTypes: { gutterExtraSmall: string; gutterSmall: string; gutterMedium: string; gutterLarge: string; gutterExtraLarge: string; }; fractions: { fourths: { percentage: string; count: number; }; thirds: { percentage: string; count: number; }; halves: { percentage: string; count: number; }; single: { percentage: string; count: number; }; }; flyoutSizes: { small: { min: string; width: string; max: string; }; medium: { min: string; width: string; max: string; }; large: { min: string; width: string; max: string; }; }; euiFlyoutBorder: string; euiFlyoutPaddingModifiers: { paddingNone: number; paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiFilePickerTallHeight: string; euiRangeLevelColors: { primary: string; success: string; warning: string; danger: string; }; textareaResizing: { vertical: string; horizontal: string; both: string; none: string; }; euiHeaderLinksGutterSizes: { gutterXS: string; gutterS: string; gutterM: string; gutterL: string; }; ruleMargins: { marginXSmall: string; marginSmall: string; marginMedium: string; marginLarge: string; marginXLarge: string; marginXXLarge: string; }; euiIconLoadingOpacity: number; euiIconColors: { accent: string; danger: string; ghost: string; primary: string; secondary: string; success: string; subdued: string; text: string; warning: string; }; euiIconSizes: { small: string; medium: string; large: string; xLarge: string; xxLarge: string; }; euiKeyPadMenuSize: string; euiKeyPadMenuItemBetaBadgeSize: string; euiLinkColors: { subdued: string; primary: string; secondary: string; accent: string; warning: string; danger: string; text: string; ghost: string; }; euiListGroupItemHoverBackground: string; euiListGroupItemHoverBackgroundGhost: string; euiListGroupGutterTypes: { gutterSmall: string; gutterMedium: string; }; euiListGroupItemColorTypes: { primary: string; text: string; subdued: string; ghost: string; }; euiListGroupItemSizeTypes: { xSmall: string; small: string; medium: string; large: string; }; euiGradientStartStop: string; euiGradientMiddle: string; browserDefaultFontSize: string; euiMarkdownEditorMinHeight: string; euiPopoverArrowSize: string; euiPopoverTranslateDistance: string; euiProgressSizes: { xs: string; s: string; m: string; l: string; }; euiProgressColors: { primary: string; secondary: string; success: string; warning: string; danger: string; accent: string; subdued: string; vis0: string; vis1: string; vis2: string; vis3: string; vis4: string; vis5: string; vis6: string; vis7: string; vis8: string; vis9: string; customColor: string; }; euiResizableButtonTransitionSpeed: string; euiResizableButtonSize: string; euiSelectableListItemBorder: string; euiSelectableListItemPadding: string; euiSelectableTemplateSitewideTypes: { application: { color: string; 'font-weight': number; }; deployment: { color: string; 'font-weight': number; }; article: { color: string; 'font-weight': number; }; case: { color: string; 'font-weight': number; }; platform: { color: string; 'font-weight': number; }; }; spacerSizes: { xs: string; s: string; m: string; l: string; xl: string; xxl: string; }; euiStepNumberSize: string; euiStepNumberSmallSize: string; euiStepNumberMargin: string; euiStepStatusColorsToFade: { warning: string; danger: string; disabled: string; incomplete: string; }; euiSuggestItemColors: { tint0: string; tint1: string; tint2: string; tint3: string; tint4: string; tint5: string; tint6: string; tint7: string; tint8: string; tint9: string; tint10: string; }; euiTableCellContentPadding: string; euiTableCellContentPaddingCompressed: string; euiTableCellCheckboxWidth: string; euiTableActionsAreaWidth: string; euiTableHoverColor: string; euiTableSelectedColor: string; euiTableHoverSelectedColor: string; euiTableActionsBorderColor: string; euiTableHoverClickableColor: string; euiTableFocusClickableColor: string; euiTabFontSize: string; euiTabFontSizeS: string; euiTabFontSizeL: string; euiTextColors: { default: string; subdued: string; secondary: string; accent: string; warning: string; danger: string; ghost: string; }; euiTextConstrainedMaxWidth: string; euiToastWidth: string; euiToastTypes: { primary: string; success: string; warning: string; danger: string; }; euiTokenGrayColor: string; euiTokenTypes: { euiColorVis0: { graphic: string; behindText: string; }; euiColorVis1: { graphic: string; behindText: string; }; euiColorVis2: { graphic: string; behindText: string; }; euiColorVis3: { graphic: string; behindText: string; }; euiColorVis4: { graphic: string; behindText: string; }; euiColorVis5: { graphic: string; behindText: string; }; euiColorVis6: { graphic: string; behindText: string; }; euiColorVis7: { graphic: string; behindText: string; }; euiColorVis8: { graphic: string; behindText: string; }; euiColorVis9: { graphic: string; behindText: string; }; gray: { graphic: string; behindText: string; }; }; euiTokenTypeKeys: string; euiAnimSlightBounce: string; euiAnimSlightResistance: string; euiAnimSpeedExtraFast: string; euiAnimSpeedFast: string; euiAnimSpeedNormal: string; euiAnimSpeedSlow: string; euiAnimSpeedExtraSlow: string; euiBorderWidthThin: string; euiBorderWidthThick: string; euiBorderColor: string; euiBorderRadius: string; euiBorderRadiusSmall: string; euiBorderThick: string; euiBorderThin: string; euiBorderEditable: string; euiButtonHeight: string; euiButtonHeightSmall: string; euiButtonColorDisabled: string; euiButtonColorDisabledText: string; euiButtonColorGhostDisabled: string; euiButtonTypes: { primary: string; secondary: string; warning: string; danger: string; ghost: string; text: string; }; euiColorGhost: string; euiColorInk: string; euiColorPrimary: string; euiColorSecondary: string; euiColorAccent: string; euiColorSuccess: string; euiColorWarning: string; euiColorDanger: string; euiColorEmptyShade: string; euiColorLightestShade: string; euiColorLightShade: string; euiColorMediumShade: string; euiColorDarkShade: string; euiColorDarkestShade: string; euiColorFullShade: string; euiPageBackgroundColor: string; euiColorHighlight: string; euiTextColor: string; euiTitleColor: string; euiTextSubduedColor: string; euiColorDisabled: string; euiColorPrimaryText: string; euiColorSecondaryText: string; euiColorAccentText: string; euiColorWarningText: string; euiColorDangerText: string; euiColorDisabledText: string; euiColorSuccessText: string; euiLinkColor: string; euiPaletteColorBlind: { euiColorVis0: { graphic: string; behindText: string; }; euiColorVis1: { graphic: string; behindText: string; }; euiColorVis2: { graphic: string; behindText: string; }; euiColorVis3: { graphic: string; behindText: string; }; euiColorVis4: { graphic: string; behindText: string; }; euiColorVis5: { graphic: string; behindText: string; }; euiColorVis6: { graphic: string; behindText: string; }; euiColorVis7: { graphic: string; behindText: string; }; euiColorVis8: { graphic: string; behindText: string; }; euiColorVis9: { graphic: string; behindText: string; }; }; euiPaletteColorBlindKeys: string; euiColorVis0: string; euiColorVis1: string; euiColorVis2: string; euiColorVis3: string; euiColorVis4: string; euiColorVis5: string; euiColorVis6: string; euiColorVis7: string; euiColorVis8: string; euiColorVis9: string; euiColorVis0_behindText: string; euiColorVis1_behindText: string; euiColorVis2_behindText: string; euiColorVis3_behindText: string; euiColorVis4_behindText: string; euiColorVis5_behindText: string; euiColorVis6_behindText: string; euiColorVis7_behindText: string; euiColorVis8_behindText: string; euiColorVis9_behindText: string; euiColorChartLines: string; euiColorChartBand: string; euiCodeBlockBackgroundColor: string; euiCodeBlockColor: string; euiCodeBlockSelectedBackgroundColor: string; euiCodeBlockCommentColor: string; euiCodeBlockSelectorTagColor: string; euiCodeBlockStringColor: string; euiCodeBlockTagColor: string; euiCodeBlockNameColor: string; euiCodeBlockNumberColor: string; euiCodeBlockKeywordColor: string; euiCodeBlockFunctionTitleColor: string; euiCodeBlockTypeColor: string; euiCodeBlockAttributeColor: string; euiCodeBlockSymbolColor: string; euiCodeBlockParamsColor: string; euiCodeBlockMetaColor: string; euiCodeBlockTitleColor: string; euiCodeBlockSectionColor: string; euiCodeBlockAdditionColor: string; euiCodeBlockDeletionColor: string; euiCodeBlockSelectorClassColor: string; euiCodeBlockSelectorIdColor: string; euiFormMaxWidth: string; euiFormControlHeight: string; euiFormControlCompressedHeight: string; euiFormControlPadding: string; euiFormControlCompressedPadding: string; euiFormControlBorderRadius: number; euiFormControlCompressedBorderRadius: string; euiRadioSize: string; euiCheckBoxSize: string; euiCheckboxBorderRadius: string; euiSwitchHeight: string; euiSwitchWidth: string; euiSwitchThumbSize: string; euiSwitchIconHeight: string; euiSwitchHeightCompressed: string; euiSwitchWidthCompressed: string; euiSwitchThumbSizeCompressed: string; euiSwitchHeightMini: string; euiSwitchWidthMini: string; euiSwitchThumbSizeMini: string; euiFormBackgroundColor: string; euiFormBackgroundDisabledColor: string; euiFormBackgroundReadOnlyColor: string; euiFormBorderOpaqueColor: string; euiFormBorderColor: string; euiFormBorderDisabledColor: string; euiFormCustomControlDisabledIconColor: string; euiFormCustomControlBorderColor: string; euiFormControlDisabledColor: string; euiFormControlBoxShadow: string; euiFormInputGroupLabelBackground: string; euiFormInputGroupBorder: string; euiSwitchOffColor: string; euiFormControlLayoutGroupInputHeight: string; euiFormControlLayoutGroupInputCompressedHeight: string; euiFormControlLayoutGroupInputCompressedBorderRadius: string; euiRangeTrackColor: string; euiRangeThumbRadius: string; euiRangeThumbHeight: string; euiRangeThumbWidth: string; euiRangeThumbBorderColor: string; euiRangeTrackWidth: string; euiRangeTrackHeight: string; euiRangeTrackBorderWidth: number; euiRangeTrackBorderColor: string; euiRangeTrackRadius: string; euiRangeDisabledOpacity: number; euiRangeHighlightHeight: string; euiHeaderBackgroundColor: string; euiHeaderBorderColor: string; euiHeaderBreadcrumbColor: string; euiHeaderHeight: string; euiHeaderChildSize: string; euiHeaderHeightCompensation: string; euiPageDefaultMaxWidth: string; euiPanelPaddingModifiers: { paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiPanelBorderRadiusModifiers: { borderRadiusNone: number; borderRadiusMedium: string; }; euiPanelBackgroundColorModifiers: { transparent: string; plain: string; subdued: string; }; euiBreakpoints: { xs: number; s: string; m: string; l: string; xl: string; }; euiBreakpointKeys: string; euiShadowColor: string; euiShadowColorLarge: string; euiSize: string; euiSizeXS: string; euiSizeS: string; euiSizeM: string; euiSizeL: string; euiSizeXL: string; euiSizeXXL: string; euiButtonMinWidth: string; euiScrollBar: string; euiScrollBarCorner: string; euiFocusRingColor: string; euiFocusRingAnimStartColor: string; euiFocusRingAnimStartSize: string; euiFocusRingAnimStartSizeLarge: string; euiFocusRingSizeLarge: string; euiFocusRingSize: string; euiFocusTransparency: number; euiFocusBackgroundColor: string; euiTooltipBackgroundColor: string; euiTooltipAnimations: { top: string; left: string; bottom: string; right: string; }; euiFontFamily: string; euiCodeFontFamily: string; euiFontFeatureSettings: string; euiTextScale: string; euiFontSize: string; euiFontSizeXS: string; euiFontSizeS: string; euiFontSizeM: string; euiFontSizeL: string; euiFontSizeXL: string; euiFontSizeXXL: string; euiLineHeight: number; euiBodyLineHeight: number; euiFontWeightLight: number; euiFontWeightRegular: number; euiFontWeightMedium: number; euiFontWeightSemiBold: number; euiFontWeightBold: number; euiCodeFontWeightRegular: number; euiCodeFontWeightBold: number; euiTitles: { xxxs: { 'font-size': string; 'line-height': string; 'font-weight': number; }; xxs: { 'font-size': string; 'line-height': string; 'font-weight': number; }; xs: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; s: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; m: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; l: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; }; euiZLevel0: number; euiZLevel1: number; euiZLevel2: number; euiZLevel3: number; euiZLevel4: number; euiZLevel5: number; euiZLevel6: number; euiZLevel7: number; euiZLevel8: number; euiZLevel9: number; euiZContent: number; euiZHeader: number; euiZContentMenu: number; euiZFlyout: number; euiZNavigation: number; euiZMask: number; euiZModal: number; euiZToastList: number; } | { paddingSizes: { xs: string; s: string; m: string; l: string; xl: string; }; avatarSizing: { s: { size: string; 'font-size': string; }; m: { size: string; 'font-size': string; }; l: { size: string; 'font-size': string; }; xl: { size: string; 'font-size': string; }; }; euiBadgeGroupGutterTypes: { gutterExtraSmall: string; gutterSmall: string; }; euiBreadcrumbSpacing: string; euiBreadcrumbTruncateWidth: string; euiButtonEmptyTypes: { primary: string; danger: string; disabled: string; ghost: string; text: string; success: string; warning: string; }; euiButtonIconTypes: { accent: string; danger: string; disabled: string; ghost: string; primary: string; subdued: string; success: string; text: string; warning: string; }; euiCallOutTypes: { primary: string; success: string; warning: string; danger: string; }; euiCardSpacing: string; euiCardBottomNodeHeight: string; euiCardSelectButtonBorders: { text: string; primary: string; success: string; danger: string; ghost: string; }; euiCardSelectButtonBackgrounds: { text: string; primary: string; success: string; danger: string; ghost: string; }; euiCardPaddingModifiers: { paddingNone: number; paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiCollapsibleNavWidth: string; euiCollapsibleNavGroupLightBackgroundColor: string; euiCollapsibleNavGroupDarkBackgroundColor: string; euiCollapsibleNavGroupDarkHighContrastColor: string; euiColorPickerValueRange0: string; euiColorPickerValueRange1: string; euiColorPickerSaturationRange0: string; euiColorPickerSaturationRange1: string; euiColorPickerIndicatorSize: string; euiColorPickerWidth: string; euiColorPaletteDisplaySizes: { sizeExtraSmall: string; sizeSmall: string; sizeMedium: string; }; euiContextMenuWidth: string; euiControlBarBackground: string; euiControlBarText: string; euiControlBarBorderColor: string; euiControlBarInitialHeight: string; euiControlBarMaxHeight: string; euiControlBarHeights: { s: string; m: string; l: string; }; euiDataGridPrefix: string; euiDataGridStyles: string; euiDataGridColumnResizerWidth: string; euiDataGridPopoverMaxHeight: string; euiDataGridCellPaddingS: string; euiDataGridCellPaddingM: string; euiDataGridCellPaddingL: string; euiDataGridVerticalBorder: string; euiDatePickerCalendarWidth: string; euiSuperDatePickerWidth: string; euiSuperDatePickerButtonWidth: string; euiDragAndDropSpacing: { s: string; m: string; l: string; }; euiExpressionColors: { subdued: string; primary: string; secondary: string; warning: string; danger: string; accent: string; }; euiFacetGutterSizes: { gutterNone: number; gutterSmall: string; gutterMedium: string; gutterLarge: string; }; gutterTypes: { gutterExtraSmall: string; gutterSmall: string; gutterMedium: string; gutterLarge: string; gutterExtraLarge: string; }; fractions: { fourths: { percentage: string; count: number; }; thirds: { percentage: string; count: number; }; halves: { percentage: string; count: number; }; single: { percentage: string; count: number; }; }; flyoutSizes: { small: { min: string; width: string; max: string; }; medium: { min: string; width: string; max: string; }; large: { min: string; width: string; max: string; }; }; euiFlyoutBorder: string; euiFlyoutPaddingModifiers: { paddingNone: number; paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiFilePickerTallHeight: string; euiRangeLevelColors: { primary: string; success: string; warning: string; danger: string; }; textareaResizing: { vertical: string; horizontal: string; both: string; none: string; }; euiHeaderLinksGutterSizes: { gutterXS: string; gutterS: string; gutterM: string; gutterL: string; }; ruleMargins: { marginXSmall: string; marginSmall: string; marginMedium: string; marginLarge: string; marginXLarge: string; marginXXLarge: string; }; euiIconLoadingOpacity: number; euiIconColors: { accent: string; danger: string; ghost: string; primary: string; secondary: string; success: string; subdued: string; text: string; warning: string; }; euiIconSizes: { small: string; medium: string; large: string; xLarge: string; xxLarge: string; }; euiKeyPadMenuSize: string; euiKeyPadMenuItemBetaBadgeSize: string; euiLinkColors: { subdued: string; primary: string; secondary: string; accent: string; warning: string; danger: string; text: string; ghost: string; }; euiListGroupItemHoverBackground: string; euiListGroupItemHoverBackgroundGhost: string; euiListGroupGutterTypes: { gutterSmall: string; gutterMedium: string; }; euiListGroupItemColorTypes: { primary: string; text: string; subdued: string; ghost: string; }; euiListGroupItemSizeTypes: { xSmall: string; small: string; medium: string; large: string; }; euiGradientStartStop: string; euiGradientMiddle: string; browserDefaultFontSize: string; euiMarkdownEditorMinHeight: string; euiPopoverArrowSize: string; euiPopoverTranslateDistance: string; euiProgressSizes: { xs: string; s: string; m: string; l: string; }; euiProgressColors: { primary: string; secondary: string; success: string; warning: string; danger: string; accent: string; subdued: string; vis0: string; vis1: string; vis2: string; vis3: string; vis4: string; vis5: string; vis6: string; vis7: string; vis8: string; vis9: string; customColor: string; }; euiResizableButtonTransitionSpeed: string; euiResizableButtonSize: string; euiSelectableListItemBorder: string; euiSelectableListItemPadding: string; euiSelectableTemplateSitewideTypes: { application: { color: string; 'font-weight': number; }; deployment: { color: string; 'font-weight': number; }; article: { color: string; 'font-weight': number; }; case: { color: string; 'font-weight': number; }; platform: { color: string; 'font-weight': number; }; }; spacerSizes: { xs: string; s: string; m: string; l: string; xl: string; xxl: string; }; euiStepNumberSize: string; euiStepNumberSmallSize: string; euiStepNumberMargin: string; euiStepStatusColorsToFade: { warning: string; danger: string; disabled: string; incomplete: string; }; euiSuggestItemColors: { tint0: string; tint1: string; tint2: string; tint3: string; tint4: string; tint5: string; tint6: string; tint7: string; tint8: string; tint9: string; tint10: string; }; euiTableCellContentPadding: string; euiTableCellContentPaddingCompressed: string; euiTableCellCheckboxWidth: string; euiTableActionsAreaWidth: string; euiTableHoverColor: string; euiTableSelectedColor: string; euiTableHoverSelectedColor: string; euiTableActionsBorderColor: string; euiTableHoverClickableColor: string; euiTableFocusClickableColor: string; euiTabFontSize: string; euiTabFontSizeS: string; euiTabFontSizeL: string; euiTextColors: { default: string; subdued: string; secondary: string; accent: string; warning: string; danger: string; ghost: string; }; euiTextConstrainedMaxWidth: string; euiToastWidth: string; euiToastTypes: { primary: string; success: string; warning: string; danger: string; }; euiTokenGrayColor: string; euiTokenTypes: { euiColorVis0: { graphic: string; behindText: string; }; euiColorVis1: { graphic: string; behindText: string; }; euiColorVis2: { graphic: string; behindText: string; }; euiColorVis3: { graphic: string; behindText: string; }; euiColorVis4: { graphic: string; behindText: string; }; euiColorVis5: { graphic: string; behindText: string; }; euiColorVis6: { graphic: string; behindText: string; }; euiColorVis7: { graphic: string; behindText: string; }; euiColorVis8: { graphic: string; behindText: string; }; euiColorVis9: { graphic: string; behindText: string; }; gray: { graphic: string; behindText: string; }; }; euiTokenTypeKeys: string; euiAnimSlightBounce: string; euiAnimSlightResistance: string; euiAnimSpeedExtraFast: string; euiAnimSpeedFast: string; euiAnimSpeedNormal: string; euiAnimSpeedSlow: string; euiAnimSpeedExtraSlow: string; euiBorderWidthThin: string; euiBorderWidthThick: string; euiBorderColor: string; euiBorderRadius: string; euiBorderRadiusSmall: string; euiBorderThick: string; euiBorderThin: string; euiBorderEditable: string; euiButtonHeight: string; euiButtonHeightSmall: string; euiButtonColorDisabled: string; euiButtonColorDisabledText: string; euiButtonColorGhostDisabled: string; euiButtonTypes: { primary: string; secondary: string; warning: string; danger: string; ghost: string; text: string; }; euiColorGhost: string; euiColorInk: string; euiColorPrimary: string; euiColorSecondary: string; euiColorAccent: string; euiColorSuccess: string; euiColorWarning: string; euiColorDanger: string; euiColorEmptyShade: string; euiColorLightestShade: string; euiColorLightShade: string; euiColorMediumShade: string; euiColorDarkShade: string; euiColorDarkestShade: string; euiColorFullShade: string; euiPageBackgroundColor: string; euiColorHighlight: string; euiTextColor: string; euiTitleColor: string; euiTextSubduedColor: string; euiColorDisabled: string; euiColorPrimaryText: string; euiColorSecondaryText: string; euiColorAccentText: string; euiColorWarningText: string; euiColorDangerText: string; euiColorDisabledText: string; euiColorSuccessText: string; euiLinkColor: string; euiPaletteColorBlind: { euiColorVis0: { graphic: string; behindText: string; }; euiColorVis1: { graphic: string; behindText: string; }; euiColorVis2: { graphic: string; behindText: string; }; euiColorVis3: { graphic: string; behindText: string; }; euiColorVis4: { graphic: string; behindText: string; }; euiColorVis5: { graphic: string; behindText: string; }; euiColorVis6: { graphic: string; behindText: string; }; euiColorVis7: { graphic: string; behindText: string; }; euiColorVis8: { graphic: string; behindText: string; }; euiColorVis9: { graphic: string; behindText: string; }; }; euiPaletteColorBlindKeys: string; euiColorVis0: string; euiColorVis1: string; euiColorVis2: string; euiColorVis3: string; euiColorVis4: string; euiColorVis5: string; euiColorVis6: string; euiColorVis7: string; euiColorVis8: string; euiColorVis9: string; euiColorVis0_behindText: string; euiColorVis1_behindText: string; euiColorVis2_behindText: string; euiColorVis3_behindText: string; euiColorVis4_behindText: string; euiColorVis5_behindText: string; euiColorVis6_behindText: string; euiColorVis7_behindText: string; euiColorVis8_behindText: string; euiColorVis9_behindText: string; euiColorChartLines: string; euiColorChartBand: string; euiCodeBlockBackgroundColor: string; euiCodeBlockColor: string; euiCodeBlockSelectedBackgroundColor: string; euiCodeBlockCommentColor: string; euiCodeBlockSelectorTagColor: string; euiCodeBlockStringColor: string; euiCodeBlockTagColor: string; euiCodeBlockNameColor: string; euiCodeBlockNumberColor: string; euiCodeBlockKeywordColor: string; euiCodeBlockFunctionTitleColor: string; euiCodeBlockTypeColor: string; euiCodeBlockAttributeColor: string; euiCodeBlockSymbolColor: string; euiCodeBlockParamsColor: string; euiCodeBlockMetaColor: string; euiCodeBlockTitleColor: string; euiCodeBlockSectionColor: string; euiCodeBlockAdditionColor: string; euiCodeBlockDeletionColor: string; euiCodeBlockSelectorClassColor: string; euiCodeBlockSelectorIdColor: string; euiFormMaxWidth: string; euiFormControlHeight: string; euiFormControlCompressedHeight: string; euiFormControlPadding: string; euiFormControlCompressedPadding: string; euiFormControlBorderRadius: number; euiFormControlCompressedBorderRadius: string; euiRadioSize: string; euiCheckBoxSize: string; euiCheckboxBorderRadius: string; euiSwitchHeight: string; euiSwitchWidth: string; euiSwitchThumbSize: string; euiSwitchIconHeight: string; euiSwitchHeightCompressed: string; euiSwitchWidthCompressed: string; euiSwitchThumbSizeCompressed: string; euiSwitchHeightMini: string; euiSwitchWidthMini: string; euiSwitchThumbSizeMini: string; euiFormBackgroundColor: string; euiFormBackgroundDisabledColor: string; euiFormBackgroundReadOnlyColor: string; euiFormBorderOpaqueColor: string; euiFormBorderColor: string; euiFormBorderDisabledColor: string; euiFormCustomControlDisabledIconColor: string; euiFormCustomControlBorderColor: string; euiFormControlDisabledColor: string; euiFormControlBoxShadow: string; euiFormInputGroupLabelBackground: string; euiFormInputGroupBorder: string; euiSwitchOffColor: string; euiFormControlLayoutGroupInputHeight: string; euiFormControlLayoutGroupInputCompressedHeight: string; euiFormControlLayoutGroupInputCompressedBorderRadius: string; euiRangeTrackColor: string; euiRangeThumbRadius: string; euiRangeThumbHeight: string; euiRangeThumbWidth: string; euiRangeThumbBorderColor: string; euiRangeTrackWidth: string; euiRangeTrackHeight: string; euiRangeTrackBorderWidth: number; euiRangeTrackBorderColor: string; euiRangeTrackRadius: string; euiRangeDisabledOpacity: number; euiRangeHighlightHeight: string; euiHeaderBackgroundColor: string; euiHeaderBorderColor: string; euiHeaderBreadcrumbColor: string; euiHeaderHeight: string; euiHeaderChildSize: string; euiHeaderHeightCompensation: string; euiPageDefaultMaxWidth: string; euiPanelPaddingModifiers: { paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiPanelBorderRadiusModifiers: { borderRadiusNone: number; borderRadiusMedium: string; }; euiPanelBackgroundColorModifiers: { transparent: string; plain: string; subdued: string; }; euiBreakpoints: { xs: number; s: string; m: string; l: string; xl: string; }; euiBreakpointKeys: string; euiShadowColor: string; euiShadowColorLarge: string; euiSize: string; euiSizeXS: string; euiSizeS: string; euiSizeM: string; euiSizeL: string; euiSizeXL: string; euiSizeXXL: string; euiButtonMinWidth: string; euiScrollBar: string; euiScrollBarCorner: string; euiFocusRingColor: string; euiFocusRingAnimStartColor: string; euiFocusRingAnimStartSize: string; euiFocusRingAnimStartSizeLarge: string; euiFocusRingSizeLarge: string; euiFocusRingSize: string; euiFocusTransparency: number; euiFocusBackgroundColor: string; euiTooltipBackgroundColor: string; euiTooltipAnimations: { top: string; left: string; bottom: string; right: string; }; euiFontFamily: string; euiCodeFontFamily: string; euiFontFeatureSettings: string; euiTextScale: string; euiFontSize: string; euiFontSizeXS: string; euiFontSizeS: string; euiFontSizeM: string; euiFontSizeL: string; euiFontSizeXL: string; euiFontSizeXXL: string; euiLineHeight: number; euiBodyLineHeight: number; euiFontWeightLight: number; euiFontWeightRegular: number; euiFontWeightMedium: number; euiFontWeightSemiBold: number; euiFontWeightBold: number; euiCodeFontWeightRegular: number; euiCodeFontWeightBold: number; euiTitles: { xxxs: { 'font-size': string; 'line-height': string; 'font-weight': number; }; xxs: { 'font-size': string; 'line-height': string; 'font-weight': number; }; xs: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; s: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; m: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; l: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; }; euiZLevel0: number; euiZLevel1: number; euiZLevel2: number; euiZLevel3: number; euiZLevel4: number; euiZLevel5: number; euiZLevel6: number; euiZLevel7: number; euiZLevel8: number; euiZLevel9: number; euiZContent: number; euiZHeader: number; euiZContentMenu: number; euiZFlyout: number; euiZNavigation: number; euiZMask: number; euiZModal: number; euiZToastList: number; }" + "{ paddingSizes: { xs: string; s: string; m: string; l: string; xl: string; }; avatarSizing: { s: { size: string; 'font-size': string; }; m: { size: string; 'font-size': string; }; l: { size: string; 'font-size': string; }; xl: { size: string; 'font-size': string; }; }; euiBadgeGroupGutterTypes: { gutterExtraSmall: string; gutterSmall: string; }; euiBreadcrumbSpacing: string; euiBreadcrumbTruncateWidth: string; euiButtonEmptyTypes: { primary: string; danger: string; disabled: string; ghost: string; text: string; success: string; warning: string; }; euiButtonIconTypes: { accent: string; danger: string; ghost: string; primary: string; subdued: string; success: string; text: string; warning: string; }; euiCallOutTypes: { primary: string; success: string; warning: string; danger: string; }; euiCardSpacing: string; euiCardBottomNodeHeight: string; euiCardSelectButtonBorders: { text: string; primary: string; success: string; danger: string; ghost: string; }; euiCardSelectButtonBackgrounds: { text: string; primary: string; success: string; danger: string; ghost: string; }; euiCardPaddingModifiers: { paddingNone: number; paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiCollapsibleNavWidth: string; euiCollapsibleNavGroupLightBackgroundColor: string; euiCollapsibleNavGroupDarkBackgroundColor: string; euiCollapsibleNavGroupDarkHighContrastColor: string; euiColorPickerValueRange0: string; euiColorPickerValueRange1: string; euiColorPickerSaturationRange0: string; euiColorPickerSaturationRange1: string; euiColorPickerIndicatorSize: string; euiColorPickerWidth: string; euiColorPaletteDisplaySizes: { sizeExtraSmall: string; sizeSmall: string; sizeMedium: string; }; euiContextMenuWidth: string; euiControlBarBackground: string; euiControlBarText: string; euiControlBarBorderColor: string; euiControlBarInitialHeight: string; euiControlBarMaxHeight: string; euiControlBarHeights: { s: string; m: string; l: string; }; euiDataGridPrefix: string; euiDataGridStyles: string; euiDataGridColumnResizerWidth: string; euiDataGridPopoverMaxHeight: string; euiDataGridCellPaddingS: string; euiDataGridCellPaddingM: string; euiDataGridCellPaddingL: string; euiDataGridVerticalBorder: string; euiDatePickerCalendarWidth: string; euiSuperDatePickerWidth: string; euiSuperDatePickerButtonWidth: string; euiDragAndDropSpacing: { s: string; m: string; l: string; }; euiExpressionColors: { subdued: string; primary: string; secondary: string; warning: string; danger: string; accent: string; }; euiFacetGutterSizes: { gutterNone: number; gutterSmall: string; gutterMedium: string; gutterLarge: string; }; gutterTypes: { gutterExtraSmall: string; gutterSmall: string; gutterMedium: string; gutterLarge: string; gutterExtraLarge: string; }; fractions: { fourths: { percentage: string; count: number; }; thirds: { percentage: string; count: number; }; halves: { percentage: string; count: number; }; single: { percentage: string; count: number; }; }; flyoutSizes: { small: { min: string; width: string; max: string; }; medium: { min: string; width: string; max: string; }; large: { min: string; width: string; max: string; }; }; euiFlyoutBorder: string; euiFlyoutPaddingModifiers: { paddingNone: number; paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiFilePickerTallHeight: string; euiRangeLevelColors: { primary: string; success: string; warning: string; danger: string; }; textareaResizing: { vertical: string; horizontal: string; both: string; none: string; }; euiHeaderLinksGutterSizes: { gutterXS: string; gutterS: string; gutterM: string; gutterL: string; }; ruleMargins: { marginXSmall: string; marginSmall: string; marginMedium: string; marginLarge: string; marginXLarge: string; marginXXLarge: string; }; euiIconLoadingOpacity: number; euiIconColors: { accent: string; danger: string; ghost: string; primary: string; secondary: string; success: string; subdued: string; text: string; warning: string; }; euiIconSizes: { small: string; medium: string; large: string; xLarge: string; xxLarge: string; }; euiKeyPadMenuSize: string; euiKeyPadMenuItemBetaBadgeSize: string; euiLinkColors: { subdued: string; primary: string; secondary: string; accent: string; warning: string; danger: string; text: string; ghost: string; }; euiListGroupItemHoverBackground: string; euiListGroupItemHoverBackgroundGhost: string; euiListGroupGutterTypes: { gutterSmall: string; gutterMedium: string; }; euiListGroupItemColorTypes: { primary: string; text: string; subdued: string; ghost: string; }; euiListGroupItemSizeTypes: { xSmall: string; small: string; medium: string; large: string; }; euiGradientStartStop: string; euiGradientMiddle: string; browserDefaultFontSize: string; euiMarkdownEditorMinHeight: string; euiPopoverArrowSize: string; euiPopoverTranslateDistance: string; euiProgressSizes: { xs: string; s: string; m: string; l: string; }; euiProgressColors: { primary: string; secondary: string; success: string; warning: string; danger: string; accent: string; subdued: string; vis0: string; vis1: string; vis2: string; vis3: string; vis4: string; vis5: string; vis6: string; vis7: string; vis8: string; vis9: string; customColor: string; }; euiResizableButtonTransitionSpeed: string; euiResizableButtonSize: string; euiSelectableListItemBorder: string; euiSelectableListItemPadding: string; euiSelectableTemplateSitewideTypes: { application: { color: string; 'font-weight': number; }; deployment: { color: string; 'font-weight': number; }; article: { color: string; 'font-weight': number; }; case: { color: string; 'font-weight': number; }; platform: { color: string; 'font-weight': number; }; }; euiSideNavEmphasizedBackgroundColor: string; euiSideNavRootTextcolor: string; euiSideNavBranchTextcolor: string; euiSideNavSelectedTextcolor: string; spacerSizes: { xs: string; s: string; m: string; l: string; xl: string; xxl: string; }; euiStepNumberSize: string; euiStepNumberSmallSize: string; euiStepNumberMargin: string; euiStepStatusColorsToFade: { warning: string; danger: string; disabled: string; incomplete: string; }; euiSuggestItemColors: { tint0: string; tint1: string; tint2: string; tint3: string; tint4: string; tint5: string; tint6: string; tint7: string; tint8: string; tint9: string; tint10: string; }; euiTableCellContentPadding: string; euiTableCellContentPaddingCompressed: string; euiTableCellCheckboxWidth: string; euiTableActionsAreaWidth: string; euiTableHoverColor: string; euiTableSelectedColor: string; euiTableHoverSelectedColor: string; euiTableActionsBorderColor: string; euiTableHoverClickableColor: string; euiTableFocusClickableColor: string; euiTabFontSize: string; euiTabFontSizeS: string; euiTabFontSizeL: string; euiTextColors: { default: string; subdued: string; secondary: string; accent: string; warning: string; danger: string; ghost: string; }; euiTextConstrainedMaxWidth: string; euiToastWidth: string; euiToastTypes: { primary: string; success: string; warning: string; danger: string; }; euiTokenGrayColor: string; euiTokenTypes: { euiColorVis0: { graphic: string; behindText: string; }; euiColorVis1: { graphic: string; behindText: string; }; euiColorVis2: { graphic: string; behindText: string; }; euiColorVis3: { graphic: string; behindText: string; }; euiColorVis4: { graphic: string; behindText: string; }; euiColorVis5: { graphic: string; behindText: string; }; euiColorVis6: { graphic: string; behindText: string; }; euiColorVis7: { graphic: string; behindText: string; }; euiColorVis8: { graphic: string; behindText: string; }; euiColorVis9: { graphic: string; behindText: string; }; gray: { graphic: string; behindText: string; }; }; euiTokenTypeKeys: string; euiAnimSlightBounce: string; euiAnimSlightResistance: string; euiAnimSpeedExtraFast: string; euiAnimSpeedFast: string; euiAnimSpeedNormal: string; euiAnimSpeedSlow: string; euiAnimSpeedExtraSlow: string; euiBorderWidthThin: string; euiBorderWidthThick: string; euiBorderColor: string; euiBorderRadius: string; euiBorderRadiusSmall: string; euiBorderThick: string; euiBorderThin: string; euiBorderEditable: string; euiButtonHeight: string; euiButtonHeightSmall: string; euiButtonHeightXSmall: string; euiButtonColorDisabled: string; euiButtonColorDisabledText: string; euiButtonColorGhostDisabled: string; euiButtonTypes: { primary: string; secondary: string; warning: string; danger: string; ghost: string; text: string; }; euiColorGhost: string; euiColorInk: string; euiColorPrimary: string; euiColorSecondary: string; euiColorAccent: string; euiColorSuccess: string; euiColorWarning: string; euiColorDanger: string; euiColorEmptyShade: string; euiColorLightestShade: string; euiColorLightShade: string; euiColorMediumShade: string; euiColorDarkShade: string; euiColorDarkestShade: string; euiColorFullShade: string; euiPageBackgroundColor: string; euiColorHighlight: string; euiTextColor: string; euiTitleColor: string; euiTextSubduedColor: string; euiColorDisabled: string; euiColorPrimaryText: string; euiColorSecondaryText: string; euiColorAccentText: string; euiColorWarningText: string; euiColorDangerText: string; euiColorDisabledText: string; euiColorSuccessText: string; euiLinkColor: string; euiPaletteColorBlind: { euiColorVis0: { graphic: string; behindText: string; }; euiColorVis1: { graphic: string; behindText: string; }; euiColorVis2: { graphic: string; behindText: string; }; euiColorVis3: { graphic: string; behindText: string; }; euiColorVis4: { graphic: string; behindText: string; }; euiColorVis5: { graphic: string; behindText: string; }; euiColorVis6: { graphic: string; behindText: string; }; euiColorVis7: { graphic: string; behindText: string; }; euiColorVis8: { graphic: string; behindText: string; }; euiColorVis9: { graphic: string; behindText: string; }; }; euiPaletteColorBlindKeys: string; euiColorVis0: string; euiColorVis1: string; euiColorVis2: string; euiColorVis3: string; euiColorVis4: string; euiColorVis5: string; euiColorVis6: string; euiColorVis7: string; euiColorVis8: string; euiColorVis9: string; euiColorVis0_behindText: string; euiColorVis1_behindText: string; euiColorVis2_behindText: string; euiColorVis3_behindText: string; euiColorVis4_behindText: string; euiColorVis5_behindText: string; euiColorVis6_behindText: string; euiColorVis7_behindText: string; euiColorVis8_behindText: string; euiColorVis9_behindText: string; euiColorChartLines: string; euiColorChartBand: string; euiCodeBlockBackgroundColor: string; euiCodeBlockColor: string; euiCodeBlockSelectedBackgroundColor: string; euiCodeBlockCommentColor: string; euiCodeBlockSelectorTagColor: string; euiCodeBlockStringColor: string; euiCodeBlockTagColor: string; euiCodeBlockNameColor: string; euiCodeBlockNumberColor: string; euiCodeBlockKeywordColor: string; euiCodeBlockFunctionTitleColor: string; euiCodeBlockTypeColor: string; euiCodeBlockAttributeColor: string; euiCodeBlockSymbolColor: string; euiCodeBlockParamsColor: string; euiCodeBlockMetaColor: string; euiCodeBlockTitleColor: string; euiCodeBlockSectionColor: string; euiCodeBlockAdditionColor: string; euiCodeBlockDeletionColor: string; euiCodeBlockSelectorClassColor: string; euiCodeBlockSelectorIdColor: string; euiFormMaxWidth: string; euiFormControlHeight: string; euiFormControlCompressedHeight: string; euiFormControlPadding: string; euiFormControlCompressedPadding: string; euiFormControlBorderRadius: number; euiFormControlCompressedBorderRadius: string; euiRadioSize: string; euiCheckBoxSize: string; euiCheckboxBorderRadius: string; euiSwitchHeight: string; euiSwitchWidth: string; euiSwitchThumbSize: string; euiSwitchIconHeight: string; euiSwitchHeightCompressed: string; euiSwitchWidthCompressed: string; euiSwitchThumbSizeCompressed: string; euiSwitchHeightMini: string; euiSwitchWidthMini: string; euiSwitchThumbSizeMini: string; euiFormBackgroundColor: string; euiFormBackgroundDisabledColor: string; euiFormBackgroundReadOnlyColor: string; euiFormBorderOpaqueColor: string; euiFormBorderColor: string; euiFormBorderDisabledColor: string; euiFormCustomControlDisabledIconColor: string; euiFormCustomControlBorderColor: string; euiFormControlDisabledColor: string; euiFormControlBoxShadow: string; euiFormInputGroupLabelBackground: string; euiFormInputGroupBorder: string; euiSwitchOffColor: string; euiFormControlLayoutGroupInputHeight: string; euiFormControlLayoutGroupInputCompressedHeight: string; euiFormControlLayoutGroupInputCompressedBorderRadius: string; euiRangeTrackColor: string; euiRangeThumbRadius: string; euiRangeThumbHeight: string; euiRangeThumbWidth: string; euiRangeThumbBorderColor: string; euiRangeTrackWidth: string; euiRangeTrackHeight: string; euiRangeTrackBorderWidth: number; euiRangeTrackBorderColor: string; euiRangeTrackRadius: string; euiRangeDisabledOpacity: number; euiRangeHighlightHeight: string; euiHeaderBackgroundColor: string; euiHeaderBorderColor: string; euiHeaderBreadcrumbColor: string; euiHeaderHeight: string; euiHeaderChildSize: string; euiHeaderHeightCompensation: string; euiPageDefaultMaxWidth: string; euiPageSidebarMinWidth: string; euiPanelPaddingModifiers: { paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiPanelBorderRadiusModifiers: { borderRadiusNone: number; borderRadiusMedium: string; }; euiPanelBackgroundColorModifiers: { transparent: string; plain: string; subdued: string; accent: string; primary: string; success: string; warning: string; danger: string; }; euiBreakpoints: { xs: number; s: string; m: string; l: string; xl: string; }; euiBreakpointKeys: string; euiShadowColor: string; euiShadowColorLarge: string; euiSize: string; euiSizeXS: string; euiSizeS: string; euiSizeM: string; euiSizeL: string; euiSizeXL: string; euiSizeXXL: string; euiButtonMinWidth: string; euiScrollBar: string; euiScrollBarCorner: string; euiFocusRingColor: string; euiFocusRingAnimStartColor: string; euiFocusRingAnimStartSize: string; euiFocusRingAnimStartSizeLarge: string; euiFocusRingSizeLarge: string; euiFocusRingSize: string; euiFocusTransparency: number; euiFocusBackgroundColor: string; euiTooltipBackgroundColor: string; euiTooltipAnimations: { top: string; left: string; bottom: string; right: string; }; euiFontFamily: string; euiCodeFontFamily: string; euiFontFeatureSettings: string; euiTextScale: string; euiFontSize: string; euiFontSizeXS: string; euiFontSizeS: string; euiFontSizeM: string; euiFontSizeL: string; euiFontSizeXL: string; euiFontSizeXXL: string; euiLineHeight: number; euiBodyLineHeight: number; euiFontWeightLight: number; euiFontWeightRegular: number; euiFontWeightMedium: number; euiFontWeightSemiBold: number; euiFontWeightBold: number; euiCodeFontWeightRegular: number; euiCodeFontWeightBold: number; euiTitles: { xxxs: { 'font-size': string; 'line-height': string; 'font-weight': number; }; xxs: { 'font-size': string; 'line-height': string; 'font-weight': number; }; xs: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; s: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; m: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; l: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; }; euiZLevel0: number; euiZLevel1: number; euiZLevel2: number; euiZLevel3: number; euiZLevel4: number; euiZLevel5: number; euiZLevel6: number; euiZLevel7: number; euiZLevel8: number; euiZLevel9: number; euiZContent: number; euiZHeader: number; euiZContentMenu: number; euiZFlyout: number; euiZNavigation: number; euiZMask: number; euiZModal: number; euiZToastList: number; } | { paddingSizes: { xs: string; s: string; m: string; l: string; xl: string; }; avatarSizing: { s: { size: string; 'font-size': string; }; m: { size: string; 'font-size': string; }; l: { size: string; 'font-size': string; }; xl: { size: string; 'font-size': string; }; }; euiBadgeGroupGutterTypes: { gutterExtraSmall: string; gutterSmall: string; }; euiBreadcrumbSpacing: string; euiBreadcrumbTruncateWidth: string; euiButtonEmptyTypes: { primary: string; danger: string; disabled: string; ghost: string; text: string; success: string; warning: string; }; euiButtonIconTypes: { accent: string; danger: string; ghost: string; primary: string; subdued: string; success: string; text: string; warning: string; }; euiCallOutTypes: { primary: string; success: string; warning: string; danger: string; }; euiCardSpacing: string; euiCardBottomNodeHeight: string; euiCardSelectButtonBorders: { text: string; primary: string; success: string; danger: string; ghost: string; }; euiCardSelectButtonBackgrounds: { text: string; primary: string; success: string; danger: string; ghost: string; }; euiCardPaddingModifiers: { paddingNone: number; paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiCollapsibleNavWidth: string; euiCollapsibleNavGroupLightBackgroundColor: string; euiCollapsibleNavGroupDarkBackgroundColor: string; euiCollapsibleNavGroupDarkHighContrastColor: string; euiColorPickerValueRange0: string; euiColorPickerValueRange1: string; euiColorPickerSaturationRange0: string; euiColorPickerSaturationRange1: string; euiColorPickerIndicatorSize: string; euiColorPickerWidth: string; euiColorPaletteDisplaySizes: { sizeExtraSmall: string; sizeSmall: string; sizeMedium: string; }; euiContextMenuWidth: string; euiControlBarBackground: string; euiControlBarText: string; euiControlBarBorderColor: string; euiControlBarInitialHeight: string; euiControlBarMaxHeight: string; euiControlBarHeights: { s: string; m: string; l: string; }; euiDataGridPrefix: string; euiDataGridStyles: string; euiDataGridColumnResizerWidth: string; euiDataGridPopoverMaxHeight: string; euiDataGridCellPaddingS: string; euiDataGridCellPaddingM: string; euiDataGridCellPaddingL: string; euiDataGridVerticalBorder: string; euiDatePickerCalendarWidth: string; euiSuperDatePickerWidth: string; euiSuperDatePickerButtonWidth: string; euiDragAndDropSpacing: { s: string; m: string; l: string; }; euiExpressionColors: { subdued: string; primary: string; secondary: string; warning: string; danger: string; accent: string; }; euiFacetGutterSizes: { gutterNone: number; gutterSmall: string; gutterMedium: string; gutterLarge: string; }; gutterTypes: { gutterExtraSmall: string; gutterSmall: string; gutterMedium: string; gutterLarge: string; gutterExtraLarge: string; }; fractions: { fourths: { percentage: string; count: number; }; thirds: { percentage: string; count: number; }; halves: { percentage: string; count: number; }; single: { percentage: string; count: number; }; }; flyoutSizes: { small: { min: string; width: string; max: string; }; medium: { min: string; width: string; max: string; }; large: { min: string; width: string; max: string; }; }; euiFlyoutBorder: string; euiFlyoutPaddingModifiers: { paddingNone: number; paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiFilePickerTallHeight: string; euiRangeLevelColors: { primary: string; success: string; warning: string; danger: string; }; textareaResizing: { vertical: string; horizontal: string; both: string; none: string; }; euiHeaderLinksGutterSizes: { gutterXS: string; gutterS: string; gutterM: string; gutterL: string; }; ruleMargins: { marginXSmall: string; marginSmall: string; marginMedium: string; marginLarge: string; marginXLarge: string; marginXXLarge: string; }; euiIconLoadingOpacity: number; euiIconColors: { accent: string; danger: string; ghost: string; primary: string; secondary: string; success: string; subdued: string; text: string; warning: string; }; euiIconSizes: { small: string; medium: string; large: string; xLarge: string; xxLarge: string; }; euiKeyPadMenuSize: string; euiKeyPadMenuItemBetaBadgeSize: string; euiLinkColors: { subdued: string; primary: string; secondary: string; accent: string; warning: string; danger: string; text: string; ghost: string; }; euiListGroupItemHoverBackground: string; euiListGroupItemHoverBackgroundGhost: string; euiListGroupGutterTypes: { gutterSmall: string; gutterMedium: string; }; euiListGroupItemColorTypes: { primary: string; text: string; subdued: string; ghost: string; }; euiListGroupItemSizeTypes: { xSmall: string; small: string; medium: string; large: string; }; euiGradientStartStop: string; euiGradientMiddle: string; browserDefaultFontSize: string; euiMarkdownEditorMinHeight: string; euiPopoverArrowSize: string; euiPopoverTranslateDistance: string; euiProgressSizes: { xs: string; s: string; m: string; l: string; }; euiProgressColors: { primary: string; secondary: string; success: string; warning: string; danger: string; accent: string; subdued: string; vis0: string; vis1: string; vis2: string; vis3: string; vis4: string; vis5: string; vis6: string; vis7: string; vis8: string; vis9: string; customColor: string; }; euiResizableButtonTransitionSpeed: string; euiResizableButtonSize: string; euiSelectableListItemBorder: string; euiSelectableListItemPadding: string; euiSelectableTemplateSitewideTypes: { application: { color: string; 'font-weight': number; }; deployment: { color: string; 'font-weight': number; }; article: { color: string; 'font-weight': number; }; case: { color: string; 'font-weight': number; }; platform: { color: string; 'font-weight': number; }; }; euiSideNavEmphasizedBackgroundColor: string; euiSideNavRootTextcolor: string; euiSideNavBranchTextcolor: string; euiSideNavSelectedTextcolor: string; spacerSizes: { xs: string; s: string; m: string; l: string; xl: string; xxl: string; }; euiStepNumberSize: string; euiStepNumberSmallSize: string; euiStepNumberMargin: string; euiStepStatusColorsToFade: { warning: string; danger: string; disabled: string; incomplete: string; }; euiSuggestItemColors: { tint0: string; tint1: string; tint2: string; tint3: string; tint4: string; tint5: string; tint6: string; tint7: string; tint8: string; tint9: string; tint10: string; }; euiTableCellContentPadding: string; euiTableCellContentPaddingCompressed: string; euiTableCellCheckboxWidth: string; euiTableActionsAreaWidth: string; euiTableHoverColor: string; euiTableSelectedColor: string; euiTableHoverSelectedColor: string; euiTableActionsBorderColor: string; euiTableHoverClickableColor: string; euiTableFocusClickableColor: string; euiTabFontSize: string; euiTabFontSizeS: string; euiTabFontSizeL: string; euiTextColors: { default: string; subdued: string; secondary: string; accent: string; warning: string; danger: string; ghost: string; }; euiTextConstrainedMaxWidth: string; euiToastWidth: string; euiToastTypes: { primary: string; success: string; warning: string; danger: string; }; euiTokenGrayColor: string; euiTokenTypes: { euiColorVis0: { graphic: string; behindText: string; }; euiColorVis1: { graphic: string; behindText: string; }; euiColorVis2: { graphic: string; behindText: string; }; euiColorVis3: { graphic: string; behindText: string; }; euiColorVis4: { graphic: string; behindText: string; }; euiColorVis5: { graphic: string; behindText: string; }; euiColorVis6: { graphic: string; behindText: string; }; euiColorVis7: { graphic: string; behindText: string; }; euiColorVis8: { graphic: string; behindText: string; }; euiColorVis9: { graphic: string; behindText: string; }; gray: { graphic: string; behindText: string; }; }; euiTokenTypeKeys: string; euiAnimSlightBounce: string; euiAnimSlightResistance: string; euiAnimSpeedExtraFast: string; euiAnimSpeedFast: string; euiAnimSpeedNormal: string; euiAnimSpeedSlow: string; euiAnimSpeedExtraSlow: string; euiBorderWidthThin: string; euiBorderWidthThick: string; euiBorderColor: string; euiBorderRadius: string; euiBorderRadiusSmall: string; euiBorderThick: string; euiBorderThin: string; euiBorderEditable: string; euiButtonHeight: string; euiButtonHeightSmall: string; euiButtonHeightXSmall: string; euiButtonColorDisabled: string; euiButtonColorDisabledText: string; euiButtonColorGhostDisabled: string; euiButtonTypes: { primary: string; secondary: string; warning: string; danger: string; ghost: string; text: string; }; euiColorGhost: string; euiColorInk: string; euiColorPrimary: string; euiColorSecondary: string; euiColorAccent: string; euiColorSuccess: string; euiColorWarning: string; euiColorDanger: string; euiColorEmptyShade: string; euiColorLightestShade: string; euiColorLightShade: string; euiColorMediumShade: string; euiColorDarkShade: string; euiColorDarkestShade: string; euiColorFullShade: string; euiPageBackgroundColor: string; euiColorHighlight: string; euiTextColor: string; euiTitleColor: string; euiTextSubduedColor: string; euiColorDisabled: string; euiColorPrimaryText: string; euiColorSecondaryText: string; euiColorAccentText: string; euiColorWarningText: string; euiColorDangerText: string; euiColorDisabledText: string; euiColorSuccessText: string; euiLinkColor: string; euiPaletteColorBlind: { euiColorVis0: { graphic: string; behindText: string; }; euiColorVis1: { graphic: string; behindText: string; }; euiColorVis2: { graphic: string; behindText: string; }; euiColorVis3: { graphic: string; behindText: string; }; euiColorVis4: { graphic: string; behindText: string; }; euiColorVis5: { graphic: string; behindText: string; }; euiColorVis6: { graphic: string; behindText: string; }; euiColorVis7: { graphic: string; behindText: string; }; euiColorVis8: { graphic: string; behindText: string; }; euiColorVis9: { graphic: string; behindText: string; }; }; euiPaletteColorBlindKeys: string; euiColorVis0: string; euiColorVis1: string; euiColorVis2: string; euiColorVis3: string; euiColorVis4: string; euiColorVis5: string; euiColorVis6: string; euiColorVis7: string; euiColorVis8: string; euiColorVis9: string; euiColorVis0_behindText: string; euiColorVis1_behindText: string; euiColorVis2_behindText: string; euiColorVis3_behindText: string; euiColorVis4_behindText: string; euiColorVis5_behindText: string; euiColorVis6_behindText: string; euiColorVis7_behindText: string; euiColorVis8_behindText: string; euiColorVis9_behindText: string; euiColorChartLines: string; euiColorChartBand: string; euiCodeBlockBackgroundColor: string; euiCodeBlockColor: string; euiCodeBlockSelectedBackgroundColor: string; euiCodeBlockCommentColor: string; euiCodeBlockSelectorTagColor: string; euiCodeBlockStringColor: string; euiCodeBlockTagColor: string; euiCodeBlockNameColor: string; euiCodeBlockNumberColor: string; euiCodeBlockKeywordColor: string; euiCodeBlockFunctionTitleColor: string; euiCodeBlockTypeColor: string; euiCodeBlockAttributeColor: string; euiCodeBlockSymbolColor: string; euiCodeBlockParamsColor: string; euiCodeBlockMetaColor: string; euiCodeBlockTitleColor: string; euiCodeBlockSectionColor: string; euiCodeBlockAdditionColor: string; euiCodeBlockDeletionColor: string; euiCodeBlockSelectorClassColor: string; euiCodeBlockSelectorIdColor: string; euiFormMaxWidth: string; euiFormControlHeight: string; euiFormControlCompressedHeight: string; euiFormControlPadding: string; euiFormControlCompressedPadding: string; euiFormControlBorderRadius: number; euiFormControlCompressedBorderRadius: string; euiRadioSize: string; euiCheckBoxSize: string; euiCheckboxBorderRadius: string; euiSwitchHeight: string; euiSwitchWidth: string; euiSwitchThumbSize: string; euiSwitchIconHeight: string; euiSwitchHeightCompressed: string; euiSwitchWidthCompressed: string; euiSwitchThumbSizeCompressed: string; euiSwitchHeightMini: string; euiSwitchWidthMini: string; euiSwitchThumbSizeMini: string; euiFormBackgroundColor: string; euiFormBackgroundDisabledColor: string; euiFormBackgroundReadOnlyColor: string; euiFormBorderOpaqueColor: string; euiFormBorderColor: string; euiFormBorderDisabledColor: string; euiFormCustomControlDisabledIconColor: string; euiFormCustomControlBorderColor: string; euiFormControlDisabledColor: string; euiFormControlBoxShadow: string; euiFormInputGroupLabelBackground: string; euiFormInputGroupBorder: string; euiSwitchOffColor: string; euiFormControlLayoutGroupInputHeight: string; euiFormControlLayoutGroupInputCompressedHeight: string; euiFormControlLayoutGroupInputCompressedBorderRadius: string; euiRangeTrackColor: string; euiRangeThumbRadius: string; euiRangeThumbHeight: string; euiRangeThumbWidth: string; euiRangeThumbBorderColor: string; euiRangeTrackWidth: string; euiRangeTrackHeight: string; euiRangeTrackBorderWidth: number; euiRangeTrackBorderColor: string; euiRangeTrackRadius: string; euiRangeDisabledOpacity: number; euiRangeHighlightHeight: string; euiHeaderBackgroundColor: string; euiHeaderBorderColor: string; euiHeaderBreadcrumbColor: string; euiHeaderHeight: string; euiHeaderChildSize: string; euiHeaderHeightCompensation: string; euiPageDefaultMaxWidth: string; euiPageSidebarMinWidth: string; euiPanelPaddingModifiers: { paddingSmall: string; paddingMedium: string; paddingLarge: string; }; euiPanelBorderRadiusModifiers: { borderRadiusNone: number; borderRadiusMedium: string; }; euiPanelBackgroundColorModifiers: { transparent: string; plain: string; subdued: string; accent: string; primary: string; success: string; warning: string; danger: string; }; euiBreakpoints: { xs: number; s: string; m: string; l: string; xl: string; }; euiBreakpointKeys: string; euiShadowColor: string; euiShadowColorLarge: string; euiSize: string; euiSizeXS: string; euiSizeS: string; euiSizeM: string; euiSizeL: string; euiSizeXL: string; euiSizeXXL: string; euiButtonMinWidth: string; euiScrollBar: string; euiScrollBarCorner: string; euiFocusRingColor: string; euiFocusRingAnimStartColor: string; euiFocusRingAnimStartSize: string; euiFocusRingAnimStartSizeLarge: string; euiFocusRingSizeLarge: string; euiFocusRingSize: string; euiFocusTransparency: number; euiFocusBackgroundColor: string; euiTooltipBackgroundColor: string; euiTooltipAnimations: { top: string; left: string; bottom: string; right: string; }; euiFontFamily: string; euiCodeFontFamily: string; euiFontFeatureSettings: string; euiTextScale: string; euiFontSize: string; euiFontSizeXS: string; euiFontSizeS: string; euiFontSizeM: string; euiFontSizeL: string; euiFontSizeXL: string; euiFontSizeXXL: string; euiLineHeight: number; euiBodyLineHeight: number; euiFontWeightLight: number; euiFontWeightRegular: number; euiFontWeightMedium: number; euiFontWeightSemiBold: number; euiFontWeightBold: number; euiCodeFontWeightRegular: number; euiCodeFontWeightBold: number; euiTitles: { xxxs: { 'font-size': string; 'line-height': string; 'font-weight': number; }; xxs: { 'font-size': string; 'line-height': string; 'font-weight': number; }; xs: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; s: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; m: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; l: { 'font-size': string; 'line-height': string; 'font-weight': number; 'letter-spacing': string; }; }; euiZLevel0: number; euiZLevel1: number; euiZLevel2: number; euiZLevel3: number; euiZLevel4: number; euiZLevel5: number; euiZLevel6: number; euiZLevel7: number; euiZLevel8: number; euiZLevel9: number; euiZContent: number; euiZHeader: number; euiZContentMenu: number; euiZFlyout: number; euiZNavigation: number; euiZMask: number; euiZModal: number; euiZToastList: number; }" ] }, { diff --git a/api_docs/kibana_utils.json b/api_docs/kibana_utils.json index da04f3be71b84..bd4d7e5e31577 100644 --- a/api_docs/kibana_utils.json +++ b/api_docs/kibana_utils.json @@ -31,6 +31,7 @@ "description": [], "children": [ { + "id": "def-public.AbortError.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -162,6 +163,7 @@ "description": [], "children": [ { + "id": "def-public.DuplicateField.Unnamed.$1", "type": "string", "label": "name", "isRequired": true, @@ -240,6 +242,7 @@ ], "children": [ { + "id": "def-public.HashedItemStore.Unnamed.$1", "type": "Object", "label": "storage", "isRequired": true, @@ -270,6 +273,7 @@ "description": [], "children": [ { + "id": "def-public.HashedItemStore.setItem.$1", "type": "string", "label": "hash", "isRequired": true, @@ -283,6 +287,7 @@ } }, { + "id": "def-public.HashedItemStore.setItem.$2", "type": "string", "label": "item", "isRequired": true, @@ -313,6 +318,7 @@ "description": [], "children": [ { + "id": "def-public.HashedItemStore.getItem.$1", "type": "string", "label": "hash", "isRequired": true, @@ -343,6 +349,7 @@ "description": [], "children": [ { + "id": "def-public.HashedItemStore.removeItem.$1", "type": "string", "label": "hash", "isRequired": true, @@ -422,6 +429,7 @@ "description": [], "children": [ { + "id": "def-public.InvalidJSONProperty.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -431,7 +439,7 @@ "description": [], "source": { "path": "src/plugins/kibana_utils/common/errors/errors.ts", - "lineNumber": 56 + "lineNumber": 74 } } ], @@ -439,13 +447,13 @@ "returnComment": [], "source": { "path": "src/plugins/kibana_utils/common/errors/errors.ts", - "lineNumber": 56 + "lineNumber": 74 } } ], "source": { "path": "src/plugins/kibana_utils/common/errors/errors.ts", - "lineNumber": 55 + "lineNumber": 73 }, "initialIsOpen": false }, @@ -476,6 +484,7 @@ "description": [], "children": [ { + "id": "def-public.KbnError.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -522,6 +531,7 @@ "description": [], "children": [ { + "id": "def-public.RenderCompleteDispatcher.Unnamed.$1", "type": "Object", "label": "el", "isRequired": false, @@ -552,6 +562,7 @@ "description": [], "children": [ { + "id": "def-public.RenderCompleteDispatcher.setEl.$1", "type": "Object", "label": "el", "isRequired": false, @@ -630,6 +641,7 @@ "description": [], "children": [ { + "id": "def-public.RenderCompleteDispatcher.setTitle.$1", "type": "string", "label": "title", "isRequired": true, @@ -674,6 +686,7 @@ "description": [], "children": [ { + "id": "def-public.RenderCompleteListener.Unnamed.$1", "type": "Object", "label": "element", "isRequired": true, @@ -779,6 +792,7 @@ "description": [], "children": [ { + "id": "def-public.ResizeChecker.Unnamed.$1", "type": "Object", "label": "el", "isRequired": true, @@ -792,7 +806,7 @@ } }, { - "id": "def-public.ResizeChecker.Unnamed.args", + "id": "def-public.ResizeChecker.Unnamed.$2.args", "type": "Object", "label": "args", "tags": [], @@ -800,7 +814,7 @@ "children": [ { "tags": [], - "id": "def-public.ResizeChecker.Unnamed.args.disabled", + "id": "def-public.ResizeChecker.Unnamed.$2.args.disabled", "type": "CompoundType", "label": "disabled", "description": [], @@ -854,6 +868,7 @@ ], "children": [ { + "id": "def-public.ResizeChecker.modifySizeWithoutTriggeringResize.$1", "type": "Function", "label": "block", "isRequired": true, @@ -899,6 +914,134 @@ }, "initialIsOpen": false }, + { + "id": "def-public.SavedFieldNotFound", + "type": "Class", + "tags": [], + "label": "SavedFieldNotFound", + "description": [ + "\nA saved field doesn't exist anymore" + ], + "signature": [ + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.SavedFieldNotFound", + "text": "SavedFieldNotFound" + }, + " extends ", + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.KbnError", + "text": "KbnError" + } + ], + "children": [ + { + "id": "def-public.SavedFieldNotFound.Unnamed", + "type": "Function", + "label": "Constructor", + "signature": [ + "any" + ], + "description": [], + "children": [ + { + "id": "def-public.SavedFieldNotFound.Unnamed.$1", + "type": "string", + "label": "message", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 54 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 54 + } + } + ], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 53 + }, + "initialIsOpen": false + }, + { + "id": "def-public.SavedFieldTypeInvalidForAgg", + "type": "Class", + "tags": [], + "label": "SavedFieldTypeInvalidForAgg", + "description": [ + "\nA saved field type isn't compatible with aggregation" + ], + "signature": [ + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.SavedFieldTypeInvalidForAgg", + "text": "SavedFieldTypeInvalidForAgg" + }, + " extends ", + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.KbnError", + "text": "KbnError" + } + ], + "children": [ + { + "id": "def-public.SavedFieldTypeInvalidForAgg.Unnamed", + "type": "Function", + "label": "Constructor", + "signature": [ + "any" + ], + "description": [], + "children": [ + { + "id": "def-public.SavedFieldTypeInvalidForAgg.Unnamed.$1", + "type": "string", + "label": "message", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 63 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 63 + } + } + ], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 62 + }, + "initialIsOpen": false + }, { "id": "def-public.SavedObjectNotFound", "type": "Class", @@ -960,6 +1103,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectNotFound.Unnamed.$1", "type": "string", "label": "type", "isRequired": true, @@ -973,6 +1117,7 @@ } }, { + "id": "def-public.SavedObjectNotFound.Unnamed.$2", "type": "string", "label": "id", "isRequired": false, @@ -986,6 +1131,7 @@ } }, { + "id": "def-public.SavedObjectNotFound.Unnamed.$3", "type": "string", "label": "link", "isRequired": false, @@ -997,6 +1143,20 @@ "path": "src/plugins/kibana_utils/common/errors/errors.ts", "lineNumber": 35 } + }, + { + "id": "def-public.SavedObjectNotFound.Unnamed.$4", + "type": "string", + "label": "customMessage", + "isRequired": false, + "signature": [ + "string | undefined" + ], + "description": [], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 35 + } } ], "tags": [], @@ -1069,6 +1229,7 @@ "description": [], "children": [ { + "id": "def-public.Storage.Unnamed.$1", "type": "Object", "label": "store", "isRequired": true, @@ -1101,6 +1262,7 @@ "type": "Function", "children": [ { + "id": "def-public.Storage.get.$1", "type": "string", "label": "key", "isRequired": true, @@ -1131,6 +1293,7 @@ "type": "Function", "children": [ { + "id": "def-public.Storage.set.$1", "type": "string", "label": "key", "isRequired": true, @@ -1144,6 +1307,7 @@ } }, { + "id": "def-public.Storage.set.$2", "type": "Any", "label": "value", "isRequired": true, @@ -1174,6 +1338,7 @@ "type": "Function", "children": [ { + "id": "def-public.Storage.remove.$1", "type": "string", "label": "key", "isRequired": true, @@ -1236,6 +1401,7 @@ ], "children": [ { + "id": "def-public.abortSignalToPromise.$1", "type": "Object", "label": "signal", "isRequired": true, @@ -1270,6 +1436,7 @@ "description": [], "children": [ { + "id": "def-public.applyDiff.$1", "type": "Object", "label": "target", "isRequired": true, @@ -1283,6 +1450,7 @@ } }, { + "id": "def-public.applyDiff.$2", "type": "Object", "label": "source", "isRequired": true, @@ -1324,6 +1492,7 @@ "type": "Function", "children": [ { + "id": "def-public.createGetterSetter.$1", "type": "string", "label": "name", "isRequired": true, @@ -1386,6 +1555,7 @@ ], "children": [ { + "id": "def-public.createHistoryObservable.$1", "type": "Object", "label": "history", "isRequired": true, @@ -1415,6 +1585,7 @@ "type": "Function", "children": [ { + "id": "def-public.createKbnUrlControls.$1", "type": "Object", "label": "history", "isRequired": true, @@ -1450,7 +1621,7 @@ "type": "Function", "children": [ { - "id": "def-public.createKbnUrlStateStorage.{\n- useHash = false,\n history,\n onGetError,\n onSetError,\n }", + "id": "def-public.createKbnUrlStateStorage.$1.useHashfalsehistoryonGetErroronSetError", "type": "Object", "label": "{\n useHash = false,\n history,\n onGetError,\n onSetError,\n }", "tags": [], @@ -1458,7 +1629,7 @@ "children": [ { "tags": [], - "id": "def-public.createKbnUrlStateStorage.{\n- useHash = false,\n history,\n onGetError,\n onSetError,\n }.useHash", + "id": "def-public.createKbnUrlStateStorage.$1.useHashfalsehistoryonGetErroronSetError.useHash", "type": "boolean", "label": "useHash", "description": [], @@ -1469,7 +1640,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlStateStorage.{\n- useHash = false,\n history,\n onGetError,\n onSetError,\n }.history", + "id": "def-public.createKbnUrlStateStorage.$1.useHashfalsehistoryonGetErroronSetError.history", "type": "Object", "label": "history", "description": [], @@ -1484,7 +1655,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlStateStorage.{\n- useHash = false,\n history,\n onGetError,\n onSetError,\n }.onGetError", + "id": "def-public.createKbnUrlStateStorage.$1.useHashfalsehistoryonGetErroronSetError.onGetError", "type": "Function", "label": "onGetError", "description": [], @@ -1498,7 +1669,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlStateStorage.{\n- useHash = false,\n history,\n onGetError,\n onSetError,\n }.onSetError", + "id": "def-public.createKbnUrlStateStorage.$1.useHashfalsehistoryonGetErroronSetError.onSetError", "type": "Function", "label": "onSetError", "description": [], @@ -1578,7 +1749,7 @@ ], "children": [ { - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink", "type": "Object", "label": "{\n baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}", "tags": [], @@ -1586,7 +1757,7 @@ "children": [ { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.baseUrl", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.baseUrl", "type": "string", "label": "baseUrl", "description": [ @@ -1599,7 +1770,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.defaultSubUrl", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.defaultSubUrl", "type": "string", "label": "defaultSubUrl", "description": [ @@ -1612,7 +1783,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.stateParams", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.stateParams", "type": "Array", "label": "stateParams", "description": [ @@ -1630,7 +1801,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.storageKey", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.storageKey", "type": "string", "label": "storageKey", "description": [ @@ -1643,7 +1814,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.navLinkUpdater$", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.navLinkUpdater$", "type": "Object", "label": "navLinkUpdater$", "description": [ @@ -1668,7 +1839,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.toastNotifications", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.toastNotifications", "type": "Object", "label": "toastNotifications", "description": [ @@ -1692,7 +1863,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.history", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.history", "type": "Object", "label": "history", "description": [ @@ -1709,7 +1880,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.getHistory", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.getHistory", "type": "Function", "label": "getHistory", "description": [ @@ -1727,7 +1898,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.storage", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.storage", "type": "Object", "label": "storage", "description": [ @@ -1743,7 +1914,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.shouldTrackUrlUpdate", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.shouldTrackUrlUpdate", "type": "Function", "label": "shouldTrackUrlUpdate", "description": [ @@ -1759,7 +1930,7 @@ }, { "tags": [], - "id": "def-public.createKbnUrlTracker.{\n- baseUrl,\n defaultSubUrl,\n storageKey,\n stateParams,\n navLinkUpdater$,\n toastNotifications,\n history,\n getHistory,\n storage,\n shouldTrackUrlUpdate = () => {\n return true;\n },\n onBeforeNavLinkSaved = (newNavLink) => newNavLink,\n}.onBeforeNavLinkSaved", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.onBeforeNavLinkSaved", "type": "Function", "label": "onBeforeNavLinkSaved", "description": [ @@ -1804,6 +1975,7 @@ ], "children": [ { + "id": "def-public.createQueryParamObservable.$1", "type": "Object", "label": "history", "isRequired": true, @@ -1820,6 +1992,7 @@ } }, { + "id": "def-public.createQueryParamObservable.$2", "type": "string", "label": "paramKey", "isRequired": true, @@ -1861,6 +2034,7 @@ ], "children": [ { + "id": "def-public.createQueryParamsObservable.$1", "type": "Object", "label": "history", "isRequired": true, @@ -1890,6 +2064,7 @@ "type": "Function", "children": [ { + "id": "def-public.createSessionStorageStateStorage.$1", "type": "Object", "label": "storage", "isRequired": true, @@ -1934,6 +2109,7 @@ "type": "Function", "children": [ { + "id": "def-public.createStartServicesGetter.$1", "type": "Function", "label": "accessor", "isRequired": true, @@ -2015,6 +2191,7 @@ ], "children": [ { + "id": "def-public.createStateContainer.$1", "type": "Uncategorized", "label": "defaultState", "isRequired": true, @@ -2060,6 +2237,7 @@ ], "children": [ { + "id": "def-public.createStateContainer.$1", "type": "Uncategorized", "label": "defaultState", "isRequired": true, @@ -2075,6 +2253,7 @@ } }, { + "id": "def-public.createStateContainer.$2", "type": "Uncategorized", "label": "pureTransitions", "isRequired": true, @@ -2128,6 +2307,7 @@ ], "children": [ { + "id": "def-public.createStateContainer.$1", "type": "Uncategorized", "label": "defaultState", "isRequired": true, @@ -2143,6 +2323,7 @@ } }, { + "id": "def-public.createStateContainer.$2", "type": "Uncategorized", "label": "pureTransitions", "isRequired": true, @@ -2158,6 +2339,7 @@ } }, { + "id": "def-public.createStateContainer.$3", "type": "Uncategorized", "label": "pureSelectors", "isRequired": true, @@ -2173,6 +2355,7 @@ } }, { + "id": "def-public.createStateContainer.$4", "type": "Object", "label": "options", "isRequired": false, @@ -2275,6 +2458,7 @@ "description": [], "children": [ { + "id": "def-public.createStateHash.$1", "type": "string", "label": "json", "isRequired": true, @@ -2288,6 +2472,7 @@ } }, { + "id": "def-public.createStateHash.$2", "type": "Function", "label": "existingJsonProvider", "isRequired": false, @@ -2322,6 +2507,7 @@ ], "children": [ { + "id": "def-public.createUrlTracker.$1", "type": "string", "label": "key", "isRequired": true, @@ -2335,6 +2521,7 @@ } }, { + "id": "def-public.createUrlTracker.$2", "type": "Object", "label": "storage", "isRequired": true, @@ -2391,6 +2578,7 @@ "description": [], "children": [ { + "id": "def-public.dispatchRenderComplete.$1", "type": "Object", "label": "el", "isRequired": true, @@ -2422,6 +2610,7 @@ "description": [], "children": [ { + "id": "def-public.dispatchRenderStart.$1", "type": "Object", "label": "el", "isRequired": true, @@ -2453,6 +2642,7 @@ "description": [], "children": [ { + "id": "def-public.fieldWildcardFilter.$1", "type": "Array", "label": "globs", "isRequired": true, @@ -2466,6 +2656,7 @@ } }, { + "id": "def-public.fieldWildcardFilter.$2", "type": "Array", "label": "metaFields", "isRequired": true, @@ -2497,6 +2688,7 @@ "description": [], "children": [ { + "id": "def-public.fieldWildcardMatcher.$1", "type": "Array", "label": "globs", "isRequired": true, @@ -2510,6 +2702,7 @@ } }, { + "id": "def-public.fieldWildcardMatcher.$2", "type": "Array", "label": "metaFields", "isRequired": true, @@ -2531,39 +2724,6 @@ }, "initialIsOpen": false }, - { - "id": "def-public.getCombinedAbortSignal", - "type": "Function", - "label": "getCombinedAbortSignal", - "signature": [ - "(signals: AbortSignal[]) => { signal: AbortSignal; cleanup: () => void; }" - ], - "description": [ - "\nReturns an `AbortSignal` that will be aborted when the first of the given signals aborts.\n" - ], - "children": [ - { - "type": "Array", - "label": "signals", - "isRequired": true, - "signature": [ - "AbortSignal[]" - ], - "description": [], - "source": { - "path": "src/plugins/kibana_utils/common/abort_utils.ts", - "lineNumber": 55 - } - } - ], - "tags": [], - "returnComment": [], - "source": { - "path": "src/plugins/kibana_utils/common/abort_utils.ts", - "lineNumber": 54 - }, - "initialIsOpen": false - }, { "id": "def-public.getQueryParams", "type": "Function", @@ -2578,6 +2738,7 @@ "description": [], "children": [ { + "id": "def-public.getQueryParams.$1", "type": "Object", "label": "location", "isRequired": true, @@ -2612,6 +2773,7 @@ ], "children": [ { + "id": "def-public.getStateFromKbnUrl.$1", "type": "string", "label": "key", "isRequired": true, @@ -2625,6 +2787,7 @@ } }, { + "id": "def-public.getStateFromKbnUrl.$2", "type": "string", "label": "url", "isRequired": true, @@ -2638,7 +2801,7 @@ } }, { - "id": "def-public.getStateFromKbnUrl.{-getFromHashQuery = true }", + "id": "def-public.getStateFromKbnUrl.$3.getFromHashQuerytrue", "type": "Object", "label": "{ getFromHashQuery = true }", "tags": [], @@ -2646,7 +2809,7 @@ "children": [ { "tags": [], - "id": "def-public.getStateFromKbnUrl.{-getFromHashQuery = true }.getFromHashQuery", + "id": "def-public.getStateFromKbnUrl.$3.getFromHashQuerytrue.getFromHashQuery", "type": "boolean", "label": "getFromHashQuery", "description": [], @@ -2682,6 +2845,7 @@ ], "children": [ { + "id": "def-public.getStatesFromKbnUrl.$1", "type": "string", "label": "url", "isRequired": true, @@ -2695,6 +2859,7 @@ } }, { + "id": "def-public.getStatesFromKbnUrl.$2", "type": "Array", "label": "keys", "isRequired": false, @@ -2708,7 +2873,7 @@ } }, { - "id": "def-public.getStatesFromKbnUrl.{-getFromHashQuery = true }", + "id": "def-public.getStatesFromKbnUrl.$3.getFromHashQuerytrue", "type": "Object", "label": "{ getFromHashQuery = true }", "tags": [], @@ -2716,7 +2881,7 @@ "children": [ { "tags": [], - "id": "def-public.getStatesFromKbnUrl.{-getFromHashQuery = true }.getFromHashQuery", + "id": "def-public.getStatesFromKbnUrl.$3.getFromHashQuerytrue.getFromHashQuery", "type": "boolean", "label": "getFromHashQuery", "description": [], @@ -2780,6 +2945,7 @@ "description": [], "children": [ { + "id": "def-public.isStateHash.$1", "type": "string", "label": "str", "isRequired": true, @@ -2806,6 +2972,7 @@ "type": "Function", "children": [ { + "id": "def-public.of.$1", "type": "Object", "label": "promise", "isRequired": true, @@ -2844,6 +3011,7 @@ "description": [], "children": [ { + "id": "def-public.persistState.$1", "type": "Uncategorized", "label": "state", "isRequired": true, @@ -2910,7 +3078,7 @@ ], "children": [ { - "id": "def-public.redirectWhenMissing.{\n- history,\n navigateToApp,\n basePath,\n mapping,\n toastNotifications,\n onBeforeRedirect,\n}", + "id": "def-public.redirectWhenMissing.$1.historynavigateToAppbasePathmappingtoastNotificationsonBeforeRedirect", "type": "Object", "label": "{\n history,\n navigateToApp,\n basePath,\n mapping,\n toastNotifications,\n onBeforeRedirect,\n}", "tags": [], @@ -2918,7 +3086,7 @@ "children": [ { "tags": [], - "id": "def-public.redirectWhenMissing.{\n- history,\n navigateToApp,\n basePath,\n mapping,\n toastNotifications,\n onBeforeRedirect,\n}.history", + "id": "def-public.redirectWhenMissing.$1.historynavigateToAppbasePathmappingtoastNotificationsonBeforeRedirect.history", "type": "Object", "label": "history", "description": [], @@ -2933,7 +3101,7 @@ }, { "tags": [], - "id": "def-public.redirectWhenMissing.{\n- history,\n navigateToApp,\n basePath,\n mapping,\n toastNotifications,\n onBeforeRedirect,\n}.navigateToApp", + "id": "def-public.redirectWhenMissing.$1.historynavigateToAppbasePathmappingtoastNotificationsonBeforeRedirect.navigateToApp", "type": "Function", "label": "navigateToApp", "description": [], @@ -2955,7 +3123,7 @@ }, { "tags": [], - "id": "def-public.redirectWhenMissing.{\n- history,\n navigateToApp,\n basePath,\n mapping,\n toastNotifications,\n onBeforeRedirect,\n}.basePath", + "id": "def-public.redirectWhenMissing.$1.historynavigateToAppbasePathmappingtoastNotificationsonBeforeRedirect.basePath", "type": "Object", "label": "basePath", "description": [], @@ -2975,7 +3143,7 @@ }, { "tags": [], - "id": "def-public.redirectWhenMissing.{\n- history,\n navigateToApp,\n basePath,\n mapping,\n toastNotifications,\n onBeforeRedirect,\n}.mapping", + "id": "def-public.redirectWhenMissing.$1.historynavigateToAppbasePathmappingtoastNotificationsonBeforeRedirect.mapping", "type": "CompoundType", "label": "mapping", "description": [ @@ -2991,7 +3159,7 @@ }, { "tags": [], - "id": "def-public.redirectWhenMissing.{\n- history,\n navigateToApp,\n basePath,\n mapping,\n toastNotifications,\n onBeforeRedirect,\n}.toastNotifications", + "id": "def-public.redirectWhenMissing.$1.historynavigateToAppbasePathmappingtoastNotificationsonBeforeRedirect.toastNotifications", "type": "Object", "label": "toastNotifications", "description": [ @@ -3015,7 +3183,7 @@ }, { "tags": [], - "id": "def-public.redirectWhenMissing.{\n- history,\n navigateToApp,\n basePath,\n mapping,\n toastNotifications,\n onBeforeRedirect,\n}.onBeforeRedirect", + "id": "def-public.redirectWhenMissing.$1.historynavigateToAppbasePathmappingtoastNotificationsonBeforeRedirect.onBeforeRedirect", "type": "Function", "label": "onBeforeRedirect", "description": [ @@ -3064,6 +3232,7 @@ "description": [], "children": [ { + "id": "def-public.removeQueryParam.$1", "type": "Object", "label": "history", "isRequired": true, @@ -3078,6 +3247,7 @@ } }, { + "id": "def-public.removeQueryParam.$2", "type": "string", "label": "param", "isRequired": true, @@ -3091,6 +3261,7 @@ } }, { + "id": "def-public.removeQueryParam.$3", "type": "boolean", "label": "replace", "isRequired": true, @@ -3126,6 +3297,7 @@ "description": [], "children": [ { + "id": "def-public.replaceUrlHashQuery.$1", "type": "string", "label": "rawUrl", "isRequired": true, @@ -3139,6 +3311,7 @@ } }, { + "id": "def-public.replaceUrlHashQuery.$2", "type": "Function", "label": "queryReplacer", "isRequired": true, @@ -3178,6 +3351,7 @@ "description": [], "children": [ { + "id": "def-public.replaceUrlQuery.$1", "type": "string", "label": "rawUrl", "isRequired": true, @@ -3191,6 +3365,7 @@ } }, { + "id": "def-public.replaceUrlQuery.$2", "type": "Function", "label": "queryReplacer", "isRequired": true, @@ -3226,6 +3401,7 @@ "description": [], "children": [ { + "id": "def-public.retrieveState.$1", "type": "string", "label": "stateHash", "isRequired": true, @@ -3259,6 +3435,7 @@ ], "children": [ { + "id": "def-public.setStateToKbnUrl.$1", "type": "string", "label": "key", "isRequired": true, @@ -3272,6 +3449,7 @@ } }, { + "id": "def-public.setStateToKbnUrl.$2", "type": "Uncategorized", "label": "state", "isRequired": true, @@ -3285,7 +3463,7 @@ } }, { - "id": "def-public.setStateToKbnUrl.{-useHash = false, storeInHashQuery = true }", + "id": "def-public.setStateToKbnUrl.$3.useHashfalsestoreInHashQuerytrue", "type": "Object", "label": "{ useHash = false, storeInHashQuery = true }", "tags": [], @@ -3293,7 +3471,7 @@ "children": [ { "tags": [], - "id": "def-public.setStateToKbnUrl.{-useHash = false, storeInHashQuery = true }.useHash", + "id": "def-public.setStateToKbnUrl.$3.useHashfalsestoreInHashQuerytrue.useHash", "type": "boolean", "label": "useHash", "description": [], @@ -3304,7 +3482,7 @@ }, { "tags": [], - "id": "def-public.setStateToKbnUrl.{-useHash = false, storeInHashQuery = true }.storeInHashQuery", + "id": "def-public.setStateToKbnUrl.$3.useHashfalsestoreInHashQuerytrue.storeInHashQuery", "type": "CompoundType", "label": "storeInHashQuery", "description": [], @@ -3323,6 +3501,7 @@ } }, { + "id": "def-public.setStateToKbnUrl.$4", "type": "string", "label": "rawUrl", "isRequired": true, @@ -3376,6 +3555,7 @@ ], "children": [ { + "id": "def-public.syncState.$1", "type": "Object", "label": "{\n storageKey,\n stateStorage,\n stateContainer,\n}", "isRequired": true, @@ -3388,13 +3568,7 @@ "text": "IStateSyncConfig" }, "" ], "description": [], @@ -3446,6 +3620,7 @@ "description": [], "children": [ { + "id": "def-public.syncStates.$1", "type": "Array", "label": "stateSyncConfigs", "isRequired": true, @@ -3458,13 +3633,7 @@ "text": "IStateSyncConfig" }, "[]" ], "description": [ @@ -3519,6 +3688,7 @@ "type": "Function", "children": [ { + "id": "def-public.useContainerSelector.$1", "type": "Uncategorized", "label": "container", "isRequired": true, @@ -3532,6 +3702,7 @@ } }, { + "id": "def-public.useContainerSelector.$2", "type": "Function", "label": "selector", "isRequired": true, @@ -3553,6 +3724,7 @@ } }, { + "id": "def-public.useContainerSelector.$3", "type": "Function", "label": "comparator", "isRequired": true, @@ -3621,6 +3793,7 @@ "type": "Function", "children": [ { + "id": "def-public.useContainerState.$1", "type": "Uncategorized", "label": "container", "isRequired": true, @@ -3674,6 +3847,7 @@ "type": "Function", "children": [ { + "id": "def-public.withNotifyOnErrors.$1", "type": "Object", "label": "toasts", "isRequired": true, @@ -4091,13 +4265,7 @@ "lineNumber": 50 }, "signature": [ - { - "pluginId": "kibanaUtils", - "scope": "public", - "docId": "kibKibanaUtilsPluginApi", - "section": "def-public.IKbnUrlControls", - "text": "IKbnUrlControls" - } + "IKbnUrlControls" ] } ], @@ -4741,13 +4909,7 @@ }, "signature": [ "(action: ", - { - "pluginId": "kibanaUtils", - "scope": "common", - "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.TransitionDescription", - "text": "TransitionDescription" - }, + "TransitionDescription", ") => void" ] }, @@ -4901,13 +5063,7 @@ }, "signature": [ "Readonly<", - { - "pluginId": "kibanaUtils", - "scope": "common", - "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.PureTransitionsToTransitions", - "text": "PureTransitionsToTransitions" - }, + "PureTransitionsToTransitions", ">" ] }, @@ -4971,6 +5127,7 @@ ], "children": [ { + "id": "def-public.UiComponentInstance.render.$1", "type": "Object", "label": "el", "isRequired": true, @@ -4986,6 +5143,7 @@ } }, { + "id": "def-public.UiComponentInstance.render.$2", "type": "Uncategorized", "label": "props", "isRequired": true, @@ -5546,13 +5704,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "kibanaUtils", - "scope": "common", - "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.encodeUriQuery", - "text": "encodeUriQuery" - } + "encodeUriQuery" ] }, { @@ -5611,6 +5763,7 @@ "description": [], "children": [ { + "id": "def-server.AbortError.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -5686,6 +5839,7 @@ "description": [], "children": [ { + "id": "def-server.KbnServerError.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -5699,6 +5853,7 @@ } }, { + "id": "def-server.KbnServerError.Unnamed.$2", "type": "number", "label": "statusCode", "isRequired": true, @@ -5712,6 +5867,7 @@ } }, { + "id": "def-server.KbnServerError.Unnamed.$3", "type": "Object", "label": "errBody", "isRequired": false, @@ -5753,6 +5909,7 @@ ], "children": [ { + "id": "def-server.abortSignalToPromise.$1", "type": "Object", "label": "signal", "isRequired": true, @@ -5781,6 +5938,7 @@ "type": "Function", "children": [ { + "id": "def-server.createGetterSetter.$1", "type": "string", "label": "name", "isRequired": true, @@ -5833,6 +5991,7 @@ "description": [], "children": [ { + "id": "def-server.fieldWildcardFilter.$1", "type": "Array", "label": "globs", "isRequired": true, @@ -5846,6 +6005,7 @@ } }, { + "id": "def-server.fieldWildcardFilter.$2", "type": "Array", "label": "metaFields", "isRequired": true, @@ -5877,6 +6037,7 @@ "description": [], "children": [ { + "id": "def-server.fieldWildcardMatcher.$1", "type": "Array", "label": "globs", "isRequired": true, @@ -5890,6 +6051,7 @@ } }, { + "id": "def-server.fieldWildcardMatcher.$2", "type": "Array", "label": "metaFields", "isRequired": true, @@ -5911,39 +6073,6 @@ }, "initialIsOpen": false }, - { - "id": "def-server.getCombinedAbortSignal", - "type": "Function", - "label": "getCombinedAbortSignal", - "signature": [ - "(signals: AbortSignal[]) => { signal: AbortSignal; cleanup: () => void; }" - ], - "description": [ - "\nReturns an `AbortSignal` that will be aborted when the first of the given signals aborts.\n" - ], - "children": [ - { - "type": "Array", - "label": "signals", - "isRequired": true, - "signature": [ - "AbortSignal[]" - ], - "description": [], - "source": { - "path": "src/plugins/kibana_utils/common/abort_utils.ts", - "lineNumber": 55 - } - } - ], - "tags": [], - "returnComment": [], - "source": { - "path": "src/plugins/kibana_utils/common/abort_utils.ts", - "lineNumber": 54 - }, - "initialIsOpen": false - }, { "id": "def-server.getKbnServerError", "type": "Function", @@ -5963,6 +6092,7 @@ ], "children": [ { + "id": "def-server.getKbnServerError.$1", "type": "Object", "label": "e", "isRequired": true, @@ -6021,6 +6151,7 @@ ], "children": [ { + "id": "def-server.reportServerError.$1", "type": "Object", "label": "res", "isRequired": true, @@ -6036,13 +6167,7 @@ "text": "CustomHttpResponseOptions" }, ") => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaResponse", - "text": "KibanaResponse" - }, + "KibanaResponse", "; badRequest: (options?: ", { "pluginId": "core", @@ -6052,13 +6177,7 @@ "text": "ErrorHttpResponseOptions" }, ") => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaResponse", - "text": "KibanaResponse" - } + "KibanaResponse" ], "description": [ "Formats a `KbnServerError` into a server error response" @@ -6069,6 +6188,7 @@ } }, { + "id": "def-server.reportServerError.$2", "type": "Object", "label": "err", "isRequired": true, @@ -6167,13 +6287,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "kibanaUtils", - "scope": "common", - "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.encodeUriQuery", - "text": "encodeUriQuery" - } + "encodeUriQuery" ] }, { @@ -6232,6 +6346,7 @@ "description": [], "children": [ { + "id": "def-common.AbortError.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -6363,6 +6478,7 @@ "description": [], "children": [ { + "id": "def-common.DuplicateField.Unnamed.$1", "type": "string", "label": "name", "isRequired": true, @@ -6426,6 +6542,7 @@ "description": [], "children": [ { + "id": "def-common.InvalidJSONProperty.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -6435,7 +6552,7 @@ "description": [], "source": { "path": "src/plugins/kibana_utils/common/errors/errors.ts", - "lineNumber": 56 + "lineNumber": 74 } } ], @@ -6443,13 +6560,13 @@ "returnComment": [], "source": { "path": "src/plugins/kibana_utils/common/errors/errors.ts", - "lineNumber": 56 + "lineNumber": 74 } } ], "source": { "path": "src/plugins/kibana_utils/common/errors/errors.ts", - "lineNumber": 55 + "lineNumber": 73 }, "initialIsOpen": false }, @@ -6480,6 +6597,7 @@ "description": [], "children": [ { + "id": "def-common.KbnError.Unnamed.$1", "type": "string", "label": "message", "isRequired": true, @@ -6507,6 +6625,134 @@ }, "initialIsOpen": false }, + { + "id": "def-common.SavedFieldNotFound", + "type": "Class", + "tags": [], + "label": "SavedFieldNotFound", + "description": [ + "\nA saved field doesn't exist anymore" + ], + "signature": [ + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.SavedFieldNotFound", + "text": "SavedFieldNotFound" + }, + " extends ", + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.KbnError", + "text": "KbnError" + } + ], + "children": [ + { + "id": "def-common.SavedFieldNotFound.Unnamed", + "type": "Function", + "label": "Constructor", + "signature": [ + "any" + ], + "description": [], + "children": [ + { + "id": "def-common.SavedFieldNotFound.Unnamed.$1", + "type": "string", + "label": "message", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 54 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 54 + } + } + ], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 53 + }, + "initialIsOpen": false + }, + { + "id": "def-common.SavedFieldTypeInvalidForAgg", + "type": "Class", + "tags": [], + "label": "SavedFieldTypeInvalidForAgg", + "description": [ + "\nA saved field type isn't compatible with aggregation" + ], + "signature": [ + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.SavedFieldTypeInvalidForAgg", + "text": "SavedFieldTypeInvalidForAgg" + }, + " extends ", + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.KbnError", + "text": "KbnError" + } + ], + "children": [ + { + "id": "def-common.SavedFieldTypeInvalidForAgg.Unnamed", + "type": "Function", + "label": "Constructor", + "signature": [ + "any" + ], + "description": [], + "children": [ + { + "id": "def-common.SavedFieldTypeInvalidForAgg.Unnamed.$1", + "type": "string", + "label": "message", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 63 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 63 + } + } + ], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 62 + }, + "initialIsOpen": false + }, { "id": "def-common.SavedObjectNotFound", "type": "Class", @@ -6568,6 +6814,7 @@ "description": [], "children": [ { + "id": "def-common.SavedObjectNotFound.Unnamed.$1", "type": "string", "label": "type", "isRequired": true, @@ -6581,6 +6828,7 @@ } }, { + "id": "def-common.SavedObjectNotFound.Unnamed.$2", "type": "string", "label": "id", "isRequired": false, @@ -6594,6 +6842,7 @@ } }, { + "id": "def-common.SavedObjectNotFound.Unnamed.$3", "type": "string", "label": "link", "isRequired": false, @@ -6605,6 +6854,20 @@ "path": "src/plugins/kibana_utils/common/errors/errors.ts", "lineNumber": 35 } + }, + { + "id": "def-common.SavedObjectNotFound.Unnamed.$4", + "type": "string", + "label": "customMessage", + "isRequired": false, + "signature": [ + "string | undefined" + ], + "description": [], + "source": { + "path": "src/plugins/kibana_utils/common/errors/errors.ts", + "lineNumber": 35 + } } ], "tags": [], @@ -6635,6 +6898,7 @@ ], "children": [ { + "id": "def-common.abortSignalToPromise.$1", "type": "Object", "label": "signal", "isRequired": true, @@ -6678,6 +6942,7 @@ "type": "Function", "children": [ { + "id": "def-common.createGetterSetter.$1", "type": "string", "label": "name", "isRequired": true, @@ -6740,6 +7005,7 @@ ], "children": [ { + "id": "def-common.createStateContainer.$1", "type": "Uncategorized", "label": "defaultState", "isRequired": true, @@ -6785,6 +7051,7 @@ ], "children": [ { + "id": "def-common.createStateContainer.$1", "type": "Uncategorized", "label": "defaultState", "isRequired": true, @@ -6800,6 +7067,7 @@ } }, { + "id": "def-common.createStateContainer.$2", "type": "Uncategorized", "label": "pureTransitions", "isRequired": true, @@ -6853,6 +7121,7 @@ ], "children": [ { + "id": "def-common.createStateContainer.$1", "type": "Uncategorized", "label": "defaultState", "isRequired": true, @@ -6868,6 +7137,7 @@ } }, { + "id": "def-common.createStateContainer.$2", "type": "Uncategorized", "label": "pureTransitions", "isRequired": true, @@ -6883,6 +7153,7 @@ } }, { + "id": "def-common.createStateContainer.$3", "type": "Uncategorized", "label": "pureSelectors", "isRequired": true, @@ -6898,6 +7169,7 @@ } }, { + "id": "def-common.createStateContainer.$4", "type": "Object", "label": "options", "isRequired": false, @@ -7027,6 +7299,7 @@ "description": [], "children": [ { + "id": "def-common.distinctUntilChangedWithInitialValue.$1", "type": "CompoundType", "label": "initialValue", "isRequired": true, @@ -7040,6 +7313,7 @@ } }, { + "id": "def-common.distinctUntilChangedWithInitialValue.$2", "type": "Function", "label": "compare", "isRequired": false, @@ -7071,6 +7345,7 @@ "description": [], "children": [ { + "id": "def-common.fieldWildcardFilter.$1", "type": "Array", "label": "globs", "isRequired": true, @@ -7084,6 +7359,7 @@ } }, { + "id": "def-common.fieldWildcardFilter.$2", "type": "Array", "label": "metaFields", "isRequired": true, @@ -7115,6 +7391,7 @@ "description": [], "children": [ { + "id": "def-common.fieldWildcardMatcher.$1", "type": "Array", "label": "globs", "isRequired": true, @@ -7128,6 +7405,7 @@ } }, { + "id": "def-common.fieldWildcardMatcher.$2", "type": "Array", "label": "metaFields", "isRequired": true, @@ -7149,39 +7427,6 @@ }, "initialIsOpen": false }, - { - "id": "def-common.getCombinedAbortSignal", - "type": "Function", - "label": "getCombinedAbortSignal", - "signature": [ - "(signals: AbortSignal[]) => { signal: AbortSignal; cleanup: () => void; }" - ], - "description": [ - "\nReturns an `AbortSignal` that will be aborted when the first of the given signals aborts.\n" - ], - "children": [ - { - "type": "Array", - "label": "signals", - "isRequired": true, - "signature": [ - "AbortSignal[]" - ], - "description": [], - "source": { - "path": "src/plugins/kibana_utils/common/abort_utils.ts", - "lineNumber": 55 - } - } - ], - "tags": [], - "returnComment": [], - "source": { - "path": "src/plugins/kibana_utils/common/abort_utils.ts", - "lineNumber": 54 - }, - "initialIsOpen": false - }, { "tags": [], "id": "def-common.makeRegEx", @@ -7219,6 +7464,7 @@ "type": "Function", "children": [ { + "id": "def-common.of.$1", "type": "Object", "label": "promise", "isRequired": true, @@ -7252,6 +7498,7 @@ "type": "Function", "children": [ { + "id": "def-common.useContainerSelector.$1", "type": "Uncategorized", "label": "container", "isRequired": true, @@ -7265,6 +7512,7 @@ } }, { + "id": "def-common.useContainerSelector.$2", "type": "Function", "label": "selector", "isRequired": true, @@ -7286,6 +7534,7 @@ } }, { + "id": "def-common.useContainerSelector.$3", "type": "Function", "label": "comparator", "isRequired": true, @@ -7354,6 +7603,7 @@ "type": "Function", "children": [ { + "id": "def-common.useContainerState.$1", "type": "Uncategorized", "label": "container", "isRequired": true, @@ -7683,13 +7933,7 @@ }, "signature": [ "(state: P, references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => P" ] }, @@ -7707,13 +7951,7 @@ }, "signature": [ "(state: P) => { state: P; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ] }, @@ -7793,13 +8031,7 @@ }, "signature": [ "(state: P, references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => P" ] }, @@ -7817,13 +8049,7 @@ }, "signature": [ "(state: P) => { state: P; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ] }, @@ -7987,13 +8213,7 @@ }, "signature": [ "(action: ", - { - "pluginId": "kibanaUtils", - "scope": "common", - "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.TransitionDescription", - "text": "TransitionDescription" - }, + "TransitionDescription", ") => void" ] }, @@ -8081,13 +8301,7 @@ }, "signature": [ "Readonly<", - { - "pluginId": "kibanaUtils", - "scope": "common", - "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.PureTransitionsToTransitions", - "text": "PureTransitionsToTransitions" - }, + "PureTransitionsToTransitions", ">" ] }, @@ -8151,6 +8365,7 @@ ], "children": [ { + "id": "def-common.UiComponentInstance.render.$1", "type": "Object", "label": "el", "isRequired": true, @@ -8166,6 +8381,7 @@ } }, { + "id": "def-common.UiComponentInstance.render.$2", "type": "Uncategorized", "label": "props", "isRequired": true, @@ -8753,13 +8969,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "kibanaUtils", - "scope": "common", - "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.encodeUriQuery", - "text": "encodeUriQuery" - } + "encodeUriQuery" ] }, { diff --git a/api_docs/lens.json b/api_docs/lens.json index b5321bf24ba6b..8176ea2dfb7a0 100644 --- a/api_docs/lens.json +++ b/api_docs/lens.json @@ -110,13 +110,7 @@ "lineNumber": 43 }, "signature": [ - { - "pluginId": "lens", - "scope": "public", - "docId": "kibLensPluginApi", - "section": "def-public.ColumnState", - "text": "ColumnState" - }, + "ColumnState", "[]" ] }, @@ -142,13 +136,7 @@ "lineNumber": 45 }, "signature": [ - { - "pluginId": "lens", - "scope": "public", - "docId": "kibLensPluginApi", - "section": "def-public.SortingState", - "text": "SortingState" - }, + "SortingState", " | undefined" ] } @@ -256,13 +244,7 @@ }, "signature": [ "{ filters: ", - { - "pluginId": "lens", - "scope": "public", - "docId": "kibLensPluginApi", - "section": "def-public.Filter", - "text": "Filter" - }, + "Filter", "[]; }" ] } @@ -291,7 +273,7 @@ "lineNumber": 46 }, "signature": [ - "\"range\" | \"filters\" | \"count\" | \"max\" | \"min\" | \"date_histogram\" | \"sum\" | \"average\" | \"terms\" | \"median\" | \"cumulative_sum\" | \"moving_average\" | \"counter_rate\" | \"differences\" | \"unique_count\" | \"percentile\" | \"last_value\" | undefined" + "\"range\" | \"filters\" | \"count\" | \"max\" | \"min\" | \"date_histogram\" | \"sum\" | \"average\" | \"percentile\" | \"terms\" | \"median\" | \"cumulative_sum\" | \"moving_average\" | \"counter_rate\" | \"differences\" | \"unique_count\" | \"last_value\" | undefined" ] }, { @@ -334,13 +316,7 @@ }, "signature": [ "Record>" ] } @@ -513,13 +489,7 @@ }, "signature": [ "(input: ", - { - "pluginId": "lens", - "scope": "public", - "docId": "kibLensPluginApi", - "section": "def-public.LensEmbeddableInput", - "text": "LensEmbeddableInput" - }, + "LensEmbeddableInput", ") => void" ] }, @@ -553,13 +523,7 @@ }, "signature": [ "() => Promise<", - { - "pluginId": "lens", - "scope": "public", - "docId": "kibLensPluginApi", - "section": "def-public.VisualizationType", - "text": "VisualizationType" - }, + "VisualizationType", "[]>" ] } @@ -609,6 +573,67 @@ }, "initialIsOpen": false }, + { + "id": "def-public.OperationMetadata", + "type": "Interface", + "label": "OperationMetadata", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-public.OperationMetadata.dataType", + "type": "CompoundType", + "label": "dataType", + "description": [], + "source": { + "path": "x-pack/plugins/lens/public/types.ts", + "lineNumber": 360 + }, + "signature": [ + { + "pluginId": "lens", + "scope": "public", + "docId": "kibLensPluginApi", + "section": "def-public.DataType", + "text": "DataType" + } + ] + }, + { + "tags": [], + "id": "def-public.OperationMetadata.isBucketed", + "type": "boolean", + "label": "isBucketed", + "description": [], + "source": { + "path": "x-pack/plugins/lens/public/types.ts", + "lineNumber": 363 + } + }, + { + "tags": [], + "id": "def-public.OperationMetadata.scale", + "type": "CompoundType", + "label": "scale", + "description": [ + "\nordinal: Each name is a unique value, but the names are in sorted order, like \"Top values\"\ninterval: Histogram data, like date or number histograms\nratio: Most number data is rendered as a ratio that includes 0" + ], + "source": { + "path": "x-pack/plugins/lens/public/types.ts", + "lineNumber": 369 + }, + "signature": [ + "\"interval\" | \"ordinal\" | \"ratio\" | undefined" + ] + } + ], + "source": { + "path": "x-pack/plugins/lens/public/types.ts", + "lineNumber": 358 + }, + "initialIsOpen": false + }, { "id": "def-public.PercentileIndexPatternColumn", "type": "Interface", @@ -776,21 +801,9 @@ }, "signature": [ "{ type: ", - { - "pluginId": "lens", - "scope": "public", - "docId": "kibLensPluginApi", - "section": "def-public.MODES_TYPES", - "text": "MODES_TYPES" - }, + "MODES_TYPES", "; maxBars: number | \"auto\"; ranges: ", - { - "pluginId": "lens", - "scope": "public", - "docId": "kibLensPluginApi", - "section": "def-public.RangeTypeLens", - "text": "RangeTypeLens" - }, + "RangeTypeLens", "[]; format?: { id: string; params?: { decimals: number; } | undefined; } | undefined; parentFormat?: { id: string; params?: { id?: string | undefined; template?: string | undefined; replaceInfinity?: boolean | undefined; } | undefined; } | undefined; }" ] } @@ -1051,13 +1064,7 @@ "lineNumber": 381 }, "signature": [ - { - "pluginId": "lens", - "scope": "public", - "docId": "kibLensPluginApi", - "section": "def-public.YConfig", - "text": "YConfig" - }, + "YConfig", "[] | undefined" ] }, @@ -1411,6 +1418,21 @@ ], "initialIsOpen": false }, + { + "id": "def-public.DataType", + "type": "Type", + "label": "DataType", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/lens/public/types.ts", + "lineNumber": 347 + }, + "signature": [ + "\"string\" | \"number\" | \"boolean\" | \"date\" | \"ip\" | \"histogram\" | \"document\"" + ], + "initialIsOpen": false + }, { "id": "def-public.DerivativeIndexPatternColumn", "type": "Type", @@ -1576,10 +1598,10 @@ ], "source": { "path": "x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts", - "lineNumber": 406 + "lineNumber": 399 }, "signature": [ - "\"range\" | \"filters\" | \"count\" | \"max\" | \"min\" | \"date_histogram\" | \"sum\" | \"average\" | \"terms\" | \"median\" | \"cumulative_sum\" | \"moving_average\" | \"counter_rate\" | \"differences\" | \"unique_count\" | \"percentile\" | \"last_value\"" + "\"range\" | \"filters\" | \"count\" | \"max\" | \"min\" | \"date_histogram\" | \"sum\" | \"average\" | \"percentile\" | \"terms\" | \"median\" | \"cumulative_sum\" | \"moving_average\" | \"counter_rate\" | \"differences\" | \"unique_count\" | \"last_value\"" ], "initialIsOpen": false }, @@ -1656,7 +1678,7 @@ "lineNumber": 38 }, "signature": [ - "Pick & { attributes: LensAttributes<'lnsXY', XYState> | LensAttributes<'lnsPie', PieVisualizationState> | LensAttributes<'lnsDatatable', DatatableVisualizationState> | LensAttributes<'lnsMetric', MetricState>; }" + "Pick & { attributes: LensAttributes<'lnsXY', XYState> | LensAttributes<'lnsPie', PieVisualizationState> | LensAttributes<'lnsDatatable', DatatableVisualizationState> | LensAttributes<'lnsMetric', MetricState>; }" ], "initialIsOpen": false }, @@ -1675,6 +1697,21 @@ ], "initialIsOpen": false }, + { + "id": "def-public.XYCurveType", + "type": "Type", + "label": "XYCurveType", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/lens/public/xy_visualization/types.ts", + "lineNumber": 419 + }, + "signature": [ + "\"LINEAR\" | \"CURVE_MONOTONE_X\"" + ], + "initialIsOpen": false + }, { "id": "def-public.YAxisMode", "type": "Type", @@ -1730,6 +1767,7 @@ "description": [], "children": [ { + "id": "def-server.LensServerPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -1791,6 +1829,7 @@ "description": [], "children": [ { + "id": "def-server.LensServerPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -1819,6 +1858,7 @@ } }, { + "id": "def-server.LensServerPlugin.setup.$2", "type": "Object", "label": "plugins", "isRequired": true, @@ -1871,6 +1911,7 @@ "description": [], "children": [ { + "id": "def-server.LensServerPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -1890,6 +1931,7 @@ } }, { + "id": "def-server.LensServerPlugin.start.$2", "type": "Object", "label": "plugins", "isRequired": true, @@ -1961,13 +2003,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "usageCollection", - "scope": "server", - "docId": "kibUsageCollectionPluginApi", - "section": "def-server.CollectorSet", - "text": "CollectorSet" - }, + "CollectorSet", ", \"makeStatsCollector\" | \"makeUsageCollector\" | \"registerCollector\" | \"getCollectorByType\" | \"areAllCollectorsReady\" | \"bulkFetch\" | \"bulkFetchUsage\" | \"toObject\" | \"toApiFieldNames\"> | undefined" ] }, @@ -2089,6 +2125,7 @@ "description": [], "children": [ { + "id": "def-common.getEditPath.$1", "type": "string", "label": "id", "isRequired": false, @@ -2120,6 +2157,7 @@ "description": [], "children": [ { + "id": "def-common.getFullPath.$1", "type": "string", "label": "id", "isRequired": false, diff --git a/api_docs/licensing.json b/api_docs/licensing.json index 1f97d24e26188..df2511925bd61 100644 --- a/api_docs/licensing.json +++ b/api_docs/licensing.json @@ -148,13 +148,7 @@ }, "signature": [ "() => ", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.PublicLicenseJSON", - "text": "PublicLicenseJSON" - } + "PublicLicenseJSON" ] }, { @@ -201,6 +195,7 @@ ], "children": [ { + "id": "def-public.ILicense.hasAtLeast.$1", "type": "CompoundType", "label": "minimumLicenseRequired", "isRequired": true, @@ -229,19 +224,14 @@ "label": "check", "signature": [ "(pluginName: string, minimumLicenseRequired: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\") => ", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.LicenseCheck", - "text": "LicenseCheck" - } + "LicenseCheck" ], "description": [ "\nFor a given plugin and license type, receive information about the status of the license." ], "children": [ { + "id": "def-public.ILicense.check.$1", "type": "string", "label": "pluginName", "isRequired": true, @@ -257,6 +247,7 @@ } }, { + "id": "def-public.ILicense.check.$2", "type": "CompoundType", "label": "minimumLicenseRequired", "isRequired": true, @@ -285,19 +276,14 @@ "label": "getFeature", "signature": [ "(name: string) => ", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.LicenseFeature", - "text": "LicenseFeature" - } + "LicenseFeature" ], "description": [ "\nA specific API for interacting with the specific features of the license." ], "children": [ { + "id": "def-public.ILicense.getFeature.$1", "type": "string", "label": "name", "isRequired": true, @@ -349,13 +335,7 @@ "lineNumber": 89 }, "signature": [ - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.LicenseCheckState", - "text": "LicenseCheckState" - } + "LicenseCheckState" ] }, { @@ -456,13 +436,7 @@ "lineNumber": 45 }, "signature": [ - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.LicenseStatus", - "text": "LicenseStatus" - } + "LicenseStatus" ] }, { @@ -541,13 +515,7 @@ "lineNumber": 75 }, "signature": [ - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.PublicLicense", - "text": "PublicLicense" - }, + "PublicLicense", " | undefined" ] }, @@ -563,13 +531,7 @@ }, "signature": [ "Record | undefined" ] }, @@ -703,13 +665,7 @@ "signature": [ "Observable", "<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">" ] }, @@ -719,13 +675,7 @@ "label": "refresh", "signature": [ "() => Promise<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">" ], "description": [ @@ -754,13 +704,7 @@ "lineNumber": 28 }, "signature": [ - { - "pluginId": "licensing", - "scope": "public", - "docId": "kibLicensingPluginApi", - "section": "def-public.FeatureUsageServiceSetup", - "text": "FeatureUsageServiceSetup" - } + "FeatureUsageServiceSetup" ] } ], @@ -795,13 +739,7 @@ "signature": [ "Observable", "<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">" ] }, @@ -811,13 +749,7 @@ "label": "refresh", "signature": [ "() => Promise<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">" ], "description": [ @@ -844,13 +776,7 @@ "lineNumber": 44 }, "signature": [ - { - "pluginId": "licensing", - "scope": "public", - "docId": "kibLicensingPluginApi", - "section": "def-public.FeatureUsageServiceStart", - "text": "FeatureUsageServiceStart" - } + "FeatureUsageServiceStart" ] } ], @@ -902,6 +828,7 @@ "description": [], "children": [ { + "id": "def-server.wrapRouteWithLicenseCheck.$1", "type": "Function", "label": "checkLicense", "isRequired": true, @@ -921,6 +848,7 @@ } }, { + "id": "def-server.wrapRouteWithLicenseCheck.$2", "type": "Function", "label": "handler", "isRequired": true, @@ -943,13 +871,7 @@ "text": "CustomHttpResponseOptions" }, ") => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaResponse", - "text": "KibanaResponse" - }, + "KibanaResponse", "; badRequest: (options?: ", { "pluginId": "core", @@ -1035,6 +957,7 @@ ], "children": [ { + "id": "def-server.FeatureUsageServiceSetup.register.$1", "type": "string", "label": "featureName", "isRequired": true, @@ -1048,6 +971,7 @@ } }, { + "id": "def-server.FeatureUsageServiceSetup.register.$2", "type": "CompoundType", "label": "licenseType", "isRequired": true, @@ -1096,6 +1020,7 @@ ], "children": [ { + "id": "def-server.FeatureUsageServiceStart.notifyUsage.$1", "type": "string", "label": "featureName", "isRequired": true, @@ -1111,6 +1036,7 @@ } }, { + "id": "def-server.FeatureUsageServiceStart.notifyUsage.$2", "type": "CompoundType", "label": "usedAt", "isRequired": false, @@ -1139,13 +1065,7 @@ "label": "getLastUsages", "signature": [ "() => ", - { - "pluginId": "licensing", - "scope": "server", - "docId": "kibLicensingPluginApi", - "section": "def-server.LastFeatureUsage", - "text": "LastFeatureUsage" - }, + "LastFeatureUsage", "[]" ], "description": [ @@ -1310,13 +1230,7 @@ }, "signature": [ "() => ", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.PublicLicenseJSON", - "text": "PublicLicenseJSON" - } + "PublicLicenseJSON" ] }, { @@ -1363,6 +1277,7 @@ ], "children": [ { + "id": "def-server.ILicense.hasAtLeast.$1", "type": "CompoundType", "label": "minimumLicenseRequired", "isRequired": true, @@ -1391,19 +1306,14 @@ "label": "check", "signature": [ "(pluginName: string, minimumLicenseRequired: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\") => ", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.LicenseCheck", - "text": "LicenseCheck" - } + "LicenseCheck" ], "description": [ "\nFor a given plugin and license type, receive information about the status of the license." ], "children": [ { + "id": "def-server.ILicense.check.$1", "type": "string", "label": "pluginName", "isRequired": true, @@ -1419,6 +1329,7 @@ } }, { + "id": "def-server.ILicense.check.$2", "type": "CompoundType", "label": "minimumLicenseRequired", "isRequired": true, @@ -1447,19 +1358,14 @@ "label": "getFeature", "signature": [ "(name: string) => ", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.LicenseFeature", - "text": "LicenseFeature" - } + "LicenseFeature" ], "description": [ "\nA specific API for interacting with the specific features of the license." ], "children": [ { + "id": "def-server.ILicense.getFeature.$1", "type": "string", "label": "name", "isRequired": true, @@ -1511,13 +1417,7 @@ "lineNumber": 89 }, "signature": [ - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.LicenseCheckState", - "text": "LicenseCheckState" - } + "LicenseCheckState" ] }, { @@ -1623,13 +1523,7 @@ "lineNumber": 51 }, "signature": [ - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - } + "ILicense" ] } ], @@ -1676,13 +1570,7 @@ "lineNumber": 45 }, "signature": [ - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.LicenseStatus", - "text": "LicenseStatus" - } + "LicenseStatus" ] }, { @@ -1761,13 +1649,7 @@ "lineNumber": 75 }, "signature": [ - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.PublicLicense", - "text": "PublicLicense" - }, + "PublicLicense", " | undefined" ] }, @@ -1783,13 +1665,7 @@ }, "signature": [ "Record | undefined" ] }, @@ -1940,13 +1816,7 @@ "signature": [ "Observable", "<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">" ] }, @@ -1956,13 +1826,7 @@ "label": "refresh", "signature": [ "() => Promise<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">" ], "description": [ @@ -2004,21 +1868,9 @@ ", \"callAsInternalUser\" | \"asScoped\">, pollingFrequency: number) => { license$: ", "Observable", "<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">; refresh(): Promise<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">; }" ] }, @@ -2076,13 +1928,7 @@ "signature": [ "Observable", "<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">" ] }, @@ -2092,13 +1938,7 @@ "label": "refresh", "signature": [ "() => Promise<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">" ], "description": [ @@ -2136,21 +1976,9 @@ ", \"callAsInternalUser\" | \"asScoped\">, pollingFrequency: number) => { license$: ", "Observable", "<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">; refresh(): Promise<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", ">; }" ] }, diff --git a/api_docs/lists.json b/api_docs/lists.json index fc935809cd7d8..df8518608f353 100644 --- a/api_docs/lists.json +++ b/api_docs/lists.json @@ -54,6 +54,7 @@ "description": [], "children": [ { + "id": "def-public.Plugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -95,13 +96,7 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.StartPlugins", - "text": "StartPlugins" - }, + "StartPlugins", ", ", { "pluginId": "lists", @@ -111,13 +106,7 @@ "text": "PluginStart" }, ">, plugins: ", - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.SetupPlugins", - "text": "SetupPlugins" - }, + "SetupPlugins", ") => ", { "pluginId": "lists", @@ -130,6 +119,7 @@ "description": [], "children": [ { + "id": "def-public.Plugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -142,13 +132,7 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.StartPlugins", - "text": "StartPlugins" - }, + "StartPlugins", ", ", { "pluginId": "lists", @@ -166,17 +150,12 @@ } }, { + "id": "def-public.Plugin.setup.$2", "type": "Object", "label": "plugins", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.SetupPlugins", - "text": "SetupPlugins" - } + "SetupPlugins" ], "description": [], "source": { @@ -206,13 +185,7 @@ "text": "CoreStart" }, ", plugins: ", - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.StartPlugins", - "text": "StartPlugins" - }, + "StartPlugins", ") => ", { "pluginId": "lists", @@ -225,6 +198,7 @@ "description": [], "children": [ { + "id": "def-public.Plugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -244,17 +218,12 @@ } }, { + "id": "def-public.Plugin.start.$2", "type": "Object", "label": "plugins", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.StartPlugins", - "text": "StartPlugins" - } + "StartPlugins" ], "description": [], "source": { @@ -284,17 +253,12 @@ "type": "Function", "children": [ { + "id": "def-public.addEndpointExceptionListWithValidation.$1", "type": "Object", "label": "{\n http,\n signal,\n}", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.AddEndpointExceptionListProps", - "text": "AddEndpointExceptionListProps" - } + "AddEndpointExceptionListProps" ], "description": [], "source": { @@ -306,7 +270,7 @@ "signature": [ "({ http, signal, }: ", "AddEndpointExceptionListProps", - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; } | {}>" + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; } | {}>" ], "description": [], "label": "addEndpointExceptionListWithValidation", @@ -323,17 +287,12 @@ "type": "Function", "children": [ { + "id": "def-public.addExceptionListItemWithValidation.$1", "type": "Object", "label": "{\n http,\n listItem,\n signal,\n}", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.AddExceptionListItemProps", - "text": "AddExceptionListItemProps" - } + "AddExceptionListItemProps" ], "description": [], "source": { @@ -345,7 +304,7 @@ "signature": [ "({ http, listItem, signal, }: ", "AddExceptionListItemProps", - ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }>" + ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }>" ], "description": [], "label": "addExceptionListItemWithValidation", @@ -362,17 +321,12 @@ "type": "Function", "children": [ { + "id": "def-public.addExceptionListWithValidation.$1", "type": "Object", "label": "{\n http,\n list,\n signal,\n}", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.AddExceptionListProps", - "text": "AddExceptionListProps" - } + "AddExceptionListProps" ], "description": [], "source": { @@ -384,7 +338,7 @@ "signature": [ "({ http, list, signal, }: ", "AddExceptionListProps", - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; }>" + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; }>" ], "description": [], "label": "addExceptionListWithValidation", @@ -401,17 +355,12 @@ "type": "Function", "children": [ { + "id": "def-public.exportListWithValidation.$1", "type": "Object", "label": "{\n http,\n listId,\n signal,\n}", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.ExportListParams", - "text": "ExportListParams" - } + "ExportListParams" ], "description": [], "source": { @@ -440,17 +389,12 @@ "type": "Function", "children": [ { + "id": "def-public.fetchExceptionListByIdWithValidation.$1", "type": "Object", "label": "{\n http,\n id,\n namespaceType,\n signal,\n}", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.ApiCallByIdProps", - "text": "ApiCallByIdProps" - } + "ApiCallByIdProps" ], "description": [], "source": { @@ -462,7 +406,7 @@ "signature": [ "({ http, id, namespaceType, signal, }: ", "ApiCallByIdProps", - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; }>" + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; }>" ], "description": [], "label": "fetchExceptionListByIdWithValidation", @@ -479,17 +423,12 @@ "type": "Function", "children": [ { + "id": "def-public.updateExceptionListItemWithValidation.$1", "type": "Object", "label": "{\n http,\n listItem,\n signal,\n}", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.UpdateExceptionListItemProps", - "text": "UpdateExceptionListItemProps" - } + "UpdateExceptionListItemProps" ], "description": [], "source": { @@ -501,7 +440,7 @@ "signature": [ "({ http, listItem, signal, }: ", "UpdateExceptionListItemProps", - ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }>" + ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }>" ], "description": [], "label": "updateExceptionListItemWithValidation", @@ -518,6 +457,7 @@ "type": "Function", "children": [ { + "id": "def-public.useApi.$1", "type": "Object", "label": "http", "isRequired": true, @@ -564,6 +504,7 @@ "type": "Function", "children": [ { + "id": "def-public.useAsync.$1", "type": "Function", "label": "fn", "isRequired": true, @@ -624,17 +565,12 @@ "type": "Function", "children": [ { + "id": "def-public.useCursor.$1", "type": "Object", "label": "{ pageIndex, pageSize }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.UseCursorProps", - "text": "UseCursorProps" - } + "UseCursorProps" ], "description": [], "source": { @@ -669,7 +605,7 @@ "OptionalSignalArgs", "<", "DeleteListParams", - ">], { _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; }>" + ">], { _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; }>" ], "description": [], "label": "useDeleteList", @@ -686,17 +622,12 @@ "type": "Function", "children": [ { + "id": "def-public.useExceptionListItems.$1", "type": "Object", "label": "{\n http,\n lists,\n pagination = {\n page: 1,\n perPage: 20,\n total: 0,\n },\n filterOptions,\n showDetectionsListsOnly,\n showEndpointListsOnly,\n matchFilters,\n onError,\n onSuccess,\n}", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.UseExceptionListProps", - "text": "UseExceptionListProps" - } + "UseExceptionListProps" ], "description": [], "source": { @@ -728,17 +659,12 @@ "type": "Function", "children": [ { + "id": "def-public.useExceptionLists.$1", "type": "Object", "label": "{\n errorMessage,\n http,\n pagination = {\n page: 1,\n perPage: 20,\n total: 0,\n },\n filterOptions = {},\n namespaceTypes,\n notifications,\n showTrustedApps = false,\n}", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.UseExceptionListsProps", - "text": "UseExceptionListsProps" - } + "UseExceptionListsProps" ], "description": [], "source": { @@ -799,7 +725,7 @@ "OptionalSignalArgs", "<", "FindListsParams", - ">], { cursor: string; data: { _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; }[]; page: number; per_page: number; total: number; }>" + ">], { cursor: string; data: { _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; }[]; page: number; per_page: number; total: number; }>" ], "description": [], "label": "useFindLists", @@ -822,7 +748,7 @@ "OptionalSignalArgs", "<", "ImportListParams", - ">], { _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; }>" + ">], { _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; }>" ], "description": [], "label": "useImportList", @@ -860,17 +786,12 @@ "type": "Function", "children": [ { + "id": "def-public.usePersistExceptionItem.$1", "type": "Object", "label": "{\n http,\n onError,\n}", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.PersistHookProps", - "text": "PersistHookProps" - } + "PersistHookProps" ], "description": [], "source": { @@ -902,17 +823,12 @@ "type": "Function", "children": [ { + "id": "def-public.usePersistExceptionList.$1", "type": "Object", "label": "{\n http,\n onError,\n}", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "public", - "docId": "kibListsPluginApi", - "section": "def-public.PersistHookProps", - "text": "PersistHookProps" - } + "PersistHookProps" ], "description": [], "source": { @@ -990,6 +906,7 @@ "type": "Function", "children": [ { + "id": "def-public.withOptionalSignal.$1", "type": "Function", "label": "fn", "isRequired": true, @@ -1036,7 +953,7 @@ "section": "def-public.ExceptionList", "text": "ExceptionList" }, - " extends { _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; }" + " extends { _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; }" ], "description": [], "tags": [], @@ -1197,7 +1114,7 @@ "lineNumber": 66 }, "signature": [ - "\"endpoint\" | \"detection\"" + "\"endpoint\" | \"detection\" | \"endpoint_events\"" ] } ], @@ -1275,7 +1192,7 @@ "lineNumber": 46 }, "signature": [ - "{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }[]" + "{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }[]" ] }, { @@ -1323,7 +1240,7 @@ "lineNumber": 121 }, "signature": [ - "{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; }[]" + "{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; }[]" ] }, { @@ -1356,7 +1273,24 @@ ], "enums": [], "misc": [], - "objects": [], + "objects": [ + { + "id": "def-public.ExceptionBuilder", + "type": "Object", + "label": "ExceptionBuilder", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/lists/public/shared_exports.ts", + "lineNumber": 41 + }, + "signature": [ + "typeof ", + "x-pack/plugins/lists/public/exceptions/components/builder/index" + ], + "initialIsOpen": false + } + ], "setup": { "id": "def-public.PluginSetup", "type": "Interface", @@ -1405,17 +1339,12 @@ "description": [], "children": [ { + "id": "def-server.ExceptionListClient.Unnamed.$1", "type": "Object", "label": "{ user, savedObjectsClient }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.ConstructorOptions", - "text": "ConstructorOptions" - } + "ConstructorOptions" ], "description": [], "source": { @@ -1436,17 +1365,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.getExceptionList.$1", "type": "Object", "label": "{\n listId,\n id,\n namespaceType,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetExceptionListOptions", - "text": "GetExceptionListOptions" - } + "GetExceptionListOptions" ], "description": [], "source": { @@ -1457,14 +1381,8 @@ ], "signature": [ "({ listId, id, namespaceType, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetExceptionListOptions", - "text": "GetExceptionListOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; } | null>" + "GetExceptionListOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; } | null>" ], "description": [], "label": "getExceptionList", @@ -1480,17 +1398,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.getExceptionListItem.$1", "type": "Object", "label": "{\n itemId,\n id,\n namespaceType,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetExceptionListItemOptions", - "text": "GetExceptionListItemOptions" - } + "GetExceptionListItemOptions" ], "description": [], "source": { @@ -1501,14 +1414,8 @@ ], "signature": [ "({ itemId, id, namespaceType, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetExceptionListItemOptions", - "text": "GetExceptionListItemOptions" - }, - ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" + "GetExceptionListItemOptions", + ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" ], "description": [], "label": "getExceptionListItem", @@ -1524,7 +1431,7 @@ "type": "Function", "children": [], "signature": [ - "() => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; } | null>" + "() => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; } | null>" ], "description": [ "\nThis creates an agnostic space endpoint list if it does not exist. This tries to be\nas fast as possible by ignoring conflict errors and not returning the contents of the\nlist if it already exists." @@ -1544,7 +1451,7 @@ "type": "Function", "children": [], "signature": [ - "() => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; } | null>" + "() => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; } | null>" ], "description": [ "\nCreate the Trusted Apps Agnostic list if it does not yet exist (`null` is returned if it does exist)" @@ -1562,17 +1469,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.createEndpointListItem.$1", "type": "Object", "label": "{\n comments,\n description,\n entries,\n itemId,\n meta,\n name,\n osTypes,\n tags,\n type,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.CreateEndpointListItemOptions", - "text": "CreateEndpointListItemOptions" - } + "CreateEndpointListItemOptions" ], "description": [], "source": { @@ -1583,14 +1485,8 @@ ], "signature": [ "({ comments, description, entries, itemId, meta, name, osTypes, tags, type, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.CreateEndpointListItemOptions", - "text": "CreateEndpointListItemOptions" - }, - ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }>" + "CreateEndpointListItemOptions", + ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }>" ], "description": [ "\nThis is the same as \"createListItem\" except it applies specifically to the agnostic endpoint list and will\nauto-call the \"createEndpointList\" for you so that you have the best chance of the agnostic endpoint\nbeing there and existing before the item is inserted into the agnostic endpoint list." @@ -1608,17 +1504,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.updateEndpointListItem.$1", "type": "Object", "label": "{\n _version,\n comments,\n description,\n entries,\n id,\n itemId,\n meta,\n name,\n osTypes,\n tags,\n type,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.UpdateEndpointListItemOptions", - "text": "UpdateEndpointListItemOptions" - } + "UpdateEndpointListItemOptions" ], "description": [], "source": { @@ -1629,14 +1520,8 @@ ], "signature": [ "({ _version, comments, description, entries, id, itemId, meta, name, osTypes, tags, type, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.UpdateEndpointListItemOptions", - "text": "UpdateEndpointListItemOptions" - }, - ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" + "UpdateEndpointListItemOptions", + ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" ], "description": [ "\nThis is the same as \"updateExceptionListItem\" except it applies specifically to the endpoint list and will\nauto-call the \"createEndpointList\" for you so that you have the best chance of the endpoint\nbeing there if it did not exist before. If the list did not exist before, then creating it here will still cause a\nreturn of null but at least the list exists again." @@ -1654,17 +1539,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.getEndpointListItem.$1", "type": "Object", "label": "{\n itemId,\n id,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetEndpointListItemOptions", - "text": "GetEndpointListItemOptions" - } + "GetEndpointListItemOptions" ], "description": [], "source": { @@ -1675,14 +1555,8 @@ ], "signature": [ "({ itemId, id, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetEndpointListItemOptions", - "text": "GetEndpointListItemOptions" - }, - ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" + "GetEndpointListItemOptions", + ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" ], "description": [ "\nThis is the same as \"getExceptionListItem\" except it applies specifically to the endpoint list." @@ -1700,17 +1574,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.createExceptionList.$1", "type": "Object", "label": "{\n description,\n immutable,\n listId,\n meta,\n name,\n namespaceType,\n tags,\n type,\n version,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.CreateExceptionListOptions", - "text": "CreateExceptionListOptions" - } + "CreateExceptionListOptions" ], "description": [], "source": { @@ -1721,14 +1590,8 @@ ], "signature": [ "({ description, immutable, listId, meta, name, namespaceType, tags, type, version, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.CreateExceptionListOptions", - "text": "CreateExceptionListOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; }>" + "CreateExceptionListOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; }>" ], "description": [], "label": "createExceptionList", @@ -1744,17 +1607,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.updateExceptionList.$1", "type": "Object", "label": "{\n _version,\n id,\n description,\n listId,\n meta,\n name,\n namespaceType,\n osTypes,\n tags,\n type,\n version,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.UpdateExceptionListOptions", - "text": "UpdateExceptionListOptions" - } + "UpdateExceptionListOptions" ], "description": [], "source": { @@ -1765,14 +1623,8 @@ ], "signature": [ "({ _version, id, description, listId, meta, name, namespaceType, osTypes, tags, type, version, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.UpdateExceptionListOptions", - "text": "UpdateExceptionListOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; } | null>" + "UpdateExceptionListOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; } | null>" ], "description": [], "label": "updateExceptionList", @@ -1788,17 +1640,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.deleteExceptionList.$1", "type": "Object", "label": "{\n id,\n listId,\n namespaceType,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteExceptionListOptions", - "text": "DeleteExceptionListOptions" - } + "DeleteExceptionListOptions" ], "description": [], "source": { @@ -1809,14 +1656,8 @@ ], "signature": [ "({ id, listId, namespaceType, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteExceptionListOptions", - "text": "DeleteExceptionListOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; } | null>" + "DeleteExceptionListOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; } | null>" ], "description": [], "label": "deleteExceptionList", @@ -1832,6 +1673,7 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.createExceptionListItem.$1", "type": "Object", "label": "{\n comments,\n description,\n entries,\n itemId,\n listId,\n meta,\n name,\n namespaceType,\n osTypes,\n tags,\n type,\n }", "isRequired": true, @@ -1860,7 +1702,7 @@ "section": "def-server.CreateExceptionListItemOptions", "text": "CreateExceptionListItemOptions" }, - ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }>" + ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }>" ], "description": [], "label": "createExceptionListItem", @@ -1876,6 +1718,7 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.updateExceptionListItem.$1", "type": "Object", "label": "{\n _version,\n comments,\n description,\n entries,\n id,\n itemId,\n meta,\n name,\n namespaceType,\n osTypes,\n tags,\n type,\n }", "isRequired": true, @@ -1904,7 +1747,7 @@ "section": "def-server.UpdateExceptionListItemOptions", "text": "UpdateExceptionListItemOptions" }, - ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" + ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" ], "description": [], "label": "updateExceptionListItem", @@ -1920,17 +1763,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.deleteExceptionListItem.$1", "type": "Object", "label": "{\n id,\n itemId,\n namespaceType,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteExceptionListItemOptions", - "text": "DeleteExceptionListItemOptions" - } + "DeleteExceptionListItemOptions" ], "description": [], "source": { @@ -1941,14 +1779,8 @@ ], "signature": [ "({ id, itemId, namespaceType, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteExceptionListItemOptions", - "text": "DeleteExceptionListItemOptions" - }, - ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" + "DeleteExceptionListItemOptions", + ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" ], "description": [], "label": "deleteExceptionListItem", @@ -1964,17 +1796,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.deleteExceptionListItemById.$1", "type": "Object", "label": "{\n id,\n namespaceType,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteExceptionListItemByIdOptions", - "text": "DeleteExceptionListItemByIdOptions" - } + "DeleteExceptionListItemByIdOptions" ], "description": [], "source": { @@ -1985,13 +1812,7 @@ ], "signature": [ "({ id, namespaceType, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteExceptionListItemByIdOptions", - "text": "DeleteExceptionListItemByIdOptions" - }, + "DeleteExceptionListItemByIdOptions", ") => Promise" ], "description": [], @@ -2008,17 +1829,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.deleteEndpointListItem.$1", "type": "Object", "label": "{\n id,\n itemId,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteEndpointListItemOptions", - "text": "DeleteEndpointListItemOptions" - } + "DeleteEndpointListItemOptions" ], "description": [], "source": { @@ -2029,14 +1845,8 @@ ], "signature": [ "({ id, itemId, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteEndpointListItemOptions", - "text": "DeleteEndpointListItemOptions" - }, - ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" + "DeleteEndpointListItemOptions", + ") => Promise<{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; } | null>" ], "description": [ "\nThis is the same as \"deleteExceptionListItem\" except it applies specifically to the endpoint list." @@ -2054,17 +1864,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.findExceptionListItem.$1", "type": "Object", "label": "{\n listId,\n filter,\n perPage,\n page,\n sortField,\n sortOrder,\n namespaceType,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindExceptionListItemOptions", - "text": "FindExceptionListItemOptions" - } + "FindExceptionListItemOptions" ], "description": [], "source": { @@ -2075,14 +1880,8 @@ ], "signature": [ "({ listId, filter, perPage, page, sortField, sortOrder, namespaceType, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindExceptionListItemOptions", - "text": "FindExceptionListItemOptions" - }, - ") => Promise<{ data: { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }[]; page: number; per_page: number; total: number; } | null>" + "FindExceptionListItemOptions", + ") => Promise<{ data: { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }[]; page: number; per_page: number; total: number; } | null>" ], "description": [], "label": "findExceptionListItem", @@ -2098,17 +1897,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.findExceptionListsItem.$1", "type": "Object", "label": "{\n listId,\n filter,\n perPage,\n page,\n sortField,\n sortOrder,\n namespaceType,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindExceptionListsItemOptions", - "text": "FindExceptionListsItemOptions" - } + "FindExceptionListsItemOptions" ], "description": [], "source": { @@ -2119,14 +1913,8 @@ ], "signature": [ "({ listId, filter, perPage, page, sortField, sortOrder, namespaceType, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindExceptionListsItemOptions", - "text": "FindExceptionListsItemOptions" - }, - ") => Promise<{ data: { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }[]; page: number; per_page: number; total: number; } | null>" + "FindExceptionListsItemOptions", + ") => Promise<{ data: { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }[]; page: number; per_page: number; total: number; } | null>" ], "description": [], "label": "findExceptionListsItem", @@ -2142,17 +1930,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.findValueListExceptionListItems.$1", "type": "Object", "label": "{\n perPage,\n page,\n sortField,\n sortOrder,\n valueListId,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindValueListExceptionListsItems", - "text": "FindValueListExceptionListsItems" - } + "FindValueListExceptionListsItems" ], "description": [], "source": { @@ -2163,14 +1946,8 @@ ], "signature": [ "({ perPage, page, sortField, sortOrder, valueListId, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindValueListExceptionListsItems", - "text": "FindValueListExceptionListsItems" - }, - ") => Promise<{ data: { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }[]; page: number; per_page: number; total: number; } | null>" + "FindValueListExceptionListsItems", + ") => Promise<{ data: { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }[]; page: number; per_page: number; total: number; } | null>" ], "description": [], "label": "findValueListExceptionListItems", @@ -2186,17 +1963,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.findExceptionList.$1", "type": "Object", "label": "{\n filter,\n perPage,\n page,\n sortField,\n sortOrder,\n namespaceType,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindExceptionListOptions", - "text": "FindExceptionListOptions" - } + "FindExceptionListOptions" ], "description": [], "source": { @@ -2207,14 +1979,8 @@ ], "signature": [ "({ filter, perPage, page, sortField, sortOrder, namespaceType, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindExceptionListOptions", - "text": "FindExceptionListOptions" - }, - ") => Promise<{ data: { _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; }[]; page: number; per_page: number; total: number; }>" + "FindExceptionListOptions", + ") => Promise<{ data: { _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; }[]; page: number; per_page: number; total: number; }>" ], "description": [], "label": "findExceptionList", @@ -2230,17 +1996,12 @@ "type": "Function", "children": [ { + "id": "def-server.ExceptionListClient.findEndpointListItem.$1", "type": "Object", "label": "{\n filter,\n perPage,\n page,\n sortField,\n sortOrder,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindEndpointListItemOptions", - "text": "FindEndpointListItemOptions" - } + "FindEndpointListItemOptions" ], "description": [], "source": { @@ -2251,14 +2012,8 @@ ], "signature": [ "({ filter, perPage, page, sortField, sortOrder, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindEndpointListItemOptions", - "text": "FindEndpointListItemOptions" - }, - ") => Promise<{ data: { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }[]; page: number; per_page: number; total: number; } | null>" + "FindEndpointListItemOptions", + ") => Promise<{ data: { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }[]; page: number; per_page: number; total: number; } | null>" ], "description": [ "\nThis is the same as \"findExceptionList\" except it applies specifically to the endpoint list and will\nauto-call the \"createEndpointList\" for you so that you have the best chance of the endpoint\nbeing there if it did not exist before. If the list did not exist before, then creating it here should give you\na good guarantee that you will get an empty record set rather than null. I keep the null as the return value in\nthe off chance that you still might somehow not get into a race condition where the endpoint list does\nnot exist because someone deleted it in-between the initial create and then the find." @@ -2295,17 +2050,12 @@ "description": [], "children": [ { + "id": "def-server.ListClient.Unnamed.$1", "type": "Object", "label": "{ spaceId, user, config, esClient }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.ConstructorOptions", - "text": "ConstructorOptions" - } + "ConstructorOptions" ], "description": [], "source": { @@ -2358,17 +2108,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.getList.$1", "type": "Object", "label": "{ id }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetListOptions", - "text": "GetListOptions" - } + "GetListOptions" ], "description": [], "source": { @@ -2379,14 +2124,8 @@ ], "signature": [ "({ id }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetListOptions", - "text": "GetListOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; } | null>" + "GetListOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; } | null>" ], "description": [], "label": "getList", @@ -2402,17 +2141,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.createList.$1", "type": "Object", "label": "{\n id,\n deserializer,\n immutable,\n serializer,\n name,\n description,\n type,\n meta,\n version,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.CreateListOptions", - "text": "CreateListOptions" - } + "CreateListOptions" ], "description": [], "source": { @@ -2423,14 +2157,8 @@ ], "signature": [ "({ id, deserializer, immutable, serializer, name, description, type, meta, version, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.CreateListOptions", - "text": "CreateListOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; }>" + "CreateListOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; }>" ], "description": [], "label": "createList", @@ -2446,17 +2174,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.createListIfItDoesNotExist.$1", "type": "Object", "label": "{\n id,\n deserializer,\n serializer,\n name,\n description,\n immutable,\n type,\n meta,\n version,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.CreateListIfItDoesNotExistOptions", - "text": "CreateListIfItDoesNotExistOptions" - } + "CreateListIfItDoesNotExistOptions" ], "description": [], "source": { @@ -2467,14 +2190,8 @@ ], "signature": [ "({ id, deserializer, serializer, name, description, immutable, type, meta, version, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.CreateListIfItDoesNotExistOptions", - "text": "CreateListIfItDoesNotExistOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; }>" + "CreateListIfItDoesNotExistOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; }>" ], "description": [], "label": "createListIfItDoesNotExist", @@ -2810,17 +2527,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.deleteListItem.$1", "type": "Object", "label": "{ id }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteListItemOptions", - "text": "DeleteListItemOptions" - } + "DeleteListItemOptions" ], "description": [], "source": { @@ -2831,14 +2543,8 @@ ], "signature": [ "({ id }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteListItemOptions", - "text": "DeleteListItemOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; value: string; } | null>" + "DeleteListItemOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; value: string; } | null>" ], "description": [], "label": "deleteListItem", @@ -2854,17 +2560,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.deleteListItemByValue.$1", "type": "Object", "label": "{\n listId,\n value,\n type,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteListItemByValueOptions", - "text": "DeleteListItemByValueOptions" - } + "DeleteListItemByValueOptions" ], "description": [], "source": { @@ -2875,14 +2576,8 @@ ], "signature": [ "({ listId, value, type, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteListItemByValueOptions", - "text": "DeleteListItemByValueOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; value: string; }[]>" + "DeleteListItemByValueOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; value: string; }[]>" ], "description": [], "label": "deleteListItemByValue", @@ -2898,17 +2593,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.deleteList.$1", "type": "Object", "label": "{ id }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteListOptions", - "text": "DeleteListOptions" - } + "DeleteListOptions" ], "description": [], "source": { @@ -2919,14 +2609,8 @@ ], "signature": [ "({ id }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.DeleteListOptions", - "text": "DeleteListOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; } | null>" + "DeleteListOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; } | null>" ], "description": [], "label": "deleteList", @@ -2942,17 +2626,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.exportListItemsToStream.$1", "type": "Object", "label": "{\n stringToAppend,\n listId,\n stream,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.ExportListItemsToStreamOptions", - "text": "ExportListItemsToStreamOptions" - } + "ExportListItemsToStreamOptions" ], "description": [], "source": { @@ -2963,13 +2642,7 @@ ], "signature": [ "({ stringToAppend, listId, stream, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.ExportListItemsToStreamOptions", - "text": "ExportListItemsToStreamOptions" - }, + "ExportListItemsToStreamOptions", ") => void" ], "description": [], @@ -2986,17 +2659,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.importListItemsToStream.$1", "type": "Object", "label": "{\n deserializer,\n serializer,\n type,\n listId,\n stream,\n meta,\n version,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.ImportListItemsToStreamOptions", - "text": "ImportListItemsToStreamOptions" - } + "ImportListItemsToStreamOptions" ], "description": [], "source": { @@ -3007,14 +2675,8 @@ ], "signature": [ "({ deserializer, serializer, type, listId, stream, meta, version, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.ImportListItemsToStreamOptions", - "text": "ImportListItemsToStreamOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; } | null>" + "ImportListItemsToStreamOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; } | null>" ], "description": [], "label": "importListItemsToStream", @@ -3030,17 +2692,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.getListItemByValue.$1", "type": "Object", "label": "{\n listId,\n value,\n type,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetListItemByValueOptions", - "text": "GetListItemByValueOptions" - } + "GetListItemByValueOptions" ], "description": [], "source": { @@ -3051,14 +2708,8 @@ ], "signature": [ "({ listId, value, type, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetListItemByValueOptions", - "text": "GetListItemByValueOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; value: string; }[]>" + "GetListItemByValueOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; value: string; }[]>" ], "description": [], "label": "getListItemByValue", @@ -3074,17 +2725,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.createListItem.$1", "type": "Object", "label": "{\n id,\n deserializer,\n serializer,\n listId,\n value,\n type,\n meta,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.CreateListItemOptions", - "text": "CreateListItemOptions" - } + "CreateListItemOptions" ], "description": [], "source": { @@ -3095,14 +2741,8 @@ ], "signature": [ "({ id, deserializer, serializer, listId, value, type, meta, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.CreateListItemOptions", - "text": "CreateListItemOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; value: string; } | null>" + "CreateListItemOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; value: string; } | null>" ], "description": [], "label": "createListItem", @@ -3118,17 +2758,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.updateListItem.$1", "type": "Object", "label": "{\n _version,\n id,\n value,\n meta,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.UpdateListItemOptions", - "text": "UpdateListItemOptions" - } + "UpdateListItemOptions" ], "description": [], "source": { @@ -3139,14 +2774,8 @@ ], "signature": [ "({ _version, id, value, meta, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.UpdateListItemOptions", - "text": "UpdateListItemOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; value: string; } | null>" + "UpdateListItemOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; value: string; } | null>" ], "description": [], "label": "updateListItem", @@ -3162,17 +2791,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.updateList.$1", "type": "Object", "label": "{\n _version,\n id,\n name,\n description,\n meta,\n version,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.UpdateListOptions", - "text": "UpdateListOptions" - } + "UpdateListOptions" ], "description": [], "source": { @@ -3183,14 +2807,8 @@ ], "signature": [ "({ _version, id, name, description, meta, version, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.UpdateListOptions", - "text": "UpdateListOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; } | null>" + "UpdateListOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; } | null>" ], "description": [], "label": "updateList", @@ -3206,17 +2824,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.getListItem.$1", "type": "Object", "label": "{ id }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetListItemOptions", - "text": "GetListItemOptions" - } + "GetListItemOptions" ], "description": [], "source": { @@ -3227,14 +2840,8 @@ ], "signature": [ "({ id }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetListItemOptions", - "text": "GetListItemOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; value: string; } | null>" + "GetListItemOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; value: string; } | null>" ], "description": [], "label": "getListItem", @@ -3250,17 +2857,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.getListItemByValues.$1", "type": "Object", "label": "{\n type,\n listId,\n value,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetListItemsByValueOptions", - "text": "GetListItemsByValueOptions" - } + "GetListItemsByValueOptions" ], "description": [], "source": { @@ -3271,14 +2873,8 @@ ], "signature": [ "({ type, listId, value, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetListItemsByValueOptions", - "text": "GetListItemsByValueOptions" - }, - ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; value: string; }[]>" + "GetListItemsByValueOptions", + ") => Promise<{ _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; value: string; }[]>" ], "description": [], "label": "getListItemByValues", @@ -3294,17 +2890,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.searchListItemByValues.$1", "type": "Object", "label": "{\n type,\n listId,\n value,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.SearchListItemByValuesOptions", - "text": "SearchListItemByValuesOptions" - } + "SearchListItemByValuesOptions" ], "description": [], "source": { @@ -3315,14 +2906,8 @@ ], "signature": [ "({ type, listId, value, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.SearchListItemByValuesOptions", - "text": "SearchListItemByValuesOptions" - }, - ") => Promise<{ items: { _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; value: string; }[]; value: unknown; }[]>" + "SearchListItemByValuesOptions", + ") => Promise<{ items: { _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; value: string; }[]; value: unknown; }[]>" ], "description": [], "label": "searchListItemByValues", @@ -3338,17 +2923,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.findList.$1", "type": "Object", "label": "{\n filter,\n currentIndexPosition,\n perPage,\n page,\n sortField,\n sortOrder,\n searchAfter,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindListOptions", - "text": "FindListOptions" - } + "FindListOptions" ], "description": [], "source": { @@ -3359,14 +2939,8 @@ ], "signature": [ "({ filter, currentIndexPosition, perPage, page, sortField, sortOrder, searchAfter, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindListOptions", - "text": "FindListOptions" - }, - ") => Promise<{ cursor: string; data: { _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; }[]; page: number; per_page: number; total: number; }>" + "FindListOptions", + ") => Promise<{ cursor: string; data: { _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; }[]; page: number; per_page: number; total: number; }>" ], "description": [], "label": "findList", @@ -3382,17 +2956,12 @@ "type": "Function", "children": [ { + "id": "def-server.ListClient.findListItem.$1", "type": "Object", "label": "{\n listId,\n filter,\n currentIndexPosition,\n perPage,\n page,\n sortField,\n sortOrder,\n searchAfter,\n }", "isRequired": true, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindListItemOptions", - "text": "FindListItemOptions" - } + "FindListItemOptions" ], "description": [], "source": { @@ -3403,14 +2972,8 @@ ], "signature": [ "({ listId, filter, currentIndexPosition, perPage, page, sortField, sortOrder, searchAfter, }: ", - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.FindListItemOptions", - "text": "FindListItemOptions" - }, - ") => Promise<{ cursor: string; data: { _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; value: string; }[]; page: number; per_page: number; total: number; } | null>" + "FindListItemOptions", + ") => Promise<{ cursor: string; data: { _version: string | undefined; created_at: string; created_by: string; deserializer: string | undefined; id: string; list_id: string; meta: object | undefined; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; value: string; }[]; page: number; per_page: number; total: number; } | null>" ], "description": [], "label": "findListItem", @@ -3463,7 +3026,7 @@ "lineNumber": 119 }, "signature": [ - "({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]" + "({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]" ] }, { @@ -3605,13 +3168,7 @@ "lineNumber": 41 }, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetExceptionListClientType", - "text": "GetExceptionListClientType" - } + "GetExceptionListClientType" ] }, { @@ -3625,13 +3182,7 @@ "lineNumber": 42 }, "signature": [ - { - "pluginId": "lists", - "scope": "server", - "docId": "kibListsPluginApi", - "section": "def-server.GetListClientType", - "text": "GetListClientType" - } + "GetListClientType" ] } ], @@ -3745,7 +3296,7 @@ "lineNumber": 146 }, "signature": [ - "({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]" + "({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]" ] }, { @@ -3894,7 +3445,7 @@ "type": "Function", "children": [ { - "id": "def-common.buildExceptionFilter.{\n- lists,\n excludeExceptions,\n chunkSize,\n}", + "id": "def-common.buildExceptionFilter.$1.listsexcludeExceptionschunkSize", "type": "Object", "label": "{\n lists,\n excludeExceptions,\n chunkSize,\n}", "tags": [], @@ -3902,7 +3453,7 @@ "children": [ { "tags": [], - "id": "def-common.buildExceptionFilter.{\n- lists,\n excludeExceptions,\n chunkSize,\n}.lists", + "id": "def-common.buildExceptionFilter.$1.listsexcludeExceptionschunkSize.lists", "type": "Array", "label": "lists", "description": [], @@ -3911,12 +3462,12 @@ "lineNumber": 74 }, "signature": [ - "(({ description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; list_id: string; name: string; type: \"simple\"; } & { comments?: { comment: string; }[] | undefined; item_id?: string | undefined; meta?: object | undefined; namespace_type?: \"single\" | \"agnostic\" | undefined; os_types?: (\"windows\" | \"linux\" | \"macos\")[] | undefined; tags?: string[] | undefined; }) | { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; })[]" + "(({ description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; list_id: string; name: string; type: \"simple\"; } & { comments?: { comment: string; }[] | undefined; item_id?: string | undefined; meta?: object | undefined; namespace_type?: \"single\" | \"agnostic\" | undefined; os_types?: (\"windows\" | \"linux\" | \"macos\")[] | undefined; tags?: string[] | undefined; }) | { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; })[]" ] }, { "tags": [], - "id": "def-common.buildExceptionFilter.{\n- lists,\n excludeExceptions,\n chunkSize,\n}.excludeExceptions", + "id": "def-common.buildExceptionFilter.$1.listsexcludeExceptionschunkSize.excludeExceptions", "type": "boolean", "label": "excludeExceptions", "description": [], @@ -3927,7 +3478,7 @@ }, { "tags": [], - "id": "def-common.buildExceptionFilter.{\n- lists,\n excludeExceptions,\n chunkSize,\n}.chunkSize", + "id": "def-common.buildExceptionFilter.$1.listsexcludeExceptionschunkSize.chunkSize", "type": "number", "label": "chunkSize", "description": [], @@ -3944,7 +3495,7 @@ } ], "signature": [ - "({ lists, excludeExceptions, chunkSize, }: { lists: (({ description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; list_id: string; name: string; type: \"simple\"; } & { comments?: { comment: string; }[] | undefined; item_id?: string | undefined; meta?: object | undefined; namespace_type?: \"single\" | \"agnostic\" | undefined; os_types?: (\"windows\" | \"linux\" | \"macos\")[] | undefined; tags?: string[] | undefined; }) | { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; })[]; excludeExceptions: boolean; chunkSize: number; }) => ", + "({ lists, excludeExceptions, chunkSize, }: { lists: (({ description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; list_id: string; name: string; type: \"simple\"; } & { comments?: { comment: string; }[] | undefined; item_id?: string | undefined; meta?: object | undefined; namespace_type?: \"single\" | \"agnostic\" | undefined; os_types?: (\"windows\" | \"linux\" | \"macos\")[] | undefined; tags?: string[] | undefined; }) | { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; })[]; excludeExceptions: boolean; chunkSize: number; }) => ", { "pluginId": "data", "scope": "common", @@ -3975,7 +3526,7 @@ "description": [], "source": { "path": "x-pack/plugins/lists/common/schemas/common/schemas.ts", - "lineNumber": 219 + "lineNumber": 223 }, "initialIsOpen": false }, @@ -3987,7 +3538,7 @@ "description": [], "source": { "path": "x-pack/plugins/lists/common/schemas/common/schemas.ts", - "lineNumber": 276 + "lineNumber": 281 }, "initialIsOpen": false }, @@ -3999,7 +3550,7 @@ "description": [], "source": { "path": "x-pack/plugins/lists/common/schemas/common/schemas.ts", - "lineNumber": 281 + "lineNumber": 286 }, "initialIsOpen": false } @@ -4076,7 +3627,7 @@ "lineNumber": 55 }, "signature": [ - "{ description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; list_id: string; name: string; type: \"simple\"; } & { comments?: { comment: string; }[] | undefined; item_id?: string | undefined; meta?: object | undefined; namespace_type?: \"single\" | \"agnostic\" | undefined; os_types?: (\"windows\" | \"linux\" | \"macos\")[] | undefined; tags?: string[] | undefined; }" + "{ description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; list_id: string; name: string; type: \"simple\"; } & { comments?: { comment: string; }[] | undefined; item_id?: string | undefined; meta?: object | undefined; namespace_type?: \"single\" | \"agnostic\" | undefined; os_types?: (\"windows\" | \"linux\" | \"macos\")[] | undefined; tags?: string[] | undefined; }" ], "initialIsOpen": false }, @@ -4091,7 +3642,7 @@ "lineNumber": 50 }, "signature": [ - "{ description: string; name: string; type: \"endpoint\" | \"detection\"; } & { list_id?: string | undefined; meta?: object | undefined; namespace_type?: \"single\" | \"agnostic\" | undefined; os_types?: (\"windows\" | \"linux\" | \"macos\")[] | undefined; tags?: string[] | undefined; version?: number | undefined; }" + "{ description: string; name: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; } & { list_id?: string | undefined; meta?: object | undefined; namespace_type?: \"single\" | \"agnostic\" | undefined; os_types?: (\"windows\" | \"linux\" | \"macos\")[] | undefined; tags?: string[] | undefined; version?: number | undefined; }" ], "initialIsOpen": false }, @@ -4140,7 +3691,7 @@ "lineNumber": 22 }, "signature": [ - "({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]" + "({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]" ], "initialIsOpen": false }, @@ -4155,7 +3706,7 @@ "lineNumber": 17 }, "signature": [ - "{ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; }" + "{ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; }" ], "initialIsOpen": false }, @@ -4185,7 +3736,7 @@ "lineNumber": 21 }, "signature": [ - "{ field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; }" + "{ field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; }" ], "initialIsOpen": false }, @@ -4245,7 +3796,7 @@ "lineNumber": 53 }, "signature": [ - "{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }" + "{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }" ], "initialIsOpen": false }, @@ -4260,7 +3811,7 @@ "lineNumber": 52 }, "signature": [ - "{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\"; updated_at: string; updated_by: string; version: number; }" + "{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"endpoint_events\"; updated_at: string; updated_by: string; version: number; }" ], "initialIsOpen": false }, @@ -4272,10 +3823,10 @@ "description": [], "source": { "path": "x-pack/plugins/lists/common/schemas/common/schemas.ts", - "lineNumber": 217 + "lineNumber": 221 }, "signature": [ - "\"endpoint\" | \"detection\"" + "\"endpoint\" | \"detection\" | \"endpoint_events\"" ], "initialIsOpen": false }, @@ -4290,7 +3841,7 @@ "lineNumber": 48 }, "signature": [ - "{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; updated_at: string; updated_by: string; version: number; }" + "{ _version: string | undefined; created_at: string; created_by: string; description: string; deserializer: string | undefined; id: string; immutable: boolean; meta: object | undefined; name: string; serializer: string | undefined; tie_breaker_id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; updated_at: string; updated_by: string; version: number; }" ], "initialIsOpen": false }, @@ -4332,7 +3883,7 @@ "description": [], "source": { "path": "x-pack/plugins/lists/common/schemas/common/schemas.ts", - "lineNumber": 275 + "lineNumber": 280 }, "signature": [ "\"excluded\" | \"included\"" @@ -4347,7 +3898,7 @@ "description": [], "source": { "path": "x-pack/plugins/lists/common/schemas/common/schemas.ts", - "lineNumber": 325 + "lineNumber": 330 }, "signature": [ "(\"windows\" | \"linux\" | \"macos\")[]" @@ -4365,7 +3916,7 @@ "lineNumber": 123 }, "signature": [ - "\"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"" + "\"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"" ], "initialIsOpen": false }, @@ -4380,7 +3931,7 @@ "lineNumber": 55 }, "signature": [ - "{ description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"double_range\" | \"float_range\" | \"half_float\" | \"integer_range\" | \"long_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; name: string; type: \"simple\"; } & { _version?: string | undefined; comments?: ({ comment: string; } & { id?: string | undefined; })[] | undefined; id?: string | undefined; item_id?: string | undefined; meta?: object | undefined; namespace_type?: \"single\" | \"agnostic\" | undefined; os_types?: (\"windows\" | \"linux\" | \"macos\")[] | undefined; tags?: string[] | undefined; }" + "{ description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"text\" | \"keyword\" | \"ip\" | \"long\" | \"double\" | \"date_nanos\" | \"geo_point\" | \"geo_shape\" | \"short\" | \"binary\" | \"date_range\" | \"ip_range\" | \"shape\" | \"integer\" | \"byte\" | \"float\" | \"half_float\" | \"integer_range\" | \"float_range\" | \"long_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; })[]; field: string; type: \"nested\"; })[]; name: string; type: \"simple\"; } & { _version?: string | undefined; comments?: ({ comment: string; } & { id?: string | undefined; })[] | undefined; id?: string | undefined; item_id?: string | undefined; meta?: object | undefined; namespace_type?: \"single\" | \"agnostic\" | undefined; os_types?: (\"windows\" | \"linux\" | \"macos\")[] | undefined; tags?: string[] | undefined; }" ], "initialIsOpen": false } @@ -4605,7 +4156,7 @@ }, "signature": [ "KeyofC", - "<{ detection: null; endpoint: null; }>" + "<{ detection: null; endpoint: null; endpoint_events: null; }>" ], "initialIsOpen": false }, @@ -4679,7 +4230,7 @@ "description": [], "source": { "path": "x-pack/plugins/lists/common/schemas/common/schemas.ts", - "lineNumber": 317 + "lineNumber": 322 }, "signature": [ "KeyofC", @@ -4695,7 +4246,7 @@ "description": [], "source": { "path": "x-pack/plugins/lists/common/schemas/common/schemas.ts", - "lineNumber": 324 + "lineNumber": 329 }, "signature": [ "Type", diff --git a/api_docs/lists.mdx b/api_docs/lists.mdx index 5d5f771548355..9c6edcab18c90 100644 --- a/api_docs/lists.mdx +++ b/api_docs/lists.mdx @@ -19,6 +19,9 @@ import listsObj from './lists.json'; ### Start +### Objects + + ### Functions diff --git a/api_docs/management.json b/api_docs/management.json index fb3c2ad2c33cf..981689af88027 100644 --- a/api_docs/management.json +++ b/api_docs/management.json @@ -31,13 +31,7 @@ "lineNumber": 20 }, "signature": [ - { - "pluginId": "management", - "scope": "public", - "docId": "kibManagementPluginApi", - "section": "def-public.Mount", - "text": "Mount" - } + "Mount" ] }, { @@ -81,6 +75,7 @@ "description": [], "children": [ { + "id": "def-public.ManagementApp.Unnamed.$1", "type": "Object", "label": "args", "isRequired": true, @@ -163,18 +158,13 @@ "description": [], "children": [ { + "id": "def-public.ManagementSection.Unnamed.$1", "type": "Object", "label": "args", "isRequired": true, "signature": [ "Pick & Pick<{ id: string; }, \"id\"> & Pick<{ id: string; }, never>, \"title\" | \"id\" | \"order\" | \"euiIconType\" | \"icon\" | \"tip\">" ], "description": [], @@ -216,6 +206,7 @@ "description": [], "children": [ { + "id": "def-public.ManagementSection.registerApp.$1", "type": "Object", "label": "args", "isRequired": true, @@ -262,6 +253,7 @@ "description": [], "children": [ { + "id": "def-public.ManagementSection.getApp.$1", "type": "string", "label": "id", "isRequired": true, @@ -555,13 +547,7 @@ "lineNumber": 14 }, "signature": [ - { - "pluginId": "management", - "scope": "public", - "docId": "kibManagementPluginApi", - "section": "def-public.Mount", - "text": "Mount" - } + "Mount" ] }, { @@ -641,13 +627,7 @@ "lineNumber": 14 }, "signature": [ - { - "pluginId": "management", - "scope": "public", - "docId": "kibManagementPluginApi", - "section": "def-public.SectionsServiceSetup", - "text": "SectionsServiceSetup" - } + "SectionsServiceSetup" ] } ], diff --git a/api_docs/maps.json b/api_docs/maps.json index 7d25efab1f6f5..fca5e82bc0e1e 100644 --- a/api_docs/maps.json +++ b/api_docs/maps.json @@ -1,7 +1,788 @@ { "id": "maps", "client": { - "classes": [], + "classes": [ + { + "id": "def-public.MapEmbeddable", + "type": "Class", + "tags": [], + "label": "MapEmbeddable", + "description": [], + "signature": [ + { + "pluginId": "maps", + "scope": "public", + "docId": "kibMapsPluginApi", + "section": "def-public.MapEmbeddable", + "text": "MapEmbeddable" + }, + " extends ", + { + "pluginId": "embeddable", + "scope": "public", + "docId": "kibEmbeddablePluginApi", + "section": "def-public.Embeddable", + "text": "Embeddable" + }, + "<", + { + "pluginId": "maps", + "scope": "public", + "docId": "kibMapsPluginApi", + "section": "def-public.MapEmbeddableInput", + "text": "MapEmbeddableInput" + }, + ", ", + "MapEmbeddableOutput", + "> implements ", + { + "pluginId": "embeddable", + "scope": "public", + "docId": "kibEmbeddablePluginApi", + "section": "def-public.ReferenceOrValueEmbeddable", + "text": "ReferenceOrValueEmbeddable" + } + ], + "children": [ + { + "tags": [], + "id": "def-public.MapEmbeddable.type", + "type": "string", + "label": "type", + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 94 + } + }, + { + "id": "def-public.MapEmbeddable.Unnamed", + "type": "Function", + "label": "Constructor", + "signature": [ + "any" + ], + "description": [], + "children": [ + { + "id": "def-public.MapEmbeddable.Unnamed.$1", + "type": "Object", + "label": "config", + "isRequired": true, + "signature": [ + "MapEmbeddableConfig" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 111 + } + }, + { + "id": "def-public.MapEmbeddable.Unnamed.$2", + "type": "CompoundType", + "label": "initialInput", + "isRequired": true, + "signature": [ + { + "pluginId": "maps", + "scope": "public", + "docId": "kibMapsPluginApi", + "section": "def-public.MapEmbeddableInput", + "text": "MapEmbeddableInput" + } + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 111 + } + }, + { + "id": "def-public.MapEmbeddable.Unnamed.$3", + "type": "Object", + "label": "parent", + "isRequired": false, + "signature": [ + { + "pluginId": "embeddable", + "scope": "public", + "docId": "kibEmbeddablePluginApi", + "section": "def-public.IContainer", + "text": "IContainer" + }, + "<{}, ", + { + "pluginId": "embeddable", + "scope": "public", + "docId": "kibEmbeddablePluginApi", + "section": "def-public.ContainerInput", + "text": "ContainerInput" + }, + "<{}>, ", + { + "pluginId": "embeddable", + "scope": "public", + "docId": "kibEmbeddablePluginApi", + "section": "def-public.ContainerOutput", + "text": "ContainerOutput" + }, + "> | undefined" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 111 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 111 + } + }, + { + "id": "def-public.MapEmbeddable.inputIsRefType", + "type": "Function", + "label": "inputIsRefType", + "signature": [ + "(input: ", + { + "pluginId": "maps", + "scope": "public", + "docId": "kibMapsPluginApi", + "section": "def-public.MapEmbeddableInput", + "text": "MapEmbeddableInput" + }, + ") => input is ", + "MapByReferenceInput" + ], + "description": [], + "children": [ + { + "id": "def-public.MapEmbeddable.inputIsRefType.$1", + "type": "CompoundType", + "label": "input", + "isRequired": true, + "signature": [ + { + "pluginId": "maps", + "scope": "public", + "docId": "kibMapsPluginApi", + "section": "def-public.MapEmbeddableInput", + "text": "MapEmbeddableInput" + } + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 186 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 185 + } + }, + { + "id": "def-public.MapEmbeddable.getInputAsRefType", + "type": "Function", + "label": "getInputAsRefType", + "signature": [ + "() => Promise<", + "MapByReferenceInput", + ">" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 191 + } + }, + { + "id": "def-public.MapEmbeddable.getInputAsValueType", + "type": "Function", + "label": "getInputAsValueType", + "signature": [ + "() => Promise<", + "MapByValueInput", + ">" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 199 + } + }, + { + "id": "def-public.MapEmbeddable.getDescription", + "type": "Function", + "label": "getDescription", + "signature": [ + "() => string | undefined" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 204 + } + }, + { + "id": "def-public.MapEmbeddable.supportedTriggers", + "type": "Function", + "label": "supportedTriggers", + "signature": [ + "() => string[]" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 208 + } + }, + { + "id": "def-public.MapEmbeddable.setRenderTooltipContent", + "type": "Function", + "children": [ + { + "id": "def-public.MapEmbeddable.setRenderTooltipContent.$1", + "type": "Function", + "label": "renderTooltipContent", + "isRequired": true, + "signature": [ + "RenderToolTipContent" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 212 + } + } + ], + "signature": [ + "(renderTooltipContent: ", + "RenderToolTipContent", + ") => void" + ], + "description": [], + "label": "setRenderTooltipContent", + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 212 + }, + "tags": [], + "returnComment": [] + }, + { + "id": "def-public.MapEmbeddable.setEventHandlers", + "type": "Function", + "children": [ + { + "id": "def-public.MapEmbeddable.setEventHandlers.$1", + "type": "Object", + "label": "eventHandlers", + "isRequired": true, + "signature": [ + "EventHandlers" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 216 + } + } + ], + "signature": [ + "(eventHandlers: ", + "EventHandlers", + ") => void" + ], + "description": [], + "label": "setEventHandlers", + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 216 + }, + "tags": [], + "returnComment": [] + }, + { + "id": "def-public.MapEmbeddable.getInspectorAdapters", + "type": "Function", + "label": "getInspectorAdapters", + "signature": [ + "() => ", + { + "pluginId": "inspector", + "scope": "common", + "docId": "kibInspectorPluginApi", + "section": "def-common.Adapters", + "text": "Adapters" + } + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 220 + } + }, + { + "id": "def-public.MapEmbeddable.onUpdate", + "type": "Function", + "label": "onUpdate", + "signature": [ + "() => void" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 224 + } + }, + { + "id": "def-public.MapEmbeddable._dispatchSetQuery", + "type": "Function", + "label": "_dispatchSetQuery", + "signature": [ + "({ forceRefresh }: { forceRefresh: boolean; }) => void" + ], + "description": [], + "children": [ + { + "id": "def-public.MapEmbeddable._dispatchSetQuery.$1.forceRefresh", + "type": "Object", + "label": "{ forceRefresh }", + "tags": [], + "description": [], + "children": [ + { + "tags": [], + "id": "def-public.MapEmbeddable._dispatchSetQuery.$1.forceRefresh.forceRefresh", + "type": "boolean", + "label": "forceRefresh", + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 256 + } + } + ], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 256 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 256 + } + }, + { + "id": "def-public.MapEmbeddable._dispatchSetRefreshConfig", + "type": "Function", + "label": "_dispatchSetRefreshConfig", + "signature": [ + "(refreshConfig: ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataQueryPluginApi", + "section": "def-common.RefreshInterval", + "text": "RefreshInterval" + }, + ") => void" + ], + "description": [], + "children": [ + { + "id": "def-public.MapEmbeddable._dispatchSetRefreshConfig.$1", + "type": "Object", + "label": "refreshConfig", + "isRequired": true, + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataQueryPluginApi", + "section": "def-common.RefreshInterval", + "text": "RefreshInterval" + } + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 278 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 278 + } + }, + { + "id": "def-public.MapEmbeddable._dispatchSetChartsPaletteServiceGetColor", + "type": "Function", + "label": "_dispatchSetChartsPaletteServiceGetColor", + "signature": [ + "(syncColors?: boolean | undefined) => Promise" + ], + "description": [], + "children": [ + { + "id": "def-public.MapEmbeddable._dispatchSetChartsPaletteServiceGetColor.$1", + "type": "CompoundType", + "label": "syncColors", + "isRequired": false, + "signature": [ + "boolean | undefined" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 288 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 288 + } + }, + { + "id": "def-public.MapEmbeddable.render", + "type": "Function", + "label": "render", + "signature": [ + "(domNode: HTMLElement) => void" + ], + "description": [ + "\n" + ], + "children": [ + { + "id": "def-public.MapEmbeddable.render.$1", + "type": "Object", + "label": "domNode", + "isRequired": true, + "signature": [ + "HTMLElement" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 306 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 306 + } + }, + { + "id": "def-public.MapEmbeddable.setLayerList", + "type": "Function", + "label": "setLayerList", + "signature": [ + "(layerList: ", + "LayerDescriptor", + "[]) => void" + ], + "description": [], + "children": [ + { + "id": "def-public.MapEmbeddable.setLayerList.$1", + "type": "Array", + "label": "layerList", + "isRequired": true, + "signature": [ + "LayerDescriptor", + "[]" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 332 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 332 + } + }, + { + "id": "def-public.MapEmbeddable.onSingleValueTrigger", + "type": "Function", + "children": [ + { + "id": "def-public.MapEmbeddable.onSingleValueTrigger.$1", + "type": "string", + "label": "actionId", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 349 + } + }, + { + "id": "def-public.MapEmbeddable.onSingleValueTrigger.$2", + "type": "string", + "label": "key", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 349 + } + }, + { + "id": "def-public.MapEmbeddable.onSingleValueTrigger.$3", + "type": "CompoundType", + "label": "value", + "isRequired": false, + "signature": [ + { + "pluginId": "maps", + "scope": "common", + "docId": "kibMapsPluginApi", + "section": "def-common.RawValue", + "text": "RawValue" + } + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 349 + } + } + ], + "signature": [ + "(actionId: string, key: string, value: ", + { + "pluginId": "maps", + "scope": "common", + "docId": "kibMapsPluginApi", + "section": "def-common.RawValue", + "text": "RawValue" + }, + ") => void" + ], + "description": [], + "label": "onSingleValueTrigger", + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 349 + }, + "tags": [], + "returnComment": [] + }, + { + "id": "def-public.MapEmbeddable.addFilters", + "type": "Function", + "children": [ + { + "id": "def-public.MapEmbeddable.addFilters.$1", + "type": "Array", + "label": "filters", + "isRequired": true, + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataPluginApi", + "section": "def-common.Filter", + "text": "Filter" + }, + "[]" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 363 + } + }, + { + "id": "def-public.MapEmbeddable.addFilters.$2", + "type": "string", + "label": "actionId", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 363 + } + } + ], + "signature": [ + "(filters: ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataPluginApi", + "section": "def-common.Filter", + "text": "Filter" + }, + "[], actionId?: string) => Promise" + ], + "description": [], + "label": "addFilters", + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 363 + }, + "tags": [], + "returnComment": [] + }, + { + "id": "def-public.MapEmbeddable.getFilterActions", + "type": "Function", + "children": [], + "signature": [ + "() => Promise<", + { + "pluginId": "uiActions", + "scope": "public", + "docId": "kibUiActionsPluginApi", + "section": "def-public.Action", + "text": "Action" + }, + "[]>" + ], + "description": [], + "label": "getFilterActions", + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 375 + }, + "tags": [], + "returnComment": [] + }, + { + "id": "def-public.MapEmbeddable.getActionContext", + "type": "Function", + "children": [], + "signature": [ + "() => ", + { + "pluginId": "uiActions", + "scope": "public", + "docId": "kibUiActionsPluginApi", + "section": "def-public.ActionExecutionContext", + "text": "ActionExecutionContext" + }, + "" + ], + "description": [], + "label": "getActionContext", + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 396 + }, + "tags": [], + "returnComment": [] + }, + { + "id": "def-public.MapEmbeddable.destroy", + "type": "Function", + "label": "destroy", + "signature": [ + "() => void" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 407 + } + }, + { + "id": "def-public.MapEmbeddable.reload", + "type": "Function", + "label": "reload", + "signature": [ + "() => void" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 423 + } + }, + { + "id": "def-public.MapEmbeddable._handleStoreChanges", + "type": "Function", + "label": "_handleStoreChanges", + "signature": [ + "() => void" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 429 + } + } + ], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", + "lineNumber": 91 + }, + "initialIsOpen": false + } + ], "functions": [], "interfaces": [ { @@ -21,6 +802,7 @@ "description": [], "children": [ { + "id": "def-public.RenderTooltipContentParams.addFilters.$1", "type": "Uncategorized", "label": "filter", "isRequired": true, @@ -34,6 +816,7 @@ } }, { + "id": "def-public.RenderTooltipContentParams.addFilters.$2", "type": "string", "label": "actionId", "isRequired": true, @@ -81,13 +864,7 @@ "lineNumber": 34 }, "signature": [ - { - "pluginId": "maps", - "scope": "common", - "docId": "kibMapsPluginApi", - "section": "def-common.TooltipFeature", - "text": "TooltipFeature" - }, + "TooltipFeature", "[]" ] }, @@ -112,6 +889,7 @@ "description": [], "children": [ { + "id": "def-public.RenderTooltipContentParams.getLayerName.$1", "type": "string", "label": "layerId", "isRequired": true, @@ -138,37 +916,20 @@ "label": "loadFeatureProperties", "signature": [ "({ layerId, featureId }: ", - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.LoadFeatureProps", - "text": "LoadFeatureProps" - }, + "LoadFeatureProps", ") => Promise<", - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.ITooltipProperty", - "text": "ITooltipProperty" - }, + "ITooltipProperty", "[]>" ], "description": [], "children": [ { + "id": "def-public.RenderTooltipContentParams.loadFeatureProperties.$1", "type": "Object", "label": "{ layerId, featureId }", "isRequired": true, "signature": [ - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.LoadFeatureProps", - "text": "LoadFeatureProps" - } + "LoadFeatureProps" ], "description": [], "source": { @@ -190,36 +951,19 @@ "label": "loadFeatureGeometry", "signature": [ "({ layerId, featureId }: ", - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.LoadFeatureProps", - "text": "LoadFeatureProps" - }, + "LoadFeatureProps", ") => ", - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.FeatureGeometry", - "text": "FeatureGeometry" - } + "FeatureGeometry" ], "description": [], "children": [ { + "id": "def-public.RenderTooltipContentParams.loadFeatureGeometry.$1", "type": "Object", "label": "{ layerId, featureId }", "isRequired": true, "signature": [ - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.LoadFeatureProps", - "text": "LoadFeatureProps" - } + "LoadFeatureProps" ], "description": [], "source": { @@ -259,6 +1003,23 @@ "\"map\"" ], "initialIsOpen": false + }, + { + "id": "def-public.MapEmbeddableInput", + "type": "Type", + "label": "MapEmbeddableInput", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/embeddable/types.ts", + "lineNumber": 41 + }, + "signature": [ + "MapByValueInput", + " | ", + "MapByReferenceInput" + ], + "initialIsOpen": false } ], "objects": [], @@ -277,41 +1038,17 @@ "description": [], "source": { "path": "x-pack/plugins/maps/public/api/start_api.ts", - "lineNumber": 14 + "lineNumber": 15 }, "signature": [ "{ createSecurityLayerDescriptors: (indexPatternId: string, indexPatternTitle: string) => Promise<", - { - "pluginId": "maps", - "scope": "common", - "docId": "kibMapsPluginApi", - "section": "def-common.LayerDescriptor", - "text": "LayerDescriptor" - }, + "LayerDescriptor", "[]>; createBasemapLayerDescriptor: () => Promise<", - { - "pluginId": "maps", - "scope": "common", - "docId": "kibMapsPluginApi", - "section": "def-common.LayerDescriptor", - "text": "LayerDescriptor" - }, + "LayerDescriptor", " | null>; createESSearchSourceLayerDescriptor: (params: ", - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.CreateLayerDescriptorParams", - "text": "CreateLayerDescriptorParams" - }, + "CreateLayerDescriptorParams", ") => Promise<", - { - "pluginId": "maps", - "scope": "common", - "docId": "kibMapsPluginApi", - "section": "def-common.LayerDescriptor", - "text": "LayerDescriptor" - }, + "LayerDescriptor", ">; }" ] }, @@ -321,34 +1058,23 @@ "label": "registerLayerWizard", "signature": [ "(layerWizard: ", - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.LayerWizard", - "text": "LayerWizard" - }, + "LayerWizard", ") => Promise" ], "description": [], "children": [ { + "id": "def-public.MapsStartApi.registerLayerWizard.$1", "type": "Object", "label": "layerWizard", "isRequired": true, "signature": [ - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.LayerWizard", - "text": "LayerWizard" - } + "LayerWizard" ], "description": [], "source": { "path": "x-pack/plugins/maps/public/api/start_api.ts", - "lineNumber": 24 + "lineNumber": 25 } } ], @@ -356,7 +1082,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/maps/public/api/start_api.ts", - "lineNumber": 24 + "lineNumber": 25 } }, { @@ -365,34 +1091,23 @@ "label": "registerSource", "signature": [ "(entry: ", - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.SourceRegistryEntry", - "text": "SourceRegistryEntry" - }, + "SourceRegistryEntry", ") => Promise" ], "description": [], "children": [ { + "id": "def-public.MapsStartApi.registerSource.$1", "type": "Object", "label": "entry", "isRequired": true, "signature": [ - { - "pluginId": "maps", - "scope": "public", - "docId": "kibMapsPluginApi", - "section": "def-public.SourceRegistryEntry", - "text": "SourceRegistryEntry" - } + "SourceRegistryEntry" ], "description": [], "source": { "path": "x-pack/plugins/maps/public/api/start_api.ts", - "lineNumber": 25 + "lineNumber": 26 } } ], @@ -400,13 +1115,48 @@ "returnComment": [], "source": { "path": "x-pack/plugins/maps/public/api/start_api.ts", - "lineNumber": 25 + "lineNumber": 26 + } + }, + { + "id": "def-public.MapsStartApi.suggestEMSTermJoinConfig", + "type": "Function", + "label": "suggestEMSTermJoinConfig", + "signature": [ + "(config: ", + "SampleValuesConfig", + ") => Promise<", + "EMSTermJoinConfig", + " | null>" + ], + "description": [], + "children": [ + { + "id": "def-public.MapsStartApi.suggestEMSTermJoinConfig.$1", + "type": "Object", + "label": "config", + "isRequired": true, + "signature": [ + "SampleValuesConfig" + ], + "description": [], + "source": { + "path": "x-pack/plugins/maps/public/api/start_api.ts", + "lineNumber": 27 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/maps/public/api/start_api.ts", + "lineNumber": 27 } } ], "source": { "path": "x-pack/plugins/maps/public/api/start_api.ts", - "lineNumber": 13 + "lineNumber": 14 }, "lifecycle": "start", "initialIsOpen": true @@ -433,6 +1183,7 @@ "description": [], "children": [ { + "id": "def-common.getEditPath.$1", "type": "string", "label": "id", "isRequired": true, @@ -464,6 +1215,7 @@ "description": [], "children": [ { + "id": "def-common.getExistingMapPath.$1", "type": "string", "label": "id", "isRequired": true, @@ -612,6 +1364,59 @@ "lineNumber": 13 }, "initialIsOpen": false + }, + { + "id": "def-common.WriteSettings", + "type": "Interface", + "label": "WriteSettings", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-common.WriteSettings.index", + "type": "string", + "label": "index", + "description": [], + "source": { + "path": "x-pack/plugins/maps/common/types.ts", + "lineNumber": 27 + } + }, + { + "tags": [], + "id": "def-common.WriteSettings.body", + "type": "Uncategorized", + "label": "body", + "description": [], + "source": { + "path": "x-pack/plugins/maps/common/types.ts", + "lineNumber": 28 + }, + "signature": [ + "object" + ] + }, + { + "id": "def-common.WriteSettings.Unnamed", + "type": "Any", + "label": "Unnamed", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/maps/common/types.ts", + "lineNumber": 29 + }, + "signature": [ + "any" + ] + } + ], + "source": { + "path": "x-pack/plugins/maps/common/types.ts", + "lineNumber": 26 + }, + "initialIsOpen": false } ], "enums": [ @@ -1346,6 +2151,51 @@ ], "initialIsOpen": false }, + { + "tags": [], + "id": "def-common.emsRegionLayerId", + "type": "string", + "label": "emsRegionLayerId", + "description": [], + "source": { + "path": "x-pack/plugins/maps/common/constants.ts", + "lineNumber": 305 + }, + "signature": [ + "\"administrative_regions_lvl2\"" + ], + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.emsUsaZipLayerId", + "type": "string", + "label": "emsUsaZipLayerId", + "description": [], + "source": { + "path": "x-pack/plugins/maps/common/constants.ts", + "lineNumber": 306 + }, + "signature": [ + "\"usa_zip_codes\"" + ], + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.emsWorldLayerId", + "type": "string", + "label": "emsWorldLayerId", + "description": [], + "source": { + "path": "x-pack/plugins/maps/common/constants.ts", + "lineNumber": 304 + }, + "signature": [ + "\"world_countries\"" + ], + "initialIsOpen": false + }, { "tags": [], "id": "def-common.ES_GEO_FIELD_TYPES", @@ -1669,6 +2519,21 @@ }, "initialIsOpen": false }, + { + "tags": [], + "id": "def-common.MAX_DRAWING_SIZE_BYTES", + "type": "number", + "label": "MAX_DRAWING_SIZE_BYTES", + "description": [], + "source": { + "path": "x-pack/plugins/maps/common/constants.ts", + "lineNumber": 302 + }, + "signature": [ + "10485760" + ], + "initialIsOpen": false + }, { "tags": [], "id": "def-common.MAX_ZOOM", diff --git a/api_docs/maps.mdx b/api_docs/maps.mdx index 9799fa1769391..f4f5594b19347 100644 --- a/api_docs/maps.mdx +++ b/api_docs/maps.mdx @@ -16,6 +16,9 @@ import mapsObj from './maps.json'; ### Start +### Classes + + ### Interfaces diff --git a/api_docs/maps_ems.json b/api_docs/maps_ems.json index 472f697420767..2619d711f9b74 100644 --- a/api_docs/maps_ems.json +++ b/api_docs/maps_ems.json @@ -228,6 +228,7 @@ "description": [], "children": [ { + "id": "def-public.IServiceSettings.getEMSHotLink.$1", "type": "Object", "label": "layer", "isRequired": true, @@ -320,6 +321,7 @@ "description": [], "children": [ { + "id": "def-public.IServiceSettings.getUrlForRegionLayer.$1", "type": "Object", "label": "layer", "isRequired": true, @@ -356,14 +358,14 @@ "description": [], "children": [ { - "id": "def-public.IServiceSettings.setQueryParams.params", + "id": "def-public.IServiceSettings.setQueryParams.$1.params", "type": "Object", "label": "params", "tags": [], "description": [], "children": [ { - "id": "def-public.IServiceSettings.setQueryParams.params.Unnamed", + "id": "def-public.IServiceSettings.setQueryParams.$1.params.Unnamed", "type": "Any", "label": "Unnamed", "tags": [], @@ -390,38 +392,6 @@ "lineNumber": 48 } }, - { - "id": "def-public.IServiceSettings.enableZoomMessage", - "type": "Function", - "label": "enableZoomMessage", - "signature": [ - "() => void" - ], - "description": [], - "children": [], - "tags": [], - "returnComment": [], - "source": { - "path": "src/plugins/maps_ems/public/service_settings/service_settings_types.ts", - "lineNumber": 49 - } - }, - { - "id": "def-public.IServiceSettings.disableZoomMessage", - "type": "Function", - "label": "disableZoomMessage", - "signature": [ - "() => void" - ], - "description": [], - "children": [], - "tags": [], - "returnComment": [], - "source": { - "path": "src/plugins/maps_ems/public/service_settings/service_settings_types.ts", - "lineNumber": 50 - } - }, { "id": "def-public.IServiceSettings.getAttributesForTMSLayer", "type": "Function", @@ -440,6 +410,7 @@ "description": [], "children": [ { + "id": "def-public.IServiceSettings.getAttributesForTMSLayer.$1", "type": "Object", "label": "tmsServiceConfig", "isRequired": true, @@ -455,10 +426,11 @@ "description": [], "source": { "path": "src/plugins/maps_ems/public/service_settings/service_settings_types.ts", - "lineNumber": 52 + "lineNumber": 50 } }, { + "id": "def-public.IServiceSettings.getAttributesForTMSLayer.$2", "type": "boolean", "label": "isDesaturated", "isRequired": true, @@ -468,10 +440,11 @@ "description": [], "source": { "path": "src/plugins/maps_ems/public/service_settings/service_settings_types.ts", - "lineNumber": 53 + "lineNumber": 51 } }, { + "id": "def-public.IServiceSettings.getAttributesForTMSLayer.$3", "type": "boolean", "label": "isDarkMode", "isRequired": true, @@ -481,7 +454,7 @@ "description": [], "source": { "path": "src/plugins/maps_ems/public/service_settings/service_settings_types.ts", - "lineNumber": 54 + "lineNumber": 52 } } ], @@ -489,7 +462,7 @@ "returnComment": [], "source": { "path": "src/plugins/maps_ems/public/service_settings/service_settings_types.ts", - "lineNumber": 51 + "lineNumber": 49 } } ], @@ -902,6 +875,7 @@ "description": [], "children": [ { + "id": "def-server.MapsEmsPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -947,6 +921,7 @@ "description": [], "children": [ { + "id": "def-server.MapsEmsPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, diff --git a/api_docs/ml.json b/api_docs/ml.json index 067ae4c0ea212..fc9d09c22c4a7 100644 --- a/api_docs/ml.json +++ b/api_docs/ml.json @@ -37,6 +37,7 @@ "description": [], "children": [ { + "id": "def-public.MlUrlGenerator.Unnamed.$1", "type": "Object", "label": "params", "isRequired": true, @@ -76,17 +77,12 @@ "type": "Function", "children": [ { + "id": "def-public.MlUrlGenerator.createUrl.$1", "type": "CompoundType", "label": "mlUrlGeneratorParams", "isRequired": true, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.MlUrlGeneratorState", - "text": "MlUrlGeneratorState" - } + "MlUrlGeneratorState" ], "description": [], "source": { @@ -97,13 +93,7 @@ ], "signature": [ "(mlUrlGeneratorParams: ", - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.MlUrlGeneratorState", - "text": "MlUrlGeneratorState" - }, + "MlUrlGeneratorState", ") => Promise" ], "description": [], @@ -136,6 +126,7 @@ ], "children": [ { + "id": "def-public.getFormattedSeverityScore.$1", "type": "number", "label": "score", "isRequired": true, @@ -145,7 +136,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/util/anomaly_utils.ts", - "lineNumber": 116 + "lineNumber": 124 } } ], @@ -153,7 +144,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/ml/common/util/anomaly_utils.ts", - "lineNumber": 116 + "lineNumber": 124 }, "initialIsOpen": false }, @@ -186,6 +177,7 @@ "description": [], "children": [ { + "id": "def-public.getSeverityColor.$1", "type": "number", "label": "normalizedScore", "isRequired": true, @@ -195,7 +187,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/util/anomaly_utils.ts", - "lineNumber": 177 + "lineNumber": 185 } } ], @@ -203,7 +195,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/ml/common/util/anomaly_utils.ts", - "lineNumber": 177 + "lineNumber": 185 }, "initialIsOpen": false }, @@ -224,6 +216,7 @@ "description": [], "children": [ { + "id": "def-public.getSeverityType.$1", "type": "number", "label": "normalizedScore", "isRequired": true, @@ -233,7 +226,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/util/anomaly_utils.ts", - "lineNumber": 138 + "lineNumber": 146 } } ], @@ -241,7 +234,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/ml/common/util/anomaly_utils.ts", - "lineNumber": 138 + "lineNumber": 146 }, "initialIsOpen": false }, @@ -250,6 +243,7 @@ "type": "Function", "children": [ { + "id": "def-public.useMlHref.$1", "type": "Object", "label": "ml", "isRequired": false, @@ -271,6 +265,7 @@ } }, { + "id": "def-public.useMlHref.$2", "type": "string", "label": "basePath", "isRequired": false, @@ -284,17 +279,12 @@ } }, { + "id": "def-public.useMlHref.$3", "type": "CompoundType", "label": "params", "isRequired": true, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.MlUrlGeneratorState", - "text": "MlUrlGeneratorState" - } + "MlUrlGeneratorState" ], "description": [], "source": { @@ -359,13 +349,7 @@ "lineNumber": 45 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.AnomalyRecordDoc", - "text": "AnomalyRecordDoc" - } + "AnomalyRecordDoc" ] }, { @@ -549,13 +533,7 @@ "lineNumber": 94 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.DatafeedResponse", - "text": "DatafeedResponse" - }, + "DatafeedResponse", "[]" ] }, @@ -570,13 +548,7 @@ "lineNumber": 95 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.JobResponse", - "text": "JobResponse" - }, + "JobResponse", "[]" ] }, @@ -592,29 +564,11 @@ }, "signature": [ "{ search: ", - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.KibanaObjectResponse", - "text": "KibanaObjectResponse" - }, + "KibanaObjectResponse", "[]; visualization: ", - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.KibanaObjectResponse", - "text": "KibanaObjectResponse" - }, + "KibanaObjectResponse", "[]; dashboard: ", - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.KibanaObjectResponse", - "text": "KibanaObjectResponse" - }, + "KibanaObjectResponse", "[]; }" ] } @@ -693,13 +647,7 @@ "lineNumber": 17 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.JobStat", - "text": "JobStat" - }, + "JobStat", "[]" ] } @@ -789,13 +737,7 @@ "lineNumber": 151 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.MlCapabilities", - "text": "MlCapabilities" - } + "MlCapabilities" ] }, { @@ -1020,13 +962,7 @@ "lineNumber": 28 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.CombinedJob", - "text": "CombinedJob" - }, + "CombinedJob", " | undefined" ] }, @@ -1056,13 +992,7 @@ }, "signature": [ "Partial<", - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.AuditMessage", - "text": "AuditMessage" - }, + "AuditMessage", "> | undefined" ] }, @@ -1165,7 +1095,7 @@ }, " extends Pick<", "UseDataGridReturnType", - ", \"status\" | \"baseline\" | \"pagination\" | \"errorMessage\" | \"chartsVisible\" | \"chartsButtonVisible\" | \"columnsWithCharts\" | \"invalidSortingColumnns\" | \"noDataMessage\" | \"onChangeItemsPerPage\" | \"onChangePage\" | \"onSort\" | \"setPagination\" | \"setVisibleColumns\" | \"rowCount\" | \"rowCountRelation\" | \"sortingColumns\" | \"tableItems\" | \"toggleChartVisibility\" | \"visibleColumns\" | \"predictionFieldName\" | \"resultsField\">" + ", \"status\" | \"baseline\" | \"pagination\" | \"errorMessage\" | \"chartsVisible\" | \"chartsButtonVisible\" | \"ccsWarning\" | \"columnsWithCharts\" | \"invalidSortingColumnns\" | \"noDataMessage\" | \"onChangeItemsPerPage\" | \"onChangePage\" | \"onSort\" | \"setPagination\" | \"setVisibleColumns\" | \"rowCount\" | \"rowCountRelation\" | \"sortingColumns\" | \"tableItems\" | \"toggleChartVisibility\" | \"visibleColumns\" | \"predictionFieldName\" | \"resultsField\">" ], "description": [], "tags": [], @@ -1178,7 +1108,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/public/application/components/data_grid/types.ts", - "lineNumber": 83 + "lineNumber": 84 }, "signature": [ { @@ -1236,7 +1166,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/public/embeddables/types.ts", - "lineNumber": 40 + "lineNumber": 49 }, "signature": [ "EmbeddableInput & AnomalySwimlaneEmbeddableCustomInput" @@ -1310,16 +1240,18 @@ "objects": [ { "tags": [], - "id": "def-public.HITS_TOTAL_RELATION", + "id": "def-public.ES_CLIENT_TOTAL_HITS_RELATION", "type": "Object", - "label": "HITS_TOTAL_RELATION", + "label": "ES_CLIENT_TOTAL_HITS_RELATION", "description": [], "source": { "path": "x-pack/plugins/ml/common/types/es_client.ts", - "lineNumber": 10 + "lineNumber": 20 }, "signature": [ - "{ readonly EQ: \"eq\"; readonly GTE: \"gte\"; }" + "Record<\"GTE\" | \"EQ\", ", + "TotalHitsRelation", + ">" ], "initialIsOpen": false }, @@ -1401,6 +1333,7 @@ "description": [], "children": [ { + "id": "def-server.InsufficientMLCapabilities.Unnamed.$1", "type": "string", "label": "message", "isRequired": false, @@ -1455,6 +1388,7 @@ "description": [], "children": [ { + "id": "def-server.MLPrivilegesUninitialized.Unnamed.$1", "type": "string", "label": "message", "isRequired": false, @@ -1509,6 +1443,7 @@ "description": [], "children": [ { + "id": "def-server.UnknownMLCapabilitiesError.Unnamed.$1", "type": "string", "label": "message", "isRequired": false, @@ -1543,6 +1478,7 @@ "type": "Function", "children": [ { + "id": "def-server.getHistogramsForFields.$1", "type": "Object", "label": "client", "isRequired": true, @@ -1562,6 +1498,7 @@ } }, { + "id": "def-server.getHistogramsForFields.$2", "type": "string", "label": "indexPatternTitle", "isRequired": true, @@ -1575,6 +1512,7 @@ } }, { + "id": "def-server.getHistogramsForFields.$3", "type": "Any", "label": "query", "isRequired": true, @@ -1588,17 +1526,12 @@ } }, { + "id": "def-server.getHistogramsForFields.$4", "type": "Array", "label": "fields", "isRequired": true, "signature": [ - { - "pluginId": "ml", - "scope": "server", - "docId": "kibMlPluginApi", - "section": "def-server.HistogramField", - "text": "HistogramField" - }, + "HistogramField", "[]" ], "description": [], @@ -1608,6 +1541,7 @@ } }, { + "id": "def-server.getHistogramsForFields.$5", "type": "number", "label": "samplerShardSize", "isRequired": true, @@ -1621,6 +1555,7 @@ } }, { + "id": "def-server.getHistogramsForFields.$6", "type": "Object", "label": "runtimeMappings", "isRequired": false, @@ -1671,6 +1606,7 @@ "description": [], "children": [ { + "id": "def-server.isCombinedJobWithStats.$1", "type": "Any", "label": "arg", "isRequired": true, @@ -1723,13 +1659,7 @@ "lineNumber": 45 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.AnomalyRecordDoc", - "text": "AnomalyRecordDoc" - } + "AnomalyRecordDoc" ] }, { @@ -2287,13 +2217,7 @@ "lineNumber": 32 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.Influencer", - "text": "Influencer" - }, + "Influencer", "[] | undefined" ] }, @@ -2566,13 +2490,7 @@ "lineNumber": 25 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.DatafeedWithStats", - "text": "DatafeedWithStats" - } + "DatafeedWithStats" ] } ], @@ -2600,13 +2518,7 @@ "lineNumber": 16 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.UrlConfig", - "text": "UrlConfig" - }, + "UrlConfig", "[] | undefined" ] }, @@ -2621,13 +2533,7 @@ "lineNumber": 17 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.CREATED_BY_LABEL", - "text": "CREATED_BY_LABEL" - }, + "CREATED_BY_LABEL", " | undefined" ] }, @@ -2896,13 +2802,7 @@ "lineNumber": 13 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.DATAFEED_STATE", - "text": "DATAFEED_STATE" - } + "DATAFEED_STATE" ] }, { @@ -2916,13 +2816,7 @@ "lineNumber": 14 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.Node", - "text": "Node" - } + "Node" ] }, { @@ -3117,13 +3011,7 @@ "lineNumber": 12 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.DataCounts", - "text": "DataCounts" - } + "DataCounts" ] }, { @@ -3137,13 +3025,7 @@ "lineNumber": 13 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.ModelSizeStats", - "text": "ModelSizeStats" - } + "ModelSizeStats" ] }, { @@ -3157,13 +3039,7 @@ "lineNumber": 14 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.ForecastsStats", - "text": "ForecastsStats" - } + "ForecastsStats" ] }, { @@ -3177,13 +3053,7 @@ "lineNumber": 15 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.JOB_STATE", - "text": "JOB_STATE" - } + "JOB_STATE" ] }, { @@ -3197,13 +3067,7 @@ "lineNumber": 16 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.Node", - "text": "Node" - } + "Node" ] }, { @@ -3503,13 +3367,7 @@ "lineNumber": 28 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.CombinedJob", - "text": "CombinedJob" - }, + "CombinedJob", " | undefined" ] }, @@ -3539,13 +3397,7 @@ }, "signature": [ "Partial<", - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.AuditMessage", - "text": "AuditMessage" - }, + "AuditMessage", "> | undefined" ] }, @@ -3950,13 +3802,7 @@ "lineNumber": 18 }, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.ModelSizeStats", - "text": "ModelSizeStats" - } + "ModelSizeStats" ] }, { @@ -4172,7 +4018,7 @@ "lineNumber": 81 }, "signature": [ - "\"bucket\" | \"record\" | \"influencer\"" + "\"record\" | \"bucket\" | \"influencer\"" ], "initialIsOpen": false }, @@ -4491,6 +4337,7 @@ ], "children": [ { + "id": "def-common.composeValidators.$1", "type": "Array", "label": "validators", "isRequired": true, @@ -4517,17 +4364,12 @@ "type": "Function", "children": [ { + "id": "def-common.extractErrorMessage.$1", "type": "CompoundType", "label": "error", "isRequired": false, "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.ErrorType", - "text": "ErrorType" - } + "ErrorType" ], "description": [], "source": { @@ -4561,6 +4403,7 @@ "description": [], "children": [ { + "id": "def-common.getSeverityColor.$1", "type": "number", "label": "normalizedScore", "isRequired": true, @@ -4570,7 +4413,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/util/anomaly_utils.ts", - "lineNumber": 177 + "lineNumber": 185 } } ], @@ -4578,7 +4421,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/ml/common/util/anomaly_utils.ts", - "lineNumber": 177 + "lineNumber": 185 }, "initialIsOpen": false }, @@ -4599,6 +4442,7 @@ "description": [], "children": [ { + "id": "def-common.getSeverityType.$1", "type": "number", "label": "normalizedScore", "isRequired": true, @@ -4608,7 +4452,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/util/anomaly_utils.ts", - "lineNumber": 138 + "lineNumber": 146 } } ], @@ -4616,148 +4460,156 @@ "returnComment": [], "source": { "path": "x-pack/plugins/ml/common/util/anomaly_utils.ts", - "lineNumber": 138 + "lineNumber": 146 }, "initialIsOpen": false }, { - "id": "def-common.patternValidator", + "id": "def-common.isPopulatedObject", "type": "Function", - "label": "patternValidator", + "children": [ + { + "id": "def-common.isPopulatedObject.$1", + "type": "Unknown", + "label": "arg", + "isRequired": true, + "signature": [ + "unknown" + ], + "description": [], + "source": { + "path": "x-pack/plugins/ml/common/util/object_utils.ts", + "lineNumber": 26 + } + }, + { + "id": "def-common.isPopulatedObject.$2", + "type": "Array", + "label": "requiredAttributes", + "isRequired": true, + "signature": [ + "U[]" + ], + "description": [], + "source": { + "path": "x-pack/plugins/ml/common/util/object_utils.ts", + "lineNumber": 27 + } + } + ], "signature": [ - "(pattern: RegExp) => (value: string) => { pattern: { matchPattern: string; }; } | null" + "(arg: unknown, requiredAttributes?: U[]) => arg is Record" ], - "description": [ - "\nProvides a validator function for checking against pattern." + "description": [], + "label": "isPopulatedObject", + "source": { + "path": "x-pack/plugins/ml/common/util/object_utils.ts", + "lineNumber": 25 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + }, + { + "id": "def-common.isRuntimeField", + "type": "Function", + "label": "isRuntimeField", + "signature": [ + "(arg: unknown) => boolean" ], + "description": [], "children": [ { - "type": "Object", - "label": "pattern", + "id": "def-common.isRuntimeField.$1", + "type": "Unknown", + "label": "arg", "isRequired": true, "signature": [ - "RegExp" + "unknown" ], "description": [], "source": { - "path": "x-pack/plugins/ml/common/util/validators.ts", - "lineNumber": 34 + "path": "x-pack/plugins/ml/common/util/runtime_field_utils.ts", + "lineNumber": 14 } } ], "tags": [], "returnComment": [], "source": { - "path": "x-pack/plugins/ml/common/util/validators.ts", - "lineNumber": 33 + "path": "x-pack/plugins/ml/common/util/runtime_field_utils.ts", + "lineNumber": 14 }, "initialIsOpen": false - } - ], - "interfaces": [ + }, { - "id": "def-common.SearchResponse7", - "type": "Interface", - "label": "SearchResponse7", + "id": "def-common.isRuntimeMappings", + "type": "Function", + "label": "isRuntimeMappings", "signature": [ - { - "pluginId": "ml", - "scope": "common", - "docId": "kibMlPluginApi", - "section": "def-common.SearchResponse7", - "text": "SearchResponse7" - }, - "" + "(arg: unknown) => boolean" ], "description": [], - "tags": [], "children": [ { - "tags": [], - "id": "def-common.SearchResponse7.took", - "type": "number", - "label": "took", - "description": [], - "source": { - "path": "x-pack/plugins/ml/common/types/es_client.ts", - "lineNumber": 26 - } - }, - { - "tags": [], - "id": "def-common.SearchResponse7.timed_out", - "type": "boolean", - "label": "timed_out", + "id": "def-common.isRuntimeMappings.$1", + "type": "Unknown", + "label": "arg", + "isRequired": true, + "signature": [ + "unknown" + ], "description": [], "source": { - "path": "x-pack/plugins/ml/common/types/es_client.ts", + "path": "x-pack/plugins/ml/common/util/runtime_field_utils.ts", "lineNumber": 27 } - }, - { - "tags": [], - "id": "def-common.SearchResponse7._scroll_id", - "type": "string", - "label": "_scroll_id", - "description": [], - "source": { - "path": "x-pack/plugins/ml/common/types/es_client.ts", - "lineNumber": 28 - }, - "signature": [ - "string | undefined" - ] - }, - { - "tags": [], - "id": "def-common.SearchResponse7._shards", - "type": "Object", - "label": "_shards", - "description": [], - "source": { - "path": "x-pack/plugins/ml/common/types/es_client.ts", - "lineNumber": 29 - }, - "signature": [ - "ShardsResponse" - ] - }, + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/ml/common/util/runtime_field_utils.ts", + "lineNumber": 27 + }, + "initialIsOpen": false + }, + { + "id": "def-common.patternValidator", + "type": "Function", + "label": "patternValidator", + "signature": [ + "(pattern: RegExp) => (value: string) => { pattern: { matchPattern: string; }; } | null" + ], + "description": [ + "\nProvides a validator function for checking against pattern." + ], + "children": [ { - "tags": [], - "id": "def-common.SearchResponse7.hits", + "id": "def-common.patternValidator.$1", "type": "Object", - "label": "hits", - "description": [], - "source": { - "path": "x-pack/plugins/ml/common/types/es_client.ts", - "lineNumber": 30 - }, + "label": "pattern", + "isRequired": true, "signature": [ - "SearchResponse7Hits" - ] - }, - { - "tags": [], - "id": "def-common.SearchResponse7.aggregations", - "type": "Any", - "label": "aggregations", + "RegExp" + ], "description": [], "source": { - "path": "x-pack/plugins/ml/common/types/es_client.ts", - "lineNumber": 31 - }, - "signature": [ - "any" - ] + "path": "x-pack/plugins/ml/common/util/validators.ts", + "lineNumber": 34 + } } ], + "tags": [], + "returnComment": [], "source": { - "path": "x-pack/plugins/ml/common/types/es_client.ts", - "lineNumber": 25 + "path": "x-pack/plugins/ml/common/util/validators.ts", + "lineNumber": 33 }, "initialIsOpen": false } ], + "interfaces": [], "enums": [ { "id": "def-common.ANOMALY_SEVERITY", @@ -4805,17 +4657,17 @@ "initialIsOpen": false }, { - "id": "def-common.HitsTotalRelation", + "id": "def-common.RuntimeMappings", "type": "Type", - "label": "HitsTotalRelation", + "label": "RuntimeMappings", "tags": [], "description": [], "source": { - "path": "x-pack/plugins/ml/common/types/es_client.ts", - "lineNumber": 14 + "path": "x-pack/plugins/ml/common/types/fields.ts", + "lineNumber": 111 }, "signature": [ - "\"gte\" | \"eq\"" + "{ [x: string]: estypes.RuntimeField; }" ], "initialIsOpen": false } @@ -4823,16 +4675,18 @@ "objects": [ { "tags": [], - "id": "def-common.HITS_TOTAL_RELATION", + "id": "def-common.ES_CLIENT_TOTAL_HITS_RELATION", "type": "Object", - "label": "HITS_TOTAL_RELATION", + "label": "ES_CLIENT_TOTAL_HITS_RELATION", "description": [], "source": { "path": "x-pack/plugins/ml/common/types/es_client.ts", - "lineNumber": 10 + "lineNumber": 20 }, "signature": [ - "{ readonly EQ: \"eq\"; readonly GTE: \"gte\"; }" + "Record<\"GTE\" | \"EQ\", ", + "TotalHitsRelation", + ">" ], "initialIsOpen": false }, diff --git a/api_docs/ml.mdx b/api_docs/ml.mdx index aca7f85b3d2d8..010bf2d2c3de4 100644 --- a/api_docs/ml.mdx +++ b/api_docs/ml.mdx @@ -65,9 +65,6 @@ import mlObj from './ml.json'; ### Functions -### Interfaces - - ### Enums diff --git a/api_docs/monitoring.json b/api_docs/monitoring.json index d8b8b60495f8f..831e4015cd842 100644 --- a/api_docs/monitoring.json +++ b/api_docs/monitoring.json @@ -119,9 +119,9 @@ "lineNumber": 92 }, "signature": [ - "{ ui: { elasticsearch: MonitoringElasticsearchConfig; enabled: boolean; logs: Readonly<{} & { index: string; }>; container: Readonly<{} & { logstash: Readonly<{} & { enabled: boolean; }>; elasticsearch: Readonly<{} & { enabled: boolean; }>; apm: Readonly<{} & { enabled: boolean; }>; }>; ccs: Readonly<{} & { enabled: boolean; }>; metricbeat: Readonly<{} & { index: string; }>; max_bucket_size: number; min_interval_seconds: number; show_license_expiration: boolean; }; enabled: boolean; kibana: Readonly<{} & { collection: Readonly<{} & { enabled: boolean; interval: number; }>; }>; cluster_alerts: Readonly<{} & { enabled: boolean; email_notifications: Readonly<{} & { enabled: boolean; email_address: string; }>; }>; licensing: Readonly<{} & { api_polling_frequency: ", + "{ ui: { elasticsearch: MonitoringElasticsearchConfig; enabled: boolean; container: Readonly<{} & { logstash: Readonly<{} & { enabled: boolean; }>; elasticsearch: Readonly<{} & { enabled: boolean; }>; apm: Readonly<{} & { enabled: boolean; }>; }>; logs: Readonly<{} & { index: string; }>; ccs: Readonly<{} & { enabled: boolean; }>; metricbeat: Readonly<{} & { index: string; }>; max_bucket_size: number; min_interval_seconds: number; show_license_expiration: boolean; }; enabled: boolean; kibana: Readonly<{} & { collection: Readonly<{} & { enabled: boolean; interval: number; }>; }>; licensing: Readonly<{} & { api_polling_frequency: ", "Duration", - "; }>; agent: Readonly<{} & { interval: string; }>; tests: Readonly<{} & { cloud_detector: Readonly<{} & { enabled: boolean; }>; }>; }" + "; }>; agent: Readonly<{} & { interval: string; }>; cluster_alerts: Readonly<{} & { enabled: boolean; email_notifications: Readonly<{} & { enabled: boolean; email_address: string; }>; }>; tests: Readonly<{} & { cloud_detector: Readonly<{} & { enabled: boolean; }>; }>; }" ], "initialIsOpen": false } diff --git a/api_docs/navigation.json b/api_docs/navigation.json index fce341c24ac79..7d07d06bd30e5 100644 --- a/api_docs/navigation.json +++ b/api_docs/navigation.json @@ -53,6 +53,7 @@ "description": [], "children": [ { + "id": "def-public.NavigationPublicPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -105,6 +106,7 @@ "description": [], "children": [ { + "id": "def-public.NavigationPublicPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -146,13 +148,7 @@ "text": "CoreStart" }, ", { data }: ", - { - "pluginId": "navigation", - "scope": "public", - "docId": "kibNavigationPluginApi", - "section": "def-public.NavigationPluginStartDependencies", - "text": "NavigationPluginStartDependencies" - }, + "NavigationPluginStartDependencies", ") => ", { "pluginId": "navigation", @@ -165,6 +161,7 @@ "description": [], "children": [ { + "id": "def-public.NavigationPublicPlugin.start.$1", "type": "Object", "label": "{ i18n }", "isRequired": true, @@ -184,17 +181,12 @@ } }, { + "id": "def-public.NavigationPublicPlugin.start.$2", "type": "Object", "label": "{ data }", "isRequired": true, "signature": [ - { - "pluginId": "navigation", - "scope": "public", - "docId": "kibNavigationPluginApi", - "section": "def-public.NavigationPluginStartDependencies", - "text": "NavigationPluginStartDependencies" - } + "NavigationPluginStartDependencies" ], "description": [], "source": { @@ -253,6 +245,7 @@ "description": [], "children": [ { + "id": "def-public.TopNavMenu.$1", "type": "CompoundType", "label": "props", "isRequired": true, @@ -325,13 +318,7 @@ "lineNumber": 16 }, "signature": [ - { - "pluginId": "navigation", - "scope": "public", - "docId": "kibNavigationPluginApi", - "section": "def-public.TopNavMenuAction", - "text": "TopNavMenuAction" - } + "TopNavMenuAction" ] }, { @@ -482,7 +469,7 @@ }, "signature": [ "SearchBarOwnProps", - " & { appName: string; useDefaultBehaviors?: boolean | undefined; savedQueryId?: string | undefined; onSavedQueryIdChange?: ((savedQueryId?: string | undefined) => void) | undefined; } & Pick & { config?: TopNavMenuData[] | undefined; badges?: (({ iconType?: string | React.ComponentClass<{}, any> | React.FunctionComponent<{}> | undefined; iconSide?: \"left\" | \"right\" | undefined; color?: string | undefined; isDisabled?: boolean | undefined; closeButtonProps?: Partial<", + " & { appName: string; useDefaultBehaviors?: boolean | undefined; savedQueryId?: string | undefined; onSavedQueryIdChange?: ((savedQueryId?: string | undefined) => void) | undefined; } & Pick & { config?: TopNavMenuData[] | undefined; badges?: (({ iconType?: string | React.ComponentClass<{}, any> | React.FunctionComponent<{}> | undefined; iconSide?: \"left\" | \"right\" | undefined; color?: string | undefined; isDisabled?: boolean | undefined; closeButtonProps?: Partial<", "EuiIconProps", "> | undefined; } & ", "CommonProps", @@ -514,13 +501,7 @@ }, "signature": [ "(menuItem: ", - { - "pluginId": "navigation", - "scope": "public", - "docId": "kibNavigationPluginApi", - "section": "def-public.RegisteredTopNavMenuData", - "text": "RegisteredTopNavMenuData" - }, + "RegisteredTopNavMenuData", ") => void" ] } diff --git a/api_docs/observability.json b/api_docs/observability.json index 2128e27f0106f..e35a98a31aa00 100644 --- a/api_docs/observability.json +++ b/api_docs/observability.json @@ -13,6 +13,7 @@ "description": [], "children": [ { + "id": "def-public.ActionMenu.$1", "type": "CompoundType", "label": "props", "isRequired": true, @@ -51,6 +52,56 @@ }, "initialIsOpen": false }, + { + "id": "def-public.createExploratoryViewUrl", + "type": "Function", + "label": "createExploratoryViewUrl", + "signature": [ + "(allSeries: Record, baseHref: string) => string" + ], + "description": [], + "children": [ + { + "id": "def-public.createExploratoryViewUrl.$1", + "type": "Object", + "label": "allSeries", + "isRequired": true, + "signature": [ + "Record" + ], + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts", + "lineNumber": 36 + } + }, + { + "id": "def-public.createExploratoryViewUrl.$2", + "type": "string", + "label": "baseHref", + "isRequired": true, + "signature": [ + "string" + ], + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts", + "lineNumber": 36 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts", + "lineNumber": 36 + }, + "initialIsOpen": false + }, { "id": "def-public.FieldValueSuggestions", "type": "Function", @@ -63,17 +114,12 @@ "description": [], "children": [ { + "id": "def-public.FieldValueSuggestions.$1", "type": "Object", "label": "props", "isRequired": true, "signature": [ - { - "pluginId": "observability", - "scope": "public", - "docId": "kibObservabilityPluginApi", - "section": "def-public.FieldValueSuggestionsProps", - "text": "FieldValueSuggestionsProps" - } + "FieldValueSuggestionsProps" ], "description": [], "source": { @@ -100,7 +146,7 @@ "description": [], "children": [ { - "id": "def-public.getApmTraceUrl.{\n- traceId,\n rangeFrom,\n rangeTo,\n}", + "id": "def-public.getApmTraceUrl.$1.traceIdrangeFromrangeTo", "type": "Object", "label": "{\n traceId,\n rangeFrom,\n rangeTo,\n}", "tags": [], @@ -108,7 +154,7 @@ "children": [ { "tags": [], - "id": "def-public.getApmTraceUrl.{\n- traceId,\n rangeFrom,\n rangeTo,\n}.traceId", + "id": "def-public.getApmTraceUrl.$1.traceIdrangeFromrangeTo.traceId", "type": "string", "label": "traceId", "description": [], @@ -119,7 +165,7 @@ }, { "tags": [], - "id": "def-public.getApmTraceUrl.{\n- traceId,\n rangeFrom,\n rangeTo,\n}.rangeFrom", + "id": "def-public.getApmTraceUrl.$1.traceIdrangeFromrangeTo.rangeFrom", "type": "string", "label": "rangeFrom", "description": [], @@ -130,7 +176,7 @@ }, { "tags": [], - "id": "def-public.getApmTraceUrl.{\n- traceId,\n rangeFrom,\n rangeTo,\n}.rangeTo", + "id": "def-public.getApmTraceUrl.$1.traceIdrangeFromrangeTo.rangeTo", "type": "string", "label": "rangeTo", "description": [], @@ -166,17 +212,12 @@ "description": [], "children": [ { + "id": "def-public.getCoreVitalsComponent.$1", "type": "Object", "label": "props", "isRequired": true, "signature": [ - { - "pluginId": "observability", - "scope": "public", - "docId": "kibObservabilityPluginApi", - "section": "def-public.CoreVitalProps", - "text": "CoreVitalProps" - } + "CoreVitalProps" ], "description": [], "source": { @@ -205,17 +246,12 @@ "description": [], "children": [ { + "id": "def-public.HeaderMenuPortal.$1", "type": "Object", "label": "props", "isRequired": true, "signature": [ - { - "pluginId": "observability", - "scope": "public", - "docId": "kibObservabilityPluginApi", - "section": "def-public.HeaderMenuPortalProps", - "text": "HeaderMenuPortalProps" - } + "HeaderMenuPortalProps" ], "description": [], "source": { @@ -260,6 +296,7 @@ "description": [], "children": [ { + "id": "def-public.SectionLink.$1", "type": "CompoundType", "label": "props", "isRequired": true, @@ -295,6 +332,7 @@ "description": [], "children": [ { + "id": "def-public.SectionLinks.$1", "type": "CompoundType", "label": "{ children, ...props }", "isRequired": true, @@ -347,7 +385,7 @@ "description": [], "children": [ { - "id": "def-public.SectionSubtitle.{-children }", + "id": "def-public.SectionSubtitle.$1.children", "type": "Object", "label": "{ children }", "tags": [], @@ -355,7 +393,7 @@ "children": [ { "tags": [], - "id": "def-public.SectionSubtitle.{-children }.children", + "id": "def-public.SectionSubtitle.$1.children.children", "type": "CompoundType", "label": "children", "description": [], @@ -392,7 +430,7 @@ "description": [], "children": [ { - "id": "def-public.SectionTitle.{-children }", + "id": "def-public.SectionTitle.$1.children", "type": "Object", "label": "{ children }", "tags": [], @@ -400,7 +438,7 @@ "children": [ { "tags": [], - "id": "def-public.SectionTitle.{-children }.children", + "id": "def-public.SectionTitle.$1.children.children", "type": "CompoundType", "label": "children", "description": [], @@ -465,6 +503,7 @@ "description": [], "children": [ { + "id": "def-public.useFetcher.$1", "type": "Function", "label": "fn", "isRequired": true, @@ -478,6 +517,7 @@ } }, { + "id": "def-public.useFetcher.$2", "type": "Array", "label": "fnDeps", "isRequired": true, @@ -491,7 +531,7 @@ } }, { - "id": "def-public.useFetcher.options", + "id": "def-public.useFetcher.$3.options", "type": "Object", "label": "options", "tags": [], @@ -499,7 +539,7 @@ "children": [ { "tags": [], - "id": "def-public.useFetcher.options.preservePreviousData", + "id": "def-public.useFetcher.$3.options.preservePreviousData", "type": "CompoundType", "label": "preservePreviousData", "description": [], @@ -568,6 +608,7 @@ "description": [], "children": [ { + "id": "def-public.useTrackMetric.$1", "type": "CompoundType", "label": "{ app, metric, metricType = METRIC_TYPE.COUNT, delay = 0 }", "isRequired": true, @@ -587,6 +628,7 @@ } }, { + "id": "def-public.useTrackMetric.$2", "type": "Array", "label": "effectDependencies", "isRequired": true, @@ -618,6 +660,7 @@ "description": [], "children": [ { + "id": "def-public.useTrackPageview.$1", "type": "CompoundType", "label": "{ path, ...rest }", "isRequired": true, @@ -631,6 +674,7 @@ } }, { + "id": "def-public.useTrackPageview.$2", "type": "Array", "label": "effectDependencies", "isRequired": true, @@ -657,7 +701,7 @@ "type": "Function", "label": "useUiTracker", "signature": [ - "({\n app: defaultApp,\n}: { app?: \"apm\" | \"infra_metrics\" | \"infra_logs\" | \"uptime\" | \"observability-overview\" | \"stack_monitoring\" | \"ux\" | undefined; }) => ({ app, metric, metricType }: ", + "({\n app: defaultApp,\n}: { app?: \"uptime\" | \"apm\" | \"infra_metrics\" | \"infra_logs\" | \"observability-overview\" | \"stack_monitoring\" | \"ux\" | undefined; }) => ({ app, metric, metricType }: ", { "pluginId": "observability", "scope": "public", @@ -670,7 +714,7 @@ "description": [], "children": [ { - "id": "def-public.useUiTracker.{\n- app: defaultApp,\n}", + "id": "def-public.useUiTracker.$1.appdefaultApp", "type": "Object", "label": "{\n app: defaultApp,\n}", "tags": [], @@ -678,7 +722,7 @@ "children": [ { "tags": [], - "id": "def-public.useUiTracker.{\n- app: defaultApp,\n}.app", + "id": "def-public.useUiTracker.$1.appdefaultApp.app", "type": "CompoundType", "label": "app", "description": [], @@ -687,7 +731,7 @@ "lineNumber": 40 }, "signature": [ - "\"apm\" | \"infra_metrics\" | \"infra_logs\" | \"uptime\" | \"observability-overview\" | \"stack_monitoring\" | \"ux\" | undefined" + "\"uptime\" | \"apm\" | \"infra_metrics\" | \"infra_logs\" | \"observability-overview\" | \"stack_monitoring\" | \"ux\" | undefined" ] } ], @@ -739,7 +783,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 91 + "lineNumber": 111 }, "signature": [ "{ services: ", @@ -769,7 +813,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 95 + "lineNumber": 115 }, "signature": [ "{ transactions: ", @@ -786,7 +830,7 @@ ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 90 + "lineNumber": 110 }, "initialIsOpen": false }, @@ -805,27 +849,27 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 17 + "lineNumber": 16 } }, { "tags": [], "id": "def-public.Coordinates.y", - "type": "number", + "type": "CompoundType", "label": "y", "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 18 + "lineNumber": 17 }, "signature": [ - "number | undefined" + "number | null | undefined" ] } ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 16 + "lineNumber": 15 }, "initialIsOpen": false }, @@ -854,7 +898,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 57 + "lineNumber": 56 }, "signature": [ { @@ -883,7 +927,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 58 + "lineNumber": 57 }, "signature": [ { @@ -899,7 +943,7 @@ ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 54 + "lineNumber": 53 }, "initialIsOpen": false }, @@ -918,7 +962,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 26 + "lineNumber": 25 }, "signature": [ "{ start: number; end: number; }" @@ -932,7 +976,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 27 + "lineNumber": 26 }, "signature": [ "{ start: string; end: string; }" @@ -946,7 +990,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 28 + "lineNumber": 27 } }, { @@ -957,7 +1001,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 29 + "lineNumber": 28 }, "signature": [ "string | undefined" @@ -966,7 +1010,7 @@ ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 25 + "lineNumber": 24 }, "initialIsOpen": false }, @@ -985,13 +1029,13 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 62 + "lineNumber": 61 } } ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 61 + "lineNumber": 60 }, "initialIsOpen": false }, @@ -1010,7 +1054,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 33 + "lineNumber": 32 }, "signature": [ "{ start: number; end: number; }" @@ -1019,7 +1063,7 @@ ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 32 + "lineNumber": 31 }, "initialIsOpen": false }, @@ -1055,7 +1099,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 66 + "lineNumber": 65 }, "signature": [ "Record Promise<", { "pluginId": "observability", "scope": "public", "docId": "kibObservabilityPluginApi", - "section": "def-public.Stat", - "text": "Stat" - }, - "; cpu: ", - { - "pluginId": "observability", - "scope": "public", - "docId": "kibObservabilityPluginApi", - "section": "def-public.Stat", - "text": "Stat" + "section": "def-public.MetricsFetchDataResponse", + "text": "MetricsFetchDataResponse" }, - "; memory: ", + ">" + ] + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataResponse.series", + "type": "Array", + "label": "series", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 95 + }, + "signature": [ { "pluginId": "observability", "scope": "public", "docId": "kibObservabilityPluginApi", - "section": "def-public.Stat", - "text": "Stat" + "section": "def-public.MetricsFetchDataSeries", + "text": "MetricsFetchDataSeries" }, - "; }" + "[]" ] } ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 70 + "lineNumber": 93 + }, + "initialIsOpen": false + }, + { + "id": "def-public.MetricsFetchDataSeries", + "type": "Interface", + "label": "MetricsFetchDataSeries", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.id", + "type": "string", + "label": "id", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 73 + } + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.name", + "type": "CompoundType", + "label": "name", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 74 + }, + "signature": [ + "string | null" + ] + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.platform", + "type": "CompoundType", + "label": "platform", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 75 + }, + "signature": [ + "string | null" + ] + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.provider", + "type": "CompoundType", + "label": "provider", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 76 + }, + "signature": [ + "string | null" + ] + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.cpu", + "type": "CompoundType", + "label": "cpu", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 77 + }, + "signature": [ + "number | null" + ] + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.iowait", + "type": "CompoundType", + "label": "iowait", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 78 + }, + "signature": [ + "number | null" + ] + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.load", + "type": "CompoundType", + "label": "load", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 79 + }, + "signature": [ + "number | null" + ] + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.uptime", + "type": "CompoundType", + "label": "uptime", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 80 + }, + "signature": [ + "number | null" + ] + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.rx", + "type": "CompoundType", + "label": "rx", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 81 + }, + "signature": [ + "number | null" + ] + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.tx", + "type": "CompoundType", + "label": "tx", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 82 + }, + "signature": [ + "number | null" + ] + }, + { + "tags": [], + "id": "def-public.MetricsFetchDataSeries.timeseries", + "type": "Array", + "label": "timeseries", + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 83 + }, + "signature": [ + "{ timestamp: number; cpu: number | null; iowait: number | null; load: number | null; rx: number | null; tx: number | null; }[]" + ] + } + ], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 72 }, "initialIsOpen": false }, @@ -1182,7 +1396,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 105 + "lineNumber": 125 }, "signature": [ { @@ -1202,7 +1416,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 106 + "lineNumber": 126 }, "signature": [ { @@ -1222,7 +1436,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 107 + "lineNumber": 127 }, "signature": [ { @@ -1242,7 +1456,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 108 + "lineNumber": 128 }, "signature": [ { @@ -1262,7 +1476,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 109 + "lineNumber": 129 }, "signature": [ { @@ -1277,7 +1491,7 @@ ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 104 + "lineNumber": 124 }, "initialIsOpen": false }, @@ -1296,7 +1510,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 113 + "lineNumber": 133 } }, { @@ -1307,7 +1521,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 114 + "lineNumber": 134 } }, { @@ -1318,7 +1532,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 115 + "lineNumber": 135 } }, { @@ -1329,7 +1543,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 116 + "lineNumber": 136 } }, { @@ -1340,7 +1554,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 117 + "lineNumber": 137 }, "signature": [ { @@ -1355,7 +1569,7 @@ ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 112 + "lineNumber": 132 }, "initialIsOpen": false }, @@ -1504,7 +1718,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 22 + "lineNumber": 21 }, "signature": [ { @@ -1520,7 +1734,7 @@ ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 21 + "lineNumber": 20 }, "initialIsOpen": false }, @@ -1539,7 +1753,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 12 + "lineNumber": 11 }, "signature": [ "\"number\" | \"percent\" | \"bytesPerSecond\"" @@ -1553,13 +1767,13 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 13 + "lineNumber": 12 } } ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 11 + "lineNumber": 10 }, "initialIsOpen": false }, @@ -1595,7 +1809,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 79 + "lineNumber": 99 }, "signature": [ "{ monitors: ", @@ -1633,7 +1847,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 84 + "lineNumber": 104 }, "signature": [ "{ up: ", @@ -1658,7 +1872,7 @@ ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 78 + "lineNumber": 98 }, "initialIsOpen": false }, @@ -1694,7 +1908,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 101 + "lineNumber": 121 }, "signature": [ { @@ -1709,7 +1923,7 @@ ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 100 + "lineNumber": 120 }, "initialIsOpen": false }, @@ -1728,7 +1942,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 37 + "lineNumber": 36 } }, { @@ -1739,7 +1953,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 38 + "lineNumber": 37 }, "signature": [ "string | number | undefined" @@ -1748,7 +1962,7 @@ ], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 36 + "lineNumber": 35 }, "initialIsOpen": false }, @@ -1948,6 +2162,21 @@ ], "initialIsOpen": false }, + { + "tags": [], + "id": "def-public.enableInspectEsQueries", + "type": "string", + "label": "enableInspectEsQueries", + "description": [], + "source": { + "path": "x-pack/plugins/observability/common/ui_settings_keys.ts", + "lineNumber": 9 + }, + "signature": [ + "\"observability:enableInspectEsQueries\"" + ], + "initialIsOpen": false + }, { "id": "def-public.FetchData", "type": "Type", @@ -1956,7 +2185,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 41 + "lineNumber": 40 }, "signature": [ "(fetchDataParams: ", @@ -1979,7 +2208,7 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 45 + "lineNumber": 44 }, "signature": [ "(params: ", @@ -2002,6 +2231,21 @@ ], "initialIsOpen": false }, + { + "id": "def-public.NumberOrNull", + "type": "Type", + "label": "NumberOrNull", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 70 + }, + "signature": [ + "null | number" + ], + "initialIsOpen": false + }, { "id": "def-public.ObservabilityFetchDataPlugins", "type": "Type", @@ -2010,10 +2254,10 @@ "description": [], "source": { "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "lineNumber": 49 + "lineNumber": 48 }, "signature": [ - "\"apm\" | \"infra_metrics\" | \"infra_logs\" | \"uptime\" | \"ux\"" + "\"uptime\" | \"apm\" | \"infra_metrics\" | \"infra_logs\" | \"ux\"" ], "initialIsOpen": false }, @@ -2040,6 +2284,21 @@ ], "initialIsOpen": false }, + { + "id": "def-public.StringOrNull", + "type": "Type", + "label": "StringOrNull", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "lineNumber": 69 + }, + "signature": [ + "null | string" + ], + "initialIsOpen": false + }, { "id": "def-public.TrackMetricOptions", "type": "Type", @@ -2099,13 +2358,7 @@ }, "signature": [ "{ register: typeof ", - { - "pluginId": "observability", - "scope": "public", - "docId": "kibObservabilityPluginApi", - "section": "def-public.registerDataHandler", - "text": "registerDataHandler" - }, + "registerDataHandler", "; }" ] } @@ -2177,6 +2430,7 @@ "description": [], "children": [ { + "id": "def-server.WrappedElasticsearchClientError.Unnamed.$1", "type": "Object", "label": "originalError", "isRequired": true, @@ -2234,7 +2488,7 @@ "description": [], "children": [ { - "id": "def-server.createOrUpdateIndex.{\n- index,\n mappings,\n client,\n logger,\n}", + "id": "def-server.createOrUpdateIndex.$1.indexmappingsclientlogger", "type": "Object", "label": "{\n index,\n mappings,\n client,\n logger,\n}", "tags": [], @@ -2242,7 +2496,7 @@ "children": [ { "tags": [], - "id": "def-server.createOrUpdateIndex.{\n- index,\n mappings,\n client,\n logger,\n}.index", + "id": "def-server.createOrUpdateIndex.$1.indexmappingsclientlogger.index", "type": "string", "label": "index", "description": [], @@ -2253,7 +2507,7 @@ }, { "tags": [], - "id": "def-server.createOrUpdateIndex.{\n- index,\n mappings,\n client,\n logger,\n}.mappings", + "id": "def-server.createOrUpdateIndex.$1.indexmappingsclientlogger.mappings", "type": "CompoundType", "label": "mappings", "description": [], @@ -2273,7 +2527,7 @@ }, { "tags": [], - "id": "def-server.createOrUpdateIndex.{\n- index,\n mappings,\n client,\n logger,\n}.client", + "id": "def-server.createOrUpdateIndex.$1.indexmappingsclientlogger.client", "type": "CompoundType", "label": "client", "description": [], @@ -2293,7 +2547,7 @@ }, { "tags": [], - "id": "def-server.createOrUpdateIndex.{\n- index,\n mappings,\n client,\n logger,\n}.logger", + "id": "def-server.createOrUpdateIndex.$1.indexmappingsclientlogger.logger", "type": "Object", "label": "logger", "description": [], @@ -2332,6 +2586,7 @@ "description": [], "children": [ { + "id": "def-server.unwrapEsResponse.$1", "type": "Uncategorized", "label": "responsePromise", "isRequired": true, @@ -2420,30 +2675,32 @@ "objects": [], "setup": { "id": "def-server.ObservabilityPluginSetup", - "type": "Interface", + "type": "Type", "label": "ObservabilityPluginSetup", - "description": [], "tags": [], - "children": [ - { - "tags": [], - "id": "def-server.ObservabilityPluginSetup.getScopedAnnotationsClient", - "type": "Function", - "label": "getScopedAnnotationsClient", - "description": [], - "source": { - "path": "x-pack/plugins/observability/server/plugin.ts", - "lineNumber": 23 - }, - "signature": [ - "LazyScopedAnnotationsClientFactory" - ] - } - ], + "description": [], "source": { "path": "x-pack/plugins/observability/server/plugin.ts", - "lineNumber": 22 + "lineNumber": 20 }, + "signature": [ + "{ getScopedAnnotationsClient: (requestContext: ", + "ObservabilityRequestHandlerContext", + ", request: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + ") => Promise<{ readonly index: string; create: (createParams: { annotation: { type: string; }; '@timestamp': string; message: string; } & { tags?: string[] | undefined; service?: { name?: string | undefined; environment?: string | undefined; version?: string | undefined; } | undefined; }) => Promise<{ _id: string; _index: string; _source: ", + "Annotation", + "; }>; getById: (getByIdParams: { id: string; }) => Promise<", + "GetResponse", + ">; delete: (deleteParams: { id: string; }) => Promise<", + "DeleteResponse" + ], "lifecycle": "setup", "initialIsOpen": true } diff --git a/api_docs/presentation_util.json b/api_docs/presentation_util.json index 55204d129800e..351fd76adf704 100644 --- a/api_docs/presentation_util.json +++ b/api_docs/presentation_util.json @@ -4,87 +4,119 @@ "classes": [], "functions": [ { - "id": "def-public.DashboardPicker", + "tags": [], + "id": "def-public.LazyDashboardPicker", "type": "Function", - "label": "DashboardPicker", - "signature": [ - "(props: ", - "DashboardPickerProps", - ") => JSX.Element" - ], + "label": "LazyDashboardPicker", "description": [], - "children": [ - { - "type": "Object", - "label": "props", - "isRequired": true, - "signature": [ - { - "pluginId": "presentationUtil", - "scope": "public", - "docId": "kibPresentationUtilPluginApi", - "section": "def-public.DashboardPickerProps", - "text": "DashboardPickerProps" - } - ], - "description": [], - "source": { - "path": "src/plugins/presentation_util/public/components/dashboard_picker.tsx", - "lineNumber": 27 - } - } + "source": { + "path": "src/plugins/presentation_util/public/components/index.tsx", + "lineNumber": 34 + }, + "signature": [ + "React.LazyExoticComponent" ], + "initialIsOpen": false + }, + { "tags": [], - "returnComment": [], + "id": "def-public.LazyLabsBeakerButton", + "type": "Function", + "label": "LazyLabsBeakerButton", + "description": [], "source": { - "path": "src/plugins/presentation_util/public/components/dashboard_picker.tsx", - "lineNumber": 27 + "path": "src/plugins/presentation_util/public/components/index.tsx", + "lineNumber": 28 }, + "signature": [ + "(props: ", + "Props", + ") => JSX.Element" + ], "initialIsOpen": false }, { - "id": "def-public.SavedObjectSaveModalDashboard", + "tags": [], + "id": "def-public.LazyLabsFlyout", "type": "Function", - "label": "SavedObjectSaveModalDashboard", + "label": "LazyLabsFlyout", + "description": [], + "source": { + "path": "src/plugins/presentation_util/public/components/index.tsx", + "lineNumber": 32 + }, "signature": [ "(props: ", - { - "pluginId": "presentationUtil", - "scope": "public", - "docId": "kibPresentationUtilPluginApi", - "section": "def-public.SaveModalDashboardProps", - "text": "SaveModalDashboardProps" - }, + "Props", ") => JSX.Element" ], + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-public.LazySavedObjectSaveModalDashboard", + "type": "Function", + "label": "LazySavedObjectSaveModalDashboard", "description": [], + "source": { + "path": "src/plugins/presentation_util/public/components/index.tsx", + "lineNumber": 36 + }, + "signature": [ + "React.LazyExoticComponent" + ], + "initialIsOpen": false + }, + { + "id": "def-public.withSuspense", + "type": "Function", "children": [ { - "type": "Object", - "label": "props", + "id": "def-public.withSuspense.$1", + "type": "CompoundType", + "label": "Component", "isRequired": true, "signature": [ - { - "pluginId": "presentationUtil", - "scope": "public", - "docId": "kibPresentationUtilPluginApi", - "section": "def-public.SaveModalDashboardProps", - "text": "SaveModalDashboardProps" - } + "React.ComponentType

" + ], + "description": [], + "source": { + "path": "src/plugins/presentation_util/public/components/index.tsx", + "lineNumber": 18 + } + }, + { + "id": "def-public.withSuspense.$2", + "type": "CompoundType", + "label": "fallback", + "isRequired": false, + "signature": [ + "React.ReactElement React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)> | null" ], "description": [], "source": { - "path": "src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.tsx", - "lineNumber": 37 + "path": "src/plugins/presentation_util/public/components/index.tsx", + "lineNumber": 19 } } ], - "tags": [], - "returnComment": [], + "signature": [ + "

(Component: React.ComponentType

, fallback?: React.ReactElement React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)> | null) => (props: P) => JSX.Element" + ], + "description": [ + "\nA HOC which supplies React.Suspense with a fallback component, and a `EuiErrorBoundary` to contain errors." + ], + "label": "withSuspense", "source": { - "path": "src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.tsx", - "lineNumber": 37 + "path": "src/plugins/presentation_util/public/components/index.tsx", + "lineNumber": 17 }, + "tags": [], + "returnComment": [], "initialIsOpen": false } ], @@ -103,13 +135,24 @@ "label": "documentInfo", "description": [], "source": { - "path": "src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.tsx", - "lineNumber": 30 + "path": "src/plugins/presentation_util/public/components/types.ts", + "lineNumber": 18 }, "signature": [ "SaveModalDocumentInfo" ] }, + { + "tags": [], + "id": "def-public.SaveModalDashboardProps.canSaveByReference", + "type": "boolean", + "label": "canSaveByReference", + "description": [], + "source": { + "path": "src/plugins/presentation_util/public/components/types.ts", + "lineNumber": 19 + } + }, { "tags": [], "id": "def-public.SaveModalDashboardProps.objectType", @@ -117,8 +160,8 @@ "label": "objectType", "description": [], "source": { - "path": "src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.tsx", - "lineNumber": 31 + "path": "src/plugins/presentation_util/public/components/types.ts", + "lineNumber": 20 } }, { @@ -128,8 +171,8 @@ "label": "onClose", "description": [], "source": { - "path": "src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.tsx", - "lineNumber": 32 + "path": "src/plugins/presentation_util/public/components/types.ts", + "lineNumber": 21 }, "signature": [ "() => void" @@ -142,8 +185,8 @@ "label": "onSave", "description": [], "source": { - "path": "src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.tsx", - "lineNumber": 33 + "path": "src/plugins/presentation_util/public/components/types.ts", + "lineNumber": 22 }, "signature": [ "(props: ", @@ -164,8 +207,8 @@ "label": "tagOptions", "description": [], "source": { - "path": "src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.tsx", - "lineNumber": 34 + "path": "src/plugins/presentation_util/public/components/types.ts", + "lineNumber": 23 }, "signature": [ "string | number | boolean | {} | React.ReactElement React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)> | React.ReactNodeArray | React.ReactPortal | ((state: ", @@ -181,15 +224,62 @@ } ], "source": { - "path": "src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.tsx", - "lineNumber": 29 + "path": "src/plugins/presentation_util/public/components/types.ts", + "lineNumber": 17 }, "initialIsOpen": false } ], "enums": [], - "misc": [], - "objects": [], + "misc": [ + { + "id": "def-public.Project", + "type": "Type", + "label": "Project", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 59 + }, + "signature": [ + "ProjectConfig & { status: ProjectStatus; }" + ], + "initialIsOpen": false + }, + { + "id": "def-public.ProjectID", + "type": "Type", + "label": "ProjectID", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 36 + }, + "signature": [ + "\"labs:presentation:unifiedToolbar\"" + ], + "initialIsOpen": false + } + ], + "objects": [ + { + "tags": [], + "id": "def-public.projectIDs", + "type": "Object", + "label": "projectIDs", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 13 + }, + "signature": [ + "readonly [\"labs:presentation:unifiedToolbar\"]" + ], + "initialIsOpen": false + } + ], "setup": { "id": "def-public.PresentationUtilPluginSetup", "type": "Interface", @@ -199,7 +289,7 @@ "children": [], "source": { "path": "src/plugins/presentation_util/public/types.ts", - "lineNumber": 10 + "lineNumber": 12 }, "lifecycle": "setup", "initialIsOpen": true @@ -219,16 +309,30 @@ "description": [], "source": { "path": "src/plugins/presentation_util/public/types.ts", - "lineNumber": 13 + "lineNumber": 15 }, "signature": [ "React.FC<{}>" ] + }, + { + "tags": [], + "id": "def-public.PresentationUtilPluginStart.labsService", + "type": "Object", + "label": "labsService", + "description": [], + "source": { + "path": "src/plugins/presentation_util/public/types.ts", + "lineNumber": 16 + }, + "signature": [ + "PresentationLabsService" + ] } ], "source": { "path": "src/plugins/presentation_util/public/types.ts", - "lineNumber": 12 + "lineNumber": 14 }, "lifecycle": "start", "initialIsOpen": true @@ -244,10 +348,467 @@ }, "common": { "classes": [], - "functions": [], - "interfaces": [], + "functions": [ + { + "id": "def-common.getProjectIDs", + "type": "Function", + "children": [], + "signature": [ + "() => readonly [\"labs:presentation:unifiedToolbar\"]" + ], + "description": [], + "label": "getProjectIDs", + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 61 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + }, + { + "id": "def-common.isProjectEnabledByStatus", + "type": "Function", + "children": [ + { + "id": "def-common.isProjectEnabledByStatus.$1", + "type": "boolean", + "label": "active", + "isRequired": true, + "signature": [ + "boolean" + ], + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 63 + } + }, + { + "id": "def-common.isProjectEnabledByStatus.$2", + "type": "Object", + "label": "status", + "isRequired": true, + "signature": [ + { + "pluginId": "presentationUtil", + "scope": "common", + "docId": "kibPresentationUtilPluginApi", + "section": "def-common.EnvironmentStatus", + "text": "EnvironmentStatus" + } + ], + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 63 + } + } + ], + "signature": [ + "(active: boolean, status: ", + { + "pluginId": "presentationUtil", + "scope": "common", + "docId": "kibPresentationUtilPluginApi", + "section": "def-common.EnvironmentStatus", + "text": "EnvironmentStatus" + }, + ") => boolean" + ], + "description": [], + "label": "isProjectEnabledByStatus", + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 63 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + } + ], + "interfaces": [ + { + "id": "def-common.ProjectConfig", + "type": "Interface", + "label": "ProjectConfig", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-common.ProjectConfig.id", + "type": "string", + "label": "id", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 51 + }, + "signature": [ + "\"labs:presentation:unifiedToolbar\"" + ] + }, + { + "tags": [], + "id": "def-common.ProjectConfig.name", + "type": "string", + "label": "name", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 52 + } + }, + { + "tags": [], + "id": "def-common.ProjectConfig.isActive", + "type": "boolean", + "label": "isActive", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 53 + } + }, + { + "tags": [], + "id": "def-common.ProjectConfig.environments", + "type": "Array", + "label": "environments", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 54 + }, + "signature": [ + "(\"kibana\" | \"browser\" | \"session\")[]" + ] + }, + { + "tags": [], + "id": "def-common.ProjectConfig.description", + "type": "string", + "label": "description", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 55 + } + }, + { + "tags": [], + "id": "def-common.ProjectConfig.solutions", + "type": "Array", + "label": "solutions", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 56 + }, + "signature": [ + "(\"dashboard\" | \"canvas\" | \"presentation\")[]" + ] + } + ], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 50 + }, + "initialIsOpen": false + } + ], "enums": [], - "misc": [], - "objects": [] + "misc": [ + { + "id": "def-common.EnvironmentName", + "type": "Type", + "label": "EnvironmentName", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 37 + }, + "signature": [ + "\"kibana\" | \"browser\" | \"session\"" + ], + "initialIsOpen": false + }, + { + "id": "def-common.EnvironmentStatus", + "type": "Type", + "label": "EnvironmentStatus", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 40 + }, + "signature": [ + "{ kibana?: boolean | undefined; browser?: boolean | undefined; session?: boolean | undefined; }" + ], + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.PLUGIN_ID", + "type": "string", + "label": "PLUGIN_ID", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/index.ts", + "lineNumber": 9 + }, + "signature": [ + "\"presentationUtil\"" + ], + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.PLUGIN_NAME", + "type": "string", + "label": "PLUGIN_NAME", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/index.ts", + "lineNumber": 10 + }, + "signature": [ + "\"presentationUtil\"" + ], + "initialIsOpen": false + }, + { + "id": "def-common.Project", + "type": "Type", + "label": "Project", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 59 + }, + "signature": [ + "ProjectConfig & { status: ProjectStatus; }" + ], + "initialIsOpen": false + }, + { + "id": "def-common.ProjectID", + "type": "Type", + "label": "ProjectID", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 36 + }, + "signature": [ + "\"labs:presentation:unifiedToolbar\"" + ], + "initialIsOpen": false + }, + { + "id": "def-common.ProjectStatus", + "type": "Type", + "label": "ProjectStatus", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 44 + }, + "signature": [ + "{ defaultValue: boolean; isEnabled: boolean; isOverride: boolean; } & EnvironmentStatus" + ], + "initialIsOpen": false + }, + { + "id": "def-common.SolutionName", + "type": "Type", + "label": "SolutionName", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 38 + }, + "signature": [ + "\"dashboard\" | \"canvas\" | \"presentation\"" + ], + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.UNIFIED_TOOLBAR", + "type": "string", + "label": "UNIFIED_TOOLBAR", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 11 + }, + "signature": [ + "\"labs:presentation:unifiedToolbar\"" + ], + "initialIsOpen": false + } + ], + "objects": [ + { + "tags": [], + "id": "def-common.environmentNames", + "type": "Object", + "label": "environmentNames", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 14 + }, + "signature": [ + "readonly [\"kibana\", \"browser\", \"session\"]" + ], + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.projectIDs", + "type": "Object", + "label": "projectIDs", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 13 + }, + "signature": [ + "readonly [\"labs:presentation:unifiedToolbar\"]" + ], + "initialIsOpen": false + }, + { + "id": "def-common.projects", + "type": "Object", + "tags": [], + "children": [ + { + "id": "def-common.projects.UNIFIED_TOOLBAR", + "type": "Object", + "tags": [], + "children": [ + { + "tags": [], + "id": "def-common.projects.UNIFIED_TOOLBAR.id", + "type": "string", + "label": "id", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 23 + }, + "signature": [ + "\"labs:presentation:unifiedToolbar\"" + ] + }, + { + "tags": [], + "id": "def-common.projects.UNIFIED_TOOLBAR.isActive", + "type": "boolean", + "label": "isActive", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 24 + }, + "signature": [ + "false" + ] + }, + { + "tags": [], + "id": "def-common.projects.UNIFIED_TOOLBAR.environments", + "type": "Array", + "label": "environments", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 25 + }, + "signature": [ + "(\"kibana\" | \"browser\" | \"session\")[]" + ] + }, + { + "tags": [], + "id": "def-common.projects.UNIFIED_TOOLBAR.name", + "type": "string", + "label": "name", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 26 + } + }, + { + "tags": [], + "id": "def-common.projects.UNIFIED_TOOLBAR.description", + "type": "string", + "label": "description", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 29 + } + }, + { + "tags": [], + "id": "def-common.projects.UNIFIED_TOOLBAR.solutions", + "type": "Array", + "label": "solutions", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 32 + }, + "signature": [ + "(\"dashboard\" | \"canvas\")[]" + ] + } + ], + "description": [], + "label": "[UNIFIED_TOOLBAR]", + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 22 + } + } + ], + "description": [ + "\nThis is a list of active Labs Projects for the Presentation Team. It is the \"source of truth\" for all projects\nprovided to users of our solutions in Kibana." + ], + "label": "projects", + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 21 + }, + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.solutionNames", + "type": "Object", + "label": "solutionNames", + "description": [], + "source": { + "path": "src/plugins/presentation_util/common/labs.ts", + "lineNumber": 15 + }, + "signature": [ + "readonly [\"canvas\", \"dashboard\", \"presentation\"]" + ], + "initialIsOpen": false + } + ] } } \ No newline at end of file diff --git a/api_docs/presentation_util.mdx b/api_docs/presentation_util.mdx index 47088db34b9e7..4cb96b938bfa5 100644 --- a/api_docs/presentation_util.mdx +++ b/api_docs/presentation_util.mdx @@ -19,9 +19,29 @@ import presentationUtilObj from './presentation_util.json'; ### Start +### Objects + + ### Functions ### Interfaces +### Consts, variables and types + + +## Common + +### Objects + + +### Functions + + +### Interfaces + + +### Consts, variables and types + + diff --git a/api_docs/reporting.json b/api_docs/reporting.json index be0c963866038..1afa9f51a1603 100644 --- a/api_docs/reporting.json +++ b/api_docs/reporting.json @@ -19,6 +19,7 @@ "description": [], "children": [ { + "id": "def-public.ReportingAPIClient.Unnamed.$1", "type": "Object", "label": "http", "isRequired": true, @@ -55,6 +56,7 @@ "description": [], "children": [ { + "id": "def-public.ReportingAPIClient.getReportURL.$1", "type": "string", "label": "jobId", "isRequired": true, @@ -85,6 +87,7 @@ "description": [], "children": [ { + "id": "def-public.ReportingAPIClient.downloadReport.$1", "type": "string", "label": "jobId", "isRequired": true, @@ -115,6 +118,7 @@ "description": [], "children": [ { + "id": "def-public.ReportingAPIClient.deleteReport.$1", "type": "string", "label": "jobId", "isRequired": true, @@ -140,6 +144,7 @@ "type": "Function", "children": [ { + "id": "def-public.ReportingAPIClient.list.$1", "type": "number", "label": "page", "isRequired": true, @@ -153,6 +158,7 @@ } }, { + "id": "def-public.ReportingAPIClient.list.$2", "type": "Array", "label": "jobIds", "isRequired": true, @@ -168,13 +174,7 @@ ], "signature": [ "(page?: number, jobIds?: string[]) => Promise<", - { - "pluginId": "reporting", - "scope": "public", - "docId": "kibReportingPluginApi", - "section": "def-public.JobQueueEntry", - "text": "JobQueueEntry" - }, + "JobQueueEntry", "[]>" ], "description": [], @@ -208,18 +208,13 @@ "label": "getContent", "signature": [ "(jobId: string) => Promise<", - { - "pluginId": "reporting", - "scope": "public", - "docId": "kibReportingPluginApi", - "section": "def-public.JobContent", - "text": "JobContent" - }, + "JobContent", ">" ], "description": [], "children": [ { + "id": "def-public.ReportingAPIClient.getContent.$1", "type": "string", "label": "jobId", "isRequired": true, @@ -246,18 +241,13 @@ "label": "getInfo", "signature": [ "(jobId: string) => Promise<", - { - "pluginId": "reporting", - "scope": "common", - "docId": "kibReportingPluginApi", - "section": "def-common.ReportApiJSON", - "text": "ReportApiJSON" - }, + "ReportApiJSON", ">" ], "description": [], "children": [ { + "id": "def-public.ReportingAPIClient.getInfo.$1", "type": "string", "label": "jobId", "isRequired": true, @@ -283,6 +273,7 @@ "type": "Function", "children": [ { + "id": "def-public.ReportingAPIClient.findForJobIds.$1", "type": "Array", "label": "jobIds", "isRequired": true, @@ -298,13 +289,7 @@ ], "signature": [ "(jobIds: string[]) => Promise<", - { - "pluginId": "reporting", - "scope": "common", - "docId": "kibReportingPluginApi", - "section": "def-common.ReportDocument", - "text": "ReportDocument" - }, + "ReportDocument", "[]>" ], "description": [], @@ -321,6 +306,7 @@ "type": "Function", "children": [ { + "id": "def-public.ReportingAPIClient.getReportingJobPath.$1", "type": "string", "label": "exportType", "isRequired": true, @@ -334,6 +320,7 @@ } }, { + "id": "def-public.ReportingAPIClient.getReportingJobPath.$2", "type": "Object", "label": "jobParams", "isRequired": true, @@ -364,6 +351,7 @@ "type": "Function", "children": [ { + "id": "def-public.ReportingAPIClient.createReportingJob.$1", "type": "string", "label": "exportType", "isRequired": true, @@ -377,6 +365,7 @@ } }, { + "id": "def-public.ReportingAPIClient.createReportingJob.$2", "type": "Any", "label": "jobParams", "isRequired": true, @@ -423,6 +412,7 @@ "type": "Function", "children": [ { + "id": "def-public.ReportingAPIClient.getDownloadLink.$1", "type": "string", "label": "jobId", "isRequired": true, @@ -470,13 +460,7 @@ "children": [], "signature": [ "() => Promise<", - { - "pluginId": "reporting", - "scope": "public", - "docId": "kibReportingPluginApi", - "section": "def-public.DiagnoseResponse", - "text": "DiagnoseResponse" - }, + "DiagnoseResponse", ">" ], "description": [], @@ -494,13 +478,7 @@ "children": [], "signature": [ "() => Promise<", - { - "pluginId": "reporting", - "scope": "public", - "docId": "kibReportingPluginApi", - "section": "def-public.DiagnoseResponse", - "text": "DiagnoseResponse" - }, + "DiagnoseResponse", ">" ], "description": [], @@ -518,13 +496,7 @@ "children": [], "signature": [ "() => Promise<", - { - "pluginId": "reporting", - "scope": "public", - "docId": "kibReportingPluginApi", - "section": "def-public.DiagnoseResponse", - "text": "DiagnoseResponse" - }, + "DiagnoseResponse", ">" ], "description": [], @@ -595,6 +567,7 @@ "description": [], "children": [ { + "id": "def-public.ReportingPublicPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -636,13 +609,7 @@ "text": "CoreSetup" }, ", { home, management, licensing, uiActions, share }: ", - { - "pluginId": "reporting", - "scope": "public", - "docId": "kibReportingPluginApi", - "section": "def-public.ReportingPublicPluginSetupDendencies", - "text": "ReportingPublicPluginSetupDendencies" - }, + "ReportingPublicPluginSetupDendencies", ") => ", { "pluginId": "reporting", @@ -655,6 +622,7 @@ "description": [], "children": [ { + "id": "def-public.ReportingPublicPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -675,17 +643,12 @@ } }, { + "id": "def-public.ReportingPublicPlugin.setup.$2", "type": "Object", "label": "{ home, management, licensing, uiActions, share }", "isRequired": true, "signature": [ - { - "pluginId": "reporting", - "scope": "public", - "docId": "kibReportingPluginApi", - "section": "def-public.ReportingPublicPluginSetupDendencies", - "text": "ReportingPublicPluginSetupDendencies" - } + "ReportingPublicPluginSetupDendencies" ], "description": [], "source": { @@ -726,6 +689,7 @@ "description": [], "children": [ { + "id": "def-public.ReportingPublicPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -836,17 +800,12 @@ "description": [], "children": [ { + "id": "def-server.ReportingCore.Unnamed.$1", "type": "Object", "label": "logger", "isRequired": true, "signature": [ - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.LevelLogger", - "text": "LevelLogger" - } + "LevelLogger" ], "description": [], "source": { @@ -855,6 +814,7 @@ } }, { + "id": "def-server.ReportingCore.Unnamed.$2", "type": "Object", "label": "context", "isRequired": true, @@ -866,9 +826,9 @@ "section": "def-server.PluginInitializerContext", "text": "PluginInitializerContext" }, - "; }>; autoDownload: boolean; }>; timeouts: Readonly<{} & { openUrl: number | moment.Duration; waitForElements: number | moment.Duration; renderComplete: number | moment.Duration; }>; networkPolicy: Readonly<{} & { enabled: boolean; rules: Readonly<{ host?: string | undefined; protocol?: string | undefined; } & { allow: boolean; }>[]; }>; zoom: number; viewport: Readonly<{} & { height: number; width: number; }>; loadDelay: number | moment.Duration; maxAttempts: number; }>; kibanaServer: Readonly<{ hostname?: string | undefined; port?: number | undefined; protocol?: string | undefined; } & {}>; queue: Readonly<{} & { timeout: number | moment.Duration; pollInterval: number | moment.Duration; indexInterval: string; pollEnabled: boolean; pollIntervalErrorMultiplier: number; }>; csv: Readonly<{} & { scroll: Readonly<{} & { size: number; duration: string; }>; checkForFormulas: boolean; escapeFormulaValues: boolean; enablePanelActionDownload: boolean; maxSizeBytes: number | ", + "; }>; autoDownload: boolean; }>; timeouts: Readonly<{} & { openUrl: number | moment.Duration; waitForElements: number | moment.Duration; renderComplete: number | moment.Duration; }>; networkPolicy: Readonly<{} & { enabled: boolean; rules: Readonly<{ host?: string | undefined; protocol?: string | undefined; } & { allow: boolean; }>[]; }>; zoom: number; viewport: Readonly<{} & { height: number; width: number; }>; loadDelay: number | moment.Duration; maxAttempts: number; }>; roles: Readonly<{} & { allow: string[]; }>; kibanaServer: Readonly<{ port?: number | undefined; hostname?: string | undefined; protocol?: string | undefined; } & {}>; queue: Readonly<{} & { timeout: number | moment.Duration; pollInterval: number | moment.Duration; indexInterval: string; pollEnabled: boolean; pollIntervalErrorMultiplier: number; }>; csv: Readonly<{} & { scroll: Readonly<{} & { size: number; duration: string; }>; checkForFormulas: boolean; escapeFormulaValues: boolean; enablePanelActionDownload: boolean; maxSizeBytes: number | ", "ByteSizeValue", - "; useByteOrderMarkEncoding: boolean; }>; roles: Readonly<{} & { allow: string[]; }>; poll: Readonly<{} & { jobCompletionNotifier: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; jobsRefresh: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; }>; }>>" + "; useByteOrderMarkEncoding: boolean; }>; poll: Readonly<{} & { jobCompletionNotifier: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; jobsRefresh: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; }>; }>>" ], "description": [], "source": { @@ -890,29 +850,18 @@ "label": "pluginSetup", "signature": [ "(setupDeps: ", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ReportingInternalSetup", - "text": "ReportingInternalSetup" - }, + "ReportingInternalSetup", ") => void" ], "description": [], "children": [ { + "id": "def-server.ReportingCore.pluginSetup.$1", "type": "Object", "label": "setupDeps", "isRequired": true, "signature": [ - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ReportingInternalSetup", - "text": "ReportingInternalSetup" - } + "ReportingInternalSetup" ], "description": [], "source": { @@ -934,29 +883,18 @@ "label": "pluginStart", "signature": [ "(startDeps: ", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ReportingInternalStart", - "text": "ReportingInternalStart" - }, + "ReportingInternalStart", ") => Promise" ], "description": [], "children": [ { + "id": "def-server.ReportingCore.pluginStart.$1", "type": "Object", "label": "startDeps", "isRequired": true, "signature": [ - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ReportingInternalStart", - "text": "ReportingInternalStart" - } + "ReportingInternalStart" ], "description": [], "source": { @@ -1038,6 +976,7 @@ "description": [], "children": [ { + "id": "def-server.ReportingCore.setConfig.$1", "type": "Object", "label": "config", "isRequired": true, @@ -1111,13 +1050,7 @@ "label": "getPluginStartDeps", "signature": [ "() => Promise<", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ReportingInternalStart", - "text": "ReportingInternalStart" - }, + "ReportingInternalStart", ">" ], "description": [], @@ -1135,13 +1068,7 @@ "label": "getExportTypesRegistry", "signature": [ "() => ", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ExportTypesRegistry", - "text": "ExportTypesRegistry" - } + "ExportTypesRegistry" ], "description": [], "children": [], @@ -1158,21 +1085,9 @@ "label": "scheduleTask", "signature": [ "(report: ", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ReportTaskParams", - "text": "ReportTaskParams" - }, + "ReportTaskParams", "<", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.BasePayload", - "text": "BasePayload" - }, + "BasePayload", ">) => Promise<", { "pluginId": "taskManager", @@ -1186,25 +1101,14 @@ "description": [], "children": [ { + "id": "def-server.ReportingCore.scheduleTask.$1", "type": "Object", "label": "report", "isRequired": true, "signature": [ - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ReportTaskParams", - "text": "ReportTaskParams" - }, + "ReportTaskParams", "<", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.BasePayload", - "text": "BasePayload" - }, + "BasePayload", ">" ], "description": [], @@ -1227,13 +1131,7 @@ "label": "getStore", "signature": [ "() => Promise<", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ReportingStore", - "text": "ReportingStore" - }, + "ReportingStore", ">" ], "description": [], @@ -1251,13 +1149,7 @@ "label": "getLicenseInfo", "signature": [ "() => Promise>" ], "description": [], @@ -1275,13 +1167,7 @@ "label": "getScreenshotsObservable", "signature": [ "() => Promise<", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ScreenshotsObservableFn", - "text": "ScreenshotsObservableFn" - }, + "ScreenshotsObservableFn", ">" ], "description": [], @@ -1299,13 +1185,7 @@ "label": "getPluginSetupDeps", "signature": [ "() => ", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.ReportingInternalSetup", - "text": "ReportingInternalSetup" - } + "ReportingInternalSetup" ], "description": [], "children": [], @@ -1352,7 +1232,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">) => Promise<", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">) => Promise<", { "pluginId": "core", "scope": "server", @@ -1365,6 +1245,7 @@ "description": [], "children": [ { + "id": "def-server.ReportingCore.getUiSettingsServiceFactory.$1", "type": "Object", "label": "savedObjectsClient", "isRequired": true, @@ -1377,7 +1258,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ], "description": [], "source": { @@ -1407,18 +1288,13 @@ "text": "KibanaRequest" }, ", logger?: ", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.LevelLogger", - "text": "LevelLogger" - }, + "LevelLogger", ") => string | undefined" ], "description": [], "children": [ { + "id": "def-server.ReportingCore.getSpaceId.$1", "type": "Object", "label": "request", "isRequired": true, @@ -1439,17 +1315,12 @@ } }, { + "id": "def-server.ReportingCore.getSpaceId.$2", "type": "Object", "label": "logger", "isRequired": true, "signature": [ - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.LevelLogger", - "text": "LevelLogger" - } + "LevelLogger" ], "description": [], "source": { @@ -1471,13 +1342,7 @@ "label": "getFakeRequest", "signature": [ "(baseRequest: object, spaceId: string | undefined, logger?: ", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.LevelLogger", - "text": "LevelLogger" - }, + "LevelLogger", ") => ", { "pluginId": "core", @@ -1491,6 +1356,7 @@ "description": [], "children": [ { + "id": "def-server.ReportingCore.getFakeRequest.$1", "type": "Uncategorized", "label": "baseRequest", "isRequired": true, @@ -1504,6 +1370,7 @@ } }, { + "id": "def-server.ReportingCore.getFakeRequest.$2", "type": "string", "label": "spaceId", "isRequired": false, @@ -1517,17 +1384,12 @@ } }, { + "id": "def-server.ReportingCore.getFakeRequest.$3", "type": "Object", "label": "logger", "isRequired": true, "signature": [ - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.LevelLogger", - "text": "LevelLogger" - } + "LevelLogger" ], "description": [], "source": { @@ -1557,13 +1419,7 @@ "text": "KibanaRequest" }, ", logger?: ", - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.LevelLogger", - "text": "LevelLogger" - }, + "LevelLogger", ") => Promise<", { "pluginId": "core", @@ -1577,6 +1433,7 @@ "description": [], "children": [ { + "id": "def-server.ReportingCore.getUiSettingsClient.$1", "type": "Object", "label": "request", "isRequired": true, @@ -1597,17 +1454,12 @@ } }, { + "id": "def-server.ReportingCore.getUiSettingsClient.$2", "type": "Object", "label": "logger", "isRequired": true, "signature": [ - { - "pluginId": "reporting", - "scope": "server", - "docId": "kibReportingPluginApi", - "section": "def-server.LevelLogger", - "text": "LevelLogger" - } + "LevelLogger" ], "description": [], "source": { @@ -1681,6 +1533,7 @@ "description": [], "children": [ { + "id": "def-server.ReportingCore.trackReport.$1", "type": "string", "label": "reportId", "isRequired": true, @@ -1711,6 +1564,7 @@ "description": [], "children": [ { + "id": "def-server.ReportingCore.untrackReport.$1", "type": "string", "label": "reportId", "isRequired": true, @@ -1805,6 +1659,7 @@ "description": [], "children": [ { + "id": "def-server.ReportingPlugin.Unnamed.$1", "type": "Object", "label": "context", "isRequired": true, @@ -1816,9 +1671,9 @@ "section": "def-server.PluginInitializerContext", "text": "PluginInitializerContext" }, - "; }>; autoDownload: boolean; }>; timeouts: Readonly<{} & { openUrl: number | moment.Duration; waitForElements: number | moment.Duration; renderComplete: number | moment.Duration; }>; networkPolicy: Readonly<{} & { enabled: boolean; rules: Readonly<{ host?: string | undefined; protocol?: string | undefined; } & { allow: boolean; }>[]; }>; zoom: number; viewport: Readonly<{} & { height: number; width: number; }>; loadDelay: number | moment.Duration; maxAttempts: number; }>; kibanaServer: Readonly<{ hostname?: string | undefined; port?: number | undefined; protocol?: string | undefined; } & {}>; queue: Readonly<{} & { timeout: number | moment.Duration; pollInterval: number | moment.Duration; indexInterval: string; pollEnabled: boolean; pollIntervalErrorMultiplier: number; }>; csv: Readonly<{} & { scroll: Readonly<{} & { size: number; duration: string; }>; checkForFormulas: boolean; escapeFormulaValues: boolean; enablePanelActionDownload: boolean; maxSizeBytes: number | ", + "; }>; autoDownload: boolean; }>; timeouts: Readonly<{} & { openUrl: number | moment.Duration; waitForElements: number | moment.Duration; renderComplete: number | moment.Duration; }>; networkPolicy: Readonly<{} & { enabled: boolean; rules: Readonly<{ host?: string | undefined; protocol?: string | undefined; } & { allow: boolean; }>[]; }>; zoom: number; viewport: Readonly<{} & { height: number; width: number; }>; loadDelay: number | moment.Duration; maxAttempts: number; }>; roles: Readonly<{} & { allow: string[]; }>; kibanaServer: Readonly<{ port?: number | undefined; hostname?: string | undefined; protocol?: string | undefined; } & {}>; queue: Readonly<{} & { timeout: number | moment.Duration; pollInterval: number | moment.Duration; indexInterval: string; pollEnabled: boolean; pollIntervalErrorMultiplier: number; }>; csv: Readonly<{} & { scroll: Readonly<{} & { size: number; duration: string; }>; checkForFormulas: boolean; escapeFormulaValues: boolean; enablePanelActionDownload: boolean; maxSizeBytes: number | ", "ByteSizeValue", - "; useByteOrderMarkEncoding: boolean; }>; roles: Readonly<{} & { allow: string[]; }>; poll: Readonly<{} & { jobCompletionNotifier: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; jobsRefresh: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; }>; }>>" + "; useByteOrderMarkEncoding: boolean; }>; poll: Readonly<{} & { jobCompletionNotifier: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; jobsRefresh: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; }>; }>>" ], "description": [], "source": { @@ -1860,6 +1715,7 @@ "description": [], "children": [ { + "id": "def-server.ReportingPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -1880,6 +1736,7 @@ } }, { + "id": "def-server.ReportingPlugin.setup.$2", "type": "Object", "label": "plugins", "isRequired": true, @@ -1932,6 +1789,7 @@ "description": [], "children": [ { + "id": "def-server.ReportingPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -1951,6 +1809,7 @@ } }, { + "id": "def-server.ReportingPlugin.start.$2", "type": "Object", "label": "plugins", "isRequired": true, @@ -1999,9 +1858,9 @@ "section": "def-server.ReportingConfig", "text": "ReportingConfig" }, - " extends Config; }>; autoDownload: boolean; }>; timeouts: Readonly<{} & { openUrl: number | moment.Duration; waitForElements: number | moment.Duration; renderComplete: number | moment.Duration; }>; networkPolicy: Readonly<{} & { enabled: boolean; rules: Readonly<{ host?: string | undefined; protocol?: string | undefined; } & { allow: boolean; }>[]; }>; zoom: number; viewport: Readonly<{} & { height: number; width: number; }>; loadDelay: number | moment.Duration; maxAttempts: number; }>; kibanaServer: Readonly<{ hostname?: string | undefined; port?: number | undefined; protocol?: string | undefined; } & {}>; queue: Readonly<{} & { timeout: number | moment.Duration; pollInterval: number | moment.Duration; indexInterval: string; pollEnabled: boolean; pollIntervalErrorMultiplier: number; }>; csv: Readonly<{} & { scroll: Readonly<{} & { size: number; duration: string; }>; checkForFormulas: boolean; escapeFormulaValues: boolean; enablePanelActionDownload: boolean; maxSizeBytes: number | ", + " extends Config; }>; autoDownload: boolean; }>; timeouts: Readonly<{} & { openUrl: number | moment.Duration; waitForElements: number | moment.Duration; renderComplete: number | moment.Duration; }>; networkPolicy: Readonly<{} & { enabled: boolean; rules: Readonly<{ host?: string | undefined; protocol?: string | undefined; } & { allow: boolean; }>[]; }>; zoom: number; viewport: Readonly<{} & { height: number; width: number; }>; loadDelay: number | moment.Duration; maxAttempts: number; }>; roles: Readonly<{} & { allow: string[]; }>; kibanaServer: Readonly<{ port?: number | undefined; hostname?: string | undefined; protocol?: string | undefined; } & {}>; queue: Readonly<{} & { timeout: number | moment.Duration; pollInterval: number | moment.Duration; indexInterval: string; pollEnabled: boolean; pollIntervalErrorMultiplier: number; }>; csv: Readonly<{} & { scroll: Readonly<{} & { size: number; duration: string; }>; checkForFormulas: boolean; escapeFormulaValues: boolean; enablePanelActionDownload: boolean; maxSizeBytes: number | ", "ByteSizeValue", - "; useByteOrderMarkEncoding: boolean; }>; roles: Readonly<{} & { allow: string[]; }>; poll: Readonly<{} & { jobCompletionNotifier: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; jobsRefresh: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; }>; }>>" + "; useByteOrderMarkEncoding: boolean; }>; poll: Readonly<{} & { jobCompletionNotifier: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; jobsRefresh: Readonly<{} & { interval: number; intervalErrorMultiplier: number; }>; }>; }>>" ], "description": [], "tags": [], @@ -2148,13 +2007,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "usageCollection", - "scope": "server", - "docId": "kibUsageCollectionPluginApi", - "section": "def-server.CollectorSet", - "text": "CollectorSet" - }, + "CollectorSet", ", \"makeStatsCollector\" | \"makeUsageCollector\" | \"registerCollector\" | \"getCollectorByType\" | \"areAllCollectorsReady\" | \"bulkFetch\" | \"bulkFetchUsage\" | \"toObject\" | \"toApiFieldNames\"> | undefined" ] } @@ -2254,6 +2107,7 @@ "type": "Function", "children": [ { + "id": "def-common.CancellationToken.on.$1", "type": "Object", "label": "callback", "isRequired": true, @@ -2335,6 +2189,7 @@ "description": [], "children": [ { + "id": "def-common.Poller.Unnamed.$1", "type": "Object", "label": "options", "isRequired": true, diff --git a/api_docs/rule_registry.json b/api_docs/rule_registry.json new file mode 100644 index 0000000000000..dfa6643c57bad --- /dev/null +++ b/api_docs/rule_registry.json @@ -0,0 +1,400 @@ +{ + "id": "ruleRegistry", + "client": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + }, + "server": { + "classes": [], + "functions": [ + { + "id": "def-server.createLifecycleRuleTypeFactory", + "type": "Function", + "label": "createLifecycleRuleTypeFactory", + "signature": [ + "() => TRuleRegistry extends ", + "RuleRegistry", + " ? CreateLifecycleRuleType : never" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/rule_type_helpers/create_lifecycle_rule_type_factory.ts", + "lineNumber": 54 + }, + "initialIsOpen": false + }, + { + "id": "def-server.createLifecycleRuleTypeFactory", + "type": "Function", + "label": "createLifecycleRuleTypeFactory", + "signature": [ + "() => CreateLifecycleRuleType<{ readonly 'kibana.rac.producer': { readonly type: \"keyword\"; }; readonly 'kibana.rac.alert.uuid': { readonly type: \"keyword\"; }; readonly 'kibana.rac.alert.id': { readonly type: \"keyword\"; }; readonly 'kibana.rac.alert.start': { readonly type: \"date\"; }; readonly 'kibana.rac.alert.end': { readonly type: \"date\"; }; readonly 'kibana.rac.alert.duration.us': { readonly type: \"long\"; }; readonly 'kibana.rac.alert.severity.level': { readonly type: \"keyword\"; }; readonly 'kibana.rac.alert.severity.value': { readonly type: \"long\"; }; readonly 'kibana.rac.alert.status': { readonly type: \"keyword\"; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }>" + ], + "description": [], + "children": [], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/rule_type_helpers/create_lifecycle_rule_type_factory.ts", + "lineNumber": 60 + }, + "initialIsOpen": false + }, + { + "id": "def-server.pickWithPatterns", + "type": "Function", + "label": "pickWithPatterns", + "signature": [ + "(map: T, patterns: TPatterns) => Pick<{ [TFieldName in keyof T]: ", + "SetIntersection", + "<", + "ValuesType", + ", PatternMapOf[TFieldName]> extends never ? never : T[TFieldName]; }, { [Key in keyof { [TFieldName in keyof T]: ", + "SetIntersection", + "<", + "ValuesType", + ", PatternMapOf[TFieldName]> extends never ? never : T[TFieldName]; }]-?: [{ [TFieldName in keyof T]: ", + "SetIntersection" + ], + "description": [], + "children": [ + { + "id": "def-server.pickWithPatterns.$1", + "type": "Uncategorized", + "label": "map", + "isRequired": true, + "signature": [ + "T" + ], + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/field_map/pick_with_patterns.ts", + "lineNumber": 42 + } + }, + { + "id": "def-server.pickWithPatterns.$2", + "type": "Uncategorized", + "label": "patterns", + "isRequired": true, + "signature": [ + "TPatterns" + ], + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/field_map/pick_with_patterns.ts", + "lineNumber": 42 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/field_map/pick_with_patterns.ts", + "lineNumber": 39 + }, + "initialIsOpen": false + } + ], + "interfaces": [ + { + "id": "def-server.ScopedRuleRegistryClient", + "type": "Interface", + "label": "ScopedRuleRegistryClient", + "signature": [ + { + "pluginId": "ruleRegistry", + "scope": "server", + "docId": "kibRuleRegistryPluginApi", + "section": "def-server.ScopedRuleRegistryClient", + "text": "ScopedRuleRegistryClient" + }, + "" + ], + "description": [], + "tags": [], + "children": [ + { + "id": "def-server.ScopedRuleRegistryClient.search", + "type": "Function", + "label": "search", + "signature": [ + ">(request: TSearchRequest) => Promise<{ body: ", + "InferSearchResponseOf", + "; events: ", + "EventsOf", + "; }>" + ], + "description": [], + "children": [ + { + "id": "def-server.ScopedRuleRegistryClient.search.$1", + "type": "Uncategorized", + "label": "request", + "isRequired": true, + "signature": [ + "TSearchRequest" + ], + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts", + "lineNumber": 42 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts", + "lineNumber": 41 + } + }, + { + "id": "def-server.ScopedRuleRegistryClient.index", + "type": "Function", + "label": "index", + "signature": [ + "(doc: Pick<", + "Mutable", + "<{ [K in keyof Pick<{ [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }, { [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap]>]: ", + "OutputOf", + "]: MapTypeValues[key][\"type\"]; }, { [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap]>[K]>; } & { [K in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }]?: ", + "OutputOf", + "<{ [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }[K]> | undefined; }>, Exclude | Exclude<{ [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap], ", + "PrepopulatedRuleEventFields" + ], + "description": [], + "children": [ + { + "id": "def-server.ScopedRuleRegistryClient.index.$1", + "type": "Object", + "label": "doc", + "isRequired": true, + "signature": [ + "Pick<", + "Mutable", + "<{ [K in keyof Pick<{ [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }, { [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap]>]: ", + "OutputOf", + "]: MapTypeValues[key][\"type\"]; }, { [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap]>[K]>; } & { [K in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }]?: ", + "OutputOf", + "<{ [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }[K]> | undefined; }>, Exclude | Exclude<{ [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap], ", + "PrepopulatedRuleEventFields" + ], + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts", + "lineNumber": 47 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts", + "lineNumber": 47 + } + }, + { + "id": "def-server.ScopedRuleRegistryClient.bulkIndex", + "type": "Function", + "label": "bulkIndex", + "signature": [ + "(doc: Pick<", + "Mutable", + "<{ [K in keyof Pick<{ [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }, { [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap]>]: ", + "OutputOf", + "]: MapTypeValues[key][\"type\"]; }, { [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap]>[K]>; } & { [K in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }]?: ", + "OutputOf", + "<{ [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }[K]> | undefined; }>, Exclude | Exclude<{ [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap], ", + "PrepopulatedRuleEventFields" + ], + "description": [], + "children": [ + { + "id": "def-server.ScopedRuleRegistryClient.bulkIndex.$1", + "type": "Array", + "label": "doc", + "isRequired": true, + "signature": [ + "Pick<", + "Mutable", + "<{ [K in keyof Pick<{ [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }, { [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap]>]: ", + "OutputOf", + "]: MapTypeValues[key][\"type\"]; }, { [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap]>[K]>; } & { [K in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }]?: ", + "OutputOf", + "<{ [key in keyof MapTypeValues]: MapTypeValues[key][\"type\"]; }[K]> | undefined; }>, Exclude | Exclude<{ [Key in keyof { [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }]-?: [true] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] ? [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key]] extends [{ [key in keyof MapTypeValues]: MapTypeValues[key][\"required\"]; }[Key] & true] ? Key : never : never; }[keyof TFieldMap], ", + "PrepopulatedRuleEventFields" + ], + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts", + "lineNumber": 49 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts", + "lineNumber": 48 + } + } + ], + "source": { + "path": "x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts", + "lineNumber": 40 + }, + "initialIsOpen": false + } + ], + "enums": [], + "misc": [ + { + "id": "def-server.FieldMapOf", + "type": "Type", + "label": "FieldMapOf", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/types.ts", + "lineNumber": 98 + }, + "signature": [ + "TRuleRegistry extends RuleRegistry ? TFieldMap : never" + ], + "initialIsOpen": false + }, + { + "id": "def-server.RuleRegistryConfig", + "type": "Type", + "label": "RuleRegistryConfig", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/index.ts", + "lineNumber": 26 + }, + "signature": [ + "{ readonly enabled: boolean; readonly writeEnabled: boolean; }" + ], + "initialIsOpen": false + } + ], + "objects": [ + { + "tags": [], + "id": "def-server.ecsFieldMap", + "type": "Object", + "label": "ecsFieldMap", + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/generated/ecs_field_map.ts", + "lineNumber": 8 + }, + "signature": [ + "{ readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'agent.build.original': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'agent.ephemeral_id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'agent.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'agent.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'agent.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'agent.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.address': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.as.number': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'client.as.organization.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.bytes': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'client.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.geo.city_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.geo.continent_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.geo.country_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.geo.country_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.geo.location': { readonly type: \"geo_point\"; readonly array: false; readonly required: false; }; readonly 'client.geo.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.geo.region_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.geo.region_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.ip': { readonly type: \"ip\"; readonly array: false; readonly required: false; }; readonly 'client.mac': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.nat.ip': { readonly type: \"ip\"; readonly array: false; readonly required: false; }; readonly 'client.nat.port': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'client.packets': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'client.port': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'client.registered_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.subdomain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.top_level_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.user.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.user.email': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.user.full_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.user.group.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.user.group.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.user.group.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.user.hash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.user.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.user.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'client.user.roles': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'cloud.account.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'cloud.account.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'cloud.availability_zone': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'cloud.instance.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'cloud.instance.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'cloud.machine.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'cloud.project.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'cloud.project.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'cloud.provider': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'cloud.region': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'container.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'container.image.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'container.image.tag': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'container.labels': { readonly type: \"object\"; readonly array: false; readonly required: false; }; readonly 'container.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'container.runtime': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.address': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.as.number': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'destination.as.organization.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.bytes': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'destination.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.geo.city_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.geo.continent_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.geo.country_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.geo.country_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.geo.location': { readonly type: \"geo_point\"; readonly array: false; readonly required: false; }; readonly 'destination.geo.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.geo.region_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.geo.region_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.ip': { readonly type: \"ip\"; readonly array: false; readonly required: false; }; readonly 'destination.mac': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.nat.ip': { readonly type: \"ip\"; readonly array: false; readonly required: false; }; readonly 'destination.nat.port': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'destination.packets': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'destination.port': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'destination.registered_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.subdomain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.top_level_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.user.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.user.email': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.user.full_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.user.group.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.user.group.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.user.group.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.user.hash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.user.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.user.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'destination.user.roles': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'dll.code_signature.exists': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'dll.code_signature.status': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.code_signature.subject_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.code_signature.trusted': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'dll.code_signature.valid': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'dll.hash.md5': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.hash.sha1': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.hash.sha256': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.hash.sha512': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.path': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.pe.architecture': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.pe.company': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.pe.description': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.pe.file_version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.pe.imphash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.pe.original_file_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dll.pe.product': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.answers': { readonly type: \"object\"; readonly array: true; readonly required: false; }; readonly 'dns.answers.class': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.answers.data': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.answers.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.answers.ttl': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'dns.answers.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.header_flags': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'dns.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.op_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.question.class': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.question.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.question.registered_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.question.subdomain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.question.top_level_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.question.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.resolved_ip': { readonly type: \"ip\"; readonly array: true; readonly required: false; }; readonly 'dns.response_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'dns.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'ecs.version': { readonly type: \"keyword\"; readonly array: false; readonly required: true; }; readonly 'error.code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'error.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'error.message': { readonly type: \"text\"; readonly array: false; readonly required: false; }; readonly 'error.stack_trace': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'error.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.category': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'event.code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.created': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'event.dataset': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.duration': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'event.end': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'event.hash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.ingested': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.module': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.original': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.outcome': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.provider': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.reason': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.reference': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.risk_score': { readonly type: \"float\"; readonly array: false; readonly required: false; }; readonly 'event.risk_score_norm': { readonly type: \"float\"; readonly array: false; readonly required: false; }; readonly 'event.sequence': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'event.severity': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'event.start': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'event.timezone': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.type': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'event.url': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.accessed': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'file.attributes': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.code_signature.exists': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'file.code_signature.status': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.code_signature.subject_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.code_signature.trusted': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'file.code_signature.valid': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'file.created': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'file.ctime': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'file.device': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.directory': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.drive_letter': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.extension': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.gid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.group': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.hash.md5': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.hash.sha1': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.hash.sha256': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.hash.sha512': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.inode': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.mime_type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.mode': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.mtime': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'file.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.owner': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.path': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.pe.architecture': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.pe.company': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.pe.description': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.pe.file_version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.pe.imphash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.pe.original_file_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.pe.product': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.size': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'file.target_path': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.uid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.x509.alternative_names': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.issuer.common_name': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.issuer.country': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.issuer.distinguished_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.x509.issuer.locality': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.issuer.organization': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.issuer.organizational_unit': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.issuer.state_or_province': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.not_after': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'file.x509.not_before': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'file.x509.public_key_algorithm': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.x509.public_key_curve': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.x509.public_key_exponent': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'file.x509.public_key_size': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'file.x509.serial_number': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.x509.signature_algorithm': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.x509.subject.common_name': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.subject.country': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.subject.distinguished_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'file.x509.subject.locality': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.subject.organization': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.subject.organizational_unit': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.subject.state_or_province': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'file.x509.version_number': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'group.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'group.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'group.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.architecture': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.geo.city_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.geo.continent_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.geo.country_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.geo.country_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.geo.location': { readonly type: \"geo_point\"; readonly array: false; readonly required: false; }; readonly 'host.geo.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.geo.region_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.geo.region_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.hostname': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.ip': { readonly type: \"ip\"; readonly array: true; readonly required: false; }; readonly 'host.mac': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'host.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.os.family': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.os.full': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.os.kernel': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.os.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.os.platform': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.os.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.os.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.uptime': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'host.user.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.user.email': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.user.full_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.user.group.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.user.group.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.user.group.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.user.hash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.user.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.user.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'host.user.roles': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'http.request.body.bytes': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'http.request.body.content': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'http.request.bytes': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'http.request.method': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'http.request.mime_type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'http.request.referrer': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'http.response.body.bytes': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'http.response.body.content': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'http.response.bytes': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'http.response.mime_type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'http.response.status_code': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'http.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly labels: { readonly type: \"object\"; readonly array: false; readonly required: false; }; readonly 'log.file.path': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'log.level': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'log.logger': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'log.origin.file.line': { readonly type: \"integer\"; readonly array: false; readonly required: false; }; readonly 'log.origin.file.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'log.origin.function': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'log.original': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'log.syslog': { readonly type: \"object\"; readonly array: false; readonly required: false; }; readonly 'log.syslog.facility.code': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'log.syslog.facility.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'log.syslog.priority': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'log.syslog.severity.code': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'log.syslog.severity.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly message: { readonly type: \"text\"; readonly array: false; readonly required: false; }; readonly 'network.application': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.bytes': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'network.community_id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.direction': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.forwarded_ip': { readonly type: \"ip\"; readonly array: false; readonly required: false; }; readonly 'network.iana_number': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.inner': { readonly type: \"object\"; readonly array: false; readonly required: false; }; readonly 'network.inner.vlan.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.inner.vlan.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.packets': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'network.protocol': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.transport': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.vlan.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'network.vlan.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.egress': { readonly type: \"object\"; readonly array: false; readonly required: false; }; readonly 'observer.egress.interface.alias': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.egress.interface.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.egress.interface.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.egress.vlan.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.egress.vlan.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.egress.zone': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.geo.city_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.geo.continent_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.geo.country_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.geo.country_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.geo.location': { readonly type: \"geo_point\"; readonly array: false; readonly required: false; }; readonly 'observer.geo.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.geo.region_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.geo.region_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.hostname': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.ingress': { readonly type: \"object\"; readonly array: false; readonly required: false; }; readonly 'observer.ingress.interface.alias': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.ingress.interface.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.ingress.interface.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.ingress.vlan.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.ingress.vlan.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.ingress.zone': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.ip': { readonly type: \"ip\"; readonly array: true; readonly required: false; }; readonly 'observer.mac': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'observer.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.os.family': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.os.full': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.os.kernel': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.os.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.os.platform': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.os.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.os.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.product': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.serial_number': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.vendor': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'observer.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'organization.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'organization.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.architecture': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.build_version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.checksum': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.description': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.install_scope': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.installed': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'package.license': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.path': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.reference': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.size': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'package.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'package.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.args': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'process.args_count': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.code_signature.exists': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'process.code_signature.status': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.code_signature.subject_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.code_signature.trusted': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'process.code_signature.valid': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'process.command_line': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.entity_id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.executable': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.exit_code': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.hash.md5': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.hash.sha1': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.hash.sha256': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.hash.sha512': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.args': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'process.parent.args_count': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.parent.code_signature.exists': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'process.parent.code_signature.status': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.code_signature.subject_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.code_signature.trusted': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'process.parent.code_signature.valid': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'process.parent.command_line': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.entity_id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.executable': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.exit_code': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.parent.hash.md5': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.hash.sha1': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.hash.sha256': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.hash.sha512': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.pe.architecture': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.pe.company': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.pe.description': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.pe.file_version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.pe.imphash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.pe.original_file_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.pe.product': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.pgid': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.parent.pid': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.parent.ppid': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.parent.start': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'process.parent.thread.id': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.parent.thread.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.title': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.parent.uptime': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.parent.working_directory': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.pe.architecture': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.pe.company': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.pe.description': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.pe.file_version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.pe.imphash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.pe.original_file_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.pe.product': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.pgid': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.pid': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.ppid': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.start': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'process.thread.id': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.thread.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.title': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'process.uptime': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'process.working_directory': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'registry.data.bytes': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'registry.data.strings': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'registry.data.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'registry.hive': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'registry.key': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'registry.path': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'registry.value': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'related.hash': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'related.hosts': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'related.ip': { readonly type: \"ip\"; readonly array: true; readonly required: false; }; readonly 'related.user': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'rule.author': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.description': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.license': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.reference': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.ruleset': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.address': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.as.number': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'server.as.organization.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.bytes': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'server.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.geo.city_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.geo.continent_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.geo.country_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.geo.country_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.geo.location': { readonly type: \"geo_point\"; readonly array: false; readonly required: false; }; readonly 'server.geo.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.geo.region_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.geo.region_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.ip': { readonly type: \"ip\"; readonly array: false; readonly required: false; }; readonly 'server.mac': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.nat.ip': { readonly type: \"ip\"; readonly array: false; readonly required: false; }; readonly 'server.nat.port': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'server.packets': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'server.port': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'server.registered_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.subdomain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.top_level_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.user.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.user.email': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.user.full_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.user.group.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.user.group.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.user.group.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.user.hash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.user.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.user.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'server.user.roles': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'service.ephemeral_id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'service.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'service.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'service.node.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'service.state': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'service.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'service.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.address': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.as.number': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'source.as.organization.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.bytes': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'source.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.geo.city_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.geo.continent_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.geo.country_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.geo.country_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.geo.location': { readonly type: \"geo_point\"; readonly array: false; readonly required: false; }; readonly 'source.geo.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.geo.region_iso_code': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.geo.region_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.ip': { readonly type: \"ip\"; readonly array: false; readonly required: false; }; readonly 'source.mac': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.nat.ip': { readonly type: \"ip\"; readonly array: false; readonly required: false; }; readonly 'source.nat.port': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'source.packets': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'source.port': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'source.registered_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.subdomain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.top_level_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.user.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.user.email': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.user.full_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.user.group.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.user.group.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.user.group.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.user.hash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.user.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.user.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'source.user.roles': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'span.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'threat.framework': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'threat.tactic.id': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'threat.tactic.name': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'threat.tactic.reference': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'threat.technique.id': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'threat.technique.name': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'threat.technique.reference': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'threat.technique.subtechnique.id': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'threat.technique.subtechnique.name': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'threat.technique.subtechnique.reference': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.cipher': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.certificate': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.certificate_chain': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.hash.md5': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.hash.sha1': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.hash.sha256': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.issuer': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.ja3': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.not_after': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'tls.client.not_before': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'tls.client.server_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.subject': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.supported_ciphers': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.alternative_names': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.issuer.common_name': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.issuer.country': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.issuer.distinguished_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.x509.issuer.locality': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.issuer.organization': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.issuer.organizational_unit': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.issuer.state_or_province': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.not_after': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'tls.client.x509.not_before': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'tls.client.x509.public_key_algorithm': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.x509.public_key_curve': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.x509.public_key_exponent': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'tls.client.x509.public_key_size': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'tls.client.x509.serial_number': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.x509.signature_algorithm': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.x509.subject.common_name': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.subject.country': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.subject.distinguished_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.client.x509.subject.locality': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.subject.organization': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.subject.organizational_unit': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.subject.state_or_province': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.client.x509.version_number': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.curve': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.established': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'tls.next_protocol': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.resumed': { readonly type: \"boolean\"; readonly array: false; readonly required: false; }; readonly 'tls.server.certificate': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.certificate_chain': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.hash.md5': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.hash.sha1': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.hash.sha256': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.issuer': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.ja3s': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.not_after': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'tls.server.not_before': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'tls.server.subject': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.alternative_names': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.issuer.common_name': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.issuer.country': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.issuer.distinguished_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.issuer.locality': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.issuer.organization': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.issuer.organizational_unit': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.issuer.state_or_province': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.not_after': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.not_before': { readonly type: \"date\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.public_key_algorithm': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.public_key_curve': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.public_key_exponent': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.public_key_size': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.serial_number': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.signature_algorithm': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.subject.common_name': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.subject.country': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.subject.distinguished_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.server.x509.subject.locality': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.subject.organization': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.subject.organizational_unit': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.subject.state_or_province': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'tls.server.x509.version_number': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'tls.version_protocol': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'trace.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'transaction.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.extension': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.fragment': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.full': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.original': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.password': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.path': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.port': { readonly type: \"long\"; readonly array: false; readonly required: false; }; readonly 'url.query': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.registered_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.scheme': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.subdomain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.top_level_domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'url.username': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.changes.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.changes.email': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.changes.full_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.changes.group.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.changes.group.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.changes.group.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.changes.hash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.changes.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.changes.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.changes.roles': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'user.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.effective.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.effective.email': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.effective.full_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.effective.group.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.effective.group.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.effective.group.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.effective.hash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.effective.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.effective.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.effective.roles': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'user.email': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.full_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.group.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.group.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.group.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.hash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.roles': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'user.target.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.target.email': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.target.full_name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.target.group.domain': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.target.group.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.target.group.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.target.hash': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.target.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.target.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user.target.roles': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'user_agent.device.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user_agent.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user_agent.original': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user_agent.os.family': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user_agent.os.full': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user_agent.os.kernel': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user_agent.os.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user_agent.os.platform': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user_agent.os.type': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user_agent.os.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'user_agent.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.category': { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'vulnerability.classification': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.description': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.enumeration': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.reference': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.report_id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.scanner.vendor': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.score.base': { readonly type: \"float\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.score.environmental': { readonly type: \"float\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.score.temporal': { readonly type: \"float\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.score.version': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'vulnerability.severity': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }" + ], + "initialIsOpen": false + } + ], + "setup": { + "id": "def-server.RuleRegistryPluginSetupContract", + "type": "Type", + "label": "RuleRegistryPluginSetupContract", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/server/plugin.ts", + "lineNumber": 15 + }, + "signature": [ + "RuleRegistry<{ readonly 'kibana.rac.producer': { readonly type: \"keyword\"; }; readonly 'kibana.rac.alert.uuid': { readonly type: \"keyword\"; }; readonly 'kibana.rac.alert.id': { readonly type: \"keyword\"; }; readonly 'kibana.rac.alert.start': { readonly type: \"date\"; }; readonly 'kibana.rac.alert.end': { readonly type: \"date\"; }; readonly 'kibana.rac.alert.duration.us': { readonly type: \"long\"; }; readonly 'kibana.rac.alert.severity.level': { readonly type: \"keyword\"; }; readonly 'kibana.rac.alert.severity.value': { readonly type: \"long\"; }; readonly 'kibana.rac.alert.status': { readonly type: \"keyword\"; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }>" + ], + "lifecycle": "setup", + "initialIsOpen": true + } + }, + "common": { + "classes": [], + "functions": [ + { + "id": "def-common.getAlertSeverityLevelValue", + "type": "Function", + "label": "getAlertSeverityLevelValue", + "signature": [ + "(level: ", + { + "pluginId": "ruleRegistry", + "scope": "common", + "docId": "kibRuleRegistryPluginApi", + "section": "def-common.AlertSeverityLevel", + "text": "AlertSeverityLevel" + }, + ") => number" + ], + "description": [], + "children": [ + { + "id": "def-common.getAlertSeverityLevelValue.$1", + "type": "Enum", + "label": "level", + "isRequired": true, + "signature": [ + { + "pluginId": "ruleRegistry", + "scope": "common", + "docId": "kibRuleRegistryPluginApi", + "section": "def-common.AlertSeverityLevel", + "text": "AlertSeverityLevel" + } + ], + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/common/types.ts", + "lineNumber": 18 + } + } + ], + "tags": [], + "returnComment": [], + "source": { + "path": "x-pack/plugins/rule_registry/common/types.ts", + "lineNumber": 18 + }, + "initialIsOpen": false + } + ], + "interfaces": [], + "enums": [ + { + "id": "def-common.AlertSeverityLevel", + "type": "Enum", + "label": "AlertSeverityLevel", + "tags": [], + "description": [], + "source": { + "path": "x-pack/plugins/rule_registry/common/types.ts", + "lineNumber": 8 + }, + "initialIsOpen": false + } + ], + "misc": [], + "objects": [] + } +} \ No newline at end of file diff --git a/api_docs/rule_registry.mdx b/api_docs/rule_registry.mdx new file mode 100644 index 0000000000000..0fdaed425ed67 --- /dev/null +++ b/api_docs/rule_registry.mdx @@ -0,0 +1,38 @@ +--- +id: kibRuleRegistryPluginApi +slug: /kibana-dev-docs/ruleRegistryPluginApi +title: ruleRegistry +image: https://source.unsplash.com/400x175/?github +summary: API docs for the ruleRegistry plugin +date: 2020-11-16 +tags: ['contributor', 'dev', 'apidocs', 'kibana', 'ruleRegistry'] +warning: This document is auto-generated and is meant to be viewed inside our experimental, new docs system. Reach out in #docs-engineering for more info. +--- + +import ruleRegistryObj from './rule_registry.json'; + +## Server + +### Setup + + +### Objects + + +### Functions + + +### Interfaces + + +### Consts, variables and types + + +## Common + +### Functions + + +### Enums + + diff --git a/api_docs/runtime_fields.json b/api_docs/runtime_fields.json index 3c5fac48f70d1..22975ac7e3770 100644 --- a/api_docs/runtime_fields.json +++ b/api_docs/runtime_fields.json @@ -8,6 +8,7 @@ "type": "Function", "children": [ { + "id": "def-public.RuntimeFieldEditor.$1", "type": "Object", "label": "{ defaultValue, onChange, docLinks, ctx }", "isRequired": true, @@ -53,6 +54,7 @@ "type": "Function", "children": [ { + "id": "def-public.RuntimeFieldEditorFlyoutContent.$1", "type": "Object", "label": "{\n onSave,\n onCancel,\n docLinks,\n defaultValue: field,\n ctx,\n}", "isRequired": true, @@ -373,13 +375,7 @@ "label": "loadEditor", "signature": [ "() => Promise<", - { - "pluginId": "runtimeFields", - "scope": "public", - "docId": "kibRuntimeFieldsPluginApi", - "section": "def-public.LoadEditorResponse", - "text": "LoadEditorResponse" - }, + "LoadEditorResponse", ">" ], "description": [], diff --git a/api_docs/saved_objects.json b/api_docs/saved_objects.json index 0842bd216383c..a27a14430d0ea 100644 --- a/api_docs/saved_objects.json +++ b/api_docs/saved_objects.json @@ -136,17 +136,12 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectFinderUi.Unnamed.$1", "type": "CompoundType", "label": "props", "isRequired": true, "signature": [ - { - "pluginId": "savedObjects", - "scope": "public", - "docId": "kibSavedObjectsPluginApi", - "section": "def-public.SavedObjectFinderUiProps", - "text": "SavedObjectFinderUiProps" - } + "SavedObjectFinderUiProps" ], "description": [], "source": { @@ -272,6 +267,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectLoader.Unnamed.$1", "type": "Any", "label": "SavedObjectClass", "isRequired": true, @@ -285,6 +281,7 @@ } }, { + "id": "def-public.SavedObjectLoader.Unnamed.$2", "type": "Object", "label": "savedObjectsClient", "isRequired": true, @@ -297,7 +294,7 @@ "section": "def-public.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"find\" | \"bulkGet\" | \"update\" | \"bulkUpdate\">" ], "description": [], "source": { @@ -325,6 +322,7 @@ ], "children": [ { + "id": "def-public.SavedObjectLoader.get.$1", "type": "CompoundType", "label": "opts", "isRequired": false, @@ -355,6 +353,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectLoader.urlFor.$1", "type": "string", "label": "id", "isRequired": true, @@ -385,6 +384,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectLoader.delete.$1", "type": "CompoundType", "label": "ids", "isRequired": true, @@ -411,13 +411,7 @@ "label": "mapHitSource", "signature": [ "(source: Record, id: string, references?: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => Record" ], "description": [ @@ -425,6 +419,7 @@ ], "children": [ { + "id": "def-public.SavedObjectLoader.mapHitSource.$1", "type": "Object", "label": "source", "isRequired": true, @@ -438,6 +433,7 @@ } }, { + "id": "def-public.SavedObjectLoader.mapHitSource.$2", "type": "string", "label": "id", "isRequired": true, @@ -451,17 +447,12 @@ } }, { + "id": "def-public.SavedObjectLoader.mapHitSource.$3", "type": "Array", "label": "references", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [], @@ -486,13 +477,7 @@ "label": "mapSavedObjectApiHits", "signature": [ "({ attributes, id, references, }: { attributes: Record; id: string; references?: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[] | undefined; }) => Record" ], "description": [ @@ -500,7 +485,7 @@ ], "children": [ { - "id": "def-public.SavedObjectLoader.mapSavedObjectApiHits.{\n- attributes,\n id,\n references = [],\n }", + "id": "def-public.SavedObjectLoader.mapSavedObjectApiHits.$1.attributesidreferences", "type": "Object", "label": "{\n attributes,\n id,\n references = [],\n }", "tags": [], @@ -508,7 +493,7 @@ "children": [ { "tags": [], - "id": "def-public.SavedObjectLoader.mapSavedObjectApiHits.{\n- attributes,\n id,\n references = [],\n }.attributes", + "id": "def-public.SavedObjectLoader.mapSavedObjectApiHits.$1.attributesidreferences.attributes", "type": "Object", "label": "attributes", "description": [], @@ -522,7 +507,7 @@ }, { "tags": [], - "id": "def-public.SavedObjectLoader.mapSavedObjectApiHits.{\n- attributes,\n id,\n references = [],\n }.id", + "id": "def-public.SavedObjectLoader.mapSavedObjectApiHits.$1.attributesidreferences.id", "type": "string", "label": "id", "description": [], @@ -533,7 +518,7 @@ }, { "tags": [], - "id": "def-public.SavedObjectLoader.mapSavedObjectApiHits.{\n- attributes,\n id,\n references = [],\n }.references", + "id": "def-public.SavedObjectLoader.mapSavedObjectApiHits.$1.attributesidreferences.references", "type": "Array", "label": "references", "description": [], @@ -542,13 +527,7 @@ "lineNumber": 116 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[] | undefined" ] } @@ -586,6 +565,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectLoader.find.$1", "type": "string", "label": "search", "isRequired": true, @@ -599,6 +579,7 @@ } }, { + "id": "def-public.SavedObjectLoader.find.$2", "type": "CompoundType", "label": "sizeOrOptions", "isRequired": true, @@ -786,6 +767,7 @@ ], "children": [ { + "id": "def-public.checkForDuplicateTitle.$1", "type": "Object", "label": "savedObject", "isRequired": true, @@ -807,6 +789,7 @@ } }, { + "id": "def-public.checkForDuplicateTitle.$2", "type": "boolean", "label": "isTitleDuplicateConfirmed", "isRequired": true, @@ -820,6 +803,7 @@ } }, { + "id": "def-public.checkForDuplicateTitle.$3", "type": "Function", "label": "onTitleDuplicate", "isRequired": false, @@ -833,18 +817,13 @@ } }, { + "id": "def-public.checkForDuplicateTitle.$4", "type": "Object", "label": "services", "isRequired": true, "signature": [ "Pick<", - { - "pluginId": "savedObjects", - "scope": "public", - "docId": "kibSavedObjectsPluginApi", - "section": "def-public.SavedObjectKibanaServices", - "text": "SavedObjectKibanaServices" - }, + "SavedObjectKibanaServices", ", \"savedObjectsClient\" | \"overlays\">" ], "description": [], @@ -867,6 +846,7 @@ "type": "Function", "children": [ { + "id": "def-public.getSavedObjectFinder.$1", "type": "Object", "label": "savedObject", "isRequired": true, @@ -886,6 +866,7 @@ } }, { + "id": "def-public.getSavedObjectFinder.$2", "type": "Object", "label": "uiSettings", "isRequired": true, @@ -946,7 +927,7 @@ "description": [], "children": [ { - "id": "def-public.isErrorNonFatal.error", + "id": "def-public.isErrorNonFatal.$1.error", "type": "Object", "label": "error", "tags": [], @@ -954,7 +935,7 @@ "children": [ { "tags": [], - "id": "def-public.isErrorNonFatal.error.message", + "id": "def-public.isErrorNonFatal.$1.error.message", "type": "string", "label": "message", "description": [], @@ -998,6 +979,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectSaveModalOrigin.$1", "type": "Object", "label": "props", "isRequired": true, @@ -1048,7 +1030,7 @@ "section": "def-public.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\">; overlays: ", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"find\" | \"bulkGet\" | \"update\" | \"bulkUpdate\">; overlays: ", { "pluginId": "core", "scope": "public", @@ -1070,17 +1052,12 @@ ], "children": [ { + "id": "def-public.saveWithConfirmation.$1", "type": "Object", "label": "source", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectAttributes", - "text": "SavedObjectAttributes" - } + "SavedObjectAttributes" ], "description": [ "- serialized version of this object what will be indexed into elasticsearch." @@ -1091,14 +1068,14 @@ } }, { - "id": "def-public.saveWithConfirmation.savedObject", + "id": "def-public.saveWithConfirmation.$2.savedObject", "type": "Object", "label": "savedObject", "tags": [], "description": [], "children": [ { - "id": "def-public.saveWithConfirmation.savedObject.getEsType", + "id": "def-public.saveWithConfirmation.$2.savedObject.getEsType", "type": "Function", "label": "getEsType", "signature": [ @@ -1115,7 +1092,7 @@ }, { "tags": [], - "id": "def-public.saveWithConfirmation.savedObject.title", + "id": "def-public.saveWithConfirmation.$2.savedObject.title", "type": "string", "label": "title", "description": [], @@ -1126,7 +1103,7 @@ }, { "tags": [], - "id": "def-public.saveWithConfirmation.savedObject.displayName", + "id": "def-public.saveWithConfirmation.$2.savedObject.displayName", "type": "string", "label": "displayName", "description": [], @@ -1142,6 +1119,7 @@ } }, { + "id": "def-public.saveWithConfirmation.$3", "type": "Object", "label": "options", "isRequired": true, @@ -1163,7 +1141,7 @@ } }, { - "id": "def-public.saveWithConfirmation.services", + "id": "def-public.saveWithConfirmation.$4.services", "type": "Object", "label": "services", "tags": [], @@ -1171,7 +1149,7 @@ "children": [ { "tags": [], - "id": "def-public.saveWithConfirmation.services.savedObjectsClient", + "id": "def-public.saveWithConfirmation.$4.services.savedObjectsClient", "type": "Object", "label": "savedObjectsClient", "description": [], @@ -1188,12 +1166,12 @@ "section": "def-public.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"find\" | \"bulkGet\" | \"update\" | \"bulkUpdate\">" ] }, { "tags": [], - "id": "def-public.saveWithConfirmation.services.overlays", + "id": "def-public.saveWithConfirmation.$4.services.overlays", "type": "Object", "label": "overlays", "description": [], @@ -1240,6 +1218,7 @@ "description": [], "children": [ { + "id": "def-public.showSaveModal.$1", "type": "Object", "label": "saveModal", "isRequired": true, @@ -1253,6 +1232,7 @@ } }, { + "id": "def-public.showSaveModal.$2", "type": "Function", "label": "I18nContext", "isRequired": true, @@ -1266,6 +1246,7 @@ } }, { + "id": "def-public.showSaveModal.$3", "type": "Function", "label": "Wrapper", "isRequired": false, @@ -1535,21 +1516,9 @@ }, "signature": [ "() => { attributes: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectAttributes", - "text": "SavedObjectAttributes" - }, + "SavedObjectAttributes", "; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ] }, @@ -1612,13 +1581,7 @@ }, "signature": [ "(opts: ", - { - "pluginId": "savedObjects", - "scope": "public", - "docId": "kibSavedObjectsPluginApi", - "section": "def-public.SavedObjectCreationOpts", - "text": "SavedObjectCreationOpts" - }, + "SavedObjectCreationOpts", ") => Record" ] }, @@ -1912,13 +1875,7 @@ "lineNumber": 49 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", " | undefined" ] } @@ -1992,21 +1949,9 @@ }, "signature": [ "((opts: ", - { - "pluginId": "savedObjects", - "scope": "public", - "docId": "kibSavedObjectsPluginApi", - "section": "def-public.SavedObjectAttributesAndRefs", - "text": "SavedObjectAttributesAndRefs" - }, + "SavedObjectAttributesAndRefs", ") => ", - { - "pluginId": "savedObjects", - "scope": "public", - "docId": "kibSavedObjectsPluginApi", - "section": "def-public.SavedObjectAttributesAndRefs", - "text": "SavedObjectAttributesAndRefs" - }, + "SavedObjectAttributesAndRefs", ") | undefined" ] }, @@ -2030,13 +1975,7 @@ "text": "SavedObject" }, ">(object: T, references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => void) | undefined" ] }, @@ -2450,6 +2389,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectMetaData.getIconForSavedObject.$1", "type": "Object", "label": "savedObject", "isRequired": true, @@ -2495,6 +2435,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectMetaData.getTooltipForSavedObject.$1", "type": "Object", "label": "savedObject", "isRequired": true, @@ -2540,6 +2481,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectMetaData.showSavedObject.$1", "type": "Object", "label": "savedObject", "isRequired": true, diff --git a/api_docs/saved_objects_management.json b/api_docs/saved_objects_management.json index 8cd47981d4558..a2ca7e318bbb1 100644 --- a/api_docs/saved_objects_management.json +++ b/api_docs/saved_objects_management.json @@ -47,34 +47,34 @@ "signature": [ "{ name: string; description: string; icon: string; type: string; available?: ((item: ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementRecord", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementRecord", "text": "SavedObjectsManagementRecord" }, ") => boolean) | undefined; enabled?: ((item: ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementRecord", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementRecord", "text": "SavedObjectsManagementRecord" }, ") => boolean) | undefined; onClick?: ((item: ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementRecord", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementRecord", "text": "SavedObjectsManagementRecord" }, ") => void) | undefined; render?: ((item: ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementRecord", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementRecord", "text": "SavedObjectsManagementRecord" }, ") => any) | undefined; }" @@ -120,10 +120,10 @@ }, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementRecord", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementRecord", "text": "SavedObjectsManagementRecord" }, " | null" @@ -139,6 +139,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectsManagementAction.setActionContext.$1", "type": "Object", "label": "actionContext", "isRequired": true, @@ -169,6 +170,7 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectsManagementAction.registerOnFinishCallback.$1", "type": "Object", "label": "callback", "isRequired": true, @@ -196,10 +198,10 @@ "signature": [ "(record: ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementRecord", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementRecord", "text": "SavedObjectsManagementRecord" }, ") => void" @@ -207,15 +209,16 @@ "description": [], "children": [ { + "id": "def-public.SavedObjectsManagementAction.start.$1", "type": "Object", "label": "record", "isRequired": true, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementRecord", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementRecord", "text": "SavedObjectsManagementRecord" } ], @@ -272,11 +275,18 @@ "text": "SavedObjectsImportResponse" }, ") => ", - "ProcessedImportResponse" + { + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.ProcessedImportResponse", + "text": "ProcessedImportResponse" + } ], "description": [], "children": [ { + "id": "def-public.processImportResponse.$1", "type": "Object", "label": "response", "isRequired": true, @@ -413,10 +423,10 @@ }, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.FailedImport", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.FailedImport", "text": "FailedImport" }, "[]" @@ -667,9 +677,9 @@ }, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsManagement", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsManagementPluginApi", "section": "def-common.SavedObjectRelationKind", "text": "SavedObjectRelationKind" } @@ -687,9 +697,9 @@ }, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsManagement", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsManagementPluginApi", "section": "def-common.SavedObjectMetadata", "text": "SavedObjectMetadata" } @@ -724,10 +734,10 @@ "signature": [ "(action: ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementAction", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementAction", "text": "SavedObjectsManagementAction" }, ") => void" @@ -778,10 +788,10 @@ "signature": [ "() => ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementAction", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementAction", "text": "SavedObjectsManagementAction" }, "[]" @@ -799,7 +809,13 @@ "type": "Interface", "label": "SavedObjectsManagementColumn", "signature": [ - "SavedObjectsManagementColumn", + { + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementColumn", + "text": "SavedObjectsManagementColumn" + }, "" ], "description": [], @@ -831,10 +847,10 @@ "EuiTableFieldDataColumnType", "<", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementRecord", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementRecord", "text": "SavedObjectsManagementRecord" }, ">, \"children\" | \"headers\" | \"onClick\" | \"onChange\" | \"color\" | \"onKeyDown\" | \"description\" | \"title\" | \"id\" | \"name\" | \"field\" | \"placeholder\" | \"defaultChecked\" | \"defaultValue\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"className\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"hidden\" | \"lang\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"security\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onError\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"css\" | \"data-test-subj\" | \"width\" | \"render\" | \"align\" | \"abbr\" | \"footer\" | \"colSpan\" | \"rowSpan\" | \"scope\" | \"valign\" | \"dataType\" | \"isExpander\" | \"textOnly\" | \"truncateText\" | \"isMobileHeader\" | \"mobileOptions\" | \"hideForMobile\">" @@ -869,10 +885,10 @@ "signature": [ "(column: ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementColumn", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementColumn", "text": "SavedObjectsManagementColumn" }, ") => void" @@ -907,10 +923,10 @@ "signature": [ "() => ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementColumn", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementColumn", "text": "SavedObjectsManagementColumn" }, "[]" @@ -985,13 +1001,7 @@ "lineNumber": 19 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ] }, @@ -1128,10 +1138,10 @@ }, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementActionServiceSetup", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementActionServiceSetup", "text": "SavedObjectsManagementActionServiceSetup" } ] @@ -1148,10 +1158,10 @@ }, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementColumnServiceSetup", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementColumnServiceSetup", "text": "SavedObjectsManagementColumnServiceSetup" } ] @@ -1168,13 +1178,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementServiceRegistry", - "text": "SavedObjectsManagementServiceRegistry" - }, + "SavedObjectsManagementServiceRegistry", ", \"get\" | \"register\" | \"all\">" ] } @@ -1205,10 +1209,10 @@ }, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementActionServiceStart", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementActionServiceStart", "text": "SavedObjectsManagementActionServiceStart" } ] @@ -1225,10 +1229,10 @@ }, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsManagementColumnServiceStart", + "pluginId": "savedObjectsManagement", + "scope": "public", + "docId": "kibSavedObjectsManagementPluginApi", + "section": "def-public.SavedObjectsManagementColumnServiceStart", "text": "SavedObjectsManagementColumnServiceStart" } ] @@ -1273,9 +1277,9 @@ }, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsManagement", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsManagementPluginApi", "section": "def-common.SavedObjectRelation", "text": "SavedObjectRelation" }, @@ -1294,9 +1298,9 @@ }, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsManagement", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsManagementPluginApi", "section": "def-common.SavedObjectInvalidRelation", "text": "SavedObjectInvalidRelation" }, @@ -1351,9 +1355,9 @@ }, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsManagement", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsManagementPluginApi", "section": "def-common.SavedObjectRelationKind", "text": "SavedObjectRelationKind" } @@ -1506,9 +1510,9 @@ }, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsManagement", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsManagementPluginApi", "section": "def-common.SavedObjectRelationKind", "text": "SavedObjectRelationKind" } @@ -1526,9 +1530,9 @@ }, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsManagement", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsManagementPluginApi", "section": "def-common.SavedObjectMetadata", "text": "SavedObjectMetadata" } diff --git a/api_docs/saved_objects_tagging.json b/api_docs/saved_objects_tagging.json index 5b09e25344537..518ca211d573b 100644 --- a/api_docs/saved_objects_tagging.json +++ b/api_docs/saved_objects_tagging.json @@ -99,17 +99,12 @@ "type": "Function", "children": [ { + "id": "def-common.getTagsCapabilities.$1", "type": "Object", "label": "capabilities", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.Capabilities", - "text": "Capabilities" - } + "Capabilities" ], "description": [], "source": { @@ -145,6 +140,7 @@ "type": "Function", "children": [ { + "id": "def-common.validateTagColor.$1", "type": "string", "label": "color", "isRequired": true, @@ -176,6 +172,7 @@ "type": "Function", "children": [ { + "id": "def-common.validateTagDescription.$1", "type": "string", "label": "description", "isRequired": true, @@ -207,6 +204,7 @@ "type": "Function", "children": [ { + "id": "def-common.validateTagName.$1", "type": "string", "label": "name", "isRequired": true, @@ -249,17 +247,17 @@ "signature": [ "(attributes: ", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.TagAttributes", "text": "TagAttributes" }, ") => Promise<", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -268,14 +266,15 @@ "description": [], "children": [ { + "id": "def-common.ITagsClient.create.$1", "type": "Object", "label": "attributes", "isRequired": true, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.TagAttributes", "text": "TagAttributes" } @@ -301,9 +300,9 @@ "signature": [ "(id: string) => Promise<", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -312,6 +311,7 @@ "description": [], "children": [ { + "id": "def-common.ITagsClient.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -339,17 +339,17 @@ "signature": [ "(options?: ", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.GetAllTagsOptions", "text": "GetAllTagsOptions" }, " | undefined) => Promise<", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -358,14 +358,15 @@ "description": [], "children": [ { + "id": "def-common.ITagsClient.getAll.$1", "type": "Object", "label": "options", "isRequired": false, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.GetAllTagsOptions", "text": "GetAllTagsOptions" }, @@ -395,6 +396,7 @@ "description": [], "children": [ { + "id": "def-common.ITagsClient.delete.$1", "type": "string", "label": "id", "isRequired": true, @@ -422,17 +424,17 @@ "signature": [ "(id: string, attributes: ", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.TagAttributes", "text": "TagAttributes" }, ") => Promise<", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -441,6 +443,7 @@ "description": [], "children": [ { + "id": "def-common.ITagsClient.update.$1", "type": "string", "label": "id", "isRequired": true, @@ -454,14 +457,15 @@ } }, { + "id": "def-common.ITagsClient.update.$2", "type": "Object", "label": "attributes", "isRequired": true, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.TagAttributes", "text": "TagAttributes" } diff --git a/api_docs/saved_objects_tagging_oss.json b/api_docs/saved_objects_tagging_oss.json index fa7943ee5bd68..d6681914391e2 100644 --- a/api_docs/saved_objects_tagging_oss.json +++ b/api_docs/saved_objects_tagging_oss.json @@ -70,9 +70,9 @@ "signature": [ "() => ", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -98,9 +98,9 @@ "Observable", "<", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -306,9 +306,9 @@ }, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.ITagsClient", "text": "ITagsClient" } @@ -328,10 +328,10 @@ }, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.ITagsCache", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.ITagsCache", "text": "ITagsCache" } ] @@ -350,10 +350,10 @@ }, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsTaggingApiUi", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.SavedObjectsTaggingApiUi", "text": "SavedObjectsTaggingApiUi" } ] @@ -383,9 +383,9 @@ "signature": [ "(tagId: string) => ", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -396,6 +396,7 @@ ], "children": [ { + "id": "def-public.SavedObjectsTaggingApiUi.getTag.$1", "type": "string", "label": "tagId", "isRequired": true, @@ -431,10 +432,10 @@ }, ") => object is ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.TagDecoratedSavedObject", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.TagDecoratedSavedObject", "text": "TagDecoratedSavedObject" } ], @@ -443,6 +444,7 @@ ], "children": [ { + "id": "def-public.SavedObjectsTaggingApiUi.hasTagDecoration.$1", "type": "Object", "label": "object", "isRequired": true, @@ -476,10 +478,10 @@ "signature": [ "(options?: ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.GetSearchBarFilterOptions", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.GetSearchBarFilterOptions", "text": "GetSearchBarFilterOptions" }, " | undefined) => ", @@ -490,15 +492,16 @@ ], "children": [ { + "id": "def-public.SavedObjectsTaggingApiUi.getSearchBarFilter.$1", "type": "Object", "label": "options", "isRequired": false, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.GetSearchBarFilterOptions", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.GetSearchBarFilterOptions", "text": "GetSearchBarFilterOptions" }, " | undefined" @@ -525,13 +528,7 @@ "() => ", "EuiTableFieldDataColumnType", "<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", ">" ], "description": [ @@ -565,6 +562,7 @@ ], "children": [ { + "id": "def-public.SavedObjectsTaggingApiUi.convertNameToReference.$1", "type": "string", "label": "tagName", "isRequired": true, @@ -592,18 +590,18 @@ "signature": [ "(query: string, options?: ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.ParseSearchQueryOptions", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.ParseSearchQueryOptions", "text": "ParseSearchQueryOptions" }, " | undefined) => ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.ParsedSearchQuery", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.ParsedSearchQuery", "text": "ParsedSearchQuery" } ], @@ -612,6 +610,7 @@ ], "children": [ { + "id": "def-public.SavedObjectsTaggingApiUi.parseSearchQuery.$1", "type": "string", "label": "query", "isRequired": true, @@ -627,15 +626,16 @@ } }, { + "id": "def-public.SavedObjectsTaggingApiUi.parseSearchQuery.$2", "type": "Object", "label": "options", "isRequired": false, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.ParseSearchQueryOptions", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.ParseSearchQueryOptions", "text": "ParseSearchQueryOptions" }, " | undefined" @@ -662,13 +662,7 @@ "label": "getTagIdsFromReferences", "signature": [ "(references: (", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", " | ", { "pluginId": "core", @@ -684,18 +678,13 @@ ], "children": [ { + "id": "def-public.SavedObjectsTaggingApiUi.getTagIdsFromReferences.$1", "type": "Array", "label": "references", "isRequired": true, "signature": [ "(", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", " | ", { "pluginId": "core", @@ -732,6 +721,7 @@ ], "children": [ { + "id": "def-public.SavedObjectsTaggingApiUi.getTagIdFromName.$1", "type": "string", "label": "tagName", "isRequired": true, @@ -758,21 +748,9 @@ "label": "updateTagsReferences", "signature": [ "(references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[], newTagIds: string[]) => ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [ @@ -780,17 +758,12 @@ ], "children": [ { + "id": "def-public.SavedObjectsTaggingApiUi.updateTagsReferences.$1", "type": "Array", "label": "references", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [], @@ -800,6 +773,7 @@ } }, { + "id": "def-public.SavedObjectsTaggingApiUi.updateTagsReferences.$2", "type": "Array", "label": "newTagIds", "isRequired": true, @@ -834,10 +808,10 @@ }, "signature": [ { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsTaggingApiUiComponent", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.SavedObjectsTaggingApiUiComponent", "text": "SavedObjectsTaggingApiUiComponent" } ] @@ -875,10 +849,10 @@ "signature": [ "React.FunctionComponent<", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.TagListComponentProps", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.TagListComponentProps", "text": "TagListComponentProps" }, ">" @@ -899,10 +873,10 @@ "signature": [ "React.FunctionComponent<", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.TagSelectorComponentProps", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.TagSelectorComponentProps", "text": "TagSelectorComponentProps" }, ">" @@ -923,10 +897,10 @@ "signature": [ "React.FunctionComponent<", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectSaveModalTagSelectorComponentProps", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.SavedObjectSaveModalTagSelectorComponentProps", "text": "SavedObjectSaveModalTagSelectorComponentProps" }, ">" @@ -963,13 +937,7 @@ "lineNumber": 218 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObject", - "text": "SavedObject" - }, + "SavedObject", "" ] } @@ -1091,10 +1059,10 @@ "signature": [ "(provider: Promise<", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsTaggingApi", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.SavedObjectsTaggingApi", "text": "SavedObjectsTaggingApi" }, ">) => void" @@ -1104,16 +1072,17 @@ ], "children": [ { + "id": "def-public.SavedObjectTaggingOssPluginSetup.registerTaggingApi.$1", "type": "Object", "label": "provider", "isRequired": true, "signature": [ "Promise<", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsTaggingApi", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.SavedObjectsTaggingApi", "text": "SavedObjectsTaggingApi" }, ">" @@ -1172,10 +1141,10 @@ "signature": [ "() => ", { - "pluginId": "savedObjects", - "scope": "common", - "docId": "kibSavedObjectsPluginApi", - "section": "def-common.SavedObjectsTaggingApi", + "pluginId": "savedObjectsTaggingOss", + "scope": "public", + "docId": "kibSavedObjectsTaggingOssPluginApi", + "section": "def-public.SavedObjectsTaggingApi", "text": "SavedObjectsTaggingApi" }, " | undefined" @@ -1254,17 +1223,17 @@ "signature": [ "(attributes: ", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.TagAttributes", "text": "TagAttributes" }, ") => Promise<", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -1273,14 +1242,15 @@ "description": [], "children": [ { + "id": "def-common.ITagsClient.create.$1", "type": "Object", "label": "attributes", "isRequired": true, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.TagAttributes", "text": "TagAttributes" } @@ -1306,9 +1276,9 @@ "signature": [ "(id: string) => Promise<", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -1317,6 +1287,7 @@ "description": [], "children": [ { + "id": "def-common.ITagsClient.get.$1", "type": "string", "label": "id", "isRequired": true, @@ -1344,17 +1315,17 @@ "signature": [ "(options?: ", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.GetAllTagsOptions", "text": "GetAllTagsOptions" }, " | undefined) => Promise<", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -1363,14 +1334,15 @@ "description": [], "children": [ { + "id": "def-common.ITagsClient.getAll.$1", "type": "Object", "label": "options", "isRequired": false, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.GetAllTagsOptions", "text": "GetAllTagsOptions" }, @@ -1400,6 +1372,7 @@ "description": [], "children": [ { + "id": "def-common.ITagsClient.delete.$1", "type": "string", "label": "id", "isRequired": true, @@ -1427,17 +1400,17 @@ "signature": [ "(id: string, attributes: ", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.TagAttributes", "text": "TagAttributes" }, ") => Promise<", { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.Tag", "text": "Tag" }, @@ -1446,6 +1419,7 @@ "description": [], "children": [ { + "id": "def-common.ITagsClient.update.$1", "type": "string", "label": "id", "isRequired": true, @@ -1459,14 +1433,15 @@ } }, { + "id": "def-common.ITagsClient.update.$2", "type": "Object", "label": "attributes", "isRequired": true, "signature": [ { - "pluginId": "savedObjects", + "pluginId": "savedObjectsTaggingOss", "scope": "common", - "docId": "kibSavedObjectsPluginApi", + "docId": "kibSavedObjectsTaggingOssPluginApi", "section": "def-common.TagAttributes", "text": "TagAttributes" } diff --git a/api_docs/security.json b/api_docs/security.json index 938a043a555cf..7b29bb75e0873 100644 --- a/api_docs/security.json +++ b/api_docs/security.json @@ -31,13 +31,7 @@ "lineNumber": 25 }, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.UserRealm", - "text": "UserRealm" - } + "UserRealm" ] }, { @@ -53,13 +47,7 @@ "lineNumber": 30 }, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.UserRealm", - "text": "UserRealm" - } + "UserRealm" ] }, { @@ -75,13 +63,7 @@ "lineNumber": 35 }, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.AuthenticationProvider", - "text": "AuthenticationProvider" - } + "AuthenticationProvider" ] }, { @@ -165,13 +147,7 @@ "label": "getFeatures", "signature": [ "() => ", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.SecurityLicenseFeatures", - "text": "SecurityLicenseFeatures" - } + "SecurityLicenseFeatures" ], "description": [], "children": [], @@ -195,13 +171,7 @@ "signature": [ "Observable", "<", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.SecurityLicenseFeatures", - "text": "SecurityLicenseFeatures" - }, + "SecurityLicenseFeatures", ">" ] } @@ -404,7 +374,7 @@ "description": [], "source": { "path": "x-pack/plugins/security/public/nav_control/nav_control_component.tsx", - "lineNumber": 29 + "lineNumber": 28 } }, { @@ -415,7 +385,7 @@ "description": [], "source": { "path": "x-pack/plugins/security/public/nav_control/nav_control_component.tsx", - "lineNumber": 30 + "lineNumber": 29 }, "signature": [ "IconType" @@ -429,7 +399,7 @@ "description": [], "source": { "path": "x-pack/plugins/security/public/nav_control/nav_control_component.tsx", - "lineNumber": 31 + "lineNumber": 30 } }, { @@ -440,7 +410,7 @@ "description": [], "source": { "path": "x-pack/plugins/security/public/nav_control/nav_control_component.tsx", - "lineNumber": 32 + "lineNumber": 31 }, "signature": [ "number | undefined" @@ -454,7 +424,7 @@ "description": [], "source": { "path": "x-pack/plugins/security/public/nav_control/nav_control_component.tsx", - "lineNumber": 33 + "lineNumber": 32 }, "signature": [ "boolean | undefined" @@ -463,7 +433,7 @@ ], "source": { "path": "x-pack/plugins/security/public/nav_control/nav_control_component.tsx", - "lineNumber": 28 + "lineNumber": 27 }, "initialIsOpen": false } @@ -718,13 +688,7 @@ "lineNumber": 25 }, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.UserRealm", - "text": "UserRealm" - } + "UserRealm" ] }, { @@ -740,13 +704,7 @@ "lineNumber": 30 }, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.UserRealm", - "text": "UserRealm" - } + "UserRealm" ] }, { @@ -762,13 +720,7 @@ "lineNumber": 35 }, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.AuthenticationProvider", - "text": "AuthenticationProvider" - } + "AuthenticationProvider" ] }, { @@ -791,6 +743,48 @@ }, "initialIsOpen": false }, + { + "id": "def-server.CheckPrivilegesPayload", + "type": "Interface", + "label": "CheckPrivilegesPayload", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-server.CheckPrivilegesPayload.kibana", + "type": "CompoundType", + "label": "kibana", + "description": [], + "source": { + "path": "x-pack/plugins/security/server/authorization/types.ts", + "lineNumber": 71 + }, + "signature": [ + "string | string[] | undefined" + ] + }, + { + "tags": [], + "id": "def-server.CheckPrivilegesPayload.elasticsearch", + "type": "Object", + "label": "elasticsearch", + "description": [], + "source": { + "path": "x-pack/plugins/security/server/authorization/types.ts", + "lineNumber": 72 + }, + "signature": [ + "{ cluster: string[]; index: Record; } | undefined" + ] + } + ], + "source": { + "path": "x-pack/plugins/security/server/authorization/types.ts", + "lineNumber": 70 + }, + "initialIsOpen": false + }, { "id": "def-server.CreateAPIKeyResult", "type": "Interface", @@ -1083,13 +1077,7 @@ "text": "KibanaRequest" }, ") => ", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.AuthenticatedUser", - "text": "AuthenticatedUser" - }, + "AuthenticatedUser", " | null; }" ] }, @@ -1107,13 +1095,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "security", - "scope": "server", - "docId": "kibSecurityPluginApi", - "section": "def-server.AuthorizationServiceSetup", - "text": "AuthorizationServiceSetup" - }, + "AuthorizationServiceSetup", ", \"mode\" | \"actions\" | \"checkPrivilegesDynamicallyWithRequest\" | \"checkPrivilegesWithRequest\">" ] }, @@ -1128,13 +1110,7 @@ "lineNumber": 81 }, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.SecurityLicense", - "text": "SecurityLicense" - } + "SecurityLicense" ] }, { @@ -1148,13 +1124,7 @@ "lineNumber": 82 }, "signature": [ - { - "pluginId": "security", - "scope": "server", - "docId": "kibSecurityPluginApi", - "section": "def-server.AuditServiceSetup", - "text": "AuditServiceSetup" - } + "AuditServiceSetup" ] } ], @@ -1185,13 +1155,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "security", - "scope": "server", - "docId": "kibSecurityPluginApi", - "section": "def-server.AuthenticationServiceStart", - "text": "AuthenticationServiceStart" - }, + "AuthenticationServiceStart", ", \"apiKeys\" | \"getCurrentUser\">" ] }, @@ -1207,13 +1171,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "security", - "scope": "server", - "docId": "kibSecurityPluginApi", - "section": "def-server.AuthorizationServiceSetup", - "text": "AuthorizationServiceSetup" - }, + "AuthorizationServiceSetup", ", \"mode\" | \"actions\" | \"checkPrivilegesDynamicallyWithRequest\" | \"checkPrivilegesWithRequest\">" ] } diff --git a/api_docs/security_oss.json b/api_docs/security_oss.json index 7fdacda7bd30d..8734617654b73 100644 --- a/api_docs/security_oss.json +++ b/api_docs/security_oss.json @@ -25,13 +25,7 @@ "lineNumber": 26 }, "signature": [ - { - "pluginId": "securityOss", - "scope": "public", - "docId": "kibSecurityOssPluginApi", - "section": "def-public.InsecureClusterServiceSetup", - "text": "InsecureClusterServiceSetup" - } + "InsecureClusterServiceSetup" ] } ], @@ -60,13 +54,7 @@ "lineNumber": 30 }, "signature": [ - { - "pluginId": "securityOss", - "scope": "public", - "docId": "kibSecurityOssPluginApi", - "section": "def-public.InsecureClusterServiceStart", - "text": "InsecureClusterServiceStart" - } + "InsecureClusterServiceStart" ] }, { @@ -81,13 +69,7 @@ }, "signature": [ "{ getAccessURLParameters: () => Promise | null>; getCapabilities: () => Promise<", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.Capabilities", - "text": "Capabilities" - }, + "Capabilities", ">; }" ] } @@ -145,13 +127,7 @@ }, "signature": [ "(provider: () => ", - { - "pluginId": "securityOss", - "scope": "server", - "docId": "kibSecurityOssPluginApi", - "section": "def-server.AnonymousAccessService", - "text": "AnonymousAccessService" - }, + "AnonymousAccessService", ") => void" ] } diff --git a/api_docs/security_solution.json b/api_docs/security_solution.json index ae85541ba6bfd..aea50fdbfecaa 100644 --- a/api_docs/security_solution.json +++ b/api_docs/security_solution.json @@ -9,7 +9,13 @@ "label": "Plugin", "description": [], "signature": [ - "Plugin", + { + "pluginId": "securitySolution", + "scope": "public", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-public.Plugin", + "text": "Plugin" + }, " implements ", { "pluginId": "core", @@ -19,9 +25,21 @@ "text": "Plugin" }, "<", - "PluginSetup", + { + "pluginId": "securitySolution", + "scope": "public", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-public.PluginSetup", + "text": "PluginSetup" + }, ", ", - "PluginStart", + { + "pluginId": "securitySolution", + "scope": "public", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-public.PluginStart", + "text": "PluginStart" + }, ", ", "SetupPlugins" ], @@ -36,6 +54,7 @@ "description": [], "children": [ { + "id": "def-public.Plugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -77,41 +96,30 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.StartPlugins", - "text": "StartPlugins" - }, + "StartPlugins", ", ", { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.PluginStart", + "pluginId": "securitySolution", + "scope": "public", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-public.PluginStart", "text": "PluginStart" }, ">, plugins: ", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.SetupPlugins", - "text": "SetupPlugins" - }, + "SetupPlugins", ") => ", { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.PluginSetup", + "pluginId": "securitySolution", + "scope": "public", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-public.PluginSetup", "text": "PluginSetup" } ], "description": [], "children": [ { + "id": "def-public.Plugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -124,19 +132,13 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.StartPlugins", - "text": "StartPlugins" - }, + "StartPlugins", ", ", { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.PluginStart", + "pluginId": "securitySolution", + "scope": "public", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-public.PluginStart", "text": "PluginStart" }, ">" @@ -148,17 +150,12 @@ } }, { + "id": "def-public.Plugin.setup.$2", "type": "Object", "label": "plugins", "isRequired": true, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.SetupPlugins", - "text": "SetupPlugins" - } + "SetupPlugins" ], "description": [], "source": { @@ -188,18 +185,13 @@ "text": "CoreStart" }, ", plugins: ", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.StartPlugins", - "text": "StartPlugins" - }, + "StartPlugins", ") => {}" ], "description": [], "children": [ { + "id": "def-public.Plugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -219,17 +211,12 @@ } }, { + "id": "def-public.Plugin.start.$2", "type": "Object", "label": "plugins", "isRequired": true, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.StartPlugins", - "text": "StartPlugins" - } + "StartPlugins" ], "description": [], "source": { @@ -293,13 +280,7 @@ }, "signature": [ "() => Promise<", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.ResolverPluginSetup", - "text": "ResolverPluginSetup" - }, + "ResolverPluginSetup", ">" ] } @@ -345,6 +326,7 @@ "description": [], "children": [ { + "id": "def-server.AppClient.Unnamed.$1", "type": "string", "label": "spaceId", "isRequired": true, @@ -358,6 +340,7 @@ } }, { + "id": "def-server.AppClient.Unnamed.$2", "type": "Object", "label": "config", "isRequired": true, @@ -408,7 +391,13 @@ "label": "Plugin", "description": [], "signature": [ - "Plugin", + { + "pluginId": "securitySolution", + "scope": "server", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-server.Plugin", + "text": "Plugin" + }, " implements ", { "pluginId": "core", @@ -418,9 +407,21 @@ "text": "Plugin" }, "<", - "PluginSetup", + { + "pluginId": "securitySolution", + "scope": "server", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-server.PluginSetup", + "text": "PluginSetup" + }, ", ", - "PluginStart", + { + "pluginId": "securitySolution", + "scope": "server", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-server.PluginStart", + "text": "PluginStart" + }, ", ", "SetupPlugins" ], @@ -435,6 +436,7 @@ "description": [], "children": [ { + "id": "def-server.Plugin.Unnamed.$1", "type": "Object", "label": "context", "isRequired": true, @@ -451,7 +453,7 @@ "description": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 145 + "lineNumber": 147 } } ], @@ -459,7 +461,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 145 + "lineNumber": 147 } }, { @@ -476,34 +478,23 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.StartPlugins", - "text": "StartPlugins" - }, + "StartPlugins", ", ", { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.PluginStart", + "pluginId": "securitySolution", + "scope": "server", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-server.PluginStart", "text": "PluginStart" }, ">, plugins: ", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.SetupPlugins", - "text": "SetupPlugins" - }, + "SetupPlugins", ") => {}" ], "description": [], "children": [ { + "id": "def-server.Plugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -516,19 +507,13 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.StartPlugins", - "text": "StartPlugins" - }, + "StartPlugins", ", ", { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.PluginStart", + "pluginId": "securitySolution", + "scope": "server", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-server.PluginStart", "text": "PluginStart" }, ">" @@ -536,26 +521,21 @@ "description": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 157 + "lineNumber": 159 } }, { + "id": "def-server.Plugin.setup.$2", "type": "Object", "label": "plugins", "isRequired": true, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.SetupPlugins", - "text": "SetupPlugins" - } + "SetupPlugins" ], "description": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 157 + "lineNumber": 159 } } ], @@ -563,7 +543,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 157 + "lineNumber": 159 } }, { @@ -580,18 +560,13 @@ "text": "CoreStart" }, ", plugins: ", - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.StartPlugins", - "text": "StartPlugins" - }, + "StartPlugins", ") => {}" ], "description": [], "children": [ { + "id": "def-server.Plugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -607,26 +582,21 @@ "description": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 339 + "lineNumber": 341 } }, { + "id": "def-server.Plugin.start.$2", "type": "Object", "label": "plugins", "isRequired": true, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.StartPlugins", - "text": "StartPlugins" - } + "StartPlugins" ], "description": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 339 + "lineNumber": 341 } } ], @@ -634,7 +604,7 @@ "returnComment": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 339 + "lineNumber": 341 } }, { @@ -650,13 +620,13 @@ "returnComment": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 405 + "lineNumber": 423 } } ], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 129 + "lineNumber": 131 }, "initialIsOpen": false } @@ -667,6 +637,7 @@ "type": "Function", "children": [ { + "id": "def-server.buildRouteValidation.$1", "type": "Uncategorized", "label": "schema", "isRequired": true, @@ -710,6 +681,7 @@ "type": "Function", "children": [ { + "id": "def-server.buildSiemResponse.$1", "type": "Object", "label": "response", "isRequired": true, @@ -725,13 +697,7 @@ "text": "CustomHttpResponseOptions" }, ") => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaResponse", - "text": "KibanaResponse" - }, + "KibanaResponse", "; badRequest: (options?: ", { "pluginId": "core", @@ -741,13 +707,7 @@ "text": "ErrorHttpResponseOptions" }, ") => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaResponse", - "text": "KibanaResponse" - } + "KibanaResponse" ], "description": [], "source": { @@ -795,6 +755,7 @@ "type": "Function", "children": [ { + "id": "def-server.createBootstrapIndex.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -814,6 +775,7 @@ } }, { + "id": "def-server.createBootstrapIndex.$2", "type": "string", "label": "index", "isRequired": true, @@ -853,6 +815,7 @@ "type": "Function", "children": [ { + "id": "def-server.deleteAllIndex.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -872,6 +835,7 @@ } }, { + "id": "def-server.deleteAllIndex.$2", "type": "string", "label": "pattern", "isRequired": true, @@ -885,6 +849,7 @@ } }, { + "id": "def-server.deleteAllIndex.$3", "type": "number", "label": "maxAttempts", "isRequired": true, @@ -924,6 +889,7 @@ "type": "Function", "children": [ { + "id": "def-server.deletePolicy.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -943,6 +909,7 @@ } }, { + "id": "def-server.deletePolicy.$2", "type": "string", "label": "policy", "isRequired": true, @@ -982,6 +949,7 @@ "type": "Function", "children": [ { + "id": "def-server.deleteTemplate.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -1001,6 +969,7 @@ } }, { + "id": "def-server.deleteTemplate.$2", "type": "string", "label": "name", "isRequired": true, @@ -1040,6 +1009,7 @@ "type": "Function", "children": [ { + "id": "def-server.getIndexExists.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -1059,6 +1029,7 @@ } }, { + "id": "def-server.getIndexExists.$2", "type": "string", "label": "index", "isRequired": true, @@ -1098,6 +1069,7 @@ "type": "Function", "children": [ { + "id": "def-server.getPolicyExists.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -1117,6 +1089,7 @@ } }, { + "id": "def-server.getPolicyExists.$2", "type": "string", "label": "policy", "isRequired": true, @@ -1156,6 +1129,7 @@ "type": "Function", "children": [ { + "id": "def-server.getTemplateExists.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -1175,6 +1149,7 @@ } }, { + "id": "def-server.getTemplateExists.$2", "type": "string", "label": "template", "isRequired": true, @@ -1214,17 +1189,12 @@ "type": "Function", "children": [ { + "id": "def-server.readPrivileges.$1", "type": "Function", "label": "callWithRequest", "isRequired": true, "signature": [ - { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.CallWithRequest", - "text": "CallWithRequest" - }, + "CallWithRequest", "<{}, unknown>" ], "description": [], @@ -1234,6 +1204,7 @@ } }, { + "id": "def-server.readPrivileges.$2", "type": "string", "label": "index", "isRequired": true, @@ -1267,6 +1238,7 @@ "type": "Function", "children": [ { + "id": "def-server.setPolicy.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -1286,6 +1258,7 @@ } }, { + "id": "def-server.setPolicy.$2", "type": "string", "label": "policy", "isRequired": true, @@ -1299,6 +1272,7 @@ } }, { + "id": "def-server.setPolicy.$3", "type": "Object", "label": "body", "isRequired": true, @@ -1338,6 +1312,7 @@ "type": "Function", "children": [ { + "id": "def-server.setTemplate.$1", "type": "CompoundType", "label": "esClient", "isRequired": true, @@ -1357,6 +1332,7 @@ } }, { + "id": "def-server.setTemplate.$2", "type": "string", "label": "name", "isRequired": true, @@ -1370,6 +1346,7 @@ } }, { + "id": "def-server.setTemplate.$3", "type": "Object", "label": "body", "isRequired": true, @@ -1409,6 +1386,7 @@ "type": "Function", "children": [ { + "id": "def-server.transformError.$1", "type": "CompoundType", "label": "err", "isRequired": true, @@ -1462,10 +1440,10 @@ "signature": [ "() => ", { - "pluginId": "security", - "scope": "common", - "docId": "kibSecurityPluginApi", - "section": "def-common.AppClient", + "pluginId": "securitySolution", + "scope": "server", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-server.AppClient", "text": "AppClient" } ] @@ -1506,7 +1484,7 @@ "children": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 106 + "lineNumber": 107 }, "lifecycle": "setup", "initialIsOpen": true @@ -1520,7 +1498,7 @@ "children": [], "source": { "path": "x-pack/plugins/security_solution/server/plugin.ts", - "lineNumber": 108 + "lineNumber": 110 }, "lifecycle": "start", "initialIsOpen": true @@ -1534,6 +1512,7 @@ "type": "Function", "children": [ { + "id": "def-common.addIdToItem.$1", "type": "Uncategorized", "label": "item", "isRequired": true, @@ -1565,6 +1544,7 @@ "type": "Function", "children": [ { + "id": "def-common.DefaultArray.$1", "type": "Uncategorized", "label": "codec", "isRequired": true, @@ -1606,6 +1586,7 @@ "type": "Function", "children": [ { + "id": "def-common.exactCheck.$1", "type": "Unknown", "label": "original", "isRequired": true, @@ -1619,6 +1600,7 @@ } }, { + "id": "def-common.exactCheck.$2", "type": "CompoundType", "label": "decoded", "isRequired": true, @@ -1682,6 +1664,7 @@ "type": "Function", "children": [ { + "id": "def-common.formatErrors.$1", "type": "Object", "label": "errors", "isRequired": true, @@ -1715,6 +1698,7 @@ "type": "Function", "children": [ { + "id": "def-common.getPaths.$1", "type": "CompoundType", "label": "validation", "isRequired": true, @@ -1755,6 +1739,7 @@ "type": "Function", "children": [ { + "id": "def-common.removeExternalLinkText.$1", "type": "string", "label": "str", "isRequired": true, @@ -1788,6 +1773,7 @@ "type": "Function", "children": [ { + "id": "def-common.removeIdFromItem.$1", "type": "Uncategorized", "label": "item", "isRequired": true, @@ -1821,6 +1807,7 @@ "type": "Function", "children": [ { + "id": "def-common.validate.$1", "type": "Uncategorized", "label": "obj", "isRequired": true, @@ -1834,6 +1821,7 @@ } }, { + "id": "def-common.validate.$2", "type": "Uncategorized", "label": "schema", "isRequired": true, @@ -1869,6 +1857,7 @@ "type": "Function", "children": [ { + "id": "def-common.validateEither.$1", "type": "Uncategorized", "label": "schema", "isRequired": true, @@ -1878,10 +1867,11 @@ "description": [], "source": { "path": "x-pack/plugins/security_solution/common/validate.ts", - "lineNumber": 30 + "lineNumber": 43 } }, { + "id": "def-common.validateEither.$2", "type": "Uncategorized", "label": "obj", "isRequired": true, @@ -1891,7 +1881,7 @@ "description": [], "source": { "path": "x-pack/plugins/security_solution/common/validate.ts", - "lineNumber": 31 + "lineNumber": 44 } } ], @@ -1906,7 +1896,7 @@ "label": "validateEither", "source": { "path": "x-pack/plugins/security_solution/common/validate.ts", - "lineNumber": 29 + "lineNumber": 42 }, "tags": [], "returnComment": [], diff --git a/api_docs/share.json b/api_docs/share.json index d8cfef6943886..f59639d35aba5 100644 --- a/api_docs/share.json +++ b/api_docs/share.json @@ -52,6 +52,7 @@ "description": [], "children": [ { + "id": "def-public.KibanaURL.Unnamed.$1", "type": "string", "label": "path", "isRequired": true, @@ -138,17 +139,12 @@ "text": "CoreSetup" }, ") => ", - { - "pluginId": "share", - "scope": "public", - "docId": "kibSharePluginApi", - "section": "def-public.UrlGeneratorsSetup", - "text": "UrlGeneratorsSetup" - } + "UrlGeneratorsSetup" ], "description": [], "children": [ { + "id": "def-public.UrlGeneratorsService.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -190,17 +186,12 @@ "text": "CoreStart" }, ") => ", - { - "pluginId": "share", - "scope": "public", - "docId": "kibSharePluginApi", - "section": "def-public.UrlGeneratorsStart", - "text": "UrlGeneratorsStart" - } + "UrlGeneratorsStart" ], "description": [], "children": [ { + "id": "def-public.UrlGeneratorsService.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -272,6 +263,7 @@ ], "children": [ { + "id": "def-public.downloadFileAs.$1", "type": "string", "label": "filename", "isRequired": true, @@ -287,6 +279,7 @@ } }, { + "id": "def-public.downloadFileAs.$2", "type": "CompoundType", "label": "payload", "isRequired": true, @@ -338,6 +331,7 @@ ], "children": [ { + "id": "def-public.downloadMultipleAs.$1", "type": "Object", "label": "files", "isRequired": true, @@ -471,13 +465,7 @@ }, "signature": [ "((anonymousUserCapabilities: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.Capabilities", - "text": "Capabilities" - }, + "Capabilities", ") => boolean) | undefined" ] } @@ -722,13 +710,7 @@ "lineNumber": 91 }, "signature": [ - { - "pluginId": "share", - "scope": "public", - "docId": "kibSharePluginApi", - "section": "def-public.UrlParamExtension", - "text": "UrlParamExtension" - }, + "UrlParamExtension", "[] | undefined" ] } @@ -788,6 +770,7 @@ "description": [], "children": [ { + "id": "def-public.UrlGeneratorContract.createUrl.$1", "type": "Uncategorized", "label": "state", "isRequired": true, @@ -860,6 +843,7 @@ "description": [], "children": [ { + "id": "def-public.UrlGeneratorContract.migrate.$1", "type": "Uncategorized", "label": "state", "isRequired": true, diff --git a/api_docs/snapshot_restore.json b/api_docs/snapshot_restore.json index af05cb837e263..1b2fb17feaabf 100644 --- a/api_docs/snapshot_restore.json +++ b/api_docs/snapshot_restore.json @@ -164,6 +164,7 @@ "type": "Function", "children": [ { + "id": "def-common.PLUGIN.getI18nName.$1", "type": "Any", "label": "i18n", "isRequired": true, @@ -205,7 +206,7 @@ "children": [ { "tags": [], - "id": "def-common.REPOSITORY_PLUGINS_MAP.'repository-s3'", + "id": "def-common.REPOSITORY_PLUGINS_MAP.repositorys3", "type": "string", "label": "'repository-s3'", "description": [], @@ -226,7 +227,7 @@ }, { "tags": [], - "id": "def-common.REPOSITORY_PLUGINS_MAP.'repository-hdfs'", + "id": "def-common.REPOSITORY_PLUGINS_MAP.repositoryhdfs", "type": "string", "label": "'repository-hdfs'", "description": [], @@ -247,7 +248,7 @@ }, { "tags": [], - "id": "def-common.REPOSITORY_PLUGINS_MAP.'repository-azure'", + "id": "def-common.REPOSITORY_PLUGINS_MAP.repositoryazure", "type": "string", "label": "'repository-azure'", "description": [], @@ -268,7 +269,7 @@ }, { "tags": [], - "id": "def-common.REPOSITORY_PLUGINS_MAP.'repository-gcs'", + "id": "def-common.REPOSITORY_PLUGINS_MAP.repositorygcs", "type": "string", "label": "'repository-gcs'", "description": [], diff --git a/api_docs/spaces.json b/api_docs/spaces.json index 8a74132d862b2..299bba81678a0 100644 --- a/api_docs/spaces.json +++ b/api_docs/spaces.json @@ -23,6 +23,7 @@ ], "children": [ { + "id": "def-public.getSpaceColor.$1", "type": "Object", "label": "space", "isRequired": true, @@ -72,6 +73,7 @@ ], "children": [ { + "id": "def-public.getSpaceImageUrl.$1", "type": "Object", "label": "space", "isRequired": true, @@ -121,6 +123,7 @@ ], "children": [ { + "id": "def-public.getSpaceInitials.$1", "type": "Object", "label": "space", "isRequired": true, @@ -391,6 +394,7 @@ "description": [], "children": [ { + "id": "def-server.addSpaceIdToPath.$1", "type": "string", "label": "basePath", "isRequired": true, @@ -404,6 +408,7 @@ } }, { + "id": "def-server.addSpaceIdToPath.$2", "type": "string", "label": "spaceId", "isRequired": true, @@ -417,6 +422,7 @@ } }, { + "id": "def-server.addSpaceIdToPath.$3", "type": "string", "label": "requestedPath", "isRequired": true, @@ -682,6 +688,7 @@ ], "children": [ { + "id": "def-server.SpacesServiceSetup.getSpaceId.$1", "type": "Object", "label": "request", "isRequired": true, @@ -723,6 +730,7 @@ ], "children": [ { + "id": "def-server.SpacesServiceSetup.spaceIdToNamespace.$1", "type": "string", "label": "spaceId", "isRequired": true, @@ -757,6 +765,7 @@ ], "children": [ { + "id": "def-server.SpacesServiceSetup.namespaceToSpaceId.$1", "type": "string", "label": "namespace", "isRequired": false, @@ -815,13 +824,7 @@ "text": "KibanaRequest" }, ") => Pick<", - { - "pluginId": "spaces", - "scope": "server", - "docId": "kibSpacesPluginApi", - "section": "def-server.SpacesClient", - "text": "SpacesClient" - }, + "SpacesClient", ", \"get\" | \"delete\" | \"create\" | \"update\" | \"getAll\">" ] }, @@ -845,6 +848,7 @@ ], "children": [ { + "id": "def-server.SpacesServiceStart.getSpaceId.$1", "type": "Object", "label": "request", "isRequired": true, @@ -892,6 +896,7 @@ ], "children": [ { + "id": "def-server.SpacesServiceStart.isInDefaultSpace.$1", "type": "Object", "label": "request", "isRequired": true, @@ -947,6 +952,7 @@ ], "children": [ { + "id": "def-server.SpacesServiceStart.getActiveSpace.$1", "type": "Object", "label": "request", "isRequired": true, @@ -986,6 +992,7 @@ ], "children": [ { + "id": "def-server.SpacesServiceStart.spaceIdToNamespace.$1", "type": "string", "label": "spaceId", "isRequired": true, @@ -1018,6 +1025,7 @@ ], "children": [ { + "id": "def-server.SpacesServiceStart.namespaceToSpaceId.$1", "type": "string", "label": "namespace", "isRequired": false, @@ -1119,21 +1127,9 @@ }, "signature": [ "{ setClientRepositoryFactory: (factory: ", - { - "pluginId": "spaces", - "scope": "server", - "docId": "kibSpacesPluginApi", - "section": "def-server.SpacesClientRepositoryFactory", - "text": "SpacesClientRepositoryFactory" - }, + "SpacesClientRepositoryFactory", ") => void; registerClientWrapper: (wrapper: ", - { - "pluginId": "spaces", - "scope": "server", - "docId": "kibSpacesPluginApi", - "section": "def-server.SpacesClientWrapper", - "text": "SpacesClientWrapper" - }, + "SpacesClientWrapper", ") => void; }" ] } @@ -1194,6 +1190,7 @@ "description": [], "children": [ { + "id": "def-common.addSpaceIdToPath.$1", "type": "string", "label": "basePath", "isRequired": true, @@ -1207,6 +1204,7 @@ } }, { + "id": "def-common.addSpaceIdToPath.$2", "type": "string", "label": "spaceId", "isRequired": true, @@ -1220,6 +1218,7 @@ } }, { + "id": "def-common.addSpaceIdToPath.$3", "type": "string", "label": "requestedPath", "isRequired": true, @@ -1251,6 +1250,7 @@ "description": [], "children": [ { + "id": "def-common.getSpaceIdFromPath.$1", "type": "CompoundType", "label": "requestBasePath", "isRequired": false, @@ -1264,6 +1264,7 @@ } }, { + "id": "def-common.getSpaceIdFromPath.$2", "type": "CompoundType", "label": "serverBasePath", "isRequired": false, @@ -1305,6 +1306,7 @@ ], "children": [ { + "id": "def-common.isReservedSpace.$1", "type": "CompoundType", "label": "space", "isRequired": false, diff --git a/api_docs/spaces_oss.json b/api_docs/spaces_oss.json index ab9717a25ab6d..a93aeefb3db6f 100644 --- a/api_docs/spaces_oss.json +++ b/api_docs/spaces_oss.json @@ -961,6 +961,7 @@ ], "children": [ { + "id": "def-public.SpacesOssPluginSetup.registerSpacesApi.$1", "type": "Object", "label": "provider", "isRequired": true, diff --git a/api_docs/task_manager.json b/api_docs/task_manager.json index f2d228ebd0615..0d12bd269a0ab 100644 --- a/api_docs/task_manager.json +++ b/api_docs/task_manager.json @@ -61,6 +61,7 @@ "description": [], "children": [ { + "id": "def-server.TaskManagerPlugin.Unnamed.$1", "type": "Object", "label": "initContext", "isRequired": true, @@ -113,6 +114,7 @@ "description": [], "children": [ { + "id": "def-server.TaskManagerPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -165,6 +167,7 @@ "description": [], "children": [ { + "id": "def-server.TaskManagerPlugin.start.$1", "type": "Object", "label": "{ savedObjects, elasticsearch }", "isRequired": true, @@ -212,18 +215,13 @@ "description": [], "children": [ { + "id": "def-server.isUnrecoverableError.$1", "type": "CompoundType", "label": "error", "isRequired": true, "signature": [ "Error | ", - { - "pluginId": "taskManager", - "scope": "server", - "docId": "kibTaskManagerPluginApi", - "section": "def-server.DecoratedError", - "text": "DecoratedError" - } + "DecoratedError" ], "description": [], "source": { @@ -250,6 +248,7 @@ "description": [], "children": [ { + "id": "def-server.throwUnrecoverableError.$1", "type": "Object", "label": "error", "isRequired": true, @@ -617,13 +616,7 @@ "lineNumber": 239 }, "signature": [ - { - "pluginId": "taskManager", - "scope": "server", - "docId": "kibTaskManagerPluginApi", - "section": "def-server.IntervalSchedule", - "text": "IntervalSchedule" - }, + "IntervalSchedule", " | undefined" ] }, diff --git a/api_docs/telemetry.json b/api_docs/telemetry.json index 043e126de3640..bff65ce9c68dd 100644 --- a/api_docs/telemetry.json +++ b/api_docs/telemetry.json @@ -25,13 +25,7 @@ "lineNumber": 38 }, "signature": [ - { - "pluginId": "telemetry", - "scope": "public", - "docId": "kibTelemetryPluginApi", - "section": "def-public.TelemetryService", - "text": "TelemetryService" - } + "TelemetryService" ] }, { @@ -45,13 +39,7 @@ "lineNumber": 39 }, "signature": [ - { - "pluginId": "telemetry", - "scope": "public", - "docId": "kibTelemetryPluginApi", - "section": "def-public.TelemetryNotifications", - "text": "TelemetryNotifications" - } + "TelemetryNotifications" ] }, { @@ -94,13 +82,7 @@ "lineNumber": 34 }, "signature": [ - { - "pluginId": "telemetry", - "scope": "public", - "docId": "kibTelemetryPluginApi", - "section": "def-public.TelemetryService", - "text": "TelemetryService" - } + "TelemetryService" ] } ], @@ -131,6 +113,7 @@ "description": [], "children": [ { + "id": "def-server.FetcherTask.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -142,7 +125,7 @@ "section": "def-server.PluginInitializerContext", "text": "PluginInitializerContext" }, - ">" + ">" ], "description": [], "source": { @@ -172,18 +155,13 @@ "text": "CoreStart" }, ", { telemetryCollectionManager }: ", - { - "pluginId": "telemetry", - "scope": "server", - "docId": "kibTelemetryPluginApi", - "section": "def-server.FetcherTaskDepsStart", - "text": "FetcherTaskDepsStart" - }, + "FetcherTaskDepsStart", ") => void" ], "description": [], "children": [ { + "id": "def-server.FetcherTask.start.$1", "type": "Object", "label": "{ savedObjects, elasticsearch }", "isRequired": true, @@ -203,17 +181,12 @@ } }, { + "id": "def-server.FetcherTask.start.$2", "type": "Object", "label": "{ telemetryCollectionManager }", "isRequired": true, "signature": [ - { - "pluginId": "telemetry", - "scope": "server", - "docId": "kibTelemetryPluginApi", - "section": "def-server.FetcherTaskDepsStart", - "text": "FetcherTaskDepsStart" - } + "FetcherTaskDepsStart" ], "description": [], "source": { @@ -279,6 +252,7 @@ "description": [], "children": [ { + "id": "def-server.buildDataTelemetryPayload.$1", "type": "Array", "label": "indices", "isRequired": true, @@ -312,15 +286,16 @@ "type": "Function", "children": [ { + "id": "def-server.getClusterUuids.$1", "type": "Object", "label": "{ esClient }", "isRequired": true, "signature": [ { - "pluginId": "telemetry", - "scope": "common", - "docId": "kibTelemetryPluginApi", - "section": "def-common.StatsCollectionConfig", + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionConfig", "text": "StatsCollectionConfig" } ], @@ -333,7 +308,13 @@ ], "signature": [ "({ esClient }: ", - "StatsCollectionConfig", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionConfig", + "text": "StatsCollectionConfig" + }, ") => Promise<{ clusterUuid: string; }[]>" ], "description": [ @@ -353,15 +334,16 @@ "type": "Function", "children": [ { + "id": "def-server.getLocalStats.$1", "type": "Array", "label": "clustersDetails", "isRequired": true, "signature": [ { - "pluginId": "telemetry", - "scope": "common", - "docId": "kibTelemetryPluginApi", - "section": "def-common.ClusterDetails", + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.ClusterDetails", "text": "ClusterDetails" }, "[]" @@ -373,15 +355,16 @@ } }, { + "id": "def-server.getLocalStats.$2", "type": "Object", "label": "config", "isRequired": true, "signature": [ { - "pluginId": "telemetry", - "scope": "common", - "docId": "kibTelemetryPluginApi", - "section": "def-common.StatsCollectionConfig", + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionConfig", "text": "StatsCollectionConfig" } ], @@ -392,15 +375,16 @@ } }, { + "id": "def-server.getLocalStats.$3", "type": "Object", "label": "context", "isRequired": true, "signature": [ { - "pluginId": "telemetry", - "scope": "common", - "docId": "kibTelemetryPluginApi", - "section": "def-common.StatsCollectionContext", + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionContext", "text": "StatsCollectionContext" } ], @@ -413,11 +397,29 @@ ], "signature": [ "(clustersDetails: ", - "ClusterDetails", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.ClusterDetails", + "text": "ClusterDetails" + }, "[], config: ", - "StatsCollectionConfig", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionConfig", + "text": "StatsCollectionConfig" + }, ", context: ", - "StatsCollectionContext", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionContext", + "text": "StatsCollectionContext" + }, ") => Promise<{ timestamp: string; cluster_uuid: string; cluster_name: string; version: string; cluster_stats: any; collection: string; stack_stats: { data: ", { "pluginId": "telemetry", @@ -453,7 +455,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">, uiSettingsClient: ", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">, uiSettingsClient: ", { "pluginId": "core", "scope": "server", @@ -466,6 +468,7 @@ "description": [], "children": [ { + "id": "def-server.handleOldSettings.$1", "type": "Object", "label": "savedObjectsClient", "isRequired": true, @@ -478,7 +481,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ], "description": [], "source": { @@ -487,6 +490,7 @@ } }, { + "id": "def-server.handleOldSettings.$2", "type": "Object", "label": "uiSettingsClient", "isRequired": true, diff --git a/api_docs/telemetry_collection_manager.json b/api_docs/telemetry_collection_manager.json index 30d3bb76a43b2..1bd65a82cffdb 100644 --- a/api_docs/telemetry_collection_manager.json +++ b/api_docs/telemetry_collection_manager.json @@ -56,13 +56,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "usageCollection", - "scope": "server", - "docId": "kibUsageCollectionPluginApi", - "section": "def-server.CollectorSet", - "text": "CollectorSet" - }, + "CollectorSet", ", \"makeStatsCollector\" | \"makeUsageCollector\" | \"registerCollector\" | \"getCollectorByType\" | \"areAllCollectorsReady\" | \"bulkFetch\" | \"bulkFetchUsage\" | \"toObject\" | \"toApiFieldNames\">" ] }, @@ -105,7 +99,7 @@ "section": "def-server.SavedObjectsClient", "text": "SavedObjectsClient" }, - ", \"get\" | \"delete\" | \"create\" | \"find\" | \"update\" | \"bulkCreate\" | \"bulkGet\" | \"bulkUpdate\" | \"errors\" | \"checkConflicts\" | \"resolve\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\">" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"addToNamespaces\" | \"deleteFromNamespaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ] }, { @@ -181,7 +175,13 @@ "type": "Interface", "label": "UsageStatsPayload", "signature": [ - "UsageStatsPayload", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.UsageStatsPayload", + "text": "UsageStatsPayload" + }, " extends ", "BasicStatsPayload" ], @@ -221,11 +221,29 @@ }, "signature": [ "(config: ", - "StatsCollectionConfig", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionConfig", + "text": "StatsCollectionConfig" + }, ", context: ", - "StatsCollectionContext", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionContext", + "text": "StatsCollectionContext" + }, ") => Promise<", - "ClusterDetails", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.ClusterDetails", + "text": "ClusterDetails" + }, "[]>" ], "initialIsOpen": false @@ -242,11 +260,29 @@ }, "signature": [ "(clustersDetails: ", - "ClusterDetails", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.ClusterDetails", + "text": "ClusterDetails" + }, "[], config: ", - "StatsCollectionConfig", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionConfig", + "text": "StatsCollectionConfig" + }, ", context: ", - "StatsCollectionContext", + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionContext", + "text": "StatsCollectionContext" + }, ") => Promise" ], "initialIsOpen": false @@ -289,21 +325,9 @@ }, "signature": [ "(collectionConfig: ", - { - "pluginId": "telemetry", - "scope": "common", - "docId": "kibTelemetryPluginApi", - "section": "def-common.CollectionStrategyConfig", - "text": "CollectionStrategyConfig" - }, + "CollectionStrategyConfig", ") => void" ] }, @@ -320,10 +344,10 @@ "signature": [ "(optInStatus: boolean, config: ", { - "pluginId": "telemetry", - "scope": "common", - "docId": "kibTelemetryPluginApi", - "section": "def-common.StatsGetterConfig", + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsGetterConfig", "text": "StatsGetterConfig" }, ") => Promise" @@ -342,18 +366,18 @@ "signature": [ "(config: ", { - "pluginId": "telemetry", - "scope": "common", - "docId": "kibTelemetryPluginApi", - "section": "def-common.StatsGetterConfig", + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsGetterConfig", "text": "StatsGetterConfig" }, ") => Promise" @@ -401,10 +425,10 @@ "signature": [ "(optInStatus: boolean, config: ", { - "pluginId": "telemetry", - "scope": "common", - "docId": "kibTelemetryPluginApi", - "section": "def-common.StatsGetterConfig", + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsGetterConfig", "text": "StatsGetterConfig" }, ") => Promise" @@ -423,18 +447,18 @@ "signature": [ "(config: ", { - "pluginId": "telemetry", - "scope": "common", - "docId": "kibTelemetryPluginApi", - "section": "def-common.StatsGetterConfig", + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsGetterConfig", "text": "StatsGetterConfig" }, ") => Promise" diff --git a/api_docs/telemetry_management_section.json b/api_docs/telemetry_management_section.json index 7b3e897689de0..a238370bd0239 100644 --- a/api_docs/telemetry_management_section.json +++ b/api_docs/telemetry_management_section.json @@ -11,7 +11,13 @@ "\nReact component for displaying the example data associated with the Telemetry opt-in banner." ], "signature": [ - "OptInExampleFlyout", + { + "pluginId": "telemetryManagementSection", + "scope": "public", + "docId": "kibTelemetryManagementSectionPluginApi", + "section": "def-public.OptInExampleFlyout", + "text": "OptInExampleFlyout" + }, " extends React.PureComponent" ], "children": [ @@ -123,6 +129,7 @@ "description": [], "children": [ { + "id": "def-public.OptInExampleFlyout.renderBody.$1", "type": "Object", "label": "{ data, isLoading, hasPrivilegeToRead }", "isRequired": true, diff --git a/api_docs/timelines.json b/api_docs/timelines.json new file mode 100644 index 0000000000000..309db2a963f71 --- /dev/null +++ b/api_docs/timelines.json @@ -0,0 +1,119 @@ +{ + "id": "timelines", + "client": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [], + "setup": { + "id": "def-public.TimelinesPluginSetup", + "type": "Interface", + "label": "TimelinesPluginSetup", + "description": [], + "tags": [], + "children": [ + { + "tags": [], + "id": "def-public.TimelinesPluginSetup.getTimeline", + "type": "Function", + "label": "getTimeline", + "description": [], + "source": { + "path": "x-pack/plugins/timelines/public/types.ts", + "lineNumber": 4 + }, + "signature": [ + "((props: ", + "TimelineProps", + ") => React.ReactElement<", + "TimelineProps", + ", string | ((props: any) => React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)>) | undefined" + ] + } + ], + "source": { + "path": "x-pack/plugins/timelines/public/types.ts", + "lineNumber": 3 + }, + "lifecycle": "setup", + "initialIsOpen": true + } + }, + "server": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [], + "setup": { + "id": "def-server.TimelinesPluginSetup", + "type": "Interface", + "label": "TimelinesPluginSetup", + "description": [], + "tags": [], + "children": [], + "source": { + "path": "x-pack/plugins/timelines/server/types.ts", + "lineNumber": 2 + }, + "lifecycle": "setup", + "initialIsOpen": true + }, + "start": { + "id": "def-server.TimelinesPluginStart", + "type": "Interface", + "label": "TimelinesPluginStart", + "description": [], + "tags": [], + "children": [], + "source": { + "path": "x-pack/plugins/timelines/server/types.ts", + "lineNumber": 4 + }, + "lifecycle": "start", + "initialIsOpen": true + } + }, + "common": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [ + { + "tags": [], + "id": "def-common.PLUGIN_ID", + "type": "string", + "label": "PLUGIN_ID", + "description": [], + "source": { + "path": "x-pack/plugins/timelines/common/index.ts", + "lineNumber": 1 + }, + "signature": [ + "\"timelines\"" + ], + "initialIsOpen": false + }, + { + "tags": [], + "id": "def-common.PLUGIN_NAME", + "type": "string", + "label": "PLUGIN_NAME", + "description": [], + "source": { + "path": "x-pack/plugins/timelines/common/index.ts", + "lineNumber": 2 + }, + "signature": [ + "\"timelines\"" + ], + "initialIsOpen": false + } + ], + "objects": [] + } +} \ No newline at end of file diff --git a/api_docs/timelines.mdx b/api_docs/timelines.mdx new file mode 100644 index 0000000000000..cb16e39419a43 --- /dev/null +++ b/api_docs/timelines.mdx @@ -0,0 +1,31 @@ +--- +id: kibTimelinesPluginApi +slug: /kibana-dev-docs/timelinesPluginApi +title: timelines +image: https://source.unsplash.com/400x175/?github +summary: API docs for the timelines plugin +date: 2020-11-16 +tags: ['contributor', 'dev', 'apidocs', 'kibana', 'timelines'] +warning: This document is auto-generated and is meant to be viewed inside our experimental, new docs system. Reach out in #docs-engineering for more info. +--- + +import timelinesObj from './timelines.json'; + +## Client + +### Setup + + +## Server + +### Setup + + +### Start + + +## Common + +### Consts, variables and types + + diff --git a/api_docs/triggers_actions_ui.json b/api_docs/triggers_actions_ui.json index 245ead8a4d0e4..0b52bf674c1d5 100644 --- a/api_docs/triggers_actions_ui.json +++ b/api_docs/triggers_actions_ui.json @@ -84,6 +84,7 @@ "description": [], "children": [ { + "id": "def-public.Plugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -104,6 +105,7 @@ } }, { + "id": "def-public.Plugin.setup.$2", "type": "Object", "label": "plugins", "isRequired": true, @@ -363,6 +365,7 @@ "type": "Function", "children": [ { + "id": "def-public.getFields.$1", "type": "Object", "label": "http", "isRequired": true, @@ -382,6 +385,7 @@ } }, { + "id": "def-public.getFields.$2", "type": "Array", "label": "indexes", "isRequired": true, @@ -421,6 +425,7 @@ "type": "Function", "children": [ { + "id": "def-public.getIndexOptions.$1", "type": "Object", "label": "http", "isRequired": true, @@ -440,6 +445,7 @@ } }, { + "id": "def-public.getIndexOptions.$2", "type": "string", "label": "pattern", "isRequired": true, @@ -453,6 +459,7 @@ } }, { + "id": "def-public.getIndexOptions.$3", "type": "Array", "label": "indexPatternsParam", "isRequired": true, @@ -567,6 +574,7 @@ "type": "Function", "children": [ { + "id": "def-public.getTimeFieldOptions.$1", "type": "Array", "label": "fields", "isRequired": true, @@ -598,6 +606,7 @@ "type": "Function", "children": [ { + "id": "def-public.getTimeOptions.$1", "type": "number", "label": "unitSize", "isRequired": true, @@ -650,6 +659,7 @@ "description": [], "children": [ { + "id": "def-public.getTimeUnitLabel.$1", "type": "Enum", "label": "timeUnit", "isRequired": true, @@ -669,6 +679,7 @@ } }, { + "id": "def-public.getTimeUnitLabel.$2", "type": "string", "label": "timeValue", "isRequired": true, @@ -733,7 +744,7 @@ "description": [], "children": [ { - "id": "def-public.loadActionTypes.{-http }", + "id": "def-public.loadActionTypes.$1.http", "type": "Object", "label": "{ http }", "tags": [], @@ -741,7 +752,7 @@ "children": [ { "tags": [], - "id": "def-public.loadActionTypes.{-http }.http", + "id": "def-public.loadActionTypes.$1.http.http", "type": "Object", "label": "http", "description": [], @@ -1039,13 +1050,7 @@ "lineNumber": 47 }, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectAttributes", - "text": "SavedObjectAttributes" - } + "SavedObjectAttributes" ] } ], @@ -1080,7 +1085,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 222 + "lineNumber": 234 } }, { @@ -1091,7 +1096,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 223 + "lineNumber": 235 } }, { @@ -1102,7 +1107,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 224 + "lineNumber": 236 } }, { @@ -1113,7 +1118,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 225 + "lineNumber": 237 }, "signature": [ "string | ((docLinks: ", @@ -1135,7 +1140,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 226 + "lineNumber": 238 }, "signature": [ "(alertParams: Params) => ", @@ -1156,7 +1161,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 227 + "lineNumber": 239 }, "signature": [ "React.FunctionComponent | React.LazyExoticComponent(property: Key, value: Params[Key] | undefined) => void" @@ -1291,10 +1296,10 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 209 + "lineNumber": 221 }, "signature": [ - "(key: Prop, value: Pick<", + "(key: Prop, value: Pick<", { "pluginId": "alerting", "scope": "common", @@ -1302,7 +1307,7 @@ "section": "def-common.Alert", "text": "Alert" }, - ", \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"muteAll\" | \"tags\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"throttle\" | \"notifyWhen\" | \"mutedInstanceIds\" | \"executionStatus\">[Prop] | null) => void" + ", \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"tags\" | \"muteAll\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"throttle\" | \"notifyWhen\" | \"mutedInstanceIds\" | \"executionStatus\">[Prop] | null) => void" ] }, { @@ -1313,7 +1318,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 213 + "lineNumber": 225 }, "signature": [ { @@ -1333,7 +1338,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 214 + "lineNumber": 226 } }, { @@ -1344,7 +1349,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 215 + "lineNumber": 227 }, "signature": [ { @@ -1365,7 +1370,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 216 + "lineNumber": 228 }, "signature": [ "MetaData | undefined" @@ -1379,7 +1384,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 217 + "lineNumber": 229 }, "signature": [ { @@ -1399,7 +1404,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 218 + "lineNumber": 230 }, "signature": [ { @@ -1414,7 +1419,7 @@ ], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 199 + "lineNumber": 211 }, "initialIsOpen": false }, @@ -1541,7 +1546,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 235 + "lineNumber": 247 }, "signature": [ "any" @@ -1550,7 +1555,7 @@ ], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 234 + "lineNumber": 246 }, "initialIsOpen": false }, @@ -1748,21 +1753,9 @@ }, "signature": [ "Pick<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.TypeRegistry", - "text": "TypeRegistry" - }, + "TypeRegistry", "<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.ActionTypeModel", - "text": "ActionTypeModel" - }, + "ActionTypeModel", ">, \"get\" | \"register\" | \"list\" | \"has\">" ] }, @@ -1778,13 +1771,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.TypeRegistry", - "text": "TypeRegistry" - }, + "TypeRegistry", "<", { "pluginId": "triggersActionsUi", @@ -1874,7 +1861,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 116 + "lineNumber": 128 }, "signature": [ "Record" @@ -1883,7 +1870,7 @@ ], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 115 + "lineNumber": 127 }, "initialIsOpen": false } @@ -1909,7 +1896,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 67 + "lineNumber": 79 }, "initialIsOpen": false }, @@ -1947,7 +1934,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 148 + "lineNumber": 160 }, "signature": [ "PreConfiguredActionConnector", @@ -1995,7 +1982,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 52 + "lineNumber": 64 }, "signature": [ "{ get: (id: string) => ActionTypeModel; register: (objectType: ActionTypeModel) => void; list: () => ActionTypeModel[]; has: (id: string) => boolean; }" @@ -2010,7 +1997,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 166 + "lineNumber": 178 }, "signature": [ "AsActionVariables<\"params\" | \"state\"> & Partial>" @@ -2025,10 +2012,10 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 34 + "lineNumber": 40 }, "signature": [ - "{ enabled: boolean; id: string; name: string; params: Record; actions: AlertAction[]; muteAll: boolean; tags: string[]; alertTypeId: string; consumer: string; schedule: ", + "{ enabled: boolean; id: string; name: string; params: Record; actions: AlertAction[]; tags: string[]; muteAll: boolean; alertTypeId: string; consumer: string; schedule: ", { "pluginId": "alerting", "scope": "common", @@ -2071,7 +2058,7 @@ "description": [], "source": { "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "lineNumber": 56 + "lineNumber": 68 }, "signature": [ "{ get: (id: string) => AlertTypeModel>; register: (objectType: AlertTypeModel>) => void; list: () => AlertTypeModel>[]; has: (id: string) => boolean; }" @@ -2505,13 +2492,13 @@ "tags": [], "children": [ { - "id": "def-public.builtInComparators.[COMPARATORS.GREATER_THAN]", + "id": "def-public.builtInComparators.COMPARATORS.GREATER_THAN", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.GREATER_THAN].text", + "id": "def-public.builtInComparators.COMPARATORS.GREATER_THAN.text", "type": "string", "label": "text", "description": [], @@ -2522,7 +2509,7 @@ }, { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.GREATER_THAN].value", + "id": "def-public.builtInComparators.COMPARATORS.GREATER_THAN.value", "type": "Enum", "label": "value", "description": [], @@ -2542,7 +2529,7 @@ }, { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.GREATER_THAN].requiredValues", + "id": "def-public.builtInComparators.COMPARATORS.GREATER_THAN.requiredValues", "type": "number", "label": "requiredValues", "description": [], @@ -2560,13 +2547,13 @@ } }, { - "id": "def-public.builtInComparators.[COMPARATORS.GREATER_THAN_OR_EQUALS]", + "id": "def-public.builtInComparators.COMPARATORS.GREATER_THAN_OR_EQUALS", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.GREATER_THAN_OR_EQUALS].text", + "id": "def-public.builtInComparators.COMPARATORS.GREATER_THAN_OR_EQUALS.text", "type": "string", "label": "text", "description": [], @@ -2577,7 +2564,7 @@ }, { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.GREATER_THAN_OR_EQUALS].value", + "id": "def-public.builtInComparators.COMPARATORS.GREATER_THAN_OR_EQUALS.value", "type": "Enum", "label": "value", "description": [], @@ -2597,7 +2584,7 @@ }, { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.GREATER_THAN_OR_EQUALS].requiredValues", + "id": "def-public.builtInComparators.COMPARATORS.GREATER_THAN_OR_EQUALS.requiredValues", "type": "number", "label": "requiredValues", "description": [], @@ -2615,13 +2602,13 @@ } }, { - "id": "def-public.builtInComparators.[COMPARATORS.LESS_THAN]", + "id": "def-public.builtInComparators.COMPARATORS.LESS_THAN", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.LESS_THAN].text", + "id": "def-public.builtInComparators.COMPARATORS.LESS_THAN.text", "type": "string", "label": "text", "description": [], @@ -2632,7 +2619,7 @@ }, { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.LESS_THAN].value", + "id": "def-public.builtInComparators.COMPARATORS.LESS_THAN.value", "type": "Enum", "label": "value", "description": [], @@ -2652,7 +2639,7 @@ }, { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.LESS_THAN].requiredValues", + "id": "def-public.builtInComparators.COMPARATORS.LESS_THAN.requiredValues", "type": "number", "label": "requiredValues", "description": [], @@ -2670,13 +2657,13 @@ } }, { - "id": "def-public.builtInComparators.[COMPARATORS.LESS_THAN_OR_EQUALS]", + "id": "def-public.builtInComparators.COMPARATORS.LESS_THAN_OR_EQUALS", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.LESS_THAN_OR_EQUALS].text", + "id": "def-public.builtInComparators.COMPARATORS.LESS_THAN_OR_EQUALS.text", "type": "string", "label": "text", "description": [], @@ -2687,7 +2674,7 @@ }, { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.LESS_THAN_OR_EQUALS].value", + "id": "def-public.builtInComparators.COMPARATORS.LESS_THAN_OR_EQUALS.value", "type": "Enum", "label": "value", "description": [], @@ -2707,7 +2694,7 @@ }, { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.LESS_THAN_OR_EQUALS].requiredValues", + "id": "def-public.builtInComparators.COMPARATORS.LESS_THAN_OR_EQUALS.requiredValues", "type": "number", "label": "requiredValues", "description": [], @@ -2725,13 +2712,13 @@ } }, { - "id": "def-public.builtInComparators.[COMPARATORS.BETWEEN]", + "id": "def-public.builtInComparators.COMPARATORS.BETWEEN", "type": "Object", "tags": [], "children": [ { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.BETWEEN].text", + "id": "def-public.builtInComparators.COMPARATORS.BETWEEN.text", "type": "string", "label": "text", "description": [], @@ -2742,7 +2729,7 @@ }, { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.BETWEEN].value", + "id": "def-public.builtInComparators.COMPARATORS.BETWEEN.value", "type": "Enum", "label": "value", "description": [], @@ -2762,7 +2749,7 @@ }, { "tags": [], - "id": "def-public.builtInComparators.[COMPARATORS.BETWEEN].requiredValues", + "id": "def-public.builtInComparators.COMPARATORS.BETWEEN.requiredValues", "type": "number", "label": "requiredValues", "description": [], @@ -2983,21 +2970,9 @@ "lineNumber": 42 }, "signature": [ - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.TypeRegistry", - "text": "TypeRegistry" - }, + "TypeRegistry", "<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.ActionTypeModel", - "text": "ActionTypeModel" - }, + "ActionTypeModel", ">" ] }, @@ -3012,13 +2987,7 @@ "lineNumber": 43 }, "signature": [ - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.TypeRegistry", - "text": "TypeRegistry" - }, + "TypeRegistry", "<", { "pluginId": "triggersActionsUi", @@ -3056,21 +3025,9 @@ "lineNumber": 47 }, "signature": [ - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.TypeRegistry", - "text": "TypeRegistry" - }, + "TypeRegistry", "<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.ActionTypeModel", - "text": "ActionTypeModel" - }, + "ActionTypeModel", ">" ] }, @@ -3085,13 +3042,7 @@ "lineNumber": 48 }, "signature": [ - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.TypeRegistry", - "text": "TypeRegistry" - }, + "TypeRegistry", "<", { "pluginId": "triggersActionsUi", @@ -3115,21 +3066,9 @@ }, "signature": [ "(props: Pick<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.ConnectorAddFlyoutProps", - "text": "ConnectorAddFlyoutProps" - }, + "ConnectorAddFlyoutProps", ", \"onClose\" | \"consumer\" | \"actionTypes\" | \"onTestConnector\" | \"reloadConnectors\">) => React.ReactElement<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.ConnectorAddFlyoutProps", - "text": "ConnectorAddFlyoutProps" - }, + "ConnectorAddFlyoutProps", ", string | ((props: any) => React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)>" ] }, @@ -3145,21 +3084,9 @@ }, "signature": [ "(props: Pick<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.ConnectorEditFlyoutProps", - "text": "ConnectorEditFlyoutProps" - }, + "ConnectorEditFlyoutProps", ", \"onClose\" | \"consumer\" | \"reloadConnectors\" | \"initialConnector\" | \"tab\">) => React.ReactElement<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.ConnectorEditFlyoutProps", - "text": "ConnectorEditFlyoutProps" - }, + "ConnectorEditFlyoutProps", ", string | ((props: any) => React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)>" ] }, @@ -3175,21 +3102,9 @@ }, "signature": [ "(props: Pick<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.AlertAddProps", - "text": "AlertAddProps" - }, + "AlertAddProps", ">, \"onClose\" | \"metadata\" | \"onSave\" | \"alertTypeId\" | \"consumer\" | \"canChangeTrigger\" | \"initialValues\" | \"reloadAlerts\">) => React.ReactElement<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.AlertAddProps", - "text": "AlertAddProps" - }, + "AlertAddProps", ">, string | ((props: any) => React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)>" ] }, @@ -3205,21 +3120,9 @@ }, "signature": [ "(props: Pick<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.AlertEditProps", - "text": "AlertEditProps" - }, + "AlertEditProps", ">, \"onClose\" | \"metadata\" | \"onSave\" | \"reloadAlerts\" | \"initialAlert\">) => React.ReactElement<", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.AlertEditProps", - "text": "AlertEditProps" - }, + "AlertEditProps", ">, string | ((props: any) => React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)>" ] } @@ -3245,6 +3148,7 @@ "description": [], "children": [ { + "id": "def-server.validateCoreQueryBody.$1", "type": "Unknown", "label": "anyParams", "isRequired": true, @@ -3276,6 +3180,7 @@ "description": [], "children": [ { + "id": "def-server.validateTimeWindowUnits.$1", "type": "string", "label": "timeWindowUnit", "isRequired": true, @@ -3565,13 +3470,7 @@ }, "signature": [ "{ timeSeriesQuery: typeof ", - { - "pluginId": "triggersActionsUi", - "scope": "server", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-server.timeSeriesQuery", - "text": "timeSeriesQuery" - }, + "timeSeriesQuery", "; }" ] } diff --git a/api_docs/ui_actions.json b/api_docs/ui_actions.json index ff6ec01cda457..bf6caf81ca07f 100644 --- a/api_docs/ui_actions.json +++ b/api_docs/ui_actions.json @@ -71,13 +71,7 @@ "lineNumber": 27 }, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.UiActionsExecutionService", - "text": "UiActionsExecutionService" - } + "UiActionsExecutionService" ] }, { @@ -91,13 +85,7 @@ "lineNumber": 28 }, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.TriggerRegistry", - "text": "TriggerRegistry" - } + "TriggerRegistry" ] }, { @@ -111,13 +99,7 @@ "lineNumber": 29 }, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionRegistry", - "text": "ActionRegistry" - } + "ActionRegistry" ] }, { @@ -131,13 +113,7 @@ "lineNumber": 30 }, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.TriggerToActionsRegistry", - "text": "TriggerToActionsRegistry" - } + "TriggerToActionsRegistry" ] }, { @@ -150,6 +126,7 @@ "description": [], "children": [ { + "id": "def-public.UiActionsService.Unnamed.$1", "type": "Object", "label": "{\n triggers = new Map(),\n actions = new Map(),\n triggerToActions = new Map(),\n }", "isRequired": true, @@ -181,6 +158,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.registerTrigger.$1", "type": "Object", "label": "trigger", "isRequired": true, @@ -225,6 +203,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.getTrigger.$1", "type": "string", "label": "triggerId", "isRequired": true, @@ -240,13 +219,7 @@ ], "signature": [ "(triggerId: string) => ", - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.TriggerContract", - "text": "TriggerContract" - }, + "TriggerContract", "" ], "description": [], @@ -263,6 +236,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.registerAction.$1", "type": "Uncategorized", "label": "definition", "isRequired": true, @@ -294,13 +268,7 @@ "text": "Action" }, "<", - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionContext", - "text": "ActionContext" - }, + "ActionContext", ">" ], "description": [], @@ -317,6 +285,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.unregisterAction.$1", "type": "string", "label": "actionId", "isRequired": true, @@ -347,6 +316,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.hasAction.$1", "type": "string", "label": "actionId", "isRequired": true, @@ -377,6 +347,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.attachAction.$1", "type": "string", "label": "triggerId", "isRequired": true, @@ -390,6 +361,7 @@ } }, { + "id": "def-public.UiActionsService.attachAction.$2", "type": "string", "label": "actionId", "isRequired": true, @@ -420,6 +392,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.detachAction.$1", "type": "string", "label": "triggerId", "isRequired": true, @@ -433,6 +406,7 @@ } }, { + "id": "def-public.UiActionsService.detachAction.$2", "type": "string", "label": "actionId", "isRequired": true, @@ -463,6 +437,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.addTriggerAction.$1", "type": "string", "label": "triggerId", "isRequired": true, @@ -476,6 +451,7 @@ } }, { + "id": "def-public.UiActionsService.addTriggerAction.$2", "type": "Object", "label": "action", "isRequired": true, @@ -523,6 +499,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.getAction.$1", "type": "string", "label": "id", "isRequired": true, @@ -554,13 +531,7 @@ "text": "Action" }, "<", - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionContext", - "text": "ActionContext" - }, + "ActionContext", ">" ], "description": [], @@ -577,6 +548,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.getTriggerActions.$1", "type": "string", "label": "triggerId", "isRequired": true, @@ -615,6 +587,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.getTriggerCompatibleActions.$1", "type": "string", "label": "triggerId", "isRequired": true, @@ -628,6 +601,7 @@ } }, { + "id": "def-public.UiActionsService.getTriggerCompatibleActions.$2", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -666,6 +640,7 @@ "type": "Function", "children": [ { + "id": "def-public.UiActionsService.executeTriggerActions.$1", "type": "string", "label": "triggerId", "isRequired": true, @@ -679,6 +654,7 @@ } }, { + "id": "def-public.UiActionsService.executeTriggerActions.$2", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -774,17 +750,12 @@ ], "children": [ { + "id": "def-public.buildContextMenuForActions.$1", "type": "Object", "label": "{\n actions,\n title = defaultTitle,\n closeMenu = () => {},\n}", "isRequired": true, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.BuildContextMenuParams", - "text": "BuildContextMenuParams" - } + "BuildContextMenuParams" ], "description": [], "source": { @@ -827,6 +798,7 @@ "description": [], "children": [ { + "id": "def-public.createAction.$1", "type": "Object", "label": "action", "isRequired": true, @@ -952,6 +924,7 @@ ], "children": [ { + "id": "def-public.Action.getIconType.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -999,6 +972,7 @@ ], "children": [ { + "id": "def-public.Action.getDisplayName.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -1077,6 +1051,7 @@ ], "children": [ { + "id": "def-public.Action.isCompatible.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -1124,6 +1099,7 @@ ], "children": [ { + "id": "def-public.Action.execute.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -1171,6 +1147,7 @@ ], "children": [ { + "id": "def-public.Action.getHref.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -1218,6 +1195,7 @@ ], "children": [ { + "id": "def-public.Action.shouldAutoExecute.$1", "type": "CompoundType", "label": "context", "isRequired": true, @@ -1316,13 +1294,7 @@ "label": "isCompatible", "signature": [ "((context: ", - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionDefinitionContext", - "text": "ActionDefinitionContext" - }, + "ActionDefinitionContext", ") => Promise) | undefined" ], "description": [ @@ -1330,17 +1302,12 @@ ], "children": [ { + "id": "def-public.ActionDefinition.isCompatible.$1", "type": "CompoundType", "label": "context", "isRequired": true, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionDefinitionContext", - "text": "ActionDefinitionContext" - }, + "ActionDefinitionContext", "" ], "description": [], @@ -1363,13 +1330,7 @@ "label": "execute", "signature": [ "(context: ", - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionDefinitionContext", - "text": "ActionDefinitionContext" - }, + "ActionDefinitionContext", ") => Promise" ], "description": [ @@ -1377,17 +1338,12 @@ ], "children": [ { + "id": "def-public.ActionDefinition.execute.$1", "type": "CompoundType", "label": "context", "isRequired": true, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionDefinitionContext", - "text": "ActionDefinitionContext" - }, + "ActionDefinitionContext", "" ], "description": [], @@ -1410,13 +1366,7 @@ "label": "shouldAutoExecute", "signature": [ "((context: ", - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionDefinitionContext", - "text": "ActionDefinitionContext" - }, + "ActionDefinitionContext", ") => Promise) | undefined" ], "description": [ @@ -1424,17 +1374,12 @@ ], "children": [ { + "id": "def-public.ActionDefinition.shouldAutoExecute.$1", "type": "CompoundType", "label": "context", "isRequired": true, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionDefinitionContext", - "text": "ActionDefinitionContext" - }, + "ActionDefinitionContext", "" ], "description": [], @@ -1457,13 +1402,7 @@ "label": "getHref", "signature": [ "((context: ", - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionDefinitionContext", - "text": "ActionDefinitionContext" - }, + "ActionDefinitionContext", ") => Promise) | undefined" ], "description": [ @@ -1471,17 +1410,12 @@ ], "children": [ { + "id": "def-public.ActionDefinition.getHref.$1", "type": "CompoundType", "label": "context", "isRequired": true, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionDefinitionContext", - "text": "ActionDefinitionContext" - }, + "ActionDefinitionContext", "" ], "description": [], @@ -1623,6 +1557,7 @@ ], "children": [ { + "id": "def-public.Presentable.getIconType.$1", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -1655,6 +1590,7 @@ ], "children": [ { + "id": "def-public.Presentable.getDisplayName.$1", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -1687,6 +1623,7 @@ ], "children": [ { + "id": "def-public.Presentable.getDisplayNameTooltip.$1", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -1719,6 +1656,7 @@ ], "children": [ { + "id": "def-public.Presentable.getHref.$1", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -1751,6 +1689,7 @@ ], "children": [ { + "id": "def-public.Presentable.isCompatible.$1", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -1930,13 +1869,7 @@ "lineNumber": 17 }, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.TriggerRegistry", - "text": "TriggerRegistry" - }, + "TriggerRegistry", " | undefined" ] }, @@ -1951,13 +1884,7 @@ "lineNumber": 18 }, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.ActionRegistry", - "text": "ActionRegistry" - }, + "ActionRegistry", " | undefined" ] }, @@ -1974,13 +1901,7 @@ "lineNumber": 23 }, "signature": [ - { - "pluginId": "uiActions", - "scope": "public", - "docId": "kibUiActionsPluginApi", - "section": "def-public.TriggerToActionsRegistry", - "text": "TriggerToActionsRegistry" - }, + "TriggerToActionsRegistry", " | undefined" ] } diff --git a/api_docs/ui_actions_enhanced.json b/api_docs/ui_actions_enhanced.json index 0a31b02f0fd94..5f4f76e574b8e 100644 --- a/api_docs/ui_actions_enhanced.json +++ b/api_docs/ui_actions_enhanced.json @@ -71,6 +71,7 @@ "description": [], "children": [ { + "id": "def-public.AbstractActionStorage.read.$1", "type": "string", "label": "eventId", "isRequired": true, @@ -109,6 +110,7 @@ "description": [], "children": [ { + "id": "def-public.AbstractActionStorage.create.$1", "type": "Object", "label": "event", "isRequired": true, @@ -153,6 +155,7 @@ "description": [], "children": [ { + "id": "def-public.AbstractActionStorage.update.$1", "type": "Object", "label": "event", "isRequired": true, @@ -189,6 +192,7 @@ "description": [], "children": [ { + "id": "def-public.AbstractActionStorage.remove.$1", "type": "string", "label": "eventId", "isRequired": true, @@ -298,6 +302,7 @@ "description": [], "children": [ { + "id": "def-public.ActionFactory.Unnamed.$1", "type": "Object", "label": "def", "isRequired": true, @@ -318,17 +323,12 @@ } }, { + "id": "def-public.ActionFactory.Unnamed.$2", "type": "Object", "label": "deps", "isRequired": true, "signature": [ - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.ActionFactoryDeps", - "text": "ActionFactoryDeps" - } + "ActionFactoryDeps" ], "description": [], "source": { @@ -549,6 +549,7 @@ "description": [], "children": [ { + "id": "def-public.ActionFactory.getIconType.$1", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -579,6 +580,7 @@ "description": [], "children": [ { + "id": "def-public.ActionFactory.getDisplayName.$1", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -609,6 +611,7 @@ "description": [], "children": [ { + "id": "def-public.ActionFactory.getDisplayNameTooltip.$1", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -639,6 +642,7 @@ "description": [], "children": [ { + "id": "def-public.ActionFactory.isCompatible.$1", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -703,6 +707,7 @@ "description": [], "children": [ { + "id": "def-public.ActionFactory.create.$1", "type": "Object", "label": "serializedAction", "isRequired": true, @@ -765,6 +770,7 @@ "description": [], "children": [ { + "id": "def-public.ActionFactory.telemetry.$1", "type": "Object", "label": "state", "isRequired": true, @@ -784,6 +790,7 @@ } }, { + "id": "def-public.ActionFactory.telemetry.$2", "type": "Object", "label": "telemetryData", "isRequired": true, @@ -826,18 +833,13 @@ "text": "SerializedEvent" }, "; references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]; }" ], "description": [], "children": [ { + "id": "def-public.ActionFactory.extract.$1", "type": "Object", "label": "state", "isRequired": true, @@ -878,13 +880,7 @@ "text": "SerializedEvent" }, ", references: ", - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]) => ", { "pluginId": "uiActionsEnhanced", @@ -897,6 +893,7 @@ "description": [], "children": [ { + "id": "def-public.ActionFactory.inject.$1", "type": "Object", "label": "state", "isRequired": true, @@ -916,17 +913,12 @@ } }, { + "id": "def-public.ActionFactory.inject.$2", "type": "Array", "label": "references", "isRequired": true, "signature": [ - { - "pluginId": "core", - "scope": "common", - "docId": "kibCorePluginApi", - "section": "def-common.SavedObjectReference", - "text": "SavedObjectReference" - }, + "SavedObjectReference", "[]" ], "description": [], @@ -1005,13 +997,7 @@ "signature": [ "BehaviorSubject", "<", - { - "pluginId": "licensing", - "scope": "common", - "docId": "kibLicensingPluginApi", - "section": "def-common.ILicense", - "text": "ILicense" - }, + "ILicense", " | undefined>" ] }, @@ -1025,6 +1011,7 @@ "description": [], "children": [ { + "id": "def-public.AdvancedUiActionsPublicPlugin.Unnamed.$1", "type": "Object", "label": "initializerContext", "isRequired": true, @@ -1066,13 +1053,7 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.StartDependencies", - "text": "StartDependencies" - }, + "StartDependencies", ", unknown>, { embeddable, uiActions, licensing }: SetupDependencies) => ", { "pluginId": "uiActionsEnhanced", @@ -1085,6 +1066,7 @@ "description": [], "children": [ { + "id": "def-public.AdvancedUiActionsPublicPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -1097,13 +1079,7 @@ "text": "CoreSetup" }, "<", - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.StartDependencies", - "text": "StartDependencies" - }, + "StartDependencies", ", unknown>" ], "description": [], @@ -1113,6 +1089,7 @@ } }, { + "id": "def-public.AdvancedUiActionsPublicPlugin.setup.$2", "type": "Object", "label": "{ embeddable, uiActions, licensing }", "isRequired": true, @@ -1147,13 +1124,7 @@ "text": "CoreStart" }, ", { uiActions, licensing }: ", - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.StartDependencies", - "text": "StartDependencies" - }, + "StartDependencies", ") => ", { "pluginId": "uiActionsEnhanced", @@ -1166,6 +1137,7 @@ "description": [], "children": [ { + "id": "def-public.AdvancedUiActionsPublicPlugin.start.$1", "type": "Object", "label": "core", "isRequired": true, @@ -1185,17 +1157,12 @@ } }, { + "id": "def-public.AdvancedUiActionsPublicPlugin.start.$2", "type": "Object", "label": "{ uiActions, licensing }", "isRequired": true, "signature": [ - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.StartDependencies", - "text": "StartDependencies" - } + "StartDependencies" ], "description": [], "source": { @@ -1273,29 +1240,11 @@ "text": "ReduxLikeStateContainer" }, "<", - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.State", - "text": "State" - }, + "State", ", ", - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.Transitions", - "text": "Transitions" - }, + "Transitions", ", ", - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.Selectors", - "text": "Selectors" - }, + "Selectors", ">" ] }, @@ -1309,6 +1258,7 @@ "description": [], "children": [ { + "id": "def-public.DynamicActionManager.Unnamed.$1", "type": "Object", "label": "params", "isRequired": true, @@ -1352,6 +1302,7 @@ "description": [], "children": [ { + "id": "def-public.DynamicActionManager.getEvent.$1", "type": "string", "label": "eventId", "isRequired": true, @@ -1384,6 +1335,7 @@ ], "children": [ { + "id": "def-public.DynamicActionManager.generateActionId.$1", "type": "string", "label": "eventId", "isRequired": true, @@ -1422,6 +1374,7 @@ "description": [], "children": [ { + "id": "def-public.DynamicActionManager.reviveAction.$1", "type": "Object", "label": "event", "isRequired": true, @@ -1466,6 +1419,7 @@ "description": [], "children": [ { + "id": "def-public.DynamicActionManager.killAction.$1", "type": "Object", "label": "{ eventId, triggers }", "isRequired": true, @@ -1513,13 +1467,7 @@ "text": "StateContainer" }, "<", - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.State", - "text": "State" - }, + "State", ", object, {}>" ] }, @@ -1587,6 +1535,7 @@ ], "children": [ { + "id": "def-public.DynamicActionManager.createEvent.$1", "type": "Object", "label": "action", "isRequired": true, @@ -1617,6 +1566,7 @@ } }, { + "id": "def-public.DynamicActionManager.createEvent.$2", "type": "Array", "label": "triggers", "isRequired": true, @@ -1667,6 +1617,7 @@ ], "children": [ { + "id": "def-public.DynamicActionManager.updateEvent.$1", "type": "string", "label": "eventId", "isRequired": true, @@ -1682,6 +1633,7 @@ } }, { + "id": "def-public.DynamicActionManager.updateEvent.$2", "type": "Object", "label": "action", "isRequired": true, @@ -1712,6 +1664,7 @@ } }, { + "id": "def-public.DynamicActionManager.updateEvent.$3", "type": "Array", "label": "triggers", "isRequired": true, @@ -1746,6 +1699,7 @@ ], "children": [ { + "id": "def-public.DynamicActionManager.deleteEvent.$1", "type": "string", "label": "eventId", "isRequired": true, @@ -1780,6 +1734,7 @@ ], "children": [ { + "id": "def-public.DynamicActionManager.deleteEvents.$1", "type": "Array", "label": "eventIds", "isRequired": true, @@ -1845,6 +1800,7 @@ "description": [], "children": [ { + "id": "def-public.MemoryActionStorage.Unnamed.$1", "type": "Object", "label": "events", "isRequired": true, @@ -1923,6 +1879,7 @@ "description": [], "children": [ { + "id": "def-public.MemoryActionStorage.create.$1", "type": "Object", "label": "event", "isRequired": true, @@ -1967,6 +1924,7 @@ "description": [], "children": [ { + "id": "def-public.MemoryActionStorage.update.$1", "type": "Object", "label": "event", "isRequired": true, @@ -2003,6 +1961,7 @@ "description": [], "children": [ { + "id": "def-public.MemoryActionStorage.remove.$1", "type": "string", "label": "eventId", "isRequired": true, @@ -2037,18 +1996,13 @@ "type": "Function", "children": [ { + "id": "def-public.ActionWizard.$1", "type": "CompoundType", "label": "{\n currentActionFactory,\n actionFactories,\n onActionFactoryChange,\n onConfigChange,\n config,\n context,\n onSelectedTriggersChange,\n getTriggerInfo,\n triggers,\n triggerPickerDocsLink,\n}", "isRequired": true, "signature": [ "React.PropsWithChildren<", - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.ActionWizardProps", - "text": "ActionWizardProps" - }, + "ActionWizardProps", "<", { "pluginId": "uiActionsEnhanced", @@ -2099,6 +2053,7 @@ "description": [], "children": [ { + "id": "def-public.compile.$1", "type": "string", "label": "urlTemplate", "isRequired": true, @@ -2112,6 +2067,7 @@ } }, { + "id": "def-public.compile.$2", "type": "Uncategorized", "label": "context", "isRequired": true, @@ -2125,6 +2081,7 @@ } }, { + "id": "def-public.compile.$3", "type": "boolean", "label": "doEncode", "isRequired": true, @@ -2163,6 +2120,7 @@ "description": [], "children": [ { + "id": "def-public.globalScopeProvider.$1", "type": "Object", "label": "{\n core,\n}", "isRequired": true, @@ -2189,18 +2147,13 @@ "type": "Function", "children": [ { + "id": "def-public.UrlDrilldownCollectConfig.$1", "type": "CompoundType", "label": "props", "isRequired": true, "signature": [ "React.PropsWithChildren<", - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.UrlDrilldownCollectConfigProps", - "text": "UrlDrilldownCollectConfigProps" - }, + "UrlDrilldownCollectConfigProps", ">" ], "description": [], @@ -2235,6 +2188,7 @@ "description": [], "children": [ { + "id": "def-public.validateUrl.$1", "type": "string", "label": "url", "isRequired": true, @@ -2274,6 +2228,7 @@ "description": [], "children": [ { + "id": "def-public.validateUrlTemplate.$1", "type": "Object", "label": "urlTemplate", "isRequired": true, @@ -2287,6 +2242,7 @@ } }, { + "id": "def-public.validateUrlTemplate.$2", "type": "Object", "label": "scope", "isRequired": true, @@ -2456,6 +2412,7 @@ ], "children": [ { + "id": "def-public.ActionFactoryDefinition.create.$1", "type": "Object", "label": "serializedAction", "isRequired": true, @@ -2764,6 +2721,7 @@ ], "children": [ { + "id": "def-public.DrilldownDefinition.isCompatible.$1", "type": "Uncategorized", "label": "config", "isRequired": true, @@ -2777,6 +2735,7 @@ } }, { + "id": "def-public.DrilldownDefinition.isCompatible.$2", "type": "CompoundType", "label": "context", "isRequired": true, @@ -2825,6 +2784,7 @@ ], "children": [ { + "id": "def-public.DrilldownDefinition.execute.$1", "type": "Uncategorized", "label": "config", "isRequired": true, @@ -2840,6 +2800,7 @@ } }, { + "id": "def-public.DrilldownDefinition.execute.$2", "type": "CompoundType", "label": "context", "isRequired": true, @@ -2890,6 +2851,7 @@ ], "children": [ { + "id": "def-public.DrilldownDefinition.getHref.$1", "type": "Uncategorized", "label": "config", "isRequired": true, @@ -2903,6 +2865,7 @@ } }, { + "id": "def-public.DrilldownDefinition.getHref.$2", "type": "CompoundType", "label": "context", "isRequired": true, @@ -2974,13 +2937,7 @@ "lineNumber": 33 }, "signature": [ - { - "pluginId": "uiActionsEnhanced", - "scope": "public", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-public.ActionStorage", - "text": "ActionStorage" - } + "ActionStorage" ] }, { @@ -3370,13 +3327,7 @@ "lineNumber": 26 }, "signature": [ - { - "pluginId": "uiActionsEnhanced", - "scope": "server", - "docId": "kibUiActionsEnhancedPluginApi", - "section": "def-server.ActionFactoryRegistry", - "text": "ActionFactoryRegistry" - } + "ActionFactoryRegistry" ] }, { @@ -3429,6 +3380,7 @@ "description": [], "children": [ { + "id": "def-server.AdvancedUiActionsServerPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -3449,6 +3401,7 @@ } }, { + "id": "def-server.AdvancedUiActionsServerPlugin.setup.$2", "type": "Object", "label": "{ embeddable }", "isRequired": true, @@ -3506,6 +3459,7 @@ "type": "Function", "children": [ { + "id": "def-server.AdvancedUiActionsServerPlugin.registerActionFactory.$1", "type": "Object", "label": "definition", "isRequired": true, diff --git a/api_docs/uptime.json b/api_docs/uptime.json index f7652de96a49e..41ebbb21b337f 100644 --- a/api_docs/uptime.json +++ b/api_docs/uptime.json @@ -16,17 +16,12 @@ "type": "Function", "children": [ { + "id": "def-server.initServerWithKibana.$1", "type": "Object", "label": "server", "isRequired": true, "signature": [ - { - "pluginId": "uptime", - "scope": "server", - "docId": "kibUptimePluginApi", - "section": "def-server.UptimeCoreSetup", - "text": "UptimeCoreSetup" - } + "UptimeCoreSetup" ], "description": [], "source": { @@ -35,17 +30,12 @@ } }, { + "id": "def-server.initServerWithKibana.$2", "type": "Object", "label": "plugins", "isRequired": true, "signature": [ - { - "pluginId": "uptime", - "scope": "server", - "docId": "kibUptimePluginApi", - "section": "def-server.UptimeCorePlugins", - "text": "UptimeCorePlugins" - } + "UptimeCorePlugins" ], "description": [], "source": { @@ -103,13 +93,7 @@ }, "signature": [ "(options: ", - { - "pluginId": "uptime", - "scope": "server", - "docId": "kibUptimePluginApi", - "section": "def-server.KibanaRouteOptions", - "text": "KibanaRouteOptions" - }, + "KibanaRouteOptions", ") => void" ] } diff --git a/api_docs/url_forwarding.json b/api_docs/url_forwarding.json index ddf7485c80240..debc212f68ae2 100644 --- a/api_docs/url_forwarding.json +++ b/api_docs/url_forwarding.json @@ -35,6 +35,7 @@ "description": [], "children": [ { + "id": "def-public.UrlForwardingPlugin.setup.$1", "type": "Object", "label": "core", "isRequired": true, @@ -84,13 +85,7 @@ "text": "CoreStart" }, ", { kibanaLegacy }: { kibanaLegacy: { dashboardConfig: ", - { - "pluginId": "kibanaLegacy", - "scope": "public", - "docId": "kibKibanaLegacyPluginApi", - "section": "def-public.DashboardConfig", - "text": "DashboardConfig" - }, + "DashboardConfig", "; loadFontAwesome: () => Promise; config: Readonly<{} & { defaultAppId: string; }>; }; }) => { navigateToDefaultApp: ({ overwriteHash }?: { overwriteHash: boolean; }) => void; navigateToLegacyKibanaUrl: (hash: string) => { navigated: boolean; }; getForwards: () => ", { "pluginId": "urlForwarding", @@ -104,6 +99,7 @@ "description": [], "children": [ { + "id": "def-public.UrlForwardingPlugin.start.$1", "type": "Object", "label": "{ application, http: { basePath }, uiSettings }", "isRequired": true, @@ -123,7 +119,7 @@ } }, { - "id": "def-public.UrlForwardingPlugin.start.{-kibanaLegacy }", + "id": "def-public.UrlForwardingPlugin.start.$2.kibanaLegacy", "type": "Object", "label": "{ kibanaLegacy }", "tags": [], @@ -131,7 +127,7 @@ "children": [ { "tags": [], - "id": "def-public.UrlForwardingPlugin.start.{-kibanaLegacy }.kibanaLegacy", + "id": "def-public.UrlForwardingPlugin.start.$2.kibanaLegacy.kibanaLegacy", "type": "Object", "label": "kibanaLegacy", "description": [], @@ -141,13 +137,7 @@ }, "signature": [ "{ dashboardConfig: ", - { - "pluginId": "kibanaLegacy", - "scope": "public", - "docId": "kibKibanaLegacyPluginApi", - "section": "def-public.DashboardConfig", - "text": "DashboardConfig" - }, + "DashboardConfig", "; loadFontAwesome: () => Promise; config: Readonly<{} & { defaultAppId: string; }>; }" ] } diff --git a/api_docs/usage_collection.json b/api_docs/usage_collection.json index cd838c470c597..a10e2e73f0098 100644 --- a/api_docs/usage_collection.json +++ b/api_docs/usage_collection.json @@ -8,18 +8,13 @@ "type": "Function", "children": [ { + "id": "def-public.TrackApplicationView.$1", "type": "CompoundType", "label": "props", "isRequired": true, "signature": [ "React.PropsWithChildren<", - { - "pluginId": "usageCollection", - "scope": "public", - "docId": "kibUsageCollectionPluginApi", - "section": "def-public.TrackApplicationViewProps", - "text": "TrackApplicationViewProps" - }, + "TrackApplicationViewProps", ">" ], "description": [], @@ -177,13 +172,7 @@ "lineNumber": 144 }, "signature": [ - { - "pluginId": "usageCollection", - "scope": "server", - "docId": "kibUsageCollectionPluginApi", - "section": "def-server.CollectorOptionsFetchExtendedContext", - "text": "CollectorOptionsFetchExtendedContext" - }, + "CollectorOptionsFetchExtendedContext", "" ] }, @@ -223,13 +212,7 @@ "lineNumber": 147 }, "signature": [ - { - "pluginId": "usageCollection", - "scope": "server", - "docId": "kibUsageCollectionPluginApi", - "section": "def-server.CollectorFetchMethod", - "text": "CollectorFetchMethod" - }, + "CollectorFetchMethod", "" ] }, @@ -257,6 +240,7 @@ "description": [], "children": [ { + "id": "def-server.Collector.Unnamed.$1", "type": "Object", "label": "log", "isRequired": true, @@ -270,6 +254,7 @@ } }, { + "id": "def-server.Collector.Unnamed.$2", "type": "CompoundType", "label": "{\n type,\n init,\n fetch,\n isReady,\n extendFetchContext = {},\n ...options\n }", "isRequired": true, diff --git a/api_docs/vis_type_timeseries.json b/api_docs/vis_type_timeseries.json index 907ced500294a..a3c2c605c8de9 100644 --- a/api_docs/vis_type_timeseries.json +++ b/api_docs/vis_type_timeseries.json @@ -10,10 +10,97 @@ }, "server": { "classes": [], - "functions": [], + "functions": [ + { + "id": "def-server.isVisSeriesData", + "type": "Function", + "children": [ + { + "id": "def-server.isVisSeriesData.$1", + "type": "CompoundType", + "label": "data", + "isRequired": true, + "signature": [ + "TimeseriesVisData" + ], + "description": [], + "source": { + "path": "src/plugins/vis_type_timeseries/common/types.ts", + "lineNumber": 74 + } + } + ], + "signature": [ + "(data: ", + "TimeseriesVisData", + ") => data is ", + "SeriesData" + ], + "description": [], + "label": "isVisSeriesData", + "source": { + "path": "src/plugins/vis_type_timeseries/common/types.ts", + "lineNumber": 74 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + }, + { + "id": "def-server.isVisTableData", + "type": "Function", + "children": [ + { + "id": "def-server.isVisTableData.$1", + "type": "CompoundType", + "label": "data", + "isRequired": true, + "signature": [ + "TimeseriesVisData" + ], + "description": [], + "source": { + "path": "src/plugins/vis_type_timeseries/common/types.ts", + "lineNumber": 71 + } + } + ], + "signature": [ + "(data: ", + "TimeseriesVisData", + ") => data is TableData" + ], + "description": [], + "label": "isVisTableData", + "source": { + "path": "src/plugins/vis_type_timeseries/common/types.ts", + "lineNumber": 71 + }, + "tags": [], + "returnComment": [], + "initialIsOpen": false + } + ], "interfaces": [], "enums": [], - "misc": [], + "misc": [ + { + "id": "def-server.TimeseriesVisData", + "type": "Type", + "label": "TimeseriesVisData", + "tags": [], + "description": [], + "source": { + "path": "src/plugins/vis_type_timeseries/common/types.ts", + "lineNumber": 36 + }, + "signature": [ + "SeriesData", + " | TableData" + ], + "initialIsOpen": false + } + ], "objects": [], "setup": { "id": "def-server.VisTypeTimeseriesSetup", @@ -30,17 +117,11 @@ "description": [], "source": { "path": "src/plugins/vis_type_timeseries/server/plugin.ts", - "lineNumber": 53 + "lineNumber": 55 }, "signature": [ "(requestContext: ", - { - "pluginId": "data", - "scope": "server", - "docId": "kibDataSearchPluginApi", - "section": "def-server.DataRequestHandlerContext", - "text": "DataRequestHandlerContext" - }, + "DataRequestHandlerContext", ", fakeRequest: ", { "pluginId": "core", @@ -50,20 +131,14 @@ "text": "KibanaRequest" }, ", options: any) => Promise<", - { - "pluginId": "visTypeTimeseries", - "scope": "common", - "docId": "kibVisTypeTimeseriesPluginApi", - "section": "def-common.TimeseriesVisData", - "text": "TimeseriesVisData" - }, + "TimeseriesVisData", ">" ] } ], "source": { "path": "src/plugins/vis_type_timeseries/server/plugin.ts", - "lineNumber": 52 + "lineNumber": 54 }, "lifecycle": "setup", "initialIsOpen": true diff --git a/api_docs/vis_type_timeseries.mdx b/api_docs/vis_type_timeseries.mdx index 156b2700a7f8b..041d01196bad9 100644 --- a/api_docs/vis_type_timeseries.mdx +++ b/api_docs/vis_type_timeseries.mdx @@ -16,3 +16,9 @@ import visTypeTimeseriesObj from './vis_type_timeseries.json'; ### Setup +### Functions + + +### Consts, variables and types + + diff --git a/api_docs/visualizations.json b/api_docs/visualizations.json index b85d424a97bde..0635d17107efa 100644 --- a/api_docs/visualizations.json +++ b/api_docs/visualizations.json @@ -30,6 +30,7 @@ "description": [], "children": [ { + "id": "def-public.PersistedState.Unnamed.$1", "type": "Any", "label": "value", "isRequired": true, @@ -43,6 +44,7 @@ } }, { + "id": "def-public.PersistedState.Unnamed.$2", "type": "CompoundType", "label": "path", "isRequired": false, @@ -73,6 +75,7 @@ "description": [], "children": [ { + "id": "def-public.PersistedState.get.$1", "type": "CompoundType", "label": "key", "isRequired": false, @@ -86,6 +89,7 @@ } }, { + "id": "def-public.PersistedState.get.$2", "type": "Any", "label": "defaultValue", "isRequired": true, @@ -116,6 +120,7 @@ "description": [], "children": [ { + "id": "def-public.PersistedState.set.$1", "type": "Any", "label": "key", "isRequired": true, @@ -129,6 +134,7 @@ } }, { + "id": "def-public.PersistedState.set.$2", "type": "Any", "label": "value", "isRequired": true, @@ -159,6 +165,7 @@ "description": [], "children": [ { + "id": "def-public.PersistedState.setSilent.$1", "type": "Any", "label": "key", "isRequired": true, @@ -172,6 +179,7 @@ } }, { + "id": "def-public.PersistedState.setSilent.$2", "type": "Any", "label": "value", "isRequired": true, @@ -218,6 +226,7 @@ "description": [], "children": [ { + "id": "def-public.PersistedState.reset.$1", "type": "CompoundType", "label": "path", "isRequired": true, @@ -296,6 +305,7 @@ "description": [], "children": [ { + "id": "def-public.PersistedState.fromString.$1", "type": "string", "label": "input", "isRequired": true, @@ -351,13 +361,7 @@ "lineNumber": 74 }, "signature": [ - { - "pluginId": "visualizations", - "scope": "public", - "docId": "kibVisualizationsPluginApi", - "section": "def-public.BaseVisType", - "text": "BaseVisType" - }, + "BaseVisType", "" ] }, @@ -453,6 +457,7 @@ "description": [], "children": [ { + "id": "def-public.Vis.Unnamed.$1", "type": "string", "label": "visType", "isRequired": true, @@ -466,6 +471,7 @@ } }, { + "id": "def-public.Vis.Unnamed.$2", "type": "Object", "label": "visState", "isRequired": true, @@ -535,6 +541,7 @@ "description": [], "children": [ { + "id": "def-public.Vis.setState.$1", "type": "Object", "label": "state", "isRequired": true, @@ -673,6 +680,7 @@ "type": "Function", "children": [ { + "id": "def-public.getVisSchemas.$1", "type": "Object", "label": "vis", "isRequired": true, @@ -693,6 +701,7 @@ } }, { + "id": "def-public.getVisSchemas.$2", "type": "Object", "label": "{ timeRange, timefilter }", "isRequired": true, @@ -768,6 +777,7 @@ "description": [], "children": [ { + "id": "def-public.updateOldState.$1", "type": "Unknown", "label": "oldState", "isRequired": true, @@ -794,6 +804,7 @@ "type": "Function", "children": [ { + "id": "def-public.VisualizationContainer.$1", "type": "Object", "label": "{\n 'data-test-subj': dataTestSubj = '',\n className,\n children,\n handlers,\n showNoResult = false,\n}", "isRequired": true, @@ -967,7 +978,7 @@ "children": [ { "tags": [], - "id": "def-public.ISchemas.[AggGroupNames.Buckets]", + "id": "def-public.ISchemas.AggGroupNames.Buckets", "type": "Array", "label": "[AggGroupNames.Buckets]", "description": [], @@ -988,7 +999,7 @@ }, { "tags": [], - "id": "def-public.ISchemas.[AggGroupNames.Metrics]", + "id": "def-public.ISchemas.AggGroupNames.Metrics", "type": "Array", "label": "[AggGroupNames.Metrics]", "description": [], @@ -1100,13 +1111,7 @@ }, "signature": [ "Pick & Pick<{ type: ", { "pluginId": "data", @@ -1562,13 +1567,7 @@ }, "signature": [ "Pick & Pick<{ type: ", { "pluginId": "data", @@ -1867,6 +1866,7 @@ "description": [], "children": [ { + "id": "def-public.VisEditorOptionsProps.setValue.$1", "type": "Uncategorized", "label": "paramName", "isRequired": true, @@ -1880,6 +1880,7 @@ } }, { + "id": "def-public.VisEditorOptionsProps.setValue.$2", "type": "Uncategorized", "label": "value", "isRequired": true, @@ -1910,6 +1911,7 @@ "description": [], "children": [ { + "id": "def-public.VisEditorOptionsProps.setValidity.$1", "type": "boolean", "label": "isValid", "isRequired": true, @@ -1940,6 +1942,7 @@ "description": [], "children": [ { + "id": "def-public.VisEditorOptionsProps.setTouched.$1", "type": "boolean", "label": "isTouched", "isRequired": true, @@ -2052,13 +2055,7 @@ }, "signature": [ "Pick<", - { - "pluginId": "data", - "scope": "public", - "docId": "kibDataQueryPluginApi", - "section": "def-public.Timefilter", - "text": "Timefilter" - }, + "Timefilter", ", \"isTimeRangeSelectorEnabled\" | \"isAutoRefreshSelectorEnabled\" | \"isTimeTouched\" | \"getEnabledUpdated$\" | \"getTimeUpdate$\" | \"getRefreshIntervalUpdate$\" | \"getAutoRefreshFetch$\" | \"getFetch$\" | \"getTime\" | \"getAbsoluteTime\" | \"setTime\" | \"getRefreshInterval\" | \"setRefreshInterval\" | \"createFilter\" | \"getBounds\" | \"calculateBounds\" | \"getActiveBounds\" | \"enableTimeRangeSelector\" | \"disableTimeRangeSelector\" | \"enableAutoRefreshSelector\" | \"disableAutoRefreshSelector\" | \"getTimeDefaults\" | \"getRefreshIntervalDefaults\">" ] }, @@ -2244,13 +2241,7 @@ }, "signature": [ "{ [appName: string]: unknown; visualizations: ", - { - "pluginId": "visualizations", - "scope": "public", - "docId": "kibVisualizationsPluginApi", - "section": "def-public.VisualizationsAppExtension", - "text": "VisualizationsAppExtension" - }, + "VisualizationsAppExtension", "; } | undefined" ] } @@ -2669,13 +2660,7 @@ }, "signature": [ "Partial<", - { - "pluginId": "visualizations", - "scope": "public", - "docId": "kibVisualizationsPluginApi", - "section": "def-public.VisTypeOptions", - "text": "VisTypeOptions" - }, + "VisTypeOptions", "> | undefined" ] }, @@ -3434,13 +3419,7 @@ "text": "SavedObjectLoader" }, " & { findListItems: (search: string, sizeOrOptions?: number | ", - { - "pluginId": "visualizations", - "scope": "public", - "docId": "kibVisualizationsPluginApi", - "section": "def-public.FindListItemsOptions", - "text": "FindListItemsOptions" - }, + "FindListItemsOptions", " | undefined) => any; }" ] }, @@ -3577,13 +3556,7 @@ }, "signature": [ "typeof ", - { - "pluginId": "visualizations", - "scope": "public", - "docId": "kibVisualizationsPluginApi", - "section": "def-public.showNewVisModal", - "text": "showNewVisModal" - } + "showNewVisModal" ] }, { @@ -3630,13 +3603,7 @@ "text": "SavedObjectLoader" }, " & { findListItems: (search: string, sizeOrOptions?: number | ", - { - "pluginId": "visualizations", - "scope": "public", - "docId": "kibVisualizationsPluginApi", - "section": "def-public.FindListItemsOptions", - "text": "FindListItemsOptions" - } + "FindListItemsOptions" ] } ], @@ -3725,13 +3692,7 @@ }, "signature": [ "Pick & Pick<{ type: ", { "pluginId": "data", diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts index 287757dd1911f..341462fdbaffd 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts @@ -56,7 +56,5 @@ export function buildFunctionDec( returnComment: getJSDocReturnTagComment(node), source: getSourceForNode(node), }; - - log.warning(`fn ${label} has tags: ${fn.tags.join(', ')}`); return fn; } diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_parameter_decs.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_parameter_decs.ts index e420f76357f75..d1eaad68961e1 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_parameter_decs.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_parameter_decs.ts @@ -14,6 +14,7 @@ import { buildApiDeclaration } from './build_api_declaration'; import { getJSDocParamComment } from './js_doc_utils'; import { getSourceForNode } from './utils'; import { getTypeKind } from './get_type_kind'; +import { getApiSectionId } from '../utils'; /** * A helper function to capture function parameters, whether it comes from an arrow function, a regular function or @@ -28,13 +29,24 @@ import { getTypeKind } from './get_type_kind'; export function buildApiDecsForParameters( params: ParameterDeclaration[], plugins: KibanaPlatformPlugin[], - anchorLink: AnchorLink, + parentAnchorLink: AnchorLink, log: ToolingLog, jsDocs?: JSDoc[] ): ApiDeclaration[] { + let paramIndex = 0; return params.reduce((acc, param) => { - const label = param.getName(); - log.debug(`Getting parameter doc def for ${label} of kind ${param.getKindName()}`); + paramIndex++; + const apiName = param.getName(); + // Destructured parameters can make these ids look ugly. Instead of parameter name, use an index for the position. + const apiId = parentAnchorLink.apiName + ? parentAnchorLink.apiName + `.$${paramIndex}` + : `$${paramIndex}`; + const anchorLink: AnchorLink = { + scope: parentAnchorLink.scope, + pluginName: parentAnchorLink.pluginName, + apiName: apiId, + }; + log.debug(`Getting parameter doc def for ${apiName} of kind ${param.getKindName()}`); // Literal types are non primitives that aren't references to other types. We add them as a more // defined node, with children. // If we don't want the docs to be too deeply nested we could avoid this special handling. @@ -47,16 +59,17 @@ export function buildApiDecsForParameters( anchorLink.pluginName, anchorLink.scope, anchorLink.apiName, - label + apiName ) ); } else { acc.push({ + id: getApiSectionId(anchorLink), type: getTypeKind(param), - label, + label: apiName, isRequired: param.getType().isNullable() === false, signature: extractImportReferences(param.getType().getText(), plugins, log), - description: jsDocs ? getJSDocParamComment(jsDocs, label) : [], + description: jsDocs ? getJSDocParamComment(jsDocs, apiName) : [], source: getSourceForNode(param), }); } diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/extract_import_refs.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/extract_import_refs.ts index 92f191197472d..7b0fe165f5f09 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/extract_import_refs.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/extract_import_refs.ts @@ -9,7 +9,7 @@ import { KibanaPlatformPlugin, ToolingLog } from '@kbn/dev-utils'; import { getApiSectionId, getPluginApiDocId, getPluginForPath } from '../utils'; import { ApiScope, TextWithLinks } from '../types'; -import { getRelativePath } from './utils'; +import { getRelativePath, pathsOutsideScopes } from './utils'; /** * @@ -115,7 +115,7 @@ function getScopeFromPath(path: string, plugin: KibanaPlatformPlugin, log: Tooli } else if (path.startsWith(`${plugin.directory}/common/`)) { return ApiScope.COMMON; } else { - log.warning(`Unexpected path encountered ${path}`); + pathsOutsideScopes[path] = plugin.directory; return ApiScope.COMMON; } } diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/utils.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/utils.ts index ab8ec7dc3461c..500c87afecd92 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/utils.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/utils.ts @@ -10,6 +10,12 @@ import { REPO_ROOT } from '@kbn/utils'; import { ParameterDeclaration, ClassMemberTypes, Node } from 'ts-morph'; import { SourceLink } from '../types'; +// Collect any paths encountered that are not in the correct scope folder. +// APIs inside these folders will cause issues with the API docs system. The +// path will map to the plugin directory. It _should_ be the prefix of the path, +// but sometimes it is not! +export const pathsOutsideScopes: { [key: string]: string } = {}; + export function isPrivate(node: ParameterDeclaration | ClassMemberTypes): boolean { return node.getModifiers().find((mod) => mod.getText() === 'private') !== undefined; } diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts b/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts index ac6d6088c25c0..7c83a0345386b 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts @@ -9,37 +9,59 @@ import Fs from 'fs'; import Path from 'path'; -import { REPO_ROOT, run } from '@kbn/dev-utils'; +import { REPO_ROOT, run, CiStatsReporter, createFlagError } from '@kbn/dev-utils'; import { Project } from 'ts-morph'; -import { getPluginApi } from './get_plugin_api'; import { writePluginDocs } from './mdx/write_plugin_mdx_docs'; -import { ApiDeclaration, PluginApi } from './types'; +import { ApiDeclaration, PluginApi, TypeKind } from './types'; import { findPlugins } from './find_plugins'; -import { removeBrokenLinks } from './utils'; +import { pathsOutsideScopes } from './build_api_declarations/utils'; +import { getPluginApiMap } from './get_plugin_api_map'; export interface PluginInfo { apiCount: number; apiCountMissingComments: number; id: string; missingApiItems: string[]; + percentApiMissingComments: number; +} + +function isStringArray(arr: unknown | string[]): arr is string[] { + return Array.isArray(arr) && arr.every((p) => typeof p === 'string'); } export function runBuildApiDocsCli() { run( - async ({ log }) => { + async ({ log, flags }) => { + const stats = flags.stats && typeof flags.stats === 'string' ? [flags.stats] : flags.stats; + const pluginFilter = + flags.plugin && typeof flags.plugin === 'string' ? [flags.plugin] : flags.plugin; + + if (pluginFilter && !isStringArray(pluginFilter)) { + throw createFlagError('expected --plugin must only contain strings'); + } + + if ( + (stats && + isStringArray(stats) && + stats.find((s) => s !== 'any' && s !== 'comments' && s !== 'exports')) || + (stats && !isStringArray(stats)) + ) { + throw createFlagError( + 'expected --stats must only contain `any`, `comments` and/or `exports`' + ); + } + const project = getTsProject(REPO_ROOT); const plugins = findPlugins(); - const pluginInfos: { - [key: string]: PluginInfo; - } = {}; - const outputFolder = Path.resolve(REPO_ROOT, 'api_docs'); if (!Fs.existsSync(outputFolder)) { Fs.mkdirSync(outputFolder); - } else { + + // Don't delete all the files if a plugin filter is being used. + } else if (!pluginFilter) { // Delete all files except the README that warns about the auto-generated nature of // the folder. const files = Fs.readdirSync(outputFolder); @@ -50,41 +72,115 @@ export function runBuildApiDocsCli() { }); } - const pluginApiMap: { [key: string]: PluginApi } = {}; - plugins.map((plugin) => { - pluginApiMap[plugin.manifest.id] = getPluginApi(project, plugin, plugins, log); - }); - - const missingApiItems: { [key: string]: string[] } = {}; + const { pluginApiMap, missingApiItems } = getPluginApiMap(project, plugins, log); + const reporter = CiStatsReporter.fromEnv(log); plugins.forEach((plugin) => { - const id = plugin.manifest.id; - const pluginApi = pluginApiMap[id]; - removeBrokenLinks(pluginApi, missingApiItems, pluginApiMap); - }); + // Note that the filtering is done here, and not above because the entire public plugin API has to + // be parsed in order to correctly determine reference links, and ensure that `removeBrokenLinks` + // doesn't remove more links than necessary. + if (pluginFilter && !pluginFilter.includes(plugin.manifest.id)) { + return; + } - plugins.forEach((plugin) => { const id = plugin.manifest.id; const pluginApi = pluginApiMap[id]; - const info = { - id, - apiCount: countApiForPlugin(pluginApi), - apiCountMissingComments: countMissingCommentsApiForPlugin(pluginApi), - missingApiItems: missingApiItems[id], - }; - - if (info.apiCount > 0) { + const apiCount = countApiForPlugin(pluginApi); + const pluginStats = collectApiStatsForPlugin(pluginApi); + + reporter.metrics([ + { + id, + group: 'API count', + value: apiCount, + }, + { + id, + group: 'API count missing comments', + value: pluginStats.missingComments.length, + }, + { + id, + group: 'API count with any type', + value: pluginStats.isAnyType.length, + }, + { + id, + group: 'Non-exported public API item count', + value: missingApiItems[id] ? Object.keys(missingApiItems[id]).length : 0, + }, + ]); + + if (stats) { + const passesAllChecks = + pluginStats.isAnyType.length === 0 && + pluginStats.missingComments.length === 0 && + (!missingApiItems[id] || Object.keys(missingApiItems[id]).length === 0); + + log.info(`--- Plugin '${id}' ${passesAllChecks ? ` passes all checks ----` : '----`'}`); + + if (!passesAllChecks) { + log.info(`${pluginStats.isAnyType.length} API items with ANY`); + + const getLink = (d: ApiDeclaration) => + `https://github.com/elastic/kibana/tree/master/${d.source.path}#L${d.source.lineNumber}`; + if (stats.includes('any')) { + // eslint-disable-next-line no-console + console.table( + pluginStats.isAnyType.map((d) => ({ + id: d.id, + link: getLink(d), + })) + ); + } + + log.info(`${pluginStats.missingComments.length} API items missing comments`); + if (stats.includes('comments')) { + // eslint-disable-next-line no-console + console.table( + pluginStats.missingComments.map((d) => ({ + id: d.id, + link: getLink(d), + })) + ); + } + + if (missingApiItems[id]) { + log.info( + `${Object.keys(missingApiItems[id]).length} referenced API items not exported` + ); + if (stats.includes('exports')) { + // eslint-disable-next-line no-console + console.table( + Object.keys(missingApiItems[id]).map((key) => ({ + 'Not exported source': key, + references: missingApiItems[id][key].join(', '), + })) + ); + } + } + } + } + + if (apiCount > 0) { writePluginDocs(outputFolder, pluginApi, log); - pluginInfos[id] = info; } }); - - // eslint-disable-next-line no-console - console.table(pluginInfos); + if (Object.values(pathsOutsideScopes).length > 0) { + log.warning(`Found paths outside of normal scope folders:`); + log.warning(pathsOutsideScopes); + } }, { log: { - defaultLevel: 'debug', + defaultLevel: 'info', + }, + flags: { + string: ['plugin', 'stats'], + help: ` + --plugin Optionally, run for only a specific plugin + --stats Optionally print API stats. Must be one or more of: any, comments or exports. + `, }, } ); @@ -100,30 +196,38 @@ function getTsProject(repoPath: string) { return project; } -function countMissingCommentsApiForPlugin(doc: PluginApi) { - return ( - doc.client.reduce((sum, def) => { - return sum + countMissingCommentsForApi(def); - }, 0) + - doc.server.reduce((sum, def) => { - return sum + countMissingCommentsForApi(def); - }, 0) + - doc.common.reduce((sum, def) => { - return sum + countMissingCommentsForApi(def); - }, 0) - ); +interface ApiStats { + missingComments: ApiDeclaration[]; + isAnyType: ApiDeclaration[]; } -function countMissingCommentsForApi(doc: ApiDeclaration): number { - const missingCnt = doc.description && doc.description.length > 0 ? 0 : 1; - if (!doc.children) return missingCnt; - else - return ( - missingCnt + - doc.children.reduce((sum, child) => { - return sum + countMissingCommentsForApi(child); - }, 0) - ); +function collectApiStatsForPlugin(doc: PluginApi): ApiStats { + const stats: ApiStats = { missingComments: [], isAnyType: [] }; + Object.values(doc.client).forEach((def) => { + collectStatsForApi(def, stats); + }); + Object.values(doc.server).forEach((def) => { + collectStatsForApi(def, stats); + }); + Object.values(doc.common).forEach((def) => { + collectStatsForApi(def, stats); + }); + return stats; +} + +function collectStatsForApi(doc: ApiDeclaration, stats: ApiStats): void { + const missingComment = doc.description === undefined || doc.description.length === 0; + if (missingComment) { + stats.missingComments.push(doc); + } + if (doc.type === TypeKind.AnyKind) { + stats.isAnyType.push(doc); + } + if (doc.children) { + doc.children.forEach((child) => { + collectStatsForApi(child, stats); + }); + } } function countApiForPlugin(doc: PluginApi) { diff --git a/packages/kbn-docs-utils/src/api_docs/get_declaration_nodes_for_plugin.ts b/packages/kbn-docs-utils/src/api_docs/get_declaration_nodes_for_plugin.ts index 6676c5e753c9b..ee1fdc7f8803d 100644 --- a/packages/kbn-docs-utils/src/api_docs/get_declaration_nodes_for_plugin.ts +++ b/packages/kbn-docs-utils/src/api_docs/get_declaration_nodes_for_plugin.ts @@ -63,7 +63,7 @@ function getExportedFileDeclarations(source: SourceFile, log: ToolingLog): Node[ if (name && name !== '') { nodes.push(ed); } else { - log.warning(`API with missing name encountered.`); + log.warning(`API with missing name encountered, text is ` + ed.getText().substring(0, 50)); } }); }); diff --git a/packages/kbn-docs-utils/src/api_docs/get_plugin_api_map.ts b/packages/kbn-docs-utils/src/api_docs/get_plugin_api_map.ts new file mode 100644 index 0000000000000..74334f5e7b25e --- /dev/null +++ b/packages/kbn-docs-utils/src/api_docs/get_plugin_api_map.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 { KibanaPlatformPlugin, ToolingLog } from '@kbn/dev-utils'; +import { Project } from 'ts-morph'; +import { getPluginApi } from './get_plugin_api'; +import { MissingApiItemMap, PluginApi } from './types'; +import { removeBrokenLinks } from './utils'; + +export function getPluginApiMap( + project: Project, + plugins: KibanaPlatformPlugin[], + log: ToolingLog +): { + pluginApiMap: { [key: string]: PluginApi }; + missingApiItems: MissingApiItemMap; +} { + const pluginApiMap: { [key: string]: PluginApi } = {}; + plugins.map((plugin) => { + pluginApiMap[plugin.manifest.id] = getPluginApi(project, plugin, plugins, log); + }); + + // Mapping of plugin id to the missing source API id to all the plugin API items that referenced this item. + const missingApiItems: { [key: string]: { [key: string]: string[] } } = {}; + + plugins.forEach((plugin) => { + const id = plugin.manifest.id; + const pluginApi = pluginApiMap[id]; + removeBrokenLinks(pluginApi, missingApiItems, pluginApiMap, log); + }); + return { pluginApiMap, missingApiItems }; +} diff --git a/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts b/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts index 5190f8e0c6fb4..356da0afbd8fe 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts +++ b/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts @@ -7,6 +7,7 @@ */ import { TypeWithGeneric, ImAType } from './types'; +import { ImNotExportedFromIndex } from './foo'; /** * This is a non arrow function. @@ -69,11 +70,7 @@ export const crazyFunction = ( { str }: { str: string } ) => () => () => fn({ param: str }); -interface ImNotExported { - foo: string; -} - -export const fnWithNonExportedRef = (a: ImNotExported) => 'shi'; +export const fnWithNonExportedRef = (a: ImNotExportedFromIndex) => a; export type NotAnArrowFnType = typeof notAnArrowFn; diff --git a/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts b/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts index 158eb68b4e5b7..cf20eea76d30d 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts +++ b/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts @@ -15,8 +15,8 @@ import { ToolingLog, KibanaPlatformPlugin } from '@kbn/dev-utils'; import { writePluginDocs } from '../mdx/write_plugin_mdx_docs'; import { ApiDeclaration, PluginApi, Reference, TextWithLinks, TypeKind } from '../types'; import { getKibanaPlatformPlugin } from './kibana_platform_plugin_mock'; -import { getPluginApi } from '../get_plugin_api'; import { groupPluginApi } from '../utils'; +import { getPluginApiMap } from '../get_plugin_api_map'; const log = new ToolingLog({ level: 'debug', @@ -87,8 +87,9 @@ beforeAll(() => { pluginA.manifest.serviceFolders = ['foo']; const plugins: KibanaPlatformPlugin[] = [pluginA]; - doc = getPluginApi(project, plugins[0], plugins, log); + const { pluginApiMap } = getPluginApiMap(project, plugins, log); + doc = pluginApiMap.pluginA; mdxOutputFolder = Path.resolve(__dirname, 'snapshots'); writePluginDocs(mdxOutputFolder, doc, log); }); @@ -137,7 +138,12 @@ describe('functions', () => { it('function referencing missing type has link removed', () => { const fn = doc.client.find((c) => c.label === 'fnWithNonExportedRef'); expect(linkCount(fn?.signature!)).toBe(0); + expect(fn?.children).toBeDefined(); + expect(fn?.children!.length).toBe(1); + expect(fn?.children![0].signature).toBeDefined(); + expect(linkCount(fn?.children![0].signature!)).toBe(0); }); + it('arrow function is exported correctly', () => { const fn = doc.client.find((c) => c.label === 'arrowFn'); // Using the same data as the not an arrow function so this is refactored. @@ -217,6 +223,13 @@ describe('objects', () => { }); describe('Misc types', () => { + it('Type referencing not exported type has the link removed', () => { + const api = doc.client.find((c) => c.label === 'IRefANotExportedType'); + expect(api).toBeDefined(); + expect(api?.signature).toBeDefined(); + expect(linkCount(api?.signature!)).toBe(0); + }); + it('Explicitly typed array is returned with the correct type', () => { const aStrArray = doc.client.find((c) => c.label === 'aStrArray'); expect(aStrArray).toBeDefined(); diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json index e9b87aa0f972f..8f8533abef0d6 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json @@ -90,6 +90,7 @@ "description": [], "children": [ { + "id": "def-public.ExampleClass.Unnamed.$1", "type": "Uncategorized", "label": "t", "isRequired": true, @@ -115,6 +116,7 @@ "type": "Function", "children": [ { + "id": "def-public.ExampleClass.arrowFn.$1", "type": "CompoundType", "label": "a", "isRequired": true, @@ -183,6 +185,7 @@ ], "children": [ { + "id": "def-public.ExampleClass.getVar.$1", "type": "CompoundType", "label": "a", "isRequired": true, @@ -225,6 +228,7 @@ "type": "Function", "children": [ { + "id": "def-public.arrowFn.$1", "type": "string", "label": "a", "isRequired": true, @@ -234,10 +238,11 @@ "description": [], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 42 + "lineNumber": 43 } }, { + "id": "def-public.arrowFn.$2", "type": "number", "label": "b", "isRequired": false, @@ -247,10 +252,11 @@ "description": [], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 43 + "lineNumber": 44 } }, { + "id": "def-public.arrowFn.$3", "type": "Array", "label": "c", "isRequired": true, @@ -267,10 +273,11 @@ "description": [], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 44 + "lineNumber": 45 } }, { + "id": "def-public.arrowFn.$4", "type": "CompoundType", "label": "d", "isRequired": true, @@ -286,10 +293,11 @@ "description": [], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 45 + "lineNumber": 46 } }, { + "id": "def-public.arrowFn.$5", "type": "string", "label": "e", "isRequired": false, @@ -299,7 +307,7 @@ "description": [], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 46 + "lineNumber": 47 } } ], @@ -336,7 +344,7 @@ "label": "arrowFn", "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 41 + "lineNumber": 42 }, "tags": [], "returnComment": [ @@ -349,7 +357,7 @@ "type": "Function", "children": [ { - "id": "def-public.crazyFunction.obj", + "id": "def-public.crazyFunction.$1.obj", "type": "Object", "label": "obj", "tags": [], @@ -357,23 +365,23 @@ "children": [ { "tags": [], - "id": "def-public.crazyFunction.obj.hi", + "id": "def-public.crazyFunction.$1.obj.hi", "type": "string", "label": "hi", "description": [], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 67 + "lineNumber": 68 } } ], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 67 + "lineNumber": 68 } }, { - "id": "def-public.crazyFunction.{-fn }", + "id": "def-public.crazyFunction.$2.fn", "type": "Object", "label": "{ fn }", "tags": [], @@ -381,13 +389,13 @@ "children": [ { "tags": [], - "id": "def-public.crazyFunction.{-fn }.fn", + "id": "def-public.crazyFunction.$2.fn.fn", "type": "Function", "label": "fn", "description": [], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 68 + "lineNumber": 69 }, "signature": [ "(foo: { param: string; }) => number" @@ -396,11 +404,11 @@ ], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 68 + "lineNumber": 69 } }, { - "id": "def-public.crazyFunction.{-str }", + "id": "def-public.crazyFunction.$3.str", "type": "Object", "label": "{ str }", "tags": [], @@ -408,19 +416,19 @@ "children": [ { "tags": [], - "id": "def-public.crazyFunction.{-str }.str", + "id": "def-public.crazyFunction.$3.str.str", "type": "string", "label": "str", "description": [], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 69 + "lineNumber": 70 } } ], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 69 + "lineNumber": 70 } } ], @@ -433,7 +441,7 @@ "label": "crazyFunction", "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 66 + "lineNumber": 67 }, "tags": [], "returnComment": [ @@ -446,27 +454,31 @@ "type": "Function", "children": [ { - "type": "Object", + "id": "def-public.fnWithNonExportedRef.$1", + "type": "Function", "label": "a", "isRequired": true, "signature": [ - "ImNotExported" + "ImNotExportedFromIndex" ], "description": [], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 76 + "lineNumber": 73 } } ], "signature": [ - "(a: ImNotExported) => string" + "(a: ", + "ImNotExportedFromIndex", + ") => ", + "ImNotExportedFromIndex" ], "description": [], "label": "fnWithNonExportedRef", "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 76 + "lineNumber": 73 }, "tags": [], "returnComment": [], @@ -508,6 +520,7 @@ ], "children": [ { + "id": "def-public.notAnArrowFn.$1", "type": "string", "label": "a", "isRequired": true, @@ -519,10 +532,11 @@ ], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 22 + "lineNumber": 23 } }, { + "id": "def-public.notAnArrowFn.$2", "type": "number", "label": "b", "isRequired": false, @@ -534,10 +548,11 @@ ], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 23 + "lineNumber": 24 } }, { + "id": "def-public.notAnArrowFn.$3", "type": "Array", "label": "c", "isRequired": true, @@ -556,10 +571,11 @@ ], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 24 + "lineNumber": 25 } }, { + "id": "def-public.notAnArrowFn.$4", "type": "CompoundType", "label": "d", "isRequired": true, @@ -577,10 +593,11 @@ ], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 25 + "lineNumber": 26 } }, { + "id": "def-public.notAnArrowFn.$5", "type": "string", "label": "e", "isRequired": false, @@ -592,7 +609,7 @@ ], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 26 + "lineNumber": 27 } } ], @@ -602,7 +619,7 @@ ], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 21 + "lineNumber": 22 }, "initialIsOpen": false } @@ -1088,13 +1105,7 @@ "lineNumber": 42 }, "signature": [ - { - "pluginId": "pluginA", - "scope": "public", - "docId": "kibPluginAFooPluginApi", - "section": "def-public.ImNotExportedFromIndex", - "text": "ImNotExportedFromIndex" - }, + "ImNotExportedFromIndex", " | { zed: \"hi\"; }" ], "initialIsOpen": false @@ -1141,7 +1152,7 @@ "description": [], "source": { "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "lineNumber": 78 + "lineNumber": 75 }, "signature": [ "(a: string, b: number | undefined, c: ", @@ -1262,6 +1273,7 @@ "type": "Function", "children": [ { + "id": "def-public.aPretendNamespaceObj.aPropertyInlineFn.$1", "type": "CompoundType", "label": "a", "isRequired": true, @@ -1488,13 +1500,7 @@ }, "signature": [ "() => ", - { - "pluginId": "pluginA", - "scope": "public", - "docId": "kibPluginAPluginApi", - "section": "def-public.SearchLanguage", - "text": "SearchLanguage" - } + "SearchLanguage" ] } ], diff --git a/packages/kbn-docs-utils/src/api_docs/types.ts b/packages/kbn-docs-utils/src/api_docs/types.ts index 3e3537e1eba11..6764592939025 100644 --- a/packages/kbn-docs-utils/src/api_docs/types.ts +++ b/packages/kbn-docs-utils/src/api_docs/types.ts @@ -111,7 +111,7 @@ export interface ApiDeclaration { * Used for an anchor link to this Api. Can't use label as there can be two labels with the same * text within the Client section and the Server section. */ - id?: string; + id: string; /** * The name of the api. @@ -197,3 +197,8 @@ export enum Lifecycle { START = 'start', SETUP = 'setup', } + +// Mapping of plugin id to the missing source API id to all the plugin API items that referenced this item. +export interface MissingApiItemMap { + [key: string]: { [key: string]: string[] }; +} diff --git a/packages/kbn-docs-utils/src/api_docs/utils.test.ts b/packages/kbn-docs-utils/src/api_docs/utils.test.ts index a506405616a47..33aa120dd2b64 100644 --- a/packages/kbn-docs-utils/src/api_docs/utils.test.ts +++ b/packages/kbn-docs-utils/src/api_docs/utils.test.ts @@ -72,12 +72,14 @@ it('test removeBrokenLinks', () => { pluginApiMap[plugin.manifest.id] = getPluginApi(project, plugin, plugins, log); }); - const missingApiItems: { [key: string]: string[] } = {}; + const missingApiItems: { [key: string]: { [key: string]: string[] } } = {}; plugins.forEach((plugin) => { const id = plugin.manifest.id; const pluginApi = pluginApiMap[id]; - removeBrokenLinks(pluginApi, missingApiItems, pluginApiMap); + removeBrokenLinks(pluginApi, missingApiItems, pluginApiMap, log); }); - expect(missingApiItems.pluginA.indexOf('public.ImNotExportedFromIndex')).toBeGreaterThan(-1); + expect(missingApiItems.pluginA['pluginA-public-ImNotExportedFromIndex'].length).toBeGreaterThan( + 0 + ); }); diff --git a/packages/kbn-docs-utils/src/api_docs/utils.ts b/packages/kbn-docs-utils/src/api_docs/utils.ts index 10ca184a72ec1..c3a7e61ec9f86 100644 --- a/packages/kbn-docs-utils/src/api_docs/utils.ts +++ b/packages/kbn-docs-utils/src/api_docs/utils.ts @@ -5,7 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ - +import path from 'path'; import { KibanaPlatformPlugin, ToolingLog } from '@kbn/dev-utils'; import { AnchorLink, @@ -28,14 +28,14 @@ export const snakeToCamel = (str: string): string => /** * Returns the plugin that the file belongs to. - * @param path An absolute file path that can point to a file nested inside a plugin + * @param filePath An absolute file path that can point to a file nested inside a plugin * @param plugins A list of plugins to search through. */ export function getPluginForPath( - path: string, + filePath: string, plugins: KibanaPlatformPlugin[] ): KibanaPlatformPlugin | undefined { - return plugins.find((plugin) => path.startsWith(plugin.directory)); + return plugins.find((plugin) => filePath.startsWith(plugin.directory + path.sep)); } /** @@ -68,13 +68,13 @@ function escapeRegExp(regexp: string) { * name of the first nested folder in the plugin. For example a path of * 'src/plugins/data/public/search_services/file.ts' would return 'search_service' while * 'src/plugin/data/server/file.ts' would return undefined. - * @param path + * @param filePath */ -export function getServiceForPath(path: string, pluginDirectory: string): string | undefined { +export function getServiceForPath(filePath: string, pluginDirectory: string): string | undefined { const dir = escapeRegExp(pluginDirectory); - const publicMatchGroups = path.match(`${dir}\/public\/([^\/]*)\/`); - const serverMatchGroups = path.match(`${dir}\/server\/([^\/]*)\/`); - const commonMatchGroups = path.match(`${dir}\/common\/([^\/]*)\/`); + const publicMatchGroups = filePath.match(`${dir}\/public\/([^\/]*)\/`); + const serverMatchGroups = filePath.match(`${dir}\/server\/([^\/]*)\/`); + const commonMatchGroups = filePath.match(`${dir}\/common\/([^\/]*)\/`); if (publicMatchGroups && publicMatchGroups.length > 1) { return publicMatchGroups[1]; @@ -109,7 +109,9 @@ export function getPluginApiDocId( } export function getApiSectionId(link: AnchorLink) { - const id = `def-${link.scope}.${link.apiName}`.replace(' ', '-'); + // Clean up the name. Things like destructured function parameters can have really long names with brackets and commas. + const cleanName = link.apiName.replace(/[^A-Za-z_.$0-9]+/g, ''); + const id = `def-${link.scope}.${cleanName}`; return id; } @@ -169,29 +171,70 @@ export function addApiDeclarationToScope(declaration: ApiDeclaration, scope: Sco } } +/** + * Loops through the signatures of every API declarations for the given pluginApi. If any are external references that + * don't actually exist inside `pluginApiMap`, it will remove the link and replace the signature with just the text. This way we avoid + * broken links in the docs system. + * @param pluginApi - The plugin API that will have all missing reference links removed. + * @param missingApiItems - Collects all the missing API items encountered so this information can be displayed as stats. + * @param pluginApiMap - Used to look up the referenced API items from other plugins. + * @param log + */ export function removeBrokenLinks( pluginApi: PluginApi, - missingApiItems: { [key: string]: string[] }, - pluginApiMap: { [key: string]: PluginApi } + missingApiItems: { [key: string]: { [key: string]: string[] } }, + pluginApiMap: { [key: string]: PluginApi }, + log: ToolingLog ) { + let missingCnt = 0; (['client', 'common', 'server'] as Array<'client' | 'server' | 'common'>).forEach((scope) => { pluginApi[scope].forEach((api) => { - if (api.signature) { - api.signature = api.signature.map((sig) => { - if (typeof sig !== 'string') { - if (apiItemExists(sig.text, sig.scope, pluginApiMap[sig.pluginId]) === false) { - if (missingApiItems[sig.pluginId] === undefined) { - missingApiItems[sig.pluginId] = []; - } - missingApiItems[sig.pluginId].push(`${sig.scope}.${sig.text}`); - return sig.text; - } + missingCnt += removeBrokenLinksFromApi(pluginApi.id, api, missingApiItems, pluginApiMap); + }); + }); + + if (missingCnt > 0) { + log.info( + `${pluginApi.id} had ${missingCnt} API item references removed to avoid broken links use the flag '--stats exports' to get a list of every missing export ` + ); + } +} + +function removeBrokenLinksFromApi( + pluginId: string, + api: ApiDeclaration, + missingApiItems: { [key: string]: { [key: string]: string[] } }, + pluginApiMap: { [key: string]: PluginApi } +): number { + let missingCnt = 0; + if (api.signature) { + api.signature = api.signature.map((sig) => { + if (typeof sig !== 'string') { + if (!apiItemExists(sig.text, sig.scope, pluginApiMap[sig.pluginId])) { + if (missingApiItems[sig.pluginId] === undefined) { + missingApiItems[sig.pluginId] = {}; + } + const sourceId = `${sig.pluginId}-${sig.scope}-${sig.text}`; + if (missingApiItems[sig.pluginId][sourceId] === undefined) { + missingApiItems[sig.pluginId][sourceId] = []; } - return sig; - }); + + missingApiItems[sig.pluginId][sourceId].push(`${pluginId}-${api.id}`); + + missingCnt++; + return sig.text; + } + return sig; } + return sig; }); - }); + } + if (api.children) { + api.children.forEach((child) => { + missingCnt += removeBrokenLinksFromApi(pluginId, child, missingApiItems, pluginApiMap); + }); + } + return missingCnt; } function apiItemExists(name: string, scope: ApiScope, pluginApi: PluginApi): boolean { diff --git a/test/scripts/checks/plugin_public_api_docs.sh b/test/scripts/checks/plugin_public_api_docs.sh index ffa6afbc9d177..8fe9eb3f2f43c 100644 --- a/test/scripts/checks/plugin_public_api_docs.sh +++ b/test/scripts/checks/plugin_public_api_docs.sh @@ -11,9 +11,10 @@ node scripts/build_api_docs ### ### verify no api changes ### -GIT_CHANGES="$(git ls-files --modified)" -if [ "$GIT_CHANGES" ]; then - echo -e "\n${RED}ERROR: 'node scripts/build_api_docs' caused changes to the following files:${C_RESET}\n" - echo -e "$GIT_CHANGES\n" - exit 1 -fi +### GIT_CHANGES="$(git ls-files --modified)" + +### if [ "$GIT_CHANGES" ]; then +### echo -e "\n${RED}ERROR: 'node scripts/build_api_docs' caused changes to the following files:${C_RESET}\n" +### echo -e "$GIT_CHANGES\n" +### exit 1 +### fi diff --git a/vars/tasks.groovy b/vars/tasks.groovy index 29776e9ab5985..7ed6de8094067 100644 --- a/vars/tasks.groovy +++ b/vars/tasks.groovy @@ -11,7 +11,7 @@ def check() { kibanaPipeline.scriptTask('Check Doc API Changes', 'test/scripts/checks/doc_api_changes.sh'), kibanaPipeline.scriptTask('Check @kbn/pm Distributable', 'test/scripts/checks/kbn_pm_dist.sh'), kibanaPipeline.scriptTask('Check Plugin List Docs', 'test/scripts/checks/plugin_list_docs.sh'), - // kibanaPipeline.scriptTask('Check Public API Docs', 'test/scripts/checks/plugin_public_api_docs.sh'), + kibanaPipeline.scriptTask('Check Public API Docs', 'test/scripts/checks/plugin_public_api_docs.sh'), kibanaPipeline.scriptTask('Check Types', 'test/scripts/checks/type_check.sh'), kibanaPipeline.scriptTask('Check Bundle Limits', 'test/scripts/checks/bundle_limits.sh'), kibanaPipeline.scriptTask('Check i18n', 'test/scripts/checks/i18n.sh'), From e675429b98069337b8bcb2e65733fb9039953acd Mon Sep 17 00:00:00 2001 From: Joe Portner <5295965+jportner@users.noreply.github.com> Date: Thu, 15 Apr 2021 11:57:24 -0400 Subject: [PATCH 22/68] Harden saved object deserialization (#94842) --- .../serialization/serializer.test.ts | 97 +++++++++++-------- .../saved_objects/serialization/serializer.ts | 29 +++++- .../saved_objects/ui_counters/data.json | 4 +- .../saved_objects/usage_counters/data.json | 10 +- 4 files changed, 87 insertions(+), 53 deletions(-) diff --git a/src/core/server/saved_objects/serialization/serializer.test.ts b/src/core/server/saved_objects/serialization/serializer.test.ts index 6c7fcc88cc902..3fdeb4aa088e1 100644 --- a/src/core/server/saved_objects/serialization/serializer.test.ts +++ b/src/core/server/saved_objects/serialization/serializer.test.ts @@ -158,7 +158,6 @@ describe('#rawToSavedObject', () => { _id: 'foo:bar', _source: { type: 'foo', - hello: {}, }, }); expect(actual).not.toHaveProperty('version'); @@ -171,7 +170,6 @@ describe('#rawToSavedObject', () => { _primary_term: 1, _source: { type: 'foo', - hello: {}, }, }); expect(actual).toHaveProperty('version', encodeVersion(4, 1)); @@ -184,7 +182,6 @@ describe('#rawToSavedObject', () => { _seq_no: 4, _source: { type: 'foo', - hello: {}, }, }) ).toThrowErrorMatchingInlineSnapshot(`"_primary_term from elasticsearch must be an integer"`); @@ -197,7 +194,6 @@ describe('#rawToSavedObject', () => { _primary_term: 1, _source: { type: 'foo', - hello: {}, }, }) ).toThrowErrorMatchingInlineSnapshot(`"_seq_no from elasticsearch must be an integer"`); @@ -249,7 +245,7 @@ describe('#rawToSavedObject', () => { test('it does not pass unknown properties through', () => { const actual = singleNamespaceSerializer.rawToSavedObject({ - _id: 'universe', + _id: 'hello:universe', _source: { type: 'hello', hello: { @@ -270,7 +266,7 @@ describe('#rawToSavedObject', () => { test('it does not create attributes if [type] is missing', () => { const actual = singleNamespaceSerializer.rawToSavedObject({ - _id: 'universe', + _id: 'hello:universe', _source: { type: 'hello', }, @@ -285,14 +281,14 @@ describe('#rawToSavedObject', () => { test('it fails for documents which do not specify a type', () => { expect(() => singleNamespaceSerializer.rawToSavedObject({ - _id: 'universe', + _id: 'hello:universe', _source: { hello: { world: 'earth', }, } as any, }) - ).toThrow(/Expected "undefined" to be a saved object type/); + ).toThrow(`Raw document 'hello:universe' is missing _source.type field`); }); test('it is complimentary with savedObjectToRaw', () => { @@ -325,29 +321,30 @@ describe('#rawToSavedObject', () => { ).toEqual(raw); }); - test('it handles unprefixed ids', () => { - const actual = singleNamespaceSerializer.rawToSavedObject({ - _id: 'universe', - _source: { - type: 'hello', - }, - }); - - expect(actual).toHaveProperty('id', 'universe'); + test('fails for documents which do not have a type prefix in their _id', () => { + expect(() => + singleNamespaceSerializer.rawToSavedObject({ + _id: 'universe', + _source: { + type: 'hello', + }, + }) + ).toThrow(`Raw document 'universe' does not start with expected prefix 'hello:'`); }); describe('namespace-agnostic type with a namespace', () => { - const raw = createSampleDoc({ _source: { namespace: 'baz' } }); + const raw = createSampleDoc({ _source: { namespace: 'baz' } }); // namespace field should be ignored const actual = namespaceAgnosticSerializer.rawToSavedObject(raw); test(`removes type prefix from _id`, () => { expect(actual).toHaveProperty('id', 'bar'); }); - test(`copies _id to id if prefixed by namespace and type`, () => { + test(`fails for documents which have a namespace prefix in their _id`, () => { const _id = `${raw._source.namespace}:${raw._id}`; - const _actual = namespaceAgnosticSerializer.rawToSavedObject({ ...raw, _id }); - expect(_actual).toHaveProperty('id', _id); + expect(() => namespaceAgnosticSerializer.rawToSavedObject({ ...raw, _id })).toThrow( + `Raw document 'baz:foo:bar' does not start with expected prefix 'foo:'` + ); }); test(`doesn't copy _source.namespace to namespace`, () => { @@ -372,10 +369,11 @@ describe('#rawToSavedObject', () => { expect(actual).toHaveProperty('id', 'bar'); }); - test(`copies _id to id if prefixed by random prefix and type`, () => { + test(`fails for documents which have any extra prefix in their _id`, () => { const _id = `random:${raw._id}`; - const _actual = singleNamespaceSerializer.rawToSavedObject({ ...raw, _id }); - expect(_actual).toHaveProperty('id', _id); + expect(() => singleNamespaceSerializer.rawToSavedObject({ ...raw, _id })).toThrow( + `Raw document 'random:foo:bar' does not start with expected prefix 'foo:'` + ); }); test(`doesn't specify namespace`, () => { @@ -385,23 +383,28 @@ describe('#rawToSavedObject', () => { describe('single-namespace type with a namespace', () => { const namespace = 'baz'; - const raw = createSampleDoc({ _source: { namespace } }); + const raw = createSampleDoc({ + _id: `${namespace}:${sampleTemplate._id}`, + _source: { namespace }, + }); const actual = singleNamespaceSerializer.rawToSavedObject(raw); test(`removes type and namespace prefix from _id`, () => { - const _id = `${namespace}:${raw._id}`; - const _actual = singleNamespaceSerializer.rawToSavedObject({ ...raw, _id }); - expect(_actual).toHaveProperty('id', 'bar'); + expect(actual).toHaveProperty('id', 'bar'); }); - test(`copies _id to id if prefixed only by type`, () => { - expect(actual).toHaveProperty('id', raw._id); + test(`fails for documents which do not have a namespace prefix in their _id`, () => { + const _id = sampleTemplate._id; + expect(() => singleNamespaceSerializer.rawToSavedObject({ ...raw, _id })).toThrow( + `Raw document 'foo:bar' does not start with expected prefix 'baz:foo:'` + ); }); - test(`copies _id to id if prefixed by random prefix and type`, () => { + test(`fails for documents which have any extra prefix in their _id`, () => { const _id = `random:${raw._id}`; - const _actual = singleNamespaceSerializer.rawToSavedObject({ ...raw, _id }); - expect(_actual).toHaveProperty('id', _id); + expect(() => singleNamespaceSerializer.rawToSavedObject({ ...raw, _id })).toThrow( + `Raw document 'random:baz:foo:bar' does not start with expected prefix 'baz:foo:'` + ); }); test(`copies _source.namespace to namespace`, () => { @@ -419,17 +422,25 @@ describe('#rawToSavedObject', () => { }); describe('multi-namespace type with a namespace', () => { - const raw = createSampleDoc({ _source: { namespace: 'baz' } }); + const raw = createSampleDoc({ _source: { namespace: 'baz' } }); // namespace should be ignored const actual = multiNamespaceSerializer.rawToSavedObject(raw); test(`removes type prefix from _id`, () => { expect(actual).toHaveProperty('id', 'bar'); }); - test(`copies _id to id if prefixed by namespace and type`, () => { + test(`fails for documents which have a namespace prefix in their _id`, () => { const _id = `${raw._source.namespace}:${raw._id}`; - const _actual = multiNamespaceSerializer.rawToSavedObject({ ...raw, _id }); - expect(_actual).toHaveProperty('id', _id); + expect(() => multiNamespaceSerializer.rawToSavedObject({ ...raw, _id })).toThrow( + `Raw document 'baz:foo:bar' does not start with expected prefix 'foo:'` + ); + }); + + test(`fails for documents which have any extra prefix in their _id`, () => { + const _id = `random:${raw._id}`; + expect(() => multiNamespaceSerializer.rawToSavedObject({ ...raw, _id })).toThrow( + `Raw document 'random:foo:bar' does not start with expected prefix 'foo:'` + ); }); test(`doesn't copy _source.namespace to namespace`, () => { @@ -785,7 +796,7 @@ describe('#isRawSavedObject', () => { ).toBeFalsy(); }); - test('is false if there is no [type] attribute', () => { + test('is true if there is no [type] attribute', () => { expect( singleNamespaceSerializer.isRawSavedObject({ _id: 'hello:world', @@ -794,7 +805,7 @@ describe('#isRawSavedObject', () => { jam: {}, }, }) - ).toBeFalsy(); + ).toBeTruthy(); }); }); @@ -1014,7 +1025,7 @@ describe('#isRawSavedObject', () => { ).toBeFalsy(); }); - test('is false if there is no [type] attribute', () => { + test('is true if there is no [type] attribute', () => { expect( multiNamespaceSerializer.isRawSavedObject({ _id: 'hello:world', @@ -1024,7 +1035,7 @@ describe('#isRawSavedObject', () => { namespace: 'foo', }, }) - ).toBeFalsy(); + ).toBeTruthy(); }); }); @@ -1107,7 +1118,7 @@ describe('#isRawSavedObject', () => { ).toBeFalsy(); }); - test('is false if there is no [type] attribute', () => { + test('is true if there is no [type] attribute', () => { expect( namespaceAgnosticSerializer.isRawSavedObject({ _id: 'hello:world', @@ -1117,7 +1128,7 @@ describe('#isRawSavedObject', () => { namespace: 'foo', }, }) - ).toBeFalsy(); + ).toBeTruthy(); }); }); }); diff --git a/src/core/server/saved_objects/serialization/serializer.ts b/src/core/server/saved_objects/serialization/serializer.ts index cd6c68a6de076..4b955032939b3 100644 --- a/src/core/server/saved_objects/serialization/serializer.ts +++ b/src/core/server/saved_objects/serialization/serializer.ts @@ -39,14 +39,35 @@ export class SavedObjectsSerializer { * @param {SavedObjectsRawDocParseOptions} options - Options for parsing the raw document. */ public isRawSavedObject(doc: SavedObjectsRawDoc, options: SavedObjectsRawDocParseOptions = {}) { + try { + this.checkIsRawSavedObject(doc, options); + return true; + } catch (error) { + // do nothing + } + return false; + } + + private checkIsRawSavedObject( + doc: SavedObjectsRawDoc, + options: SavedObjectsRawDocParseOptions = {} + ) { const { namespaceTreatment = 'strict' } = options; const { _id, _source } = doc; const { type, namespace } = _source; if (!type) { - return false; + throw new Error(`Raw document '${_id}' is missing _source.type field`); } - const { idMatchesPrefix } = this.parseIdPrefix(namespace, type, _id, namespaceTreatment); - return idMatchesPrefix && _source.hasOwnProperty(type); + const { idMatchesPrefix, prefix } = this.parseIdPrefix( + namespace, + type, + _id, + namespaceTreatment + ); + if (!idMatchesPrefix) { + throw new Error(`Raw document '${_id}' does not start with expected prefix '${prefix}'`); + } + return idMatchesPrefix; } /** @@ -59,6 +80,8 @@ export class SavedObjectsSerializer { doc: SavedObjectsRawDoc, options: SavedObjectsRawDocParseOptions = {} ): SavedObjectSanitizedDoc { + this.checkIsRawSavedObject(doc, options); // throws a descriptive error if the document is not a saved object + const { namespaceTreatment = 'strict' } = options; const { _id, _source, _seq_no, _primary_term } = doc; const { diff --git a/test/api_integration/fixtures/es_archiver/saved_objects/ui_counters/data.json b/test/api_integration/fixtures/es_archiver/saved_objects/ui_counters/data.json index 80071fe422780..8192c3c161f93 100644 --- a/test/api_integration/fixtures/es_archiver/saved_objects/ui_counters/data.json +++ b/test/api_integration/fixtures/es_archiver/saved_objects/ui_counters/data.json @@ -77,7 +77,7 @@ "type": "doc", "value": { "index": ".kibana", - "id": "uiCounter:09042021:count:myApp:some_app_event", + "id": "usage-counters:uiCounter:09042021:count:myApp:some_app_event", "source": { "usage-counters": { "count": 2, @@ -95,7 +95,7 @@ "type": "doc", "value": { "index": ".kibana", - "id": "anotherDomainId:09042021:count:some_event_name", + "id": "usage-counters:anotherDomainId:09042021:count:some_event_name", "source": { "usage-counters": { "count": 2, diff --git a/test/api_integration/fixtures/es_archiver/saved_objects/usage_counters/data.json b/test/api_integration/fixtures/es_archiver/saved_objects/usage_counters/data.json index 16e0364b24fda..cd8d63dffa04e 100644 --- a/test/api_integration/fixtures/es_archiver/saved_objects/usage_counters/data.json +++ b/test/api_integration/fixtures/es_archiver/saved_objects/usage_counters/data.json @@ -2,7 +2,7 @@ "type": "doc", "value": { "index": ".kibana", - "id": "uiCounter:20112020:count:myApp:some_app_event", + "id": "usage-counters:uiCounter:20112020:count:myApp:some_app_event", "source": { "usage-counters": { "count": 2, @@ -20,7 +20,7 @@ "type": "doc", "value": { "index": ".kibana", - "id": "anotherDomainId:20112020:count:some_event_name", + "id": "usage-counters:anotherDomainId:20112020:count:some_event_name", "source": { "usage-counters": { "count": 3, @@ -38,7 +38,7 @@ "type": "doc", "value": { "index": ".kibana", - "id": "anotherDomainId:09042021:count:some_event_name", + "id": "usage-counters:anotherDomainId:09042021:count:some_event_name", "source": { "usage-counters": { "count": 2, @@ -56,7 +56,7 @@ "type": "doc", "value": { "index": ".kibana", - "id": "anotherDomainId2:09042021:count:some_event_name", + "id": "usage-counters:anotherDomainId2:09042021:count:some_event_name", "source": { "usage-counters": { "count": 1, @@ -74,7 +74,7 @@ "type": "doc", "value": { "index": ".kibana", - "id": "anotherDomainId3:09042021:custom_type:zero_count", + "id": "usage-counters:anotherDomainId3:09042021:custom_type:zero_count", "source": { "usage-counters": { "count": 0, From 6c07eb238212b8d6b48579640e8374cef5046d36 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 15 Apr 2021 17:57:44 +0200 Subject: [PATCH 23/68] fix test leak (#97082) --- .../components/line_clamp/index.test.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/components/line_clamp/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/line_clamp/index.test.tsx index a1547940765c9..73f46a1771030 100644 --- a/x-pack/plugins/security_solution/public/common/components/line_clamp/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/line_clamp/index.test.tsx @@ -43,17 +43,19 @@ describe('LineClamp', () => { describe('overflow', () => { const clientHeight = 400; const scrollHeight = clientHeight + 100; // scrollHeight is > clientHeight + let spyClientHeight: jest.SpyInstance; + let spyScrollHeight: jest.SpyInstance; beforeAll(() => { - Object.defineProperty(HTMLElement.prototype, 'clientHeight', { - configurable: true, - value: clientHeight, - }); + spyClientHeight = jest.spyOn(window.HTMLElement.prototype, 'clientHeight', 'get'); + spyClientHeight.mockReturnValue(clientHeight); + spyScrollHeight = jest.spyOn(window.HTMLElement.prototype, 'scrollHeight', 'get'); + spyScrollHeight.mockReturnValue(scrollHeight); + }); - Object.defineProperty(HTMLElement.prototype, 'scrollHeight', { - configurable: true, - value: scrollHeight, - }); + afterAll(() => { + spyClientHeight.mockRestore(); + spyScrollHeight.mockRestore(); }); test('it does NOT render the expanded line clamp by default when isOverflow is true', () => { From 5ecf09843e7bcc4a5beaa33772b5716a2250de8f Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 15 Apr 2021 18:02:18 +0200 Subject: [PATCH 24/68] [ILM] Support max primary shard size rollover field (#96545) * added max primary shard size rollover field * large-ish refactor of the hot phase component to move the rollover fields to their own components * added comment * address i18n issue * - fixed jest tests - fixed behaviour to show missing value for rollover - updated jest snapshots * added field deprecation component * added test for whether deprecation icon is visible * remove unused import, remove type generic from FormSchema * fixed getting "getFields" from incorrect object * wip!!! * - removed FieldDeprecationWarning component and associated tests - implmented always showing the warning icon and updated the color - cleaned up test helpers * - more tightly grouped the numeric inputs with their unit selects by reducing the gutter size before defazios feedback - fixed alignment issue between numeric rollover inputs and their unit select field by adding flex-end styling to the groups Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../edit_policy/constants.ts | 9 +- .../edit_policy/edit_policy.helpers.tsx | 13 ++ .../features/request_flyout.test.ts | 2 +- .../hot_phase_validation.test.ts | 27 ++- .../policy_serialization.test.ts | 165 +++++++++--------- .../common/types/policies.ts | 6 +- .../public/application/constants/policy.ts | 2 +- .../public/application/lib/rollover.ts | 2 +- .../phases/hot_phase/components/index.ts | 14 ++ .../hot_phase/components/max_age_field.tsx | 55 ++++++ .../components/max_document_count_field.tsx | 32 ++++ .../components/max_index_size_field.tsx | 66 +++++++ .../max_primary_shard_size_field.tsx | 55 ++++++ .../components/phases/hot_phase/hot_phase.tsx | 136 +++------------ .../use_rollover_value_required_validation.ts | 36 ++++ .../sections/edit_policy/constants.ts | 1 + .../sections/edit_policy/form/deserializer.ts | 8 + .../form/deserializer_and_serializer.test.ts | 3 +- .../sections/edit_policy/form/schema.ts | 20 +++ .../edit_policy/form/serializer/serializer.ts | 6 + .../sections/edit_policy/form/validations.ts | 61 ++++--- .../sections/edit_policy/i18n_texts.ts | 8 +- .../application/sections/edit_policy/types.ts | 7 +- .../public/shared_imports.ts | 1 + 24 files changed, 504 insertions(+), 231 deletions(-) create mode 100644 x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/index.ts create mode 100644 x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_age_field.tsx create mode 100644 x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_document_count_field.tsx create mode 100644 x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_index_size_field.tsx create mode 100644 x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_primary_shard_size_field.tsx create mode 100644 x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/use_rollover_value_required_validation.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/constants.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/constants.ts index 2c84acc969496..3f550aef40ac9 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/constants.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/constants.ts @@ -9,6 +9,8 @@ import moment from 'moment-timezone'; import { PolicyFromES } from '../../../common/types'; +import { defaultRolloverAction } from '../../../public/application/constants'; + export const POLICY_NAME = 'my_policy'; export const SNAPSHOT_POLICY_NAME = 'my_snapshot_policy'; export const NEW_SNAPSHOT_POLICY_NAME = 'my_new_snapshot_policy'; @@ -22,10 +24,7 @@ export const POLICY_WITH_MIGRATE_OFF: PolicyFromES = { hot: { min_age: '0ms', actions: { - rollover: { - max_age: '30d', - max_size: '50gb', - }, + rollover: defaultRolloverAction, }, }, warm: { @@ -117,7 +116,7 @@ export const getDefaultHotPhasePolicy = (policyName: string): PolicyFromES => ({ actions: { rollover: { max_age: '30d', - max_size: '50gb', + max_primary_shard_size: '50gb', }, }, }, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx index 6e4dbd90082a4..26ed0a7728d2f 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx @@ -138,6 +138,18 @@ export const setup = async (arg?: { const toggleRollover = createFormToggleAction('rolloverSwitch'); + const setMaxPrimaryShardSize = async (value: string, units?: string) => { + await act(async () => { + find('hot-selectedMaxPrimaryShardSize').simulate('change', { target: { value } }); + if (units) { + find('hot-selectedMaxPrimaryShardSize.select').simulate('change', { + target: { value: units }, + }); + } + }); + component.update(); + }; + const setMaxSize = async (value: string, units?: string) => { await act(async () => { find('hot-selectedMaxSizeStored').simulate('change', { target: { value } }); @@ -351,6 +363,7 @@ export const setup = async (arg?: { setMaxSize, setMaxDocs, setMaxAge, + setMaxPrimaryShardSize, toggleRollover, toggleDefaultRollover, hasRolloverSettingRequiredCallout, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/request_flyout.test.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/request_flyout.test.ts index 6584c19c85be3..fbd0152e19cc4 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/request_flyout.test.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/request_flyout.test.ts @@ -51,7 +51,7 @@ describe(' request flyout', () => { actions: { rollover: { max_age: '30d', - max_size: '50gb', + max_primary_shard_size: '50gb', }, }, }, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/hot_phase_validation.test.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/hot_phase_validation.test.ts index ba260ee33e31e..46fbf69fbcad5 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/hot_phase_validation.test.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/hot_phase_validation.test.ts @@ -38,21 +38,44 @@ describe(' hot phase validation', () => { }); describe('rollover', () => { - test(`doesn't allow no max size, no max age and no max docs`, async () => { + test(`doesn't allow no max primary shard size, no max index size, no max age, no max docs`, async () => { const { actions } = testBed; await actions.hot.toggleDefaultRollover(false); expect(actions.hot.hasRolloverSettingRequiredCallout()).toBeFalsy(); - await actions.hot.setMaxSize(''); + await actions.hot.setMaxPrimaryShardSize(''); await actions.hot.setMaxAge(''); await actions.hot.setMaxDocs(''); + await actions.hot.setMaxSize(''); runTimers(); expect(actions.hot.hasRolloverSettingRequiredCallout()).toBeTruthy(); }); + test(`doesn't allow -1 for max primary shard size`, async () => { + const { actions } = testBed; + + await actions.hot.toggleDefaultRollover(false); + await actions.hot.setMaxPrimaryShardSize('-1'); + + runTimers(); + + actions.expectErrorMessages([i18nTexts.editPolicy.errors.numberGreatThan0Required]); + }); + + test(`doesn't allow 0 for max primary shard size`, async () => { + const { actions } = testBed; + + await actions.hot.toggleDefaultRollover(false); + await actions.hot.setMaxPrimaryShardSize('0'); + + runTimers(); + + actions.expectErrorMessages([i18nTexts.editPolicy.errors.numberGreatThan0Required]); + }); + test(`doesn't allow -1 for max size`, async () => { const { actions } = testBed; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.test.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.test.ts index 7a0571e4a7cb2..15d89c988f729 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.test.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.test.ts @@ -115,7 +115,7 @@ describe(' serialization', () => { actions: { rollover: { max_age: '30d', - max_size: '50gb', + max_primary_shard_size: '50gb', }, set_priority: { priority: 100, @@ -153,7 +153,7 @@ describe(' serialization', () => { actions: { rollover: { max_age: '30d', - max_size: '50gb', + max_primary_shard_size: '50gb', }, set_priority: { priority: 100, @@ -187,33 +187,34 @@ describe(' serialization', () => { const latestRequest = server.requests[server.requests.length - 1]; const entirePolicy = JSON.parse(JSON.parse(latestRequest.requestBody).body); expect(entirePolicy).toMatchInlineSnapshot(` - Object { - "name": "my_policy", - "phases": Object { - "hot": Object { - "actions": Object { - "forcemerge": Object { - "index_codec": "best_compression", - "max_num_segments": 123, - }, - "readonly": Object {}, - "rollover": Object { - "max_age": "123h", - "max_docs": 123, - "max_size": "123mb", - }, - "set_priority": Object { - "priority": 123, - }, - "shrink": Object { - "number_of_shards": 2, - }, + Object { + "name": "my_policy", + "phases": Object { + "hot": Object { + "actions": Object { + "forcemerge": Object { + "index_codec": "best_compression", + "max_num_segments": 123, + }, + "readonly": Object {}, + "rollover": Object { + "max_age": "123h", + "max_docs": 123, + "max_primary_shard_size": "50gb", + "max_size": "123mb", + }, + "set_priority": Object { + "priority": 123, + }, + "shrink": Object { + "number_of_shards": 2, }, - "min_age": "0ms", }, + "min_age": "0ms", }, - } - `); + }, + } + `); }); test('setting searchable snapshot', async () => { @@ -299,43 +300,43 @@ describe(' serialization', () => { const entirePolicy = JSON.parse(JSON.parse(latestRequest.requestBody).body); // Check shape of entire policy expect(entirePolicy).toMatchInlineSnapshot(` - Object { - "name": "my_policy", - "phases": Object { - "hot": Object { - "actions": Object { - "rollover": Object { - "max_age": "30d", - "max_size": "50gb", - }, + Object { + "name": "my_policy", + "phases": Object { + "hot": Object { + "actions": Object { + "rollover": Object { + "max_age": "30d", + "max_primary_shard_size": "50gb", }, - "min_age": "0ms", }, - "warm": Object { - "actions": Object { - "allocate": Object { - "number_of_replicas": 123, - "require": Object { - "test": "123", - }, - }, - "forcemerge": Object { - "index_codec": "best_compression", - "max_num_segments": 123, - }, - "readonly": Object {}, - "set_priority": Object { - "priority": 123, - }, - "shrink": Object { - "number_of_shards": 123, + "min_age": "0ms", + }, + "warm": Object { + "actions": Object { + "allocate": Object { + "number_of_replicas": 123, + "require": Object { + "test": "123", }, }, - "min_age": "11d", + "forcemerge": Object { + "index_codec": "best_compression", + "max_num_segments": 123, + }, + "readonly": Object {}, + "set_priority": Object { + "priority": 123, + }, + "shrink": Object { + "number_of_shards": 123, + }, }, + "min_age": "11d", }, - } - `); + }, + } + `); }); describe('policy with include and exclude', () => { @@ -437,37 +438,37 @@ describe(' serialization', () => { const entirePolicy = JSON.parse(JSON.parse(latestRequest.requestBody).body); expect(entirePolicy).toMatchInlineSnapshot(` - Object { - "name": "my_policy", - "phases": Object { - "cold": Object { - "actions": Object { - "allocate": Object { - "number_of_replicas": 123, - "require": Object { - "test": "123", - }, - }, - "freeze": Object {}, - "readonly": Object {}, - "set_priority": Object { - "priority": 123, + Object { + "name": "my_policy", + "phases": Object { + "cold": Object { + "actions": Object { + "allocate": Object { + "number_of_replicas": 123, + "require": Object { + "test": "123", }, }, - "min_age": "123s", + "freeze": Object {}, + "readonly": Object {}, + "set_priority": Object { + "priority": 123, + }, }, - "hot": Object { - "actions": Object { - "rollover": Object { - "max_age": "30d", - "max_size": "50gb", - }, + "min_age": "123s", + }, + "hot": Object { + "actions": Object { + "rollover": Object { + "max_age": "30d", + "max_primary_shard_size": "50gb", }, - "min_age": "0ms", }, + "min_age": "0ms", }, - } - `); + }, + } + `); }); // Setting searchable snapshot field disables setting replicas so we test this separately diff --git a/x-pack/plugins/index_lifecycle_management/common/types/policies.ts b/x-pack/plugins/index_lifecycle_management/common/types/policies.ts index f4ff69f9b5c10..337a1be2b2fbc 100644 --- a/x-pack/plugins/index_lifecycle_management/common/types/policies.ts +++ b/x-pack/plugins/index_lifecycle_management/common/types/policies.ts @@ -70,9 +70,13 @@ export interface SearchableSnapshotAction { } export interface RolloverAction { - max_size?: string; max_age?: string; max_docs?: number; + max_primary_shard_size?: string; + /** + * @deprecated This will be removed in versions 8+ of the stack + */ + max_size?: string; } export interface SerializedHotPhase extends SerializedPhase { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/constants/policy.ts b/x-pack/plugins/index_lifecycle_management/public/application/constants/policy.ts index 6e3134f9f2428..293e232e349df 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/constants/policy.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/constants/policy.ts @@ -16,7 +16,7 @@ export const defaultIndexPriority = { export const defaultRolloverAction: RolloverAction = { max_age: '30d', - max_size: '50gb', + max_primary_shard_size: '50gb', }; export const defaultPolicy: SerializedPolicy = { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/lib/rollover.ts b/x-pack/plugins/index_lifecycle_management/public/application/lib/rollover.ts index 20f1e01bed065..e5a169e83a993 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/lib/rollover.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/lib/rollover.ts @@ -14,6 +14,6 @@ export const isUsingDefaultRollover = (policy: SerializedPolicy): boolean => { rollover && rollover.max_age === defaultRolloverAction.max_age && rollover.max_docs === defaultRolloverAction.max_docs && - rollover.max_size === defaultRolloverAction.max_size + rollover.max_primary_shard_size === defaultRolloverAction.max_primary_shard_size ); }; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/index.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/index.ts new file mode 100644 index 0000000000000..7459ee7558f53 --- /dev/null +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/index.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { MaxPrimaryShardSizeField } from './max_primary_shard_size_field'; + +export { MaxAgeField } from './max_age_field'; + +export { MaxDocumentCountField } from './max_document_count_field'; + +export { MaxIndexSizeField } from './max_index_size_field'; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_age_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_age_field.tsx new file mode 100644 index 0000000000000..2d3704e252ac8 --- /dev/null +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_age_field.tsx @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FunctionComponent } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; + +import { NumericField, SelectField } from '../../../../../../../shared_imports'; +import { UseField } from '../../../../form'; +import { ROLLOVER_FORM_PATHS } from '../../../../constants'; + +import { maxAgeUnits } from '../constants'; + +export const MaxAgeField: FunctionComponent = () => { + return ( + + + + + + + + + ); +}; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_document_count_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_document_count_field.tsx new file mode 100644 index 0000000000000..c6f8abef3f2c2 --- /dev/null +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_document_count_field.tsx @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FunctionComponent } from 'react'; +import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; + +import { NumericField } from '../../../../../../../shared_imports'; +import { UseField } from '../../../../form'; +import { ROLLOVER_FORM_PATHS } from '../../../../constants'; + +export const MaxDocumentCountField: FunctionComponent = () => { + return ( + + + + + + ); +}; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_index_size_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_index_size_field.tsx new file mode 100644 index 0000000000000..78f3c74c9cb82 --- /dev/null +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_index_size_field.tsx @@ -0,0 +1,66 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FunctionComponent } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiFlexGroup, EuiFlexItem, EuiIconTip } from '@elastic/eui'; + +import { NumericField, SelectField } from '../../../../../../../shared_imports'; +import { UseField } from '../../../../form'; +import { ROLLOVER_FORM_PATHS } from '../../../../constants'; + +import { maxSizeStoredUnits } from '../constants'; + +const i18nTexts = { + deprecationMessage: i18n.translate( + 'xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeDeprecationMessage', + { + defaultMessage: + 'Maximum index size is deprecated and will be removed in a future version. Use maximum primary shard size instead.', + } + ), + maxSizeUnit: { + ariaLabel: i18n.translate('xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeUnitsAriaLabel', { + defaultMessage: 'Maximum index size units', + }), + }, +}; + +export const MaxIndexSizeField: FunctionComponent = () => { + return ( + + + , + min: 1, + }, + }} + /> + + + + + + ); +}; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_primary_shard_size_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_primary_shard_size_field.tsx new file mode 100644 index 0000000000000..eed23bd48a0fa --- /dev/null +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_primary_shard_size_field.tsx @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FunctionComponent } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; + +import { NumericField, SelectField } from '../../../../../../../shared_imports'; +import { UseField } from '../../../../form'; +import { ROLLOVER_FORM_PATHS } from '../../../../constants'; + +import { maxSizeStoredUnits } from '../constants'; + +export const MaxPrimaryShardSizeField: FunctionComponent = () => { + return ( + + + + + + + + + ); +}; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx index ea345009b230b..dc4a8dca60694 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx @@ -5,25 +5,17 @@ * 2.0. */ -import React, { FunctionComponent, useState } from 'react'; +import React, { FunctionComponent } from 'react'; import { get } from 'lodash'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { - EuiFlexGroup, - EuiFlexItem, - EuiSpacer, - EuiCallOut, - EuiTextColor, - EuiSwitch, - EuiText, -} from '@elastic/eui'; +import { EuiSpacer, EuiCallOut, EuiTextColor, EuiSwitch, EuiText } from '@elastic/eui'; -import { useFormData, SelectField, NumericField } from '../../../../../../shared_imports'; +import { useFormData } from '../../../../../../shared_imports'; import { i18nTexts } from '../../../i18n_texts'; -import { ROLLOVER_EMPTY_VALIDATION, useConfiguration, UseField } from '../../../form'; +import { useConfiguration, UseField } from '../../../form'; import { useEditPolicyContext } from '../../../edit_policy_context'; @@ -40,19 +32,28 @@ import { } from '../shared_fields'; import { Phase } from '../phase'; -import { maxSizeStoredUnits, maxAgeUnits } from './constants'; +import { useRolloverValueRequiredValidation } from './use_rollover_value_required_validation'; +import { + MaxPrimaryShardSizeField, + MaxAgeField, + MaxDocumentCountField, + MaxIndexSizeField, +} from './components'; + +const rolloverFieldPaths = Object.values(ROLLOVER_FORM_PATHS); export const HotPhase: FunctionComponent = () => { const { license } = useEditPolicyContext(); const [formData] = useFormData({ - watch: isUsingDefaultRolloverPath, + watch: [isUsingDefaultRolloverPath, ...rolloverFieldPaths], }); const { isUsingRollover } = useConfiguration(); const isUsingDefaultRollover: boolean = get(formData, isUsingDefaultRolloverPath); - const [showEmptyRolloverFieldsError, setShowEmptyRolloverFieldsError] = useState(false); + + const showEmptyRolloverFieldsError = useRolloverValueRequiredValidation(); return ( - + @@ -107,7 +108,7 @@ export const HotPhase: FunctionComponent = () => { )} @@ -143,99 +144,18 @@ export const HotPhase: FunctionComponent = () => { )} - - - - {(field) => { - const showErrorCallout = field.errors.some( - (e) => e.code === ROLLOVER_EMPTY_VALIDATION - ); - if (showErrorCallout !== showEmptyRolloverFieldsError) { - setShowEmptyRolloverFieldsError(showErrorCallout); - } - return ( - - ); - }} - - - - - - + + - - - - - + + - - - - - - - - + + + + + {/* This field is currently deprecated and will be removed in v8+ of the stack */} + )} diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/use_rollover_value_required_validation.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/use_rollover_value_required_validation.ts new file mode 100644 index 0000000000000..2e5c794d7888f --- /dev/null +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/use_rollover_value_required_validation.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useState, useEffect } from 'react'; +import { get } from 'lodash'; +import { useFormData, useFormContext, ValidationError } from '../../../../../../shared_imports'; +import { ROLLOVER_FORM_PATHS } from '../../../constants'; +import { ROLLOVER_VALUE_REQUIRED_VALIDATION_CODE } from '../../../form'; + +const rolloverFieldPaths = Object.values(ROLLOVER_FORM_PATHS); + +export const useRolloverValueRequiredValidation = (): boolean => { + const [isValid, setIsValid] = useState(false); + const [formData] = useFormData({ watch: rolloverFieldPaths }); + const { getFields } = useFormContext(); + + useEffect(() => { + // We check just the ROLLOVER_FORM_PATHS.maxPrimaryShardSize field because if + // it has the ROLLOVER_VALUE_REQUIRED_VALIDATION_CODE error, all the other rollover + // fields should too. + const rolloverFieldErrors: ValidationError[] = + get(getFields(), ROLLOVER_FORM_PATHS.maxPrimaryShardSize)?.errors ?? []; + + setIsValid( + rolloverFieldErrors.some( + (validation) => validation.code === ROLLOVER_VALUE_REQUIRED_VALIDATION_CODE + ) + ); + }, [getFields, formData]); + + return isValid; +}; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/constants.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/constants.ts index 817ff9baf806d..88d5f6e138882 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/constants.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/constants.ts @@ -17,6 +17,7 @@ export const ROLLOVER_FORM_PATHS = { maxDocs: 'phases.hot.actions.rollover.max_docs', maxAge: 'phases.hot.actions.rollover.max_age', maxSize: 'phases.hot.actions.rollover.max_size', + maxPrimaryShardSize: 'phases.hot.actions.rollover.max_primary_shard_size', }; /** diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer.ts index 356a5b4561d0a..ddb21dba90157 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer.ts @@ -83,6 +83,14 @@ export const createDeserializer = (isCloudEnabled: boolean) => ( draft._meta.hot.customRollover.maxStorageSizeUnit = maxSize.units; } + if (draft.phases.hot.actions.rollover.max_primary_shard_size) { + const maxPrimaryShardSize = splitSizeAndUnits( + draft.phases.hot.actions.rollover.max_primary_shard_size + ); + draft.phases.hot.actions.rollover.max_primary_shard_size = maxPrimaryShardSize.size; + draft._meta.hot.customRollover.maxPrimaryShardSizeUnit = maxPrimaryShardSize.units; + } + if (draft.phases.hot.actions.rollover.max_age) { const maxAge = splitSizeAndUnits(draft.phases.hot.actions.rollover.max_age); draft.phases.hot.actions.rollover.max_age = maxAge.size; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer_and_serializer.test.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer_and_serializer.test.ts index 7cc48b3fcd90e..4391f398a6c5a 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer_and_serializer.test.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer_and_serializer.test.ts @@ -41,8 +41,9 @@ const originalPolicy: SerializedPolicy = { actions: { rollover: { max_age: '1d', - max_size: '10gb', + max_primary_shard_size: '33gb', max_docs: 1000, + max_size: '10gb', }, forcemerge: { index_codec: 'best_compression', diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/schema.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/schema.ts index 93af58644cc06..f24d350432d80 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/schema.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/schema.ts @@ -159,6 +159,9 @@ export const getSchema = (isCloudEnabled: boolean): FormSchema => ({ maxStorageSizeUnit: { defaultValue: 'gb', }, + maxPrimaryShardSizeUnit: { + defaultValue: 'gb', + }, maxAgeUnit: { defaultValue: 'd', }, @@ -330,6 +333,23 @@ export const getSchema = (isCloudEnabled: boolean): FormSchema => ({ serializer: serializers.stringToNumber, fieldsToValidateOnChange: rolloverFormPaths, }, + max_primary_shard_size: { + label: i18n.translate( + 'xpack.indexLifecycleMgmt.hotPhase.maximumPrimaryShardSizeLabel', + { + defaultMessage: 'Maximum primary shard size', + } + ), + validations: [ + { + validator: rolloverThresholdsValidator, + }, + { + validator: ifExistsNumberGreaterThanZero, + }, + ], + fieldsToValidateOnChange: rolloverFormPaths, + }, max_size: { label: i18n.translate('xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeLabel', { defaultMessage: 'Maximum index size', diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/serializer/serializer.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/serializer/serializer.ts index 0b1db784469a9..2a7d21cce03bc 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/serializer/serializer.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/serializer/serializer.ts @@ -71,6 +71,12 @@ export const createSerializer = (originalPolicy?: SerializedPolicy) => ( delete hotPhaseActions.rollover.max_docs; } + if (updatedPolicy.phases.hot!.actions.rollover?.max_primary_shard_size) { + hotPhaseActions.rollover.max_primary_shard_size = `${hotPhaseActions.rollover.max_primary_shard_size}${_meta.hot?.customRollover.maxPrimaryShardSizeUnit}`; + } else { + delete hotPhaseActions.rollover.max_primary_shard_size; + } + if (updatedPolicy.phases.hot!.actions.rollover?.max_size) { hotPhaseActions.rollover.max_size = `${hotPhaseActions.rollover.max_size}${_meta.hot?.customRollover.maxStorageSizeUnit}`; } else { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/validations.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/validations.ts index 70a58ad144192..b39b3f3cd4226 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/validations.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/validations.ts @@ -6,7 +6,12 @@ */ import { i18n } from '@kbn/i18n'; -import { fieldValidators, ValidationFunc, ValidationConfig } from '../../../../shared_imports'; +import { + fieldValidators, + ValidationFunc, + ValidationConfig, + ValidationError, +} from '../../../../shared_imports'; import { ROLLOVER_FORM_PATHS } from '../constants'; @@ -50,7 +55,9 @@ export const ifExistsNumberNonNegative = createIfNumberExistsValidator({ * A special validation type used to keep track of validation errors for * the rollover threshold values not being set (e.g., age and doc count) */ -export const ROLLOVER_EMPTY_VALIDATION = 'ROLLOVER_EMPTY_VALIDATION'; +export const ROLLOVER_VALUE_REQUIRED_VALIDATION_CODE = 'ROLLOVER_VALUE_REQUIRED_VALIDATION_CODE'; + +const rolloverFieldPaths = Object.values(ROLLOVER_FORM_PATHS); /** * An ILM policy requires that for rollover a value must be set for one of the threshold values. @@ -60,33 +67,33 @@ export const ROLLOVER_EMPTY_VALIDATION = 'ROLLOVER_EMPTY_VALIDATION'; */ export const rolloverThresholdsValidator: ValidationFunc = ({ form, path }) => { const fields = form.getFields(); - if ( - !( - fields[ROLLOVER_FORM_PATHS.maxAge]?.value || - fields[ROLLOVER_FORM_PATHS.maxDocs]?.value || - fields[ROLLOVER_FORM_PATHS.maxSize]?.value - ) - ) { - if (path === ROLLOVER_FORM_PATHS.maxAge) { - return { - code: ROLLOVER_EMPTY_VALIDATION, - message: i18nTexts.editPolicy.errors.maximumAgeRequiredMessage, - }; - } else if (path === ROLLOVER_FORM_PATHS.maxDocs) { - return { - code: ROLLOVER_EMPTY_VALIDATION, - message: i18nTexts.editPolicy.errors.maximumDocumentsRequiredMessage, - }; - } else { - return { - code: ROLLOVER_EMPTY_VALIDATION, - message: i18nTexts.editPolicy.errors.maximumSizeRequiredMessage, - }; + // At least one rollover field needs a value specified for this action. + const someRolloverFieldHasAValue = rolloverFieldPaths.some((rolloverFieldPath) => + Boolean(fields[rolloverFieldPath]?.value) + ); + if (!someRolloverFieldHasAValue) { + const errorToReturn: ValidationError = { + code: ROLLOVER_VALUE_REQUIRED_VALIDATION_CODE, + message: '', // We need to map the current path to the corresponding validation error message + }; + switch (path) { + case ROLLOVER_FORM_PATHS.maxAge: + errorToReturn.message = i18nTexts.editPolicy.errors.maximumAgeRequiredMessage; + break; + case ROLLOVER_FORM_PATHS.maxDocs: + errorToReturn.message = i18nTexts.editPolicy.errors.maximumDocumentsRequiredMessage; + break; + case ROLLOVER_FORM_PATHS.maxPrimaryShardSize: + errorToReturn.message = i18nTexts.editPolicy.errors.maximumPrimaryShardSizeRequiredMessage; + break; + default: + errorToReturn.message = i18nTexts.editPolicy.errors.maximumSizeRequiredMessage; } + return errorToReturn; } else { - fields[ROLLOVER_FORM_PATHS.maxAge].clearErrors(ROLLOVER_EMPTY_VALIDATION); - fields[ROLLOVER_FORM_PATHS.maxDocs].clearErrors(ROLLOVER_EMPTY_VALIDATION); - fields[ROLLOVER_FORM_PATHS.maxSize].clearErrors(ROLLOVER_EMPTY_VALIDATION); + rolloverFieldPaths.forEach((rolloverFieldPath) => { + fields[rolloverFieldPath]?.clearErrors(ROLLOVER_VALUE_REQUIRED_VALIDATION_CODE); + }); } }; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/i18n_texts.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/i18n_texts.ts index d9bd9b664d205..2ad754ea61c89 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/i18n_texts.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/i18n_texts.ts @@ -126,6 +126,12 @@ export const i18nTexts = { defaultMessage: 'Maximum documents is required.', } ), + maximumPrimaryShardSizeRequiredMessage: i18n.translate( + 'xpack.indexLifecycleMgmt.editPolicy.errors.maximumPrimaryShardSizeMissingError', + { + defaultMessage: 'A maximum primary shard size is required', + } + ), rollOverConfigurationCallout: { title: i18n.translate( 'xpack.indexLifecycleMgmt.editPolicy.errors.rolloverConfigurationError.title', @@ -137,7 +143,7 @@ export const i18nTexts = { 'xpack.indexLifecycleMgmt.editPolicy.errors.rolloverConfigurationError.body', { defaultMessage: - 'A value for one of maximum size, maximum documents, or maximum age is required.', + 'A value for one of maximum primary shard size, maximum documents, maximum age or maximum index size is required.', } ), }, diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/types.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/types.ts index 688d2ecfaa4a2..987cbbcfde45b 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/types.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/types.ts @@ -39,8 +39,13 @@ interface HotPhaseMetaFields extends ForcemergeFields { */ customRollover: { enabled: boolean; - maxStorageSizeUnit?: string; + maxPrimaryShardSizeUnit?: string; maxAgeUnit?: string; + + /** + * @deprecated This is the byte size unit for the max_size field which will by removed in version 8+ of the stack. + */ + maxStorageSizeUnit?: string; }; } diff --git a/x-pack/plugins/index_lifecycle_management/public/shared_imports.ts b/x-pack/plugins/index_lifecycle_management/public/shared_imports.ts index a8e0182ada77b..7e9aa7a0d422b 100644 --- a/x-pack/plugins/index_lifecycle_management/public/shared_imports.ts +++ b/x-pack/plugins/index_lifecycle_management/public/shared_imports.ts @@ -23,6 +23,7 @@ export { useFormContext, FormSchema, ValidationConfig, + ValidationError, UseMultiFields, } from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; From 5bb9eecd2647b7cce1492d802e96ae4caf4ccd7d Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Thu, 15 Apr 2021 18:25:50 +0200 Subject: [PATCH 25/68] [RAC] Populate Observability alerts table with data from alerts indices (#96692) * Set up Observability rule APIs * Populate alerts table with data from API * Move field map types/utils to common * Format reason/link in alert type * Format reason/link in alert type * Fix issues with tsconfigs * Storybook cleanup for example alerts * Use `MemoryRouter` in the stories and `useHistory` in the component to get the history * Replace examples with ones from "real" data * Use `() => {}` instead of `jest.fn()` in mock registry data * Store/display evaluations, add active/recovered badge * Some more story fixes * Decode rule data with type from owning registry * Use transaction type/environment in link to app * Fix type issues * Fix API tests * Undo changes in task_runner.ts * Remove Mutable<> wrappers for field map * Remove logger.debug calls in alerting es client * Add API test for recovery of alerts * Revert changes to src/core/server/http/router * Use type imports where possible * Update limits * Set limit to 100kb Co-authored-by: Nathan L Smith --- packages/kbn-io-ts-utils/src/index.ts | 3 + .../src}/iso_to_epoch_rt/index.test.ts | 5 +- .../src}/iso_to_epoch_rt/index.ts | 9 +- .../src}/to_boolean_rt/index.ts | 5 +- .../src}/to_number_rt/index.ts | 5 +- packages/kbn-optimizer/limits.yml | 1 + x-pack/plugins/apm/common/rules.ts | 25 + .../alerting/register_apm_alerts.ts | 115 +- x-pack/plugins/apm/public/plugin.ts | 20 +- .../apm/scripts/optimize-tsconfig/optimize.js | 12 +- .../apm/scripts/optimize-tsconfig/paths.js | 2 + .../server/lib/alerts/alerting_es_client.ts | 11 +- .../alerts/register_error_count_alert_type.ts | 13 +- ...egister_transaction_duration_alert_type.ts | 14 +- ...transaction_duration_anomaly_alert_type.ts | 16 +- ...ister_transaction_error_rate_alert_type.ts | 12 +- x-pack/plugins/apm/server/plugin.ts | 18 +- .../apm/server/routes/default_api_types.ts | 2 +- x-pack/plugins/apm/server/routes/services.ts | 4 +- .../routes/settings/agent_configuration.ts | 2 +- .../plugins/apm/server/routes/transactions.ts | 2 +- x-pack/plugins/apm/server/utils/queries.ts | 29 +- x-pack/plugins/observability/common/i18n.ts | 12 + .../common/observability_rule_registry.ts | 22 + .../plugins/observability/common/typings.ts | 8 + .../common/utils/array_union_to_callable.ts | 14 + .../common/utils/as_mutable_array.ts | 41 + .../common/utils/formatters/datetime.test.ts | 194 + .../common/utils/formatters/datetime.ts | 148 + .../common/utils/formatters/duration.test.ts | 51 + .../common/utils/formatters/duration.ts | 214 ++ .../utils/formatters/formatters.test.ts | 54 + .../common/utils/formatters/formatters.ts | 56 + .../common/utils/formatters/index.ts | 11 + .../common/utils/formatters/size.test.ts | 83 + .../common/utils/formatters/size.ts | 69 + .../common/utils/is_finite_number.ts | 13 + .../common/utils/join_by_key/index.test.ts | 169 + .../common/utils/join_by_key/index.ts | 68 + .../observability/common/utils/maybe.ts | 10 + .../observability/common/utils/pick_keys.ts | 12 + x-pack/plugins/observability/kibana.json | 24 +- .../public/application/application.test.tsx | 8 +- .../public/application/index.tsx | 22 +- .../components/app/section/apm/index.test.tsx | 6 +- .../components/app/section/ux/index.test.tsx | 2 + .../shared/timestamp_tooltip/index.test.tsx | 65 + .../shared/timestamp_tooltip/index.tsx | 31 + .../public/context/plugin_context.tsx | 3 +- .../public/hooks/use_fetcher.tsx | 46 +- .../public/hooks/use_time_range.test.ts | 3 + x-pack/plugins/observability/public/index.ts | 2 + .../public/pages/alerts/alerts.stories.tsx | 112 +- .../public/pages/alerts/alerts_flyout.tsx | 62 +- .../public/pages/alerts/alerts_search_bar.tsx | 47 +- .../public/pages/alerts/alerts_table.tsx | 113 +- .../public/pages/alerts/example_data.ts | 710 ++-- .../public/pages/alerts/index.tsx | 95 +- .../pages/overview/overview.stories.tsx | 2 + x-pack/plugins/observability/public/plugin.ts | 57 +- .../observability/public/routes/index.tsx | 1 + .../public/rules/formatter_rule_registry.ts | 25 + .../rules/observability_rule_registry_mock.ts | 17 + .../services/call_observability_api/index.ts | 30 + .../services/call_observability_api/types.ts | 34 + .../observability/public/utils/date.ts | 26 +- .../public/utils/test_helper.tsx | 7 +- x-pack/plugins/observability/server/index.ts | 3 + .../lib/annotations/bootstrap_annotations.ts | 11 +- .../server/lib/rules/get_top_alerts.ts | 55 + x-pack/plugins/observability/server/plugin.ts | 27 +- .../create_observability_server_route.ts | 13 + ...e_observability_server_route_repository.ts | 15 + ...l_observability_server_route_repository.ts | 15 + .../server/routes/register_routes.ts | 92 + .../observability/server/routes/rules.ts | 76 + .../observability/server/routes/types.ts | 56 + x-pack/plugins/observability/server/types.ts | 16 + .../observability/server/utils/queries.ts | 32 + x-pack/plugins/observability/tsconfig.json | 2 +- .../field_map/base_rule_field_map.ts} | 9 +- .../field_map}/ecs_field_map.ts | 6 + .../common/field_map/es_field_type_map.ts | 23 + .../rule_registry/common/field_map/index.ts | 12 + .../field_map/merge_field_maps.ts | 5 +- .../runtime_type_from_fieldmap.test.ts | 0 .../field_map/runtime_type_from_fieldmap.ts | 57 +- .../rule_registry/common/field_map/types.ts | 10 + x-pack/plugins/rule_registry/common/index.ts | 4 +- .../pick_with_patterns/index.test.ts} | 2 +- .../pick_with_patterns/index.ts} | 0 x-pack/plugins/rule_registry/common/types.ts | 20 - x-pack/plugins/rule_registry/kibana.json | 9 +- x-pack/plugins/rule_registry/public/index.ts | 17 + x-pack/plugins/rule_registry/public/plugin.ts | 56 + .../public/rule_registry/index.ts | 47 + .../public/rule_registry/types.ts | 63 + .../scripts/generate_ecs_fieldmap/index.js | 38 +- .../server/generated/ecs_mappings.json | 3416 ----------------- x-pack/plugins/rule_registry/server/index.ts | 2 - x-pack/plugins/rule_registry/server/plugin.ts | 6 +- .../index.ts | 109 +- .../types.ts | 34 +- .../field_map/mapping_from_field_map.ts | 3 +- .../server/rule_registry/index.ts | 120 +- .../create_lifecycle_rule_type_factory.ts | 22 +- .../server/rule_registry/types.ts | 2 - x-pack/plugins/rule_registry/server/types.ts | 8 +- x-pack/plugins/rule_registry/tsconfig.json | 3 +- .../tests/alerts/rule_registry.ts | 169 +- 110 files changed, 3379 insertions(+), 4430 deletions(-) rename {x-pack/plugins/apm/common/runtime_types => packages/kbn-io-ts-utils/src}/iso_to_epoch_rt/index.test.ts (83%) rename {x-pack/plugins/apm/common/runtime_types => packages/kbn-io-ts-utils/src}/iso_to_epoch_rt/index.ts (69%) rename {x-pack/plugins/apm/common/runtime_types => packages/kbn-io-ts-utils/src}/to_boolean_rt/index.ts (72%) rename {x-pack/plugins/apm/common/runtime_types => packages/kbn-io-ts-utils/src}/to_number_rt/index.ts (70%) create mode 100644 x-pack/plugins/apm/common/rules.ts create mode 100644 x-pack/plugins/observability/common/i18n.ts create mode 100644 x-pack/plugins/observability/common/observability_rule_registry.ts create mode 100644 x-pack/plugins/observability/common/typings.ts create mode 100644 x-pack/plugins/observability/common/utils/array_union_to_callable.ts create mode 100644 x-pack/plugins/observability/common/utils/as_mutable_array.ts create mode 100644 x-pack/plugins/observability/common/utils/formatters/datetime.test.ts create mode 100644 x-pack/plugins/observability/common/utils/formatters/datetime.ts create mode 100644 x-pack/plugins/observability/common/utils/formatters/duration.test.ts create mode 100644 x-pack/plugins/observability/common/utils/formatters/duration.ts create mode 100644 x-pack/plugins/observability/common/utils/formatters/formatters.test.ts create mode 100644 x-pack/plugins/observability/common/utils/formatters/formatters.ts create mode 100644 x-pack/plugins/observability/common/utils/formatters/index.ts create mode 100644 x-pack/plugins/observability/common/utils/formatters/size.test.ts create mode 100644 x-pack/plugins/observability/common/utils/formatters/size.ts create mode 100644 x-pack/plugins/observability/common/utils/is_finite_number.ts create mode 100644 x-pack/plugins/observability/common/utils/join_by_key/index.test.ts create mode 100644 x-pack/plugins/observability/common/utils/join_by_key/index.ts create mode 100644 x-pack/plugins/observability/common/utils/maybe.ts create mode 100644 x-pack/plugins/observability/common/utils/pick_keys.ts create mode 100644 x-pack/plugins/observability/public/components/shared/timestamp_tooltip/index.test.tsx create mode 100644 x-pack/plugins/observability/public/components/shared/timestamp_tooltip/index.tsx create mode 100644 x-pack/plugins/observability/public/rules/formatter_rule_registry.ts create mode 100644 x-pack/plugins/observability/public/rules/observability_rule_registry_mock.ts create mode 100644 x-pack/plugins/observability/public/services/call_observability_api/index.ts create mode 100644 x-pack/plugins/observability/public/services/call_observability_api/types.ts create mode 100644 x-pack/plugins/observability/server/lib/rules/get_top_alerts.ts create mode 100644 x-pack/plugins/observability/server/routes/create_observability_server_route.ts create mode 100644 x-pack/plugins/observability/server/routes/create_observability_server_route_repository.ts create mode 100644 x-pack/plugins/observability/server/routes/get_global_observability_server_route_repository.ts create mode 100644 x-pack/plugins/observability/server/routes/register_routes.ts create mode 100644 x-pack/plugins/observability/server/routes/rules.ts create mode 100644 x-pack/plugins/observability/server/routes/types.ts create mode 100644 x-pack/plugins/observability/server/utils/queries.ts rename x-pack/plugins/rule_registry/{server/rule_registry/defaults/field_map.ts => common/field_map/base_rule_field_map.ts} (80%) rename x-pack/plugins/rule_registry/{server/generated => common/field_map}/ecs_field_map.ts (99%) create mode 100644 x-pack/plugins/rule_registry/common/field_map/es_field_type_map.ts create mode 100644 x-pack/plugins/rule_registry/common/field_map/index.ts rename x-pack/plugins/rule_registry/{server/rule_registry => common}/field_map/merge_field_maps.ts (89%) rename x-pack/plugins/rule_registry/{server/rule_registry => common}/field_map/runtime_type_from_fieldmap.test.ts (100%) rename x-pack/plugins/rule_registry/{server/rule_registry => common}/field_map/runtime_type_from_fieldmap.ts (67%) create mode 100644 x-pack/plugins/rule_registry/common/field_map/types.ts rename x-pack/plugins/rule_registry/{server/rule_registry/field_map/pick_with_patterns.test.ts => common/pick_with_patterns/index.test.ts} (97%) rename x-pack/plugins/rule_registry/{server/rule_registry/field_map/pick_with_patterns.ts => common/pick_with_patterns/index.ts} (100%) delete mode 100644 x-pack/plugins/rule_registry/common/types.ts create mode 100644 x-pack/plugins/rule_registry/public/index.ts create mode 100644 x-pack/plugins/rule_registry/public/plugin.ts create mode 100644 x-pack/plugins/rule_registry/public/rule_registry/index.ts create mode 100644 x-pack/plugins/rule_registry/public/rule_registry/types.ts delete mode 100644 x-pack/plugins/rule_registry/server/generated/ecs_mappings.json diff --git a/packages/kbn-io-ts-utils/src/index.ts b/packages/kbn-io-ts-utils/src/index.ts index 2032127b1eb91..418a5a41a2bec 100644 --- a/packages/kbn-io-ts-utils/src/index.ts +++ b/packages/kbn-io-ts-utils/src/index.ts @@ -9,3 +9,6 @@ export { jsonRt } from './json_rt'; export { mergeRt } from './merge_rt'; export { strictKeysRt } from './strict_keys_rt'; +export { isoToEpochRt } from './iso_to_epoch_rt'; +export { toNumberRt } from './to_number_rt'; +export { toBooleanRt } from './to_boolean_rt'; diff --git a/x-pack/plugins/apm/common/runtime_types/iso_to_epoch_rt/index.test.ts b/packages/kbn-io-ts-utils/src/iso_to_epoch_rt/index.test.ts similarity index 83% rename from x-pack/plugins/apm/common/runtime_types/iso_to_epoch_rt/index.test.ts rename to packages/kbn-io-ts-utils/src/iso_to_epoch_rt/index.test.ts index 573bfdc83e429..d6d6afbf98755 100644 --- a/x-pack/plugins/apm/common/runtime_types/iso_to_epoch_rt/index.test.ts +++ b/packages/kbn-io-ts-utils/src/iso_to_epoch_rt/index.test.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 { isoToEpochRt } from './index'; diff --git a/x-pack/plugins/apm/common/runtime_types/iso_to_epoch_rt/index.ts b/packages/kbn-io-ts-utils/src/iso_to_epoch_rt/index.ts similarity index 69% rename from x-pack/plugins/apm/common/runtime_types/iso_to_epoch_rt/index.ts rename to packages/kbn-io-ts-utils/src/iso_to_epoch_rt/index.ts index 970e39bc4f86f..fe2ece7b0730c 100644 --- a/x-pack/plugins/apm/common/runtime_types/iso_to_epoch_rt/index.ts +++ b/packages/kbn-io-ts-utils/src/iso_to_epoch_rt/index.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 * as t from 'io-ts'; @@ -17,9 +18,7 @@ export const isoToEpochRt = new t.Type( (input, context) => either.chain(t.string.validate(input, context), (str) => { const epochDate = new Date(str).getTime(); - return isNaN(epochDate) - ? t.failure(input, context) - : t.success(epochDate); + return isNaN(epochDate) ? t.failure(input, context) : t.success(epochDate); }), (output) => new Date(output).toISOString() ); diff --git a/x-pack/plugins/apm/common/runtime_types/to_boolean_rt/index.ts b/packages/kbn-io-ts-utils/src/to_boolean_rt/index.ts similarity index 72% rename from x-pack/plugins/apm/common/runtime_types/to_boolean_rt/index.ts rename to packages/kbn-io-ts-utils/src/to_boolean_rt/index.ts index 1e6828ed4ead3..eb8277adb281e 100644 --- a/x-pack/plugins/apm/common/runtime_types/to_boolean_rt/index.ts +++ b/packages/kbn-io-ts-utils/src/to_boolean_rt/index.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 * as t from 'io-ts'; diff --git a/x-pack/plugins/apm/common/runtime_types/to_number_rt/index.ts b/packages/kbn-io-ts-utils/src/to_number_rt/index.ts similarity index 70% rename from x-pack/plugins/apm/common/runtime_types/to_number_rt/index.ts rename to packages/kbn-io-ts-utils/src/to_number_rt/index.ts index a4632680cb6e1..ae6bb4911c907 100644 --- a/x-pack/plugins/apm/common/runtime_types/to_number_rt/index.ts +++ b/packages/kbn-io-ts-utils/src/to_number_rt/index.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 * as t from 'io-ts'; diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index e114e3e930016..f42ca7451601b 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -61,6 +61,7 @@ pageLoadAssetSize: remoteClusters: 51327 reporting: 183418 rollup: 97204 + ruleRegistry: 100000 savedObjects: 108518 savedObjectsManagement: 101836 savedObjectsTagging: 59482 diff --git a/x-pack/plugins/apm/common/rules.ts b/x-pack/plugins/apm/common/rules.ts new file mode 100644 index 0000000000000..a3b60a785f5c7 --- /dev/null +++ b/x-pack/plugins/apm/common/rules.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +const plainApmRuleRegistrySettings = { + name: 'apm', + fieldMap: { + 'service.environment': { + type: 'keyword', + }, + 'transaction.type': { + type: 'keyword', + }, + 'processor.event': { + type: 'keyword', + }, + }, +} as const; + +type APMRuleRegistrySettings = typeof plainApmRuleRegistrySettings; + +export const apmRuleRegistrySettings: APMRuleRegistrySettings = plainApmRuleRegistrySettings; diff --git a/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts b/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts index 4f33f11b5f3e7..8834cbc70e0b1 100644 --- a/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts +++ b/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts @@ -7,18 +7,39 @@ import { i18n } from '@kbn/i18n'; import { lazy } from 'react'; +import { format } from 'url'; +import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values'; +import { asDuration, asPercent } from '../../../common/utils/formatters'; import { AlertType } from '../../../common/alert_types'; -import { ApmPluginStartDeps } from '../../plugin'; +import { ApmRuleRegistry } from '../../plugin'; -export function registerApmAlerts( - alertTypeRegistry: ApmPluginStartDeps['triggersActionsUi']['alertTypeRegistry'] -) { - alertTypeRegistry.register({ +export function registerApmAlerts(apmRuleRegistry: ApmRuleRegistry) { + apmRuleRegistry.registerType({ id: AlertType.ErrorCount, description: i18n.translate('xpack.apm.alertTypes.errorCount.description', { defaultMessage: 'Alert when the number of errors in a service exceeds a defined threshold.', }), + format: ({ alert }) => { + return { + reason: i18n.translate('xpack.apm.alertTypes.errorCount.reason', { + defaultMessage: `Error count is greater than {threshold} (current value is {measured}) for {serviceName}`, + values: { + threshold: alert['kibana.observability.evaluation.threshold'], + measured: alert['kibana.observability.evaluation.value'], + serviceName: alert['service.name']!, + }, + }), + link: format({ + pathname: `/app/apm/services/${alert['service.name']!}`, + query: { + ...(alert['service.environment'] + ? { environment: alert['service.environment'] } + : { environment: ENVIRONMENT_ALL.value }), + }, + }), + }; + }, iconClass: 'bell', documentationUrl(docLinks) { return `${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/apm-alerts.html`; @@ -41,7 +62,7 @@ export function registerApmAlerts( ), }); - alertTypeRegistry.register({ + apmRuleRegistry.registerType({ id: AlertType.TransactionDuration, description: i18n.translate( 'xpack.apm.alertTypes.transactionDuration.description', @@ -50,6 +71,32 @@ export function registerApmAlerts( 'Alert when the latency of a specific transaction type in a service exceeds a defined threshold.', } ), + format: ({ alert }) => ({ + reason: i18n.translate( + 'xpack.apm.alertTypes.transactionDuration.reason', + { + defaultMessage: `Latency is above {threshold} (current value is {measured}) for {serviceName}`, + values: { + threshold: asDuration( + alert['kibana.observability.evaluation.threshold'] + ), + measured: asDuration( + alert['kibana.observability.evaluation.value'] + ), + serviceName: alert['service.name']!, + }, + } + ), + link: format({ + pathname: `/app/apm/services/${alert['service.name']!}`, + query: { + transactionType: alert['transaction.type']!, + ...(alert['service.environment'] + ? { environment: alert['service.environment'] } + : { environment: ENVIRONMENT_ALL.value }), + }, + }), + }), iconClass: 'bell', documentationUrl(docLinks) { return `${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/apm-alerts.html`; @@ -75,7 +122,7 @@ export function registerApmAlerts( ), }); - alertTypeRegistry.register({ + apmRuleRegistry.registerType({ id: AlertType.TransactionErrorRate, description: i18n.translate( 'xpack.apm.alertTypes.transactionErrorRate.description', @@ -84,6 +131,34 @@ export function registerApmAlerts( 'Alert when the rate of transaction errors in a service exceeds a defined threshold.', } ), + format: ({ alert }) => ({ + reason: i18n.translate( + 'xpack.apm.alertTypes.transactionErrorRate.reason', + { + defaultMessage: `Transaction error rate is greater than {threshold} (current value is {measured}) for {serviceName}`, + values: { + threshold: asPercent( + alert['kibana.observability.evaluation.threshold'], + 100 + ), + measured: asPercent( + alert['kibana.observability.evaluation.value'], + 100 + ), + serviceName: alert['service.name']!, + }, + } + ), + link: format({ + pathname: `/app/apm/services/${alert['service.name']!}`, + query: { + transactionType: alert['transaction.type']!, + ...(alert['service.environment'] + ? { environment: alert['service.environment'] } + : { environment: ENVIRONMENT_ALL.value }), + }, + }), + }), iconClass: 'bell', documentationUrl(docLinks) { return `${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/apm-alerts.html`; @@ -109,7 +184,7 @@ export function registerApmAlerts( ), }); - alertTypeRegistry.register({ + apmRuleRegistry.registerType({ id: AlertType.TransactionDurationAnomaly, description: i18n.translate( 'xpack.apm.alertTypes.transactionDurationAnomaly.description', @@ -117,6 +192,28 @@ export function registerApmAlerts( defaultMessage: 'Alert when the latency of a service is abnormal.', } ), + format: ({ alert }) => ({ + reason: i18n.translate( + 'xpack.apm.alertTypes.transactionDurationAnomaly.reason', + { + defaultMessage: `{severityLevel} anomaly detected for {serviceName} (score was {measured})`, + values: { + serviceName: alert['service.name'], + severityLevel: alert['kibana.rac.alert.severity.level'], + measured: alert['kibana.observability.evaluation.value'], + }, + } + ), + link: format({ + pathname: `/app/apm/services/${alert['service.name']!}`, + query: { + transactionType: alert['transaction.type']!, + ...(alert['service.environment'] + ? { environment: alert['service.environment'] } + : { environment: ENVIRONMENT_ALL.value }), + }, + }), + }), iconClass: 'bell', documentationUrl(docLinks) { return `${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/apm-alerts.html`; @@ -137,7 +234,7 @@ export function registerApmAlerts( - Type: \\{\\{context.transactionType\\}\\} - Environment: \\{\\{context.environment\\}\\} - Severity threshold: \\{\\{context.threshold\\}\\} -- Severity value: \\{\\{context.thresholdValue\\}\\} +- Severity value: \\{\\{context.triggerValue\\}\\} `, } ), diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts index 382053f133950..391c54c1e2497 100644 --- a/x-pack/plugins/apm/public/plugin.ts +++ b/x-pack/plugins/apm/public/plugin.ts @@ -8,6 +8,7 @@ import { ConfigSchema } from '.'; import { FetchDataParams, + FormatterRuleRegistry, HasDataParams, ObservabilityPublicSetup, } from '../../observability/public'; @@ -40,8 +41,11 @@ import { EmbeddableStart } from '../../../../src/plugins/embeddable/public'; import { registerApmAlerts } from './components/alerting/register_apm_alerts'; import { MlPluginSetup, MlPluginStart } from '../../ml/public'; import { MapsStartApi } from '../../maps/public'; +import { apmRuleRegistrySettings } from '../common/rules'; + +export type ApmPluginSetup = ReturnType; +export type ApmRuleRegistry = ApmPluginSetup['ruleRegistry']; -export type ApmPluginSetup = void; export type ApmPluginStart = void; export interface ApmPluginSetupDeps { @@ -52,7 +56,7 @@ export interface ApmPluginSetupDeps { home?: HomePublicPluginSetup; licensing: LicensingPluginSetup; triggersActionsUi: TriggersAndActionsUIPublicPluginSetup; - observability?: ObservabilityPublicSetup; + observability: ObservabilityPublicSetup; } export interface ApmPluginStartDeps { @@ -156,6 +160,13 @@ export class ApmPlugin implements Plugin { }, }); + const apmRuleRegistry = plugins.observability.ruleRegistry.create({ + ...apmRuleRegistrySettings, + ctor: FormatterRuleRegistry, + }); + + registerApmAlerts(apmRuleRegistry); + core.application.register({ id: 'ux', title: 'User Experience', @@ -196,9 +207,12 @@ export class ApmPlugin implements Plugin { ); }, }); + + return { + ruleRegistry: apmRuleRegistry, + }; } public start(core: CoreStart, plugins: ApmPluginStartDeps) { toggleAppLinkInNav(core, this.initializerContext.config.get()); - registerApmAlerts(plugins.triggersActionsUi.alertTypeRegistry); } } diff --git a/x-pack/plugins/apm/scripts/optimize-tsconfig/optimize.js b/x-pack/plugins/apm/scripts/optimize-tsconfig/optimize.js index 58fb096ca3a51..e0151c473d6e2 100644 --- a/x-pack/plugins/apm/scripts/optimize-tsconfig/optimize.js +++ b/x-pack/plugins/apm/scripts/optimize-tsconfig/optimize.js @@ -85,8 +85,14 @@ async function setIgnoreChanges() { } } -async function deleteApmTsConfig() { - await unlink(path.resolve(kibanaRoot, 'x-pack/plugins/apm', 'tsconfig.json')); +async function deleteTsConfigs() { + const toDelete = ['apm', 'observability', 'rule_registry']; + + for (const app of toDelete) { + await unlink( + path.resolve(kibanaRoot, 'x-pack/plugins', app, 'tsconfig.json') + ); + } } async function optimizeTsConfig() { @@ -98,7 +104,7 @@ async function optimizeTsConfig() { await addApmFilesToTestTsConfig(); - await deleteApmTsConfig(); + await deleteTsConfigs(); await setIgnoreChanges(); // eslint-disable-next-line no-console diff --git a/x-pack/plugins/apm/scripts/optimize-tsconfig/paths.js b/x-pack/plugins/apm/scripts/optimize-tsconfig/paths.js index bde129f434934..3a21a89e30917 100644 --- a/x-pack/plugins/apm/scripts/optimize-tsconfig/paths.js +++ b/x-pack/plugins/apm/scripts/optimize-tsconfig/paths.js @@ -15,6 +15,8 @@ const filesToIgnore = [ path.resolve(kibanaRoot, 'tsconfig.json'), path.resolve(kibanaRoot, 'tsconfig.base.json'), path.resolve(kibanaRoot, 'x-pack/plugins/apm', 'tsconfig.json'), + path.resolve(kibanaRoot, 'x-pack/plugins/observability', 'tsconfig.json'), + path.resolve(kibanaRoot, 'x-pack/plugins/rule_registry', 'tsconfig.json'), path.resolve(kibanaRoot, 'x-pack/test', 'tsconfig.json'), ]; diff --git a/x-pack/plugins/apm/server/lib/alerts/alerting_es_client.ts b/x-pack/plugins/apm/server/lib/alerts/alerting_es_client.ts index e3d5e5481caa5..7d5b7d594bdf9 100644 --- a/x-pack/plugins/apm/server/lib/alerts/alerting_es_client.ts +++ b/x-pack/plugins/apm/server/lib/alerts/alerting_es_client.ts @@ -11,14 +11,17 @@ import { } from '../../../../../../typings/elasticsearch'; import { AlertServices } from '../../../../alerting/server'; -export async function alertingEsClient( +export async function alertingEsClient({ + scopedClusterClient, + params, +}: { scopedClusterClient: AlertServices< never, never, never - >['scopedClusterClient'], - params: TParams -): Promise> { + >['scopedClusterClient']; + params: TParams; +}): Promise> { const response = await scopedClusterClient.asCurrentUser.search({ ...params, ignore_unavailable: true, diff --git a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts index 8240e0c369d1f..15ec5d0ef0bd0 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts @@ -114,10 +114,10 @@ export function registerErrorCountAlertType({ }, }; - const response = await alertingEsClient( - services.scopedClusterClient, - searchParams - ); + const response = await alertingEsClient({ + scopedClusterClient: services.scopedClusterClient, + params: searchParams, + }); const errorCountResults = response.aggregations?.error_counts.buckets.map((bucket) => { @@ -145,7 +145,10 @@ export function registerErrorCountAlertType({ ...(environment ? { [SERVICE_ENVIRONMENT]: environment } : {}), - [PROCESSOR_EVENT]: 'error', + [PROCESSOR_EVENT]: ProcessorEvent.error, + 'kibana.observability.evaluation.value': errorCount, + 'kibana.observability.evaluation.threshold': + alertParams.threshold, }, }) .scheduleActions(alertTypeConfig.defaultActionGroupId, { diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts index 6ca1c4370d6ae..4918a6cc892b7 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts @@ -77,8 +77,8 @@ export function registerTransactionDurationAlertType({ const searchParams = { index: indices['apm_oss.transactionIndices'], - size: 0, body: { + size: 0, query: { bool: { filter: [ @@ -112,10 +112,10 @@ export function registerTransactionDurationAlertType({ }, }; - const response = await alertingEsClient( - services.scopedClusterClient, - searchParams - ); + const response = await alertingEsClient({ + scopedClusterClient: services.scopedClusterClient, + params: searchParams, + }); if (!response.aggregations) { return {}; @@ -149,6 +149,10 @@ export function registerTransactionDurationAlertType({ ? { [SERVICE_ENVIRONMENT]: environmentParsed.esFieldValue } : {}), [TRANSACTION_TYPE]: alertParams.transactionType, + [PROCESSOR_EVENT]: ProcessorEvent.transaction, + 'kibana.observability.evaluation.value': transactionDuration, + 'kibana.observability.evaluation.threshold': + alertParams.threshold * 1000, }, }) .scheduleActions(alertTypeConfig.defaultActionGroupId, { diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts index 15f4a8ea07801..66eb7125b0370 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts @@ -9,8 +9,10 @@ import { schema } from '@kbn/config-schema'; import { compact } from 'lodash'; import { ESSearchResponse } from 'typings/elasticsearch'; import { QueryContainer } from '@elastic/elasticsearch/api/types'; +import { ProcessorEvent } from '../../../common/processor_event'; import { getSeverity } from '../../../common/anomaly_detection'; import { + PROCESSOR_EVENT, SERVICE_ENVIRONMENT, SERVICE_NAME, TRANSACTION_TYPE, @@ -49,7 +51,6 @@ const alertTypeConfig = export function registerTransactionDurationAnomalyAlertType({ registry, ml, - logger, }: RegisterRuleDependencies) { registry.registerType( createAPMLifecycleRuleType({ @@ -166,7 +167,7 @@ export function registerTransactionDurationAnomalyAlertType({ { field: 'job_id' }, ] as const), sort: { - '@timestamp': 'desc' as const, + timestamp: 'desc' as const, }, }, }, @@ -189,7 +190,7 @@ export function registerTransactionDurationAnomalyAlertType({ const job = mlJobs.find((j) => j.job_id === latest.job_id); if (!job) { - logger.warn( + services.logger.warn( `Could not find matching job for job id ${latest.job_id}` ); return undefined; @@ -211,6 +212,8 @@ export function registerTransactionDurationAnomalyAlertType({ const parsedEnvironment = parseEnvironmentUrlParam(environment); + const severityLevel = getSeverity(score); + services .alertWithLifecycle({ id: [ @@ -227,6 +230,11 @@ export function registerTransactionDurationAnomalyAlertType({ ? { [SERVICE_ENVIRONMENT]: environment } : {}), [TRANSACTION_TYPE]: transactionType, + [PROCESSOR_EVENT]: ProcessorEvent.transaction, + 'kibana.rac.alert.severity.level': severityLevel, + 'kibana.rac.alert.severity.value': score, + 'kibana.observability.evaluation.value': score, + 'kibana.observability.evaluation.threshold': threshold, }, }) .scheduleActions(alertTypeConfig.defaultActionGroupId, { @@ -234,7 +242,7 @@ export function registerTransactionDurationAnomalyAlertType({ transactionType, environment, threshold: selectedOption?.label, - triggerValue: getSeverity(score), + triggerValue: severityLevel, }); }); diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts index 0865bed41142e..bead17e308f06 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts @@ -129,10 +129,10 @@ export function registerTransactionErrorRateAlertType({ }, }; - const response = await alertingEsClient( - services.scopedClusterClient, - searchParams - ); + const response = await alertingEsClient({ + scopedClusterClient: services.scopedClusterClient, + params: searchParams, + }); if (!response.aggregations) { return {}; @@ -182,6 +182,10 @@ export function registerTransactionErrorRateAlertType({ [SERVICE_NAME]: serviceName, ...(environment ? { [SERVICE_ENVIRONMENT]: environment } : {}), [TRANSACTION_TYPE]: transactionType, + [PROCESSOR_EVENT]: ProcessorEvent.transaction, + 'kibana.observability.evaluation.value': errorRate, + 'kibana.observability.evaluation.threshold': + alertParams.threshold, }, }) .scheduleActions(alertTypeConfig.defaultActionGroupId, { diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index cb94b18a1ecf9..714b887a4008b 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -42,6 +42,7 @@ import { } from './types'; import { registerRoutes } from './routes/register_routes'; import { getGlobalApmServerRouteRepository } from './routes/get_global_apm_server_route_repository'; +import { apmRuleRegistrySettings } from '../common/rules'; export type APMRuleRegistry = ReturnType['ruleRegistry']; @@ -150,20 +151,9 @@ export class APMPlugin config: await mergedConfig$.pipe(take(1)).toPromise(), }); - const apmRuleRegistry = plugins.observability.ruleRegistry.create({ - name: 'apm', - fieldMap: { - 'service.environment': { - type: 'keyword', - }, - 'transaction.type': { - type: 'keyword', - }, - 'processor.event': { - type: 'keyword', - }, - }, - }); + const apmRuleRegistry = plugins.observability.ruleRegistry.create( + apmRuleRegistrySettings + ); registerApmAlerts({ registry: apmRuleRegistry, diff --git a/x-pack/plugins/apm/server/routes/default_api_types.ts b/x-pack/plugins/apm/server/routes/default_api_types.ts index 10c50a384c2d7..3181a3dbce7ac 100644 --- a/x-pack/plugins/apm/server/routes/default_api_types.ts +++ b/x-pack/plugins/apm/server/routes/default_api_types.ts @@ -6,7 +6,7 @@ */ import * as t from 'io-ts'; -import { isoToEpochRt } from '../../common/runtime_types/iso_to_epoch_rt'; +import { isoToEpochRt } from '@kbn/io-ts-utils'; export const rangeRt = t.type({ start: isoToEpochRt, diff --git a/x-pack/plugins/apm/server/routes/services.ts b/x-pack/plugins/apm/server/routes/services.ts index 800a5bdcc5d5f..3ac76d4a5b4c2 100644 --- a/x-pack/plugins/apm/server/routes/services.ts +++ b/x-pack/plugins/apm/server/routes/services.ts @@ -6,13 +6,11 @@ */ import Boom from '@hapi/boom'; -import { jsonRt } from '@kbn/io-ts-utils'; +import { jsonRt, isoToEpochRt, toNumberRt } from '@kbn/io-ts-utils'; import * as t from 'io-ts'; import { uniq } from 'lodash'; import { latencyAggregationTypeRt } from '../../common/latency_aggregation_types'; import { ProfilingValueType } from '../../common/profiling'; -import { isoToEpochRt } from '../../common/runtime_types/iso_to_epoch_rt'; -import { toNumberRt } from '../../common/runtime_types/to_number_rt'; import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; import { setupRequest } from '../lib/helpers/setup_request'; import { getServiceAnnotations } from '../lib/services/annotations'; diff --git a/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts index 111e0a18c8608..ef1ade645cc44 100644 --- a/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts @@ -7,7 +7,7 @@ import * as t from 'io-ts'; import Boom from '@hapi/boom'; -import { toBooleanRt } from '../../../common/runtime_types/to_boolean_rt'; +import { toBooleanRt } from '@kbn/io-ts-utils'; import { setupRequest } from '../../lib/helpers/setup_request'; import { getServiceNames } from '../../lib/settings/agent_configuration/get_service_names'; import { createOrUpdateConfiguration } from '../../lib/settings/agent_configuration/create_or_update_configuration'; diff --git a/x-pack/plugins/apm/server/routes/transactions.ts b/x-pack/plugins/apm/server/routes/transactions.ts index ebca374db86d7..b323801430dba 100644 --- a/x-pack/plugins/apm/server/routes/transactions.ts +++ b/x-pack/plugins/apm/server/routes/transactions.ts @@ -7,11 +7,11 @@ import { jsonRt } from '@kbn/io-ts-utils'; import * as t from 'io-ts'; +import { toNumberRt } from '@kbn/io-ts-utils'; import { LatencyAggregationType, latencyAggregationTypeRt, } from '../../common/latency_aggregation_types'; -import { toNumberRt } from '../../common/runtime_types/to_number_rt'; import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; import { setupRequest } from '../lib/helpers/setup_request'; import { getServiceTransactionGroups } from '../lib/services/get_service_transaction_groups'; diff --git a/x-pack/plugins/apm/server/utils/queries.ts b/x-pack/plugins/apm/server/utils/queries.ts index 3cbcb0a5b684f..7255e7ed75a63 100644 --- a/x-pack/plugins/apm/server/utils/queries.ts +++ b/x-pack/plugins/apm/server/utils/queries.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { esKuery } from '../../../../../src/plugins/data/server'; import { ESFilter } from '../../../../../typings/elasticsearch'; import { SERVICE_ENVIRONMENT } from '../../common/elasticsearch_fieldnames'; import { ENVIRONMENT_ALL, ENVIRONMENT_NOT_DEFINED, } from '../../common/environment_filter_values'; +export { kqlQuery, rangeQuery } from '../../../observability/server'; type QueryContainer = ESFilter; @@ -26,30 +26,3 @@ export function environmentQuery(environment?: string): QueryContainer[] { return [{ term: { [SERVICE_ENVIRONMENT]: environment } }]; } - -export function rangeQuery( - start: number, - end: number, - field = '@timestamp' -): QueryContainer[] { - return [ - { - range: { - [field]: { - gte: start, - lte: end, - format: 'epoch_millis', - }, - }, - }, - ]; -} - -export function kqlQuery(kql?: string) { - if (!kql) { - return []; - } - - const ast = esKuery.fromKueryExpression(kql); - return [esKuery.toElasticsearchQuery(ast) as ESFilter]; -} diff --git a/x-pack/plugins/observability/common/i18n.ts b/x-pack/plugins/observability/common/i18n.ts new file mode 100644 index 0000000000000..73c27e811b2d6 --- /dev/null +++ b/x-pack/plugins/observability/common/i18n.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; + +export const NOT_AVAILABLE_LABEL = i18n.translate('xpack.observability.notAvailable', { + defaultMessage: 'N/A', +}); diff --git a/x-pack/plugins/observability/common/observability_rule_registry.ts b/x-pack/plugins/observability/common/observability_rule_registry.ts new file mode 100644 index 0000000000000..9254401fc19c4 --- /dev/null +++ b/x-pack/plugins/observability/common/observability_rule_registry.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { ecsFieldMap, pickWithPatterns } from '../../rule_registry/common'; + +export const observabilityRuleRegistrySettings = { + name: 'observability', + fieldMap: { + ...pickWithPatterns(ecsFieldMap, 'host.name', 'service.name'), + 'kibana.observability.evaluation.value': { + type: 'scaled_float' as const, + scaling_factor: 1000, + }, + 'kibana.observability.evaluation.threshold': { + type: 'scaled_float' as const, + scaling_factor: 1000, + }, + }, +}; diff --git a/x-pack/plugins/observability/common/typings.ts b/x-pack/plugins/observability/common/typings.ts new file mode 100644 index 0000000000000..2a7f9edffc4af --- /dev/null +++ b/x-pack/plugins/observability/common/typings.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type Maybe = T | null | undefined; diff --git a/x-pack/plugins/observability/common/utils/array_union_to_callable.ts b/x-pack/plugins/observability/common/utils/array_union_to_callable.ts new file mode 100644 index 0000000000000..f376f7cd4ef21 --- /dev/null +++ b/x-pack/plugins/observability/common/utils/array_union_to_callable.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ValuesType } from 'utility-types'; + +// work around a TypeScript limitation described in https://stackoverflow.com/posts/49511416 + +export const arrayUnionToCallable = (array: T): Array> => { + return array; +}; diff --git a/x-pack/plugins/observability/common/utils/as_mutable_array.ts b/x-pack/plugins/observability/common/utils/as_mutable_array.ts new file mode 100644 index 0000000000000..ce1d7e607ec4c --- /dev/null +++ b/x-pack/plugins/observability/common/utils/as_mutable_array.ts @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +// Sometimes we use `as const` to have a more specific type, +// because TypeScript by default will widen the value type of an +// array literal. Consider the following example: +// +// const filter = [ +// { term: { 'agent.name': 'nodejs' } }, +// { range: { '@timestamp': { gte: 'now-15m ' }} +// ]; + +// The result value type will be: + +// const filter: ({ +// term: { +// 'agent.name'?: string +// }; +// range?: undefined +// } | { +// term?: undefined; +// range: { +// '@timestamp': { +// gte: string +// } +// } +// })[]; + +// This can sometimes leads to issues. In those cases, we can +// use `as const`. However, the Readonly type is not compatible +// with Array. This function returns a mutable version of a type. + +export function asMutableArray>( + arr: T +): T extends Readonly<[...infer U]> ? U : unknown[] { + return arr as any; +} diff --git a/x-pack/plugins/observability/common/utils/formatters/datetime.test.ts b/x-pack/plugins/observability/common/utils/formatters/datetime.test.ts new file mode 100644 index 0000000000000..aaf0b1e574221 --- /dev/null +++ b/x-pack/plugins/observability/common/utils/formatters/datetime.test.ts @@ -0,0 +1,194 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import moment from 'moment-timezone'; +import { asRelativeDateTimeRange, asAbsoluteDateTime, getDateDifference } from './datetime'; + +describe('date time formatters', () => { + beforeAll(() => { + moment.tz.setDefault('Europe/Amsterdam'); + }); + afterAll(() => moment.tz.setDefault('')); + describe('asRelativeDateTimeRange', () => { + const formatDateToTimezone = (dateTimeString: string) => moment(dateTimeString).valueOf(); + describe('YYYY - YYYY', () => { + it('range: 10 years', () => { + const start = formatDateToTimezone('2000-01-01 10:01:01'); + const end = formatDateToTimezone('2010-01-01 10:01:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('2000 - 2010'); + }); + it('range: 5 years', () => { + const start = formatDateToTimezone('2010-01-01 10:01:01'); + const end = formatDateToTimezone('2015-01-01 10:01:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('2010 - 2015'); + }); + }); + describe('MMM YYYY - MMM YYYY', () => { + it('range: 4 years ', () => { + const start = formatDateToTimezone('2010-01-01 10:01:01'); + const end = formatDateToTimezone('2014-04-01 10:01:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Jan 2010 - Apr 2014'); + }); + it('range: 6 months ', () => { + const start = formatDateToTimezone('2019-01-01 10:01:01'); + const end = formatDateToTimezone('2019-07-01 10:01:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Jan 2019 - Jul 2019'); + }); + }); + describe('MMM D, YYYY - MMM D, YYYY', () => { + it('range: 2 days', () => { + const start = formatDateToTimezone('2019-10-01 10:01:01'); + const end = formatDateToTimezone('2019-10-05 10:01:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 1, 2019 - Oct 5, 2019'); + }); + it('range: 1 day', () => { + const start = formatDateToTimezone('2019-10-01 10:01:01'); + const end = formatDateToTimezone('2019-10-03 10:01:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 1, 2019 - Oct 3, 2019'); + }); + }); + describe('MMM D, YYYY, HH:mm - HH:mm (UTC)', () => { + it('range: 9 hours', () => { + const start = formatDateToTimezone('2019-10-29 10:01:01'); + const end = formatDateToTimezone('2019-10-29 19:01:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 29, 2019, 10:01 - 19:01 (UTC+1)'); + }); + it('range: 5 hours', () => { + const start = formatDateToTimezone('2019-10-29 10:01:01'); + const end = formatDateToTimezone('2019-10-29 15:01:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 29, 2019, 10:01 - 15:01 (UTC+1)'); + }); + it('range: 14 minutes', () => { + const start = formatDateToTimezone('2019-10-29 10:01:01'); + const end = formatDateToTimezone('2019-10-29 10:15:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 29, 2019, 10:01 - 10:15 (UTC+1)'); + }); + it('range: 5 minutes', () => { + const start = formatDateToTimezone('2019-10-29 10:01:01'); + const end = formatDateToTimezone('2019-10-29 10:06:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 29, 2019, 10:01 - 10:06 (UTC+1)'); + }); + it('range: 1 minute', () => { + const start = formatDateToTimezone('2019-10-29 10:01:01'); + const end = formatDateToTimezone('2019-10-29 10:02:01'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 29, 2019, 10:01 - 10:02 (UTC+1)'); + }); + }); + describe('MMM D, YYYY, HH:mm:ss - HH:mm:ss (UTC)', () => { + it('range: 50 seconds', () => { + const start = formatDateToTimezone('2019-10-29 10:01:01'); + const end = formatDateToTimezone('2019-10-29 10:01:50'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 29, 2019, 10:01:01 - 10:01:50 (UTC+1)'); + }); + it('range: 10 seconds', () => { + const start = formatDateToTimezone('2019-10-29 10:01:01'); + const end = formatDateToTimezone('2019-10-29 10:01:11'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 29, 2019, 10:01:01 - 10:01:11 (UTC+1)'); + }); + }); + describe('MMM D, YYYY, HH:mm:ss.SSS - HH:mm:ss.SSS (UTC)', () => { + it('range: 9 seconds', () => { + const start = formatDateToTimezone('2019-10-29 10:01:01.001'); + const end = formatDateToTimezone('2019-10-29 10:01:10.002'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 29, 2019, 10:01:01.001 - 10:01:10.002 (UTC+1)'); + }); + it('range: 1 second', () => { + const start = formatDateToTimezone('2019-10-29 10:01:01.001'); + const end = formatDateToTimezone('2019-10-29 10:01:02.002'); + const dateRange = asRelativeDateTimeRange(start, end); + expect(dateRange).toEqual('Oct 29, 2019, 10:01:01.001 - 10:01:02.002 (UTC+1)'); + }); + }); + }); + + describe('asAbsoluteDateTime', () => { + afterAll(() => moment.tz.setDefault('')); + + it('should add a leading plus for timezones with positive UTC offset', () => { + moment.tz.setDefault('Europe/Copenhagen'); + expect(asAbsoluteDateTime(1559390400000, 'minutes')).toBe('Jun 1, 2019, 14:00 (UTC+2)'); + }); + + it('should add a leading minus for timezones with negative UTC offset', () => { + moment.tz.setDefault('America/Los_Angeles'); + expect(asAbsoluteDateTime(1559390400000, 'minutes')).toBe('Jun 1, 2019, 05:00 (UTC-7)'); + }); + + it('should use default UTC offset formatting when offset contains minutes', () => { + moment.tz.setDefault('Canada/Newfoundland'); + expect(asAbsoluteDateTime(1559390400000, 'minutes')).toBe('Jun 1, 2019, 09:30 (UTC-02:30)'); + }); + + it('should respect DST', () => { + moment.tz.setDefault('Europe/Copenhagen'); + const timeWithDST = 1559390400000; // Jun 1, 2019 + const timeWithoutDST = 1575201600000; // Dec 1, 2019 + + expect(asAbsoluteDateTime(timeWithDST)).toBe('Jun 1, 2019, 14:00:00.000 (UTC+2)'); + + expect(asAbsoluteDateTime(timeWithoutDST)).toBe('Dec 1, 2019, 13:00:00.000 (UTC+1)'); + }); + }); + describe('getDateDifference', () => { + it('milliseconds', () => { + const start = moment('2019-10-29 08:00:00.001'); + const end = moment('2019-10-29 08:00:00.005'); + expect(getDateDifference({ start, end, unitOfTime: 'milliseconds' })).toEqual(4); + }); + it('seconds', () => { + const start = moment('2019-10-29 08:00:00'); + const end = moment('2019-10-29 08:00:10'); + expect(getDateDifference({ start, end, unitOfTime: 'seconds' })).toEqual(10); + }); + it('minutes', () => { + const start = moment('2019-10-29 08:00:00'); + const end = moment('2019-10-29 08:15:00'); + expect(getDateDifference({ start, end, unitOfTime: 'minutes' })).toEqual(15); + }); + it('hours', () => { + const start = moment('2019-10-29 08:00:00'); + const end = moment('2019-10-29 10:00:00'); + expect(getDateDifference({ start, end, unitOfTime: 'hours' })).toEqual(2); + }); + it('days', () => { + const start = moment('2019-10-29 08:00:00'); + const end = moment('2019-10-30 10:00:00'); + expect(getDateDifference({ start, end, unitOfTime: 'days' })).toEqual(1); + }); + it('months', () => { + const start = moment('2019-10-29 08:00:00'); + const end = moment('2019-12-29 08:00:00'); + expect(getDateDifference({ start, end, unitOfTime: 'months' })).toEqual(2); + }); + it('years', () => { + const start = moment('2019-10-29 08:00:00'); + const end = moment('2020-10-29 08:00:00'); + expect(getDateDifference({ start, end, unitOfTime: 'years' })).toEqual(1); + }); + it('precise days', () => { + const start = moment('2019-10-29 08:00:00'); + const end = moment('2019-10-30 10:00:00'); + expect(getDateDifference({ start, end, unitOfTime: 'days', precise: true })).toEqual( + 1.0833333333333333 + ); + }); + }); +}); diff --git a/x-pack/plugins/observability/common/utils/formatters/datetime.ts b/x-pack/plugins/observability/common/utils/formatters/datetime.ts new file mode 100644 index 0000000000000..ebb332797ad2e --- /dev/null +++ b/x-pack/plugins/observability/common/utils/formatters/datetime.ts @@ -0,0 +1,148 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import moment from 'moment-timezone'; + +/** + * Returns the timezone set on momentTime. + * (UTC+offset) when offset if bigger than 0. + * (UTC-offset) when offset if lower than 0. + * @param momentTime Moment + */ +function formatTimezone(momentTime: moment.Moment) { + const DEFAULT_TIMEZONE_FORMAT = 'Z'; + + const utcOffsetHours = momentTime.utcOffset() / 60; + + const customTimezoneFormat = utcOffsetHours > 0 ? `+${utcOffsetHours}` : utcOffsetHours; + + const utcOffsetFormatted = Number.isInteger(utcOffsetHours) + ? customTimezoneFormat + : DEFAULT_TIMEZONE_FORMAT; + + return momentTime.format(`(UTC${utcOffsetFormatted})`); +} + +export type TimeUnit = 'hours' | 'minutes' | 'seconds' | 'milliseconds'; +function getTimeFormat(timeUnit: TimeUnit) { + switch (timeUnit) { + case 'hours': + return 'HH'; + case 'minutes': + return 'HH:mm'; + case 'seconds': + return 'HH:mm:ss'; + case 'milliseconds': + return 'HH:mm:ss.SSS'; + default: + return ''; + } +} + +type DateUnit = 'days' | 'months' | 'years'; +function getDateFormat(dateUnit: DateUnit) { + switch (dateUnit) { + case 'years': + return 'YYYY'; + case 'months': + return 'MMM YYYY'; + case 'days': + return 'MMM D, YYYY'; + default: + return ''; + } +} + +export const getDateDifference = ({ + start, + end, + unitOfTime, + precise, +}: { + start: moment.Moment; + end: moment.Moment; + unitOfTime: DateUnit | TimeUnit; + precise?: boolean; +}) => end.diff(start, unitOfTime, precise); + +function getFormatsAccordingToDateDifference(start: moment.Moment, end: moment.Moment) { + if (getDateDifference({ start, end, unitOfTime: 'years' }) >= 5) { + return { dateFormat: getDateFormat('years') }; + } + + if (getDateDifference({ start, end, unitOfTime: 'months' }) >= 5) { + return { dateFormat: getDateFormat('months') }; + } + + const dateFormatWithDays = getDateFormat('days'); + if (getDateDifference({ start, end, unitOfTime: 'days' }) > 1) { + return { dateFormat: dateFormatWithDays }; + } + + if (getDateDifference({ start, end, unitOfTime: 'minutes' }) >= 1) { + return { + dateFormat: dateFormatWithDays, + timeFormat: getTimeFormat('minutes'), + }; + } + + if (getDateDifference({ start, end, unitOfTime: 'seconds' }) >= 10) { + return { + dateFormat: dateFormatWithDays, + timeFormat: getTimeFormat('seconds'), + }; + } + + return { + dateFormat: dateFormatWithDays, + timeFormat: getTimeFormat('milliseconds'), + }; +} + +export function asAbsoluteDateTime(time: number, timeUnit: TimeUnit = 'milliseconds') { + const momentTime = moment(time); + const formattedTz = formatTimezone(momentTime); + + return momentTime.format(`${getDateFormat('days')}, ${getTimeFormat(timeUnit)} ${formattedTz}`); +} + +/** + * + * Returns the dates formatted according to the difference between the two dates: + * + * | Difference | Format | + * | -------------- |:----------------------------------------------:| + * | >= 5 years | YYYY - YYYY | + * | >= 5 months | MMM YYYY - MMM YYYY | + * | > 1 day | MMM D, YYYY - MMM D, YYYY | + * | >= 1 minute | MMM D, YYYY, HH:mm - HH:mm (UTC) | + * | >= 10 seconds | MMM D, YYYY, HH:mm:ss - HH:mm:ss (UTC) | + * | default | MMM D, YYYY, HH:mm:ss.SSS - HH:mm:ss.SSS (UTC) | + * + * @param start timestamp + * @param end timestamp + */ +export function asRelativeDateTimeRange(start: number, end: number) { + const momentStartTime = moment(start); + const momentEndTime = moment(end); + + const { dateFormat, timeFormat } = getFormatsAccordingToDateDifference( + momentStartTime, + momentEndTime + ); + + if (timeFormat) { + const startFormatted = momentStartTime.format(`${dateFormat}, ${timeFormat}`); + const endFormatted = momentEndTime.format(timeFormat); + const formattedTz = formatTimezone(momentStartTime); + return `${startFormatted} - ${endFormatted} ${formattedTz}`; + } + + const startFormatted = momentStartTime.format(dateFormat); + const endFormatted = momentEndTime.format(dateFormat); + return `${startFormatted} - ${endFormatted}`; +} diff --git a/x-pack/plugins/observability/common/utils/formatters/duration.test.ts b/x-pack/plugins/observability/common/utils/formatters/duration.test.ts new file mode 100644 index 0000000000000..83bcae34a2cf7 --- /dev/null +++ b/x-pack/plugins/observability/common/utils/formatters/duration.test.ts @@ -0,0 +1,51 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { asDuration, toMicroseconds, asMillisecondDuration } from './duration'; + +describe('duration formatters', () => { + describe('asDuration', () => { + it('formats correctly with defaults', () => { + expect(asDuration(null)).toEqual('N/A'); + expect(asDuration(undefined)).toEqual('N/A'); + expect(asDuration(0)).toEqual('0 μs'); + expect(asDuration(1)).toEqual('1 μs'); + expect(asDuration(toMicroseconds(1, 'milliseconds'))).toEqual('1,000 μs'); + expect(asDuration(toMicroseconds(1000, 'milliseconds'))).toEqual('1,000 ms'); + expect(asDuration(toMicroseconds(10000, 'milliseconds'))).toEqual('10,000 ms'); + expect(asDuration(toMicroseconds(20, 'seconds'))).toEqual('20 s'); + expect(asDuration(toMicroseconds(10, 'minutes'))).toEqual('600 s'); + expect(asDuration(toMicroseconds(11, 'minutes'))).toEqual('11 min'); + expect(asDuration(toMicroseconds(1, 'hours'))).toEqual('60 min'); + expect(asDuration(toMicroseconds(1.5, 'hours'))).toEqual('90 min'); + expect(asDuration(toMicroseconds(10, 'hours'))).toEqual('600 min'); + expect(asDuration(toMicroseconds(11, 'hours'))).toEqual('11 h'); + }); + + it('falls back to default value', () => { + expect(asDuration(undefined, { defaultValue: 'nope' })).toEqual('nope'); + }); + }); + + describe('toMicroseconds', () => { + it('transformes to microseconds', () => { + expect(toMicroseconds(1, 'hours')).toEqual(3600000000); + expect(toMicroseconds(10, 'minutes')).toEqual(600000000); + expect(toMicroseconds(10, 'seconds')).toEqual(10000000); + expect(toMicroseconds(10, 'milliseconds')).toEqual(10000); + }); + }); + + describe('asMilliseconds', () => { + it('converts to formatted decimal milliseconds', () => { + expect(asMillisecondDuration(0)).toEqual('0 ms'); + }); + it('formats correctly with undefined values', () => { + expect(asMillisecondDuration(undefined)).toEqual('N/A'); + }); + }); +}); diff --git a/x-pack/plugins/observability/common/utils/formatters/duration.ts b/x-pack/plugins/observability/common/utils/formatters/duration.ts new file mode 100644 index 0000000000000..6bbeb44ef06af --- /dev/null +++ b/x-pack/plugins/observability/common/utils/formatters/duration.ts @@ -0,0 +1,214 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import moment from 'moment'; +import { memoize } from 'lodash'; +import { NOT_AVAILABLE_LABEL } from '../../i18n'; +import { asDecimalOrInteger, asInteger, asDecimal } from './formatters'; +import { TimeUnit } from './datetime'; +import { Maybe } from '../../typings'; +import { isFiniteNumber } from '../is_finite_number'; + +interface FormatterOptions { + defaultValue?: string; + extended?: boolean; +} + +type DurationTimeUnit = TimeUnit | 'microseconds'; + +interface ConvertedDuration { + value: string; + unit?: string; + formatted: string; +} + +export type TimeFormatter = (value: Maybe, options?: FormatterOptions) => ConvertedDuration; + +type TimeFormatterBuilder = (max: number) => TimeFormatter; + +function getUnitLabelAndConvertedValue(unitKey: DurationTimeUnit, value: number) { + switch (unitKey) { + case 'hours': { + return { + unitLabel: i18n.translate('xpack.observability.formatters.hoursTimeUnitLabel', { + defaultMessage: 'h', + }), + unitLabelExtended: i18n.translate( + 'xpack.observability.formatters.hoursTimeUnitLabelExtended', + { + defaultMessage: 'hours', + } + ), + convertedValue: asDecimalOrInteger(moment.duration(value / 1000).asHours()), + }; + } + case 'minutes': { + return { + unitLabel: i18n.translate('xpack.observability.formatters.minutesTimeUnitLabel', { + defaultMessage: 'min', + }), + unitLabelExtended: i18n.translate( + 'xpack.observability.formatters.minutesTimeUnitLabelExtended', + { + defaultMessage: 'minutes', + } + ), + convertedValue: asDecimalOrInteger(moment.duration(value / 1000).asMinutes()), + }; + } + case 'seconds': { + return { + unitLabel: i18n.translate('xpack.observability.formatters.secondsTimeUnitLabel', { + defaultMessage: 's', + }), + unitLabelExtended: i18n.translate( + 'xpack.observability.formatters.secondsTimeUnitLabelExtended', + { + defaultMessage: 'seconds', + } + ), + convertedValue: asDecimalOrInteger(moment.duration(value / 1000).asSeconds()), + }; + } + case 'milliseconds': { + return { + unitLabel: i18n.translate('xpack.observability.formatters.millisTimeUnitLabel', { + defaultMessage: 'ms', + }), + unitLabelExtended: i18n.translate( + 'xpack.observability.formatters.millisTimeUnitLabelExtended', + { + defaultMessage: 'milliseconds', + } + ), + convertedValue: asDecimalOrInteger(moment.duration(value / 1000).asMilliseconds()), + }; + } + case 'microseconds': { + return { + unitLabel: i18n.translate('xpack.observability.formatters.microsTimeUnitLabel', { + defaultMessage: 'μs', + }), + unitLabelExtended: i18n.translate( + 'xpack.observability.formatters.microsTimeUnitLabelExtended', + { + defaultMessage: 'microseconds', + } + ), + convertedValue: asInteger(value), + }; + } + } +} + +/** + * Converts a microseconds value into the unit defined. + */ +function convertTo({ + unit, + microseconds, + defaultValue = NOT_AVAILABLE_LABEL, + extended, +}: { + unit: DurationTimeUnit; + microseconds: Maybe; + defaultValue?: string; + extended?: boolean; +}): ConvertedDuration { + if (!isFiniteNumber(microseconds)) { + return { value: defaultValue, formatted: defaultValue }; + } + + const { convertedValue, unitLabel, unitLabelExtended } = getUnitLabelAndConvertedValue( + unit, + microseconds + ); + + const label = extended ? unitLabelExtended : unitLabel; + + return { + value: convertedValue, + unit: unitLabel, + formatted: `${convertedValue} ${label}`, + }; +} + +export const toMicroseconds = (value: number, timeUnit: TimeUnit) => + moment.duration(value, timeUnit).asMilliseconds() * 1000; + +function getDurationUnitKey(max: number): DurationTimeUnit { + if (max > toMicroseconds(10, 'hours')) { + return 'hours'; + } + if (max > toMicroseconds(10, 'minutes')) { + return 'minutes'; + } + if (max > toMicroseconds(10, 'seconds')) { + return 'seconds'; + } + if (max > toMicroseconds(1, 'milliseconds')) { + return 'milliseconds'; + } + return 'microseconds'; +} + +export const getDurationFormatter: TimeFormatterBuilder = memoize((max: number) => { + const unit = getDurationUnitKey(max); + return (value, { defaultValue, extended }: FormatterOptions = {}) => { + return convertTo({ unit, microseconds: value, defaultValue, extended }); + }; +}); + +export function asTransactionRate(value: Maybe) { + if (!isFiniteNumber(value)) { + return NOT_AVAILABLE_LABEL; + } + + let displayedValue: string; + + if (value === 0) { + displayedValue = '0'; + } else if (value <= 0.1) { + displayedValue = '< 0.1'; + } else { + displayedValue = asDecimal(value); + } + + return i18n.translate('xpack.observability.transactionRateLabel', { + defaultMessage: `{value} tpm`, + values: { + value: displayedValue, + }, + }); +} + +/** + * Converts value and returns it formatted - 00 unit + */ +export function asDuration( + value: Maybe, + { defaultValue = NOT_AVAILABLE_LABEL, extended }: FormatterOptions = {} +) { + if (!isFiniteNumber(value)) { + return defaultValue; + } + + const formatter = getDurationFormatter(value); + return formatter(value, { defaultValue, extended }).formatted; +} +/** + * Convert a microsecond value to decimal milliseconds. Normally we use + * `asDuration`, but this is used in places like tables where we always want + * the same units. + */ +export function asMillisecondDuration(value: Maybe) { + return convertTo({ + unit: 'milliseconds', + microseconds: value, + }).formatted; +} diff --git a/x-pack/plugins/observability/common/utils/formatters/formatters.test.ts b/x-pack/plugins/observability/common/utils/formatters/formatters.test.ts new file mode 100644 index 0000000000000..230912045077d --- /dev/null +++ b/x-pack/plugins/observability/common/utils/formatters/formatters.test.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { asPercent, asDecimalOrInteger } from './formatters'; + +describe('formatters', () => { + describe('asPercent', () => { + it('formats as integer when number is above 10', () => { + expect(asPercent(3725, 10000, 'n/a')).toEqual('37%'); + }); + + it('adds a decimal when value is below 10', () => { + expect(asPercent(0.092, 1)).toEqual('9.2%'); + }); + + it('formats when numerator is 0', () => { + expect(asPercent(0, 1, 'n/a')).toEqual('0%'); + }); + + it('returns fallback when denominator is undefined', () => { + expect(asPercent(3725, undefined, 'n/a')).toEqual('n/a'); + }); + + it('returns fallback when denominator is 0 ', () => { + expect(asPercent(3725, 0, 'n/a')).toEqual('n/a'); + }); + + it('returns fallback when numerator or denominator is NaN', () => { + expect(asPercent(3725, NaN, 'n/a')).toEqual('n/a'); + expect(asPercent(NaN, 10000, 'n/a')).toEqual('n/a'); + }); + }); + + describe('asDecimalOrInteger', () => { + it('formats as integer when number equals to 0 ', () => { + expect(asDecimalOrInteger(0)).toEqual('0'); + }); + it('formats as integer when number is above or equals 10 ', () => { + expect(asDecimalOrInteger(10.123)).toEqual('10'); + expect(asDecimalOrInteger(15.123)).toEqual('15'); + }); + it('formats as decimal when number is below 10 ', () => { + expect(asDecimalOrInteger(0.25435632645)).toEqual('0.3'); + expect(asDecimalOrInteger(1)).toEqual('1.0'); + expect(asDecimalOrInteger(3.374329704990765)).toEqual('3.4'); + expect(asDecimalOrInteger(5)).toEqual('5.0'); + expect(asDecimalOrInteger(9)).toEqual('9.0'); + }); + }); +}); diff --git a/x-pack/plugins/observability/common/utils/formatters/formatters.ts b/x-pack/plugins/observability/common/utils/formatters/formatters.ts new file mode 100644 index 0000000000000..3c307f64fa0a9 --- /dev/null +++ b/x-pack/plugins/observability/common/utils/formatters/formatters.ts @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import numeral from '@elastic/numeral'; +import { Maybe } from '../../typings'; +import { NOT_AVAILABLE_LABEL } from '../../i18n'; +import { isFiniteNumber } from '../is_finite_number'; + +export function asDecimal(value?: number | null) { + if (!isFiniteNumber(value)) { + return NOT_AVAILABLE_LABEL; + } + + return numeral(value).format('0,0.0'); +} + +export function asInteger(value?: number | null) { + if (!isFiniteNumber(value)) { + return NOT_AVAILABLE_LABEL; + } + + return numeral(value).format('0,0'); +} + +export function asPercent( + numerator: Maybe, + denominator: number | undefined, + fallbackResult = NOT_AVAILABLE_LABEL +) { + if (!denominator || !isFiniteNumber(numerator)) { + return fallbackResult; + } + + const decimal = numerator / denominator; + + // 33.2 => 33% + // 3.32 => 3.3% + // 0 => 0% + if (Math.abs(decimal) >= 0.1 || decimal === 0) { + return numeral(decimal).format('0%'); + } + + return numeral(decimal).format('0.0%'); +} + +export function asDecimalOrInteger(value: number) { + // exact 0 or above 10 should not have decimal + if (value === 0 || value >= 10) { + return asInteger(value); + } + return asDecimal(value); +} diff --git a/x-pack/plugins/observability/common/utils/formatters/index.ts b/x-pack/plugins/observability/common/utils/formatters/index.ts new file mode 100644 index 0000000000000..1a431867308b6 --- /dev/null +++ b/x-pack/plugins/observability/common/utils/formatters/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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export * from './formatters'; +export * from './datetime'; +export * from './duration'; +export * from './size'; diff --git a/x-pack/plugins/observability/common/utils/formatters/size.test.ts b/x-pack/plugins/observability/common/utils/formatters/size.test.ts new file mode 100644 index 0000000000000..a71617151c0db --- /dev/null +++ b/x-pack/plugins/observability/common/utils/formatters/size.test.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getFixedByteFormatter, asDynamicBytes } from './size'; + +describe('size formatters', () => { + describe('byte formatting', () => { + const bytes = 10; + const kb = 1000 + 1; + const mb = 1e6 + 1; + const gb = 1e9 + 1; + const tb = 1e12 + 1; + + test('dynamic', () => { + expect(asDynamicBytes(bytes)).toEqual('10.0 B'); + expect(asDynamicBytes(kb)).toEqual('1.0 KB'); + expect(asDynamicBytes(mb)).toEqual('1.0 MB'); + expect(asDynamicBytes(gb)).toEqual('1.0 GB'); + expect(asDynamicBytes(tb)).toEqual('1.0 TB'); + expect(asDynamicBytes(null)).toEqual(''); + expect(asDynamicBytes(NaN)).toEqual(''); + }); + + describe('fixed', () => { + test('in bytes', () => { + const formatInBytes = getFixedByteFormatter(bytes); + expect(formatInBytes(bytes)).toEqual('10.0 B'); + expect(formatInBytes(kb)).toEqual('1,001.0 B'); + expect(formatInBytes(mb)).toEqual('1,000,001.0 B'); + expect(formatInBytes(gb)).toEqual('1,000,000,001.0 B'); + expect(formatInBytes(tb)).toEqual('1,000,000,000,001.0 B'); + expect(formatInBytes(null)).toEqual(''); + expect(formatInBytes(NaN)).toEqual(''); + }); + + test('in kb', () => { + const formatInKB = getFixedByteFormatter(kb); + expect(formatInKB(bytes)).toEqual('0.0 KB'); + expect(formatInKB(kb)).toEqual('1.0 KB'); + expect(formatInKB(mb)).toEqual('1,000.0 KB'); + expect(formatInKB(gb)).toEqual('1,000,000.0 KB'); + expect(formatInKB(tb)).toEqual('1,000,000,000.0 KB'); + }); + + test('in mb', () => { + const formatInMB = getFixedByteFormatter(mb); + expect(formatInMB(bytes)).toEqual('0.0 MB'); + expect(formatInMB(kb)).toEqual('0.0 MB'); + expect(formatInMB(mb)).toEqual('1.0 MB'); + expect(formatInMB(gb)).toEqual('1,000.0 MB'); + expect(formatInMB(tb)).toEqual('1,000,000.0 MB'); + expect(formatInMB(null)).toEqual(''); + expect(formatInMB(NaN)).toEqual(''); + }); + + test('in gb', () => { + const formatInGB = getFixedByteFormatter(gb); + expect(formatInGB(bytes)).toEqual('1e-8 GB'); + expect(formatInGB(kb)).toEqual('0.0 GB'); + expect(formatInGB(mb)).toEqual('0.0 GB'); + expect(formatInGB(gb)).toEqual('1.0 GB'); + expect(formatInGB(tb)).toEqual('1,000.0 GB'); + expect(formatInGB(null)).toEqual(''); + expect(formatInGB(NaN)).toEqual(''); + }); + + test('in tb', () => { + const formatInTB = getFixedByteFormatter(tb); + expect(formatInTB(bytes)).toEqual('1e-11 TB'); + expect(formatInTB(kb)).toEqual('1.001e-9 TB'); + expect(formatInTB(mb)).toEqual('0.0 TB'); + expect(formatInTB(gb)).toEqual('0.0 TB'); + expect(formatInTB(tb)).toEqual('1.0 TB'); + expect(formatInTB(null)).toEqual(''); + expect(formatInTB(NaN)).toEqual(''); + }); + }); + }); +}); diff --git a/x-pack/plugins/observability/common/utils/formatters/size.ts b/x-pack/plugins/observability/common/utils/formatters/size.ts new file mode 100644 index 0000000000000..ec0b753f1523d --- /dev/null +++ b/x-pack/plugins/observability/common/utils/formatters/size.ts @@ -0,0 +1,69 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { memoize } from 'lodash'; +import { asDecimal } from './formatters'; +import { Maybe } from '../../typings'; + +function asKilobytes(value: number) { + return `${asDecimal(value / 1000)} KB`; +} + +function asMegabytes(value: number) { + return `${asDecimal(value / 1e6)} MB`; +} + +function asGigabytes(value: number) { + return `${asDecimal(value / 1e9)} GB`; +} + +function asTerabytes(value: number) { + return `${asDecimal(value / 1e12)} TB`; +} + +function asBytes(value: number) { + return `${asDecimal(value)} B`; +} + +const bailIfNumberInvalid = (cb: (val: number) => string) => { + return (val: Maybe) => { + if (val === null || val === undefined || isNaN(val)) { + return ''; + } + return cb(val); + }; +}; + +export const getFixedByteFormatter = memoize((max: number) => { + const formatter = unmemoizedFixedByteFormatter(max); + + return bailIfNumberInvalid(formatter); +}); + +export const asDynamicBytes = bailIfNumberInvalid((value: number) => { + return unmemoizedFixedByteFormatter(value)(value); +}); + +const unmemoizedFixedByteFormatter = (max: number) => { + if (max > 1e12) { + return asTerabytes; + } + + if (max > 1e9) { + return asGigabytes; + } + + if (max > 1e6) { + return asMegabytes; + } + + if (max > 1000) { + return asKilobytes; + } + + return asBytes; +}; diff --git a/x-pack/plugins/observability/common/utils/is_finite_number.ts b/x-pack/plugins/observability/common/utils/is_finite_number.ts new file mode 100644 index 0000000000000..e5c9af80c7d69 --- /dev/null +++ b/x-pack/plugins/observability/common/utils/is_finite_number.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { isFinite } from 'lodash'; + +// _.isNumber() returns true for NaN, _.isFinite() does not refine +export function isFiniteNumber(value: any): value is number { + return isFinite(value); +} diff --git a/x-pack/plugins/observability/common/utils/join_by_key/index.test.ts b/x-pack/plugins/observability/common/utils/join_by_key/index.test.ts new file mode 100644 index 0000000000000..93be59df9c0ca --- /dev/null +++ b/x-pack/plugins/observability/common/utils/join_by_key/index.test.ts @@ -0,0 +1,169 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { joinByKey } from './'; + +describe('joinByKey', () => { + it('joins by a string key', () => { + const joined = joinByKey( + [ + { + serviceName: 'opbeans-node', + avg: 10, + }, + { + serviceName: 'opbeans-node', + count: 12, + }, + { + serviceName: 'opbeans-java', + avg: 11, + }, + { + serviceName: 'opbeans-java', + p95: 18, + }, + ], + 'serviceName' + ); + + expect(joined.length).toBe(2); + + expect(joined).toEqual([ + { + serviceName: 'opbeans-node', + avg: 10, + count: 12, + }, + { + serviceName: 'opbeans-java', + avg: 11, + p95: 18, + }, + ]); + }); + + it('joins by a record key', () => { + const joined = joinByKey( + [ + { + key: { + serviceName: 'opbeans-node', + transactionName: '/api/opbeans-node', + }, + avg: 10, + }, + { + key: { + serviceName: 'opbeans-node', + transactionName: '/api/opbeans-node', + }, + count: 12, + }, + { + key: { + serviceName: 'opbeans-java', + transactionName: '/api/opbeans-java', + }, + avg: 11, + }, + { + key: { + serviceName: 'opbeans-java', + transactionName: '/api/opbeans-java', + }, + p95: 18, + }, + ], + 'key' + ); + + expect(joined.length).toBe(2); + + expect(joined).toEqual([ + { + key: { + serviceName: 'opbeans-node', + transactionName: '/api/opbeans-node', + }, + avg: 10, + count: 12, + }, + { + key: { + serviceName: 'opbeans-java', + transactionName: '/api/opbeans-java', + }, + avg: 11, + p95: 18, + }, + ]); + }); + + it('uses the custom merge fn to replace items', () => { + const joined = joinByKey( + [ + { + serviceName: 'opbeans-java', + values: ['a'], + }, + { + serviceName: 'opbeans-node', + values: ['a'], + }, + { + serviceName: 'opbeans-node', + values: ['b'], + }, + { + serviceName: 'opbeans-node', + values: ['c'], + }, + ], + 'serviceName', + (a, b) => ({ + ...a, + ...b, + values: a.values.concat(b.values), + }) + ); + + expect(joined.find((item) => item.serviceName === 'opbeans-node')?.values).toEqual([ + 'a', + 'b', + 'c', + ]); + }); + + it('deeply merges objects', () => { + const joined = joinByKey( + [ + { + serviceName: 'opbeans-node', + properties: { + foo: '', + }, + }, + { + serviceName: 'opbeans-node', + properties: { + bar: '', + }, + }, + ], + 'serviceName' + ); + + expect(joined[0]).toEqual({ + serviceName: 'opbeans-node', + properties: { + foo: '', + bar: '', + }, + }); + }); +}); diff --git a/x-pack/plugins/observability/common/utils/join_by_key/index.ts b/x-pack/plugins/observability/common/utils/join_by_key/index.ts new file mode 100644 index 0000000000000..91c10e5c550d8 --- /dev/null +++ b/x-pack/plugins/observability/common/utils/join_by_key/index.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { UnionToIntersection, ValuesType } from 'utility-types'; +import { isEqual, pull, merge, castArray } from 'lodash'; + +/** + * Joins a list of records by a given key. Key can be any type of value, from + * strings to plain objects, as long as it is present in all records. `isEqual` + * is used for comparing keys. + * + * UnionToIntersection is needed to get all keys of union types, see below for + * example. + * + const agentNames = [{ serviceName: '', agentName: '' }]; + const transactionRates = [{ serviceName: '', transactionsPerMinute: 1 }]; + const flattened = joinByKey( + [...agentNames, ...transactionRates], + 'serviceName' + ); +*/ + +type JoinedReturnType, U extends UnionToIntersection> = Array< + Partial & + { + [k in keyof T]: T[k]; + } +>; + +type ArrayOrSingle = T | T[]; + +export function joinByKey< + T extends Record, + U extends UnionToIntersection, + V extends ArrayOrSingle +>(items: T[], key: V): JoinedReturnType; + +export function joinByKey< + T extends Record, + U extends UnionToIntersection, + V extends ArrayOrSingle, + W extends JoinedReturnType, + X extends (a: T, b: T) => ValuesType +>(items: T[], key: V, mergeFn: X): W; + +export function joinByKey( + items: Array>, + key: string | string[], + mergeFn: Function = (a: Record, b: Record) => merge({}, a, b) +) { + const keys = castArray(key); + return items.reduce>>((prev, current) => { + let item = prev.find((prevItem) => keys.every((k) => isEqual(prevItem[k], current[k]))); + + if (!item) { + item = { ...current }; + prev.push(item); + } else { + pull(prev, item).push(mergeFn(item, current)); + } + + return prev; + }, []); +} diff --git a/x-pack/plugins/observability/common/utils/maybe.ts b/x-pack/plugins/observability/common/utils/maybe.ts new file mode 100644 index 0000000000000..f73dbe09d6ad4 --- /dev/null +++ b/x-pack/plugins/observability/common/utils/maybe.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export function maybe(value: T): T | null | undefined { + return value; +} diff --git a/x-pack/plugins/observability/common/utils/pick_keys.ts b/x-pack/plugins/observability/common/utils/pick_keys.ts new file mode 100644 index 0000000000000..fe45e9a0e42c8 --- /dev/null +++ b/x-pack/plugins/observability/common/utils/pick_keys.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { pick } from 'lodash'; + +export function pickKeys(obj: T, ...keys: K[]) { + return pick(obj, keys) as Pick; +} diff --git a/x-pack/plugins/observability/kibana.json b/x-pack/plugins/observability/kibana.json index 74efc1f4985a3..0ee978c75d6c0 100644 --- a/x-pack/plugins/observability/kibana.json +++ b/x-pack/plugins/observability/kibana.json @@ -2,10 +2,26 @@ "id": "observability", "version": "8.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack", "observability"], - "optionalPlugins": ["licensing", "home", "usageCollection","lens", "ruleRegistry"], - "requiredPlugins": ["data"], + "configPath": [ + "xpack", + "observability" + ], + "optionalPlugins": [ + "licensing", + "home", + "usageCollection", + "lens" + ], + "requiredPlugins": [ + "data", + "alerting", + "ruleRegistry" + ], "ui": true, "server": true, - "requiredBundles": ["data", "kibanaReact", "kibanaUtils"] + "requiredBundles": [ + "data", + "kibanaReact", + "kibanaUtils" + ] } diff --git a/x-pack/plugins/observability/public/application/application.test.tsx b/x-pack/plugins/observability/public/application/application.test.tsx index d06b3822c2571..34ee22e89e66b 100644 --- a/x-pack/plugins/observability/public/application/application.test.tsx +++ b/x-pack/plugins/observability/public/application/application.test.tsx @@ -10,6 +10,7 @@ import React from 'react'; import { Observable } from 'rxjs'; import { AppMountParameters, CoreStart } from 'src/core/public'; import { ObservabilityPublicPluginsStart } from '../plugin'; +import { createObservabilityRuleRegistryMock } from '../rules/observability_rule_registry_mock'; import { renderApp } from './'; describe('renderApp', () => { @@ -51,7 +52,12 @@ describe('renderApp', () => { } as unknown) as AppMountParameters; expect(() => { - const unmount = renderApp(core, plugins, params); + const unmount = renderApp({ + core, + plugins, + appMountParameters: params, + observabilityRuleRegistry: createObservabilityRuleRegistryMock(), + }); unmount(); }).not.toThrowError(); }); diff --git a/x-pack/plugins/observability/public/application/index.tsx b/x-pack/plugins/observability/public/application/index.tsx index c8a8d877380e3..aa7d1d037d7b7 100644 --- a/x-pack/plugins/observability/public/application/index.tsx +++ b/x-pack/plugins/observability/public/application/index.tsx @@ -18,7 +18,7 @@ import { import { PluginContext } from '../context/plugin_context'; import { usePluginContext } from '../hooks/use_plugin_context'; import { useRouteParams } from '../hooks/use_route_params'; -import { ObservabilityPublicPluginsStart } from '../plugin'; +import { ObservabilityPublicPluginsStart, ObservabilityRuleRegistry } from '../plugin'; import { HasDataContextProvider } from '../context/has_data_context'; import { Breadcrumbs, routes } from '../routes'; import { Storage } from '../../../../../src/plugins/kibana_utils/public'; @@ -66,11 +66,17 @@ function App() { ); } -export const renderApp = ( - core: CoreStart, - plugins: ObservabilityPublicPluginsStart, - appMountParameters: AppMountParameters -) => { +export const renderApp = ({ + core, + plugins, + appMountParameters, + observabilityRuleRegistry, +}: { + core: CoreStart; + plugins: ObservabilityPublicPluginsStart; + observabilityRuleRegistry: ObservabilityRuleRegistry; + appMountParameters: AppMountParameters; +}) => { const { element, history } = appMountParameters; const i18nCore = core.i18n; const isDarkMode = core.uiSettings.get('theme:darkMode'); @@ -84,7 +90,9 @@ export const renderApp = ( ReactDOM.render( - + diff --git a/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx b/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx index d29481a39eb72..8ff68a0466054 100644 --- a/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx +++ b/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx @@ -14,7 +14,7 @@ import * as hasDataHook from '../../../../hooks/use_has_data'; import * as pluginContext from '../../../../hooks/use_plugin_context'; import { HasDataContextValue } from '../../../../context/has_data_context'; import { AppMountParameters, CoreStart } from 'kibana/public'; -import { ObservabilityPublicPluginsStart } from '../../../../plugin'; +import { ObservabilityPublicPluginsStart, ObservabilityRuleRegistry } from '../../../../plugin'; jest.mock('react-router-dom', () => ({ useLocation: () => ({ @@ -40,6 +40,10 @@ describe('APMSection', () => { http: { basePath: { prepend: jest.fn() } }, } as unknown) as CoreStart, appMountParameters: {} as AppMountParameters, + observabilityRuleRegistry: ({ + registerType: jest.fn(), + getTypeByRuleId: jest.fn(), + } as unknown) as ObservabilityRuleRegistry, plugins: ({ data: { query: { diff --git a/x-pack/plugins/observability/public/components/app/section/ux/index.test.tsx b/x-pack/plugins/observability/public/components/app/section/ux/index.test.tsx index d76e6d1b3e551..290990a5c05a5 100644 --- a/x-pack/plugins/observability/public/components/app/section/ux/index.test.tsx +++ b/x-pack/plugins/observability/public/components/app/section/ux/index.test.tsx @@ -7,6 +7,7 @@ import { AppMountParameters, CoreStart } from 'kibana/public'; import React from 'react'; +import { createObservabilityRuleRegistryMock } from '../../../../rules/observability_rule_registry_mock'; import { HasDataContextValue } from '../../../../context/has_data_context'; import * as fetcherHook from '../../../../hooks/use_fetcher'; import * as hasDataHook from '../../../../hooks/use_has_data'; @@ -53,6 +54,7 @@ describe('UXSection', () => { }, }, } as unknown) as ObservabilityPublicPluginsStart, + observabilityRuleRegistry: createObservabilityRuleRegistryMock(), })); }); it('renders with core web vitals', () => { diff --git a/x-pack/plugins/observability/public/components/shared/timestamp_tooltip/index.test.tsx b/x-pack/plugins/observability/public/components/shared/timestamp_tooltip/index.test.tsx new file mode 100644 index 0000000000000..14d0a64be5241 --- /dev/null +++ b/x-pack/plugins/observability/public/components/shared/timestamp_tooltip/index.test.tsx @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { shallow } from 'enzyme'; +import React from 'react'; +import moment from 'moment-timezone'; +import { TimestampTooltip } from './index'; + +function mockNow(date: string | number | Date) { + const fakeNow = new Date(date).getTime(); + return jest.spyOn(Date, 'now').mockReturnValue(fakeNow); +} + +describe('TimestampTooltip', () => { + const timestamp = 1570720000123; // Oct 10, 2019, 08:06:40.123 (UTC-7) + + beforeAll(() => { + // mock Date.now + mockNow(1570737000000); + + moment.tz.setDefault('America/Los_Angeles'); + }); + + afterAll(() => moment.tz.setDefault('')); + + it('should render component with relative time in body and absolute time in tooltip', () => { + expect(shallow()).toMatchInlineSnapshot(` + + 5 hours ago + + `); + }); + + it('should format with precision in milliseconds by default', () => { + expect( + shallow() + .find('EuiToolTip') + .prop('content') + ).toBe('Oct 10, 2019, 08:06:40.123 (UTC-7)'); + }); + + it('should format with precision in seconds', () => { + expect( + shallow() + .find('EuiToolTip') + .prop('content') + ).toBe('Oct 10, 2019, 08:06:40 (UTC-7)'); + }); + + it('should format with precision in minutes', () => { + expect( + shallow() + .find('EuiToolTip') + .prop('content') + ).toBe('Oct 10, 2019, 08:06 (UTC-7)'); + }); +}); diff --git a/x-pack/plugins/observability/public/components/shared/timestamp_tooltip/index.tsx b/x-pack/plugins/observability/public/components/shared/timestamp_tooltip/index.tsx new file mode 100644 index 0000000000000..784507fbfbcd8 --- /dev/null +++ b/x-pack/plugins/observability/public/components/shared/timestamp_tooltip/index.tsx @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { EuiToolTip } from '@elastic/eui'; +import moment from 'moment-timezone'; +import { asAbsoluteDateTime, TimeUnit } from '../../../../common/utils/formatters/datetime'; + +interface Props { + /** + * timestamp in milliseconds + */ + time: number; + timeUnit?: TimeUnit; +} + +export function TimestampTooltip({ time, timeUnit = 'milliseconds' }: Props) { + const momentTime = moment(time); + const relativeTimeLabel = momentTime.fromNow(); + const absoluteTimeLabel = asAbsoluteDateTime(time, timeUnit); + + return ( + + <>{relativeTimeLabel} + + ); +} diff --git a/x-pack/plugins/observability/public/context/plugin_context.tsx b/x-pack/plugins/observability/public/context/plugin_context.tsx index 771968861a6bb..7a6daca6e7923 100644 --- a/x-pack/plugins/observability/public/context/plugin_context.tsx +++ b/x-pack/plugins/observability/public/context/plugin_context.tsx @@ -7,12 +7,13 @@ import { createContext } from 'react'; import { AppMountParameters, CoreStart } from 'kibana/public'; -import { ObservabilityPublicPluginsStart } from '../plugin'; +import { ObservabilityPublicPluginsStart, ObservabilityRuleRegistry } from '../plugin'; export interface PluginContextValue { appMountParameters: AppMountParameters; core: CoreStart; plugins: ObservabilityPublicPluginsStart; + observabilityRuleRegistry: ObservabilityRuleRegistry; } export const PluginContext = createContext({} as PluginContextValue); diff --git a/x-pack/plugins/observability/public/hooks/use_fetcher.tsx b/x-pack/plugins/observability/public/hooks/use_fetcher.tsx index 8e30f270bc58c..ab8263b086fcd 100644 --- a/x-pack/plugins/observability/public/hooks/use_fetcher.tsx +++ b/x-pack/plugins/observability/public/hooks/use_fetcher.tsx @@ -28,7 +28,7 @@ type InferResponseType = Exclude extends Promise( - fn: () => TReturn, + fn: ({}: { signal: AbortSignal }) => TReturn, fnDeps: any[], options: { preservePreviousData?: boolean; @@ -43,8 +43,16 @@ export function useFetcher( }); const [counter, setCounter] = useState(0); useEffect(() => { + let controller: AbortController = new AbortController(); + async function doFetch() { - const promise = fn(); + controller.abort(); + + controller = new AbortController(); + + const signal = controller.signal; + + const promise = fn({ signal }); if (!promise) { return; } @@ -58,22 +66,34 @@ export function useFetcher( try { const data = await promise; - setResult({ - data, - status: FETCH_STATUS.SUCCESS, - error: undefined, - } as FetcherResult>); + // when http fetches are aborted, the promise will be rejected + // and this code is never reached. For async operations that are + // not cancellable, we need to check whether the signal was + // aborted before updating the result. + if (!signal.aborted) { + setResult({ + data, + status: FETCH_STATUS.SUCCESS, + error: undefined, + } as FetcherResult>); + } } catch (e) { - setResult((prevResult) => ({ - data: preservePreviousData ? prevResult.data : undefined, - status: FETCH_STATUS.FAILURE, - error: e, - loading: false, - })); + if (!signal.aborted) { + setResult((prevResult) => ({ + data: preservePreviousData ? prevResult.data : undefined, + status: FETCH_STATUS.FAILURE, + error: e, + loading: false, + })); + } } } doFetch(); + + return () => { + controller.abort(); + }; // eslint-disable-next-line react-hooks/exhaustive-deps }, [counter, ...fnDeps]); diff --git a/x-pack/plugins/observability/public/hooks/use_time_range.test.ts b/x-pack/plugins/observability/public/hooks/use_time_range.test.ts index 184ec4f3390f4..61505d4850dc4 100644 --- a/x-pack/plugins/observability/public/hooks/use_time_range.test.ts +++ b/x-pack/plugins/observability/public/hooks/use_time_range.test.ts @@ -10,6 +10,7 @@ import * as pluginContext from './use_plugin_context'; import { AppMountParameters, CoreStart } from 'kibana/public'; import { ObservabilityPublicPluginsStart } from '../plugin'; import * as kibanaUISettings from './use_kibana_ui_settings'; +import { createObservabilityRuleRegistryMock } from '../rules/observability_rule_registry_mock'; jest.mock('react-router-dom', () => ({ useLocation: () => ({ @@ -37,6 +38,7 @@ describe('useTimeRange', () => { }, }, } as unknown) as ObservabilityPublicPluginsStart, + observabilityRuleRegistry: createObservabilityRuleRegistryMock(), })); jest.spyOn(kibanaUISettings, 'useKibanaUISettings').mockImplementation(() => ({ from: '2020-10-08T05:00:00.000Z', @@ -77,6 +79,7 @@ describe('useTimeRange', () => { }, }, } as unknown) as ObservabilityPublicPluginsStart, + observabilityRuleRegistry: createObservabilityRuleRegistryMock(), })); }); it('returns ranges and absolute times from kibana default settings', () => { diff --git a/x-pack/plugins/observability/public/index.ts b/x-pack/plugins/observability/public/index.ts index 837404d273ee4..ee2df9369aa39 100644 --- a/x-pack/plugins/observability/public/index.ts +++ b/x-pack/plugins/observability/public/index.ts @@ -56,3 +56,5 @@ export { useChartTheme } from './hooks/use_chart_theme'; export { useTheme } from './hooks/use_theme'; export { getApmTraceUrl } from './utils/get_apm_trace_url'; export { createExploratoryViewUrl } from './components/shared/exploratory_view/configurations/utils'; + +export { FormatterRuleRegistry } from './rules/formatter_rule_registry'; diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts.stories.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts.stories.tsx index 4adff299c30b7..33eec65c40dce 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts.stories.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts.stories.tsx @@ -5,68 +5,98 @@ * 2.0. */ +import { StoryContext } from '@storybook/react'; import React, { ComponentType } from 'react'; import { IntlProvider } from 'react-intl'; +import { MemoryRouter } from 'react-router-dom'; import { AlertsPage } from '.'; +import { HttpSetup } from '../../../../../../src/core/public'; import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; import { PluginContext, PluginContextValue } from '../../context/plugin_context'; +import { createObservabilityRuleRegistryMock } from '../../rules/observability_rule_registry_mock'; +import { createCallObservabilityApi } from '../../services/call_observability_api'; +import type { ObservabilityAPIReturnType } from '../../services/call_observability_api/types'; import { AlertsFlyout } from './alerts_flyout'; -import { AlertItem } from './alerts_table'; -import { eventLogPocData, wireframeData } from './example_data'; +import { TopAlert } from './alerts_table'; +import { apmAlertResponseExample, dynamicIndexPattern, flyoutItemExample } from './example_data'; + +interface PageArgs { + items: ObservabilityAPIReturnType<'GET /api/observability/rules/alerts/top'>; +} + +interface FlyoutArgs { + alert: TopAlert; +} export default { title: 'app/Alerts', component: AlertsPage, decorators: [ - (Story: ComponentType) => { + (Story: ComponentType, { args: { items = [] } }: StoryContext) => { + createCallObservabilityApi(({ + get: async (endpoint: string) => { + if (endpoint === '/api/observability/rules/alerts/top') { + return items; + } else if (endpoint === '/api/observability/rules/alerts/dynamic_index_pattern') { + return dynamicIndexPattern; + } + }, + } as unknown) as HttpSetup); + return ( - - {} }, - uiSettings: { - get: (setting: string) => { - if (setting === 'dateFormat') { - return ''; - } else { - return []; - } - }, - }, - }} - > - '' } }, + + + false }, query: {} }, + docLinks: { links: { query: {} } }, + storage: { get: () => {} }, + uiSettings: { + get: (setting: string) => { + if (setting === 'dateFormat') { + return ''; + } else { + return []; + } }, - } as unknown) as PluginContextValue - } + }, + }} > - - - - + '' } }, + }, + observabilityRuleRegistry: createObservabilityRuleRegistryMock(), + } as unknown) as PluginContextValue + } + > + + + + + ); }, ], }; -export function Example() { - return ; -} - -export function EventLog() { - return ; +export function Example(_args: PageArgs) { + return ( + + ); } +Example.args = { + items: apmAlertResponseExample, +} as PageArgs; -export function EmptyState() { - return ; +export function EmptyState(_args: PageArgs) { + return ; } +EmptyState.args = { items: [] } as PageArgs; -export function Flyout() { - return {}} />; +export function Flyout({ alert }: FlyoutArgs) { + return {}} />; } +Flyout.args = { alert: flyoutItemExample } as FlyoutArgs; diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_flyout.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_flyout.tsx index 0b63049ec1f72..4b383283c4d4b 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts_flyout.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_flyout.tsx @@ -6,7 +6,6 @@ */ import { - EuiBadge, EuiFlyout, EuiFlyoutHeader, EuiFlyoutProps, @@ -17,57 +16,46 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import { AlertItem } from './alerts_table'; +import { asDuration } from '../../../common/utils/formatters'; +import { TopAlert } from './alerts_table'; -type AlertsFlyoutProps = AlertItem & EuiFlyoutProps; +type AlertsFlyoutProps = { alert: TopAlert } & EuiFlyoutProps; export function AlertsFlyout(props: AlertsFlyoutProps) { - const { - actualValue, - affectedEntity, - expectedValue, - onClose, - reason, - severity, - severityLog, - status, - duration, - type, - } = props; - const timestamp = props['@timestamp']; + const { onClose, alert } = props; const overviewListItems = [ { title: 'Status', - description: status || '-', + description: alert.active ? 'Active' : 'Recovered', }, { title: 'Severity', - description: severity || '-', // TODO: badge and "(changed 2 min ago)" - }, - { - title: 'Affected entity', - description: affectedEntity || '-', // TODO: link to entity + description: alert.severityLevel || '-', // TODO: badge and "(changed 2 min ago)" }, + // { + // title: 'Affected entity', + // description: affectedEntity || '-', // TODO: link to entity + // }, { title: 'Triggered', - description: timestamp, // TODO: format date + description: alert.start, // TODO: format date }, { title: 'Duration', - description: duration || '-', // TODO: format duration - }, - { - title: 'Expected value', - description: expectedValue || '-', + description: asDuration(alert.duration, { extended: true }) || '-', // TODO: format duration }, + // { + // title: 'Expected value', + // description: expectedValue || '-', + // }, + // { + // title: 'Actual value', + // description: actualValue || '-', + // }, { - title: 'Actual value', - description: actualValue || '-', - }, - { - title: 'Type', - description: type || '-', + title: 'Rule type', + description: alert.ruleCategory || '-', }, ]; @@ -87,7 +75,7 @@ export function AlertsFlyout(props: AlertsFlyoutProps) { ]} items={overviewListItems} /> - + {/*

Severity log

@@ -105,7 +93,7 @@ export function AlertsFlyout(props: AlertsFlyoutProps) { }, ]} items={severityLog ?? []} - /> + /> */} ), }, @@ -123,7 +111,7 @@ export function AlertsFlyout(props: AlertsFlyoutProps) { -

{reason}

+

{alert.ruleName}

diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_search_bar.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_search_bar.tsx index 1afab90f2999e..97595b456d503 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts_search_bar.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_search_bar.tsx @@ -6,19 +6,56 @@ */ import { i18n } from '@kbn/i18n'; -import React from 'react'; +import React, { useMemo } from 'react'; import { SearchBar, TimeHistory } from '../../../../../../src/plugins/data/public'; import { Storage } from '../../../../../../src/plugins/kibana_utils/public'; +import { useFetcher } from '../../hooks/use_fetcher'; +import { callObservabilityApi } from '../../services/call_observability_api'; + +export function AlertsSearchBar({ + rangeFrom, + rangeTo, + onQueryChange, + query, +}: { + rangeFrom?: string; + rangeTo?: string; + query?: string; + onQueryChange: ({}: { + dateRange: { from: string; to: string; mode?: 'absolute' | 'relative' }; + query?: string; + }) => void; +}) { + const timeHistory = useMemo(() => { + return new TimeHistory(new Storage(localStorage)); + }, []); + + const { data: dynamicIndexPattern } = useFetcher(({ signal }) => { + return callObservabilityApi({ + signal, + endpoint: 'GET /api/observability/rules/alerts/dynamic_index_pattern', + }); + }, []); -export function AlertsSearchBar() { return ( { + onQueryChange({ dateRange, query }); + }} + onQuerySubmit={({ dateRange, query: nextQuery }) => { + onQueryChange({ + dateRange, + query: typeof nextQuery?.query === 'string' ? nextQuery.query : '', + }); + }} /> ); } diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_table.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_table.tsx index 057e3e74b84d8..0985597cc4b69 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts_table.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_table.tsx @@ -12,66 +12,38 @@ import { DefaultItemAction, EuiTableSelectionType, EuiLink, + EuiBadge, } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; import React, { useState } from 'react'; +import { asDuration } from '../../../common/utils/formatters'; +import { TimestampTooltip } from '../../components/shared/timestamp_tooltip'; import { usePluginContext } from '../../hooks/use_plugin_context'; import { AlertsFlyout } from './alerts_flyout'; -/** - * The type of an item in the alert list. - * - * The fields here are the minimum to make this work at this time, but - * eventually this type should be derived from the schema of what is returned in - * the API response. - */ -export interface AlertItem { - '@timestamp': number; +export interface TopAlert { + start: number; + duration: number; reason: string; - severity: string; - // These are just made up so we can make example links - service?: { name?: string }; - pod?: string; - log?: boolean; - // Other fields used in the flyout - actualValue?: string; - affectedEntity?: string; - expectedValue?: string; - severityLog?: Array<{ '@timestamp': number; severity: string; message: string }>; - status?: string; - duration?: string; - type?: string; + link?: string; + severityLevel?: string; + active: boolean; + ruleName: string; + ruleCategory: string; } type AlertsTableProps = Omit< - EuiBasicTableProps, + EuiBasicTableProps, 'columns' | 'isSelectable' | 'pagination' | 'selection' >; export function AlertsTable(props: AlertsTableProps) { - const [flyoutAlert, setFlyoutAlert] = useState(undefined); + const [flyoutAlert, setFlyoutAlert] = useState(undefined); const handleFlyoutClose = () => setFlyoutAlert(undefined); - const { prepend } = usePluginContext().core.http.basePath; - - // This is a contrived implementation of the reason field that shows how - // you could link to certain types of resources based on what's contained - // in their alert data. - function reasonRenderer(text: string, item: AlertItem) { - const serviceName = item.service?.name; - const pod = item.pod; - const log = item.log; - - if (serviceName) { - return {text}; - } else if (pod) { - return {text}; - } else if (log) { - return {text}; - } else { - return <>{text}; - } - } + const { core } = usePluginContext(); + const { prepend } = core.http.basePath; - const actions: Array> = [ + const actions: Array> = [ { name: 'Alert details', description: 'Alert details', @@ -82,25 +54,53 @@ export function AlertsTable(props: AlertsTableProps) { }, ]; - const columns: Array> = [ + const columns: Array> = [ + { + field: 'active', + name: 'Status', + width: '112px', + render: (_, { active }) => { + const style = { + width: '96px', + textAlign: 'center' as const, + }; + + return active ? ( + + {i18n.translate('xpack.observability.alertsTable.status.active', { + defaultMessage: 'Active', + })} + + ) : ( + + {i18n.translate('xpack.observability.alertsTable.status.recovered', { + defaultMessage: 'Recovered', + })} + + ); + }, + }, { - field: '@timestamp', + field: 'start', name: 'Triggered', - dataType: 'date', + render: (_, item) => { + return ; + }, }, { field: 'duration', name: 'Duration', - }, - { - field: 'severity', - name: 'Severity', + render: (_, { duration, active }) => { + return active ? null : asDuration(duration, { extended: true }); + }, }, { field: 'reason', name: 'Reason', dataType: 'string', - render: reasonRenderer, + render: (_, item) => { + return item.link ? {item.reason} : item.reason; + }, }, { actions, @@ -110,12 +110,13 @@ export function AlertsTable(props: AlertsTableProps) { return ( <> - {flyoutAlert && } - + {flyoutAlert && } + {...props} isSelectable={true} - selection={{} as EuiTableSelectionType} + selection={{} as EuiTableSelectionType} columns={columns} + tableLayout="auto" pagination={{ pageIndex: 0, pageSize: 0, totalItemCount: 0 }} /> diff --git a/x-pack/plugins/observability/public/pages/alerts/example_data.ts b/x-pack/plugins/observability/public/pages/alerts/example_data.ts index 584408a23d9bd..860c8d059f00d 100644 --- a/x-pack/plugins/observability/public/pages/alerts/example_data.ts +++ b/x-pack/plugins/observability/public/pages/alerts/example_data.ts @@ -5,505 +5,237 @@ * 2.0. */ -/** - * Example data from Whimsical wireframes: https://whimsical.com/observability-alerting-user-journeys-8TFDcHRPMQDJgtLpJ7XuBj - */ -export const wireframeData = [ - { - '@timestamp': 1615392661000, - duration: '10 min 2 s', - severity: '-', - reason: 'Error count is greater than 100 (current value is 135) on shippingService', - service: { name: 'opbeans-go' }, - affectedEntity: 'opbeans-go service', - status: 'Active', - expectedValue: '< 100', - actualValue: '135', - severityLog: [ - { '@timestamp': 1615392661000, severity: 'critical', message: 'Load is 3.5' }, - { '@timestamp': 1615392600000, severity: 'warning', message: 'Load is 2.5' }, - { '@timestamp': 1615392552000, severity: 'critical', message: 'Load is 3.5' }, - ], - type: 'APM Error count', - }, +export const apmAlertResponseExample = [ { - '@timestamp': 1615392600000, - duration: '11 min 1 s', - severity: '-', - reason: 'Latency is greater than 1500ms (current value is 1700ms) on frontend', - service: { name: 'opbeans-go' }, - severityLog: [], + 'rule.id': 'apm.error_rate', + 'service.name': 'opbeans-java', + 'rule.name': 'Error count threshold | opbeans-java (smith test)', + 'kibana.rac.alert.duration.us': 180057000, + 'kibana.rac.alert.status': 'open', + tags: ['apm', 'service.name:opbeans-java'], + 'kibana.rac.alert.uuid': '0175ec0a-a3b1-4d41-b557-e21c2d024352', + 'rule.uuid': '474920d0-93e9-11eb-ac86-0b455460de81', + 'event.action': 'active', + '@timestamp': '2021-04-12T13:53:49.550Z', + 'kibana.rac.alert.id': 'apm.error_rate_opbeans-java_production', + 'kibana.rac.alert.start': '2021-04-12T13:50:49.493Z', + 'kibana.rac.producer': 'apm', + 'event.kind': 'state', + 'rule.category': 'Error count threshold', + 'service.environment': ['production'], + 'processor.event': ['error'], }, { - '@timestamp': 1615392552000, - duration: '10 min 2 s', - severity: 'critical', - reason: 'Latency anomaly score is 84 on checkoutService', - service: { name: 'opbeans-go' }, - severityLog: [], - }, - { - '@timestamp': 1615392391000, - duration: '10 min 2 s', - severity: '-', - reason: - 'CPU is greater than a threshold of 75% (current value is 83%) on gke-eden-3-prod-pool-2-395ef018-06xg', - pod: 'gke-dev-oblt-dev-oblt-pool-30f1ba48-skw', - severityLog: [], - }, - { - '@timestamp': 1615392363000, - duration: '10 min 2 s', - severity: '-', - reason: - "Log count with 'Log.level.error' and 'service.name; frontend' is greater than 75 (current value 122)", - log: true, - severityLog: [], - }, - { - '@timestamp': 1615392361000, - duration: '10 min 2 s', - severity: 'critical', - reason: 'Load is greater than 2 (current value is 3.5) on gke-eden-3-prod-pool-2-395ef018-06xg', - pod: 'gke-dev-oblt-dev-oblt-pool-30f1ba48-skw', - severityLog: [], + 'rule.id': 'apm.error_rate', + 'service.name': 'opbeans-java', + 'rule.name': 'Error count threshold | opbeans-java (smith test)', + 'kibana.rac.alert.duration.us': 2419005000, + 'kibana.rac.alert.end': '2021-04-12T13:49:49.446Z', + 'kibana.rac.alert.status': 'closed', + tags: ['apm', 'service.name:opbeans-java'], + 'kibana.rac.alert.uuid': '32b940e1-3809-4c12-8eee-f027cbb385e2', + 'rule.uuid': '474920d0-93e9-11eb-ac86-0b455460de81', + 'event.action': 'close', + '@timestamp': '2021-04-12T13:49:49.446Z', + 'kibana.rac.alert.id': 'apm.error_rate_opbeans-java_production', + 'kibana.rac.alert.start': '2021-04-12T13:09:30.441Z', + 'kibana.rac.producer': 'apm', + 'event.kind': 'state', + 'rule.category': 'Error count threshold', + 'service.environment': ['production'], + 'processor.event': ['error'], }, ]; -/** - * Example data from this proof of concept: https://github.com/dgieselaar/kibana/tree/alerting-event-log-poc - */ -export const eventLogPocData = [ - { - '@timestamp': 1615395754597, - first_seen: 1615362488702, - severity: 'warning', - severity_value: 1241.4546, - reason: - 'Transaction duration for opbeans-java/request in production was above the threshold of 1.0 ms (1.2 ms)', - rule_id: 'cb1fc3e0-7fef-11eb-827d-d94e80a23d8d', - rule_name: 'Latency threshold | opbeans-java', - rule_type_id: 'apm.transaction_duration', - rule_type_name: 'Latency threshold', - alert_instance_title: ['opbeans-java/request:production'], - alert_instance_name: 'apm.transaction_duration_production', - unique: 1, - group_by_field: 'alert_instance.uuid', - group_by_value: '1b354805-4bf3-4626-b6be-5801d7d1e256', - influencers: [ - 'service.name:opbeans-java', - 'service.environment:production', - 'transaction.type:request', - ], - fields: { - 'processor.event': 'transaction', - 'service.name': 'opbeans-java', - 'service.environment': 'production', - 'transaction.type': 'request', +export const flyoutItemExample = { + link: '/app/apm/services/opbeans-java?rangeFrom=now-15m&rangeTo=now', + reason: 'Error count for opbeans-java was above the threshold', + active: true, + start: 1618235449493, + duration: 180057000, + ruleCategory: 'Error count threshold', + ruleName: 'Error count threshold | opbeans-java (smith test)', +}; + +export const dynamicIndexPattern = { + fields: [ + { + name: '@timestamp', + type: 'date', + esTypes: ['date'], + searchable: true, + aggregatable: true, + readFromDocValues: true, }, - timeseries: [ - { - x: 1615359600000, - y: 48805, - threshold: 1000, - }, - { - x: 1615370400000, - y: 3992.5, - threshold: 1000, - }, - { - x: 1615381200000, - y: 4296.7998046875, - threshold: 1000, - }, - { - x: 1615392000000, - y: 1633.8182373046875, - threshold: 1000, - }, - ], - recovered: false, - }, - { - '@timestamp': 1615326143423, - first_seen: 1615323802378, - severity: 'warning', - severity_value: 27, - reason: 'Error count for opbeans-node in production was above the threshold of 2 (27)', - rule_id: '335b38d0-80be-11eb-9fd1-d3725789930d', - rule_name: 'Error count threshold', - rule_type_id: 'apm.error_rate', - rule_type_name: 'Error count threshold', - alert_instance_title: ['opbeans-node:production'], - alert_instance_name: 'opbeans-node_production', - unique: 1, - group_by_field: 'alert_instance.uuid', - group_by_value: '19165a4f-296a-4045-9448-40c793d97d02', - influencers: ['service.name:opbeans-node', 'service.environment:production'], - fields: { - 'processor.event': 'error', - 'service.name': 'opbeans-node', - 'service.environment': 'production', + { + name: 'event.action', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, }, - timeseries: [ - { - x: 1615323780000, - y: 32, - threshold: 2, - }, - { - x: 1615324080000, - y: 34, - threshold: 2, - }, - { - x: 1615324380000, - y: 32, - threshold: 2, - }, - { - x: 1615324680000, - y: 34, - threshold: 2, - }, - { - x: 1615324980000, - y: 35, - threshold: 2, - }, - { - x: 1615325280000, - y: 31, - threshold: 2, - }, - { - x: 1615325580000, - y: 36, - threshold: 2, - }, - { - x: 1615325880000, - y: 35, - threshold: 2, - }, - ], - recovered: true, - }, - { - '@timestamp': 1615326143423, - first_seen: 1615325783256, - severity: 'warning', - severity_value: 27, - reason: 'Error count for opbeans-java in production was above the threshold of 2 (27)', - rule_id: '335b38d0-80be-11eb-9fd1-d3725789930d', - rule_name: 'Error count threshold', - rule_type_id: 'apm.error_rate', - rule_type_name: 'Error count threshold', - alert_instance_title: ['opbeans-java:production'], - alert_instance_name: 'opbeans-java_production', - unique: 1, - group_by_field: 'alert_instance.uuid', - group_by_value: '73075d90-e27a-4e20-9ba0-3512a16c2829', - influencers: ['service.name:opbeans-java', 'service.environment:production'], - fields: { - 'processor.event': 'error', - 'service.name': 'opbeans-java', - 'service.environment': 'production', + { + name: 'event.kind', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, }, - timeseries: [ - { - x: 1615325760000, - y: 36, - threshold: 2, - }, - { - x: 1615325820000, - y: 26, - threshold: 2, - }, - { - x: 1615325880000, - y: 28, - threshold: 2, - }, - { - x: 1615325940000, - y: 35, - threshold: 2, - }, - { - x: 1615326000000, - y: 32, - threshold: 2, - }, - { - x: 1615326060000, - y: 23, - threshold: 2, - }, - { - x: 1615326120000, - y: 27, - threshold: 2, - }, - ], - recovered: true, - }, - { - '@timestamp': 1615326143423, - first_seen: 1615323802378, - severity: 'warning', - severity_value: 4759.9116, - reason: - 'Transaction duration for opbeans-java/request in production was above the threshold of 1.0 ms (4.8 ms)', - rule_id: 'cb1fc3e0-7fef-11eb-827d-d94e80a23d8d', - rule_name: 'Latency threshold | opbeans-java', - rule_type_id: 'apm.transaction_duration', - rule_type_name: 'Latency threshold', - alert_instance_title: ['opbeans-java/request:production'], - alert_instance_name: 'apm.transaction_duration_production', - unique: 1, - group_by_field: 'alert_instance.uuid', - group_by_value: 'ffa0437d-6656-4553-a1cd-c170fc6e2f81', - influencers: [ - 'service.name:opbeans-java', - 'service.environment:production', - 'transaction.type:request', - ], - fields: { - 'processor.event': 'transaction', - 'service.name': 'opbeans-java', - 'service.environment': 'production', - 'transaction.type': 'request', + { + name: 'host.name', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, }, - timeseries: [ - { - x: 1615323780000, - y: 13145.51171875, - threshold: 1000, - }, - { - x: 1615324080000, - y: 15995.15625, - threshold: 1000, - }, - { - x: 1615324380000, - y: 18974.59375, - threshold: 1000, - }, - { - x: 1615324680000, - y: 11604.87890625, - threshold: 1000, - }, - { - x: 1615324980000, - y: 17945.9609375, - threshold: 1000, - }, - { - x: 1615325280000, - y: 9933.22265625, - threshold: 1000, - }, - { - x: 1615325580000, - y: 10011.58984375, - threshold: 1000, - }, - { - x: 1615325880000, - y: 10953.1845703125, - threshold: 1000, - }, - ], - recovered: true, - }, - { - '@timestamp': 1615325663207, - first_seen: 1615324762861, - severity: 'warning', - severity_value: 27, - reason: 'Error count for opbeans-java in production was above the threshold of 2 (27)', - rule_id: '335b38d0-80be-11eb-9fd1-d3725789930d', - rule_name: 'Error count threshold', - rule_type_id: 'apm.error_rate', - rule_type_name: 'Error count threshold', - alert_instance_title: ['opbeans-java:production'], - alert_instance_name: 'opbeans-java_production', - unique: 1, - group_by_field: 'alert_instance.uuid', - group_by_value: 'bf5f9574-57c8-44ed-9a3c-512b446695cf', - influencers: ['service.name:opbeans-java', 'service.environment:production'], - fields: { - 'processor.event': 'error', - 'service.name': 'opbeans-java', - 'service.environment': 'production', + { + name: 'kibana.rac.alert.duration.us', + type: 'number', + esTypes: ['long'], + searchable: true, + aggregatable: true, + readFromDocValues: true, }, - timeseries: [ - { - x: 1615324740000, - y: 34, - threshold: 2, - }, - { - x: 1615325040000, - y: 35, - threshold: 2, - }, - { - x: 1615325340000, - y: 31, - threshold: 2, - }, - { - x: 1615325640000, - y: 27, - threshold: 2, - }, - ], - recovered: true, - }, - { - '@timestamp': 1615324642764, - first_seen: 1615324402620, - severity: 'warning', - severity_value: 32, - reason: 'Error count for opbeans-java in production was above the threshold of 2 (32)', - rule_id: '335b38d0-80be-11eb-9fd1-d3725789930d', - rule_name: 'Error count threshold', - rule_type_id: 'apm.error_rate', - rule_type_name: 'Error count threshold', - alert_instance_title: ['opbeans-java:production'], - alert_instance_name: 'opbeans-java_production', - unique: 1, - group_by_field: 'alert_instance.uuid', - group_by_value: '87768bef-67a3-4ddd-b95d-7ab8830b30ef', - influencers: ['service.name:opbeans-java', 'service.environment:production'], - fields: { - 'processor.event': 'error', - 'service.name': 'opbeans-java', - 'service.environment': 'production', + { + name: 'kibana.rac.alert.end', + type: 'date', + esTypes: ['date'], + searchable: true, + aggregatable: true, + readFromDocValues: true, }, - timeseries: [ - { - x: 1615324402000, - y: 30, - threshold: 2, - }, - { - x: 1615324432000, - y: null, - threshold: null, - }, - { - x: 1615324462000, - y: 28, - threshold: 2, - }, - { - x: 1615324492000, - y: null, - threshold: null, - }, - { - x: 1615324522000, - y: 30, - threshold: 2, - }, - { - x: 1615324552000, - y: null, - threshold: null, - }, - { - x: 1615324582000, - y: 18, - threshold: 2, - }, - { - x: 1615324612000, - y: null, - threshold: null, - }, - { - x: 1615324642000, - y: 32, - threshold: 2, - }, - ], - recovered: true, - }, - { - '@timestamp': 1615324282583, - first_seen: 1615323802378, - severity: 'warning', - severity_value: 30, - reason: 'Error count for opbeans-java in production was above the threshold of 2 (30)', - rule_id: '335b38d0-80be-11eb-9fd1-d3725789930d', - rule_name: 'Error count threshold', - rule_type_id: 'apm.error_rate', - rule_type_name: 'Error count threshold', - alert_instance_title: ['opbeans-java:production'], - alert_instance_name: 'opbeans-java_production', - unique: 1, - group_by_field: 'alert_instance.uuid', - group_by_value: '31d087bd-51ae-419d-81c0-d0671eb97392', - influencers: ['service.name:opbeans-java', 'service.environment:production'], - fields: { - 'processor.event': 'error', - 'service.name': 'opbeans-java', - 'service.environment': 'production', + { + name: 'kibana.rac.alert.id', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, }, - timeseries: [ - { - x: 1615323780000, - y: 31, - threshold: 2, - }, - { - x: 1615323840000, - y: 30, - threshold: 2, - }, - { - x: 1615323900000, - y: 24, - threshold: 2, - }, - { - x: 1615323960000, - y: 32, - threshold: 2, - }, - { - x: 1615324020000, - y: 32, - threshold: 2, - }, - { - x: 1615324080000, - y: 30, - threshold: 2, - }, - { - x: 1615324140000, - y: 25, - threshold: 2, - }, - { - x: 1615324200000, - y: 34, - threshold: 2, - }, - { - x: 1615324260000, - y: 30, - threshold: 2, - }, - ], - recovered: true, - }, -]; + { + name: 'kibana.rac.alert.severity.level', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'kibana.rac.alert.severity.value', + type: 'number', + esTypes: ['long'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'kibana.rac.alert.start', + type: 'date', + esTypes: ['date'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'kibana.rac.alert.status', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'kibana.rac.alert.uuid', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'kibana.rac.producer', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'processor.event', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'rule.category', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'rule.id', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'rule.name', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'rule.uuid', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'service.environment', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'service.name', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'tags', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + { + name: 'transaction.type', + type: 'string', + esTypes: ['keyword'], + searchable: true, + aggregatable: true, + readFromDocValues: true, + }, + ], + timeFieldName: '@timestamp', + title: '.kibana_smith-alerts-observability*', +}; diff --git a/x-pack/plugins/observability/public/pages/alerts/index.tsx b/x-pack/plugins/observability/public/pages/alerts/index.tsx index b4cc600e59d56..0089465003393 100644 --- a/x-pack/plugins/observability/public/pages/alerts/index.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/index.tsx @@ -16,26 +16,28 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; +import { useHistory } from 'react-router-dom'; +import { format, parse } from 'url'; import { ExperimentalBadge } from '../../components/shared/experimental_badge'; +import { useFetcher } from '../../hooks/use_fetcher'; import { usePluginContext } from '../../hooks/use_plugin_context'; import { RouteParams } from '../../routes'; +import { callObservabilityApi } from '../../services/call_observability_api'; +import { getAbsoluteDateRange } from '../../utils/date'; import { AlertsSearchBar } from './alerts_search_bar'; -import { AlertItem, AlertsTable } from './alerts_table'; -import { wireframeData } from './example_data'; +import { AlertsTable } from './alerts_table'; interface AlertsPageProps { - items?: AlertItem[]; routeParams: RouteParams<'/alerts'>; } -export function AlertsPage({ items }: AlertsPageProps) { - // For now, if we're not passed any items load the example wireframe data. - if (!items) { - items = wireframeData; - } - - const { core } = usePluginContext(); +export function AlertsPage({ routeParams }: AlertsPageProps) { + const { core, observabilityRuleRegistry } = usePluginContext(); const { prepend } = core.http.basePath; + const history = useHistory(); + const { + query: { rangeFrom = 'now-15m', rangeTo = 'now', kuery = '' }, + } = routeParams; // In a future milestone we'll have a page dedicated to rule management in // observability. For now link to the settings page. @@ -43,6 +45,59 @@ export function AlertsPage({ items }: AlertsPageProps) { '/app/management/insightsAndAlerting/triggersActions/alerts' ); + const { data: topAlerts } = useFetcher( + ({ signal }) => { + const { start, end } = getAbsoluteDateRange({ rangeFrom, rangeTo }); + + if (!start || !end) { + return; + } + return callObservabilityApi({ + signal, + endpoint: 'GET /api/observability/rules/alerts/top', + params: { + query: { + start, + end, + kuery, + }, + }, + }).then((alerts) => { + return alerts.map((alert) => { + const ruleType = observabilityRuleRegistry.getTypeByRuleId(alert['rule.id']); + const formatted = { + link: undefined, + reason: alert['rule.name'], + ...(ruleType?.format?.({ alert }) ?? {}), + }; + + const parsedLink = formatted.link ? parse(formatted.link, true) : undefined; + + return { + ...formatted, + link: parsedLink + ? format({ + ...parsedLink, + query: { + ...parsedLink.query, + rangeFrom, + rangeTo, + }, + }) + : undefined, + active: alert['event.action'] !== 'close', + severityLevel: alert['kibana.rac.alert.severity.level'], + start: new Date(alert['kibana.rac.alert.start']).getTime(), + duration: alert['kibana.rac.alert.duration.us'], + ruleCategory: alert['rule.category'], + ruleName: alert['rule.name'], + }; + }); + }); + }, + [kuery, observabilityRuleRegistry, rangeFrom, rangeTo] + ); + return ( - + { + const nextSearchParams = new URLSearchParams(history.location.search); + + nextSearchParams.set('rangeFrom', dateRange.from); + nextSearchParams.set('rangeTo', dateRange.to); + nextSearchParams.set('kuery', query ?? ''); + + history.push({ + ...history.location, + search: nextSearchParams.toString(), + }); + }} + /> - + diff --git a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx index 56019eeccfd5a..6fc573b11109a 100644 --- a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx +++ b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx @@ -23,6 +23,7 @@ import { emptyResponse as emptyLogsResponse, fetchLogsData } from './mock/logs.m import { emptyResponse as emptyMetricsResponse, fetchMetricsData } from './mock/metrics.mock'; import { newsFeedFetchData } from './mock/news_feed.mock'; import { emptyResponse as emptyUptimeResponse, fetchUptimeData } from './mock/uptime.mock'; +import { createObservabilityRuleRegistryMock } from '../../rules/observability_rule_registry_mock'; function unregisterAll() { unregisterDataHandler({ appName: 'apm' }); @@ -52,6 +53,7 @@ const withCore = makeDecorator({ }, }, } as unknown) as ObservabilityPublicPluginsStart, + observabilityRuleRegistry: createObservabilityRuleRegistryMock(), }} > diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts index cd3cb66187c6f..491eb36d01ac0 100644 --- a/x-pack/plugins/observability/public/plugin.ts +++ b/x-pack/plugins/observability/public/plugin.ts @@ -7,7 +7,11 @@ import { BehaviorSubject } from 'rxjs'; import { i18n } from '@kbn/i18n'; -import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../../src/plugins/data/public'; +import type { RuleRegistryPublicPluginSetupContract } from '../../rule_registry/public'; +import type { + DataPublicPluginSetup, + DataPublicPluginStart, +} from '../../../../src/plugins/data/public'; import { AppMountParameters, AppUpdater, @@ -17,17 +21,23 @@ import { PluginInitializerContext, CoreStart, } from '../../../../src/core/public'; -import { HomePublicPluginSetup, HomePublicPluginStart } from '../../../../src/plugins/home/public'; +import type { + HomePublicPluginSetup, + HomePublicPluginStart, +} from '../../../../src/plugins/home/public'; import { registerDataHandler } from './data_handler'; import { toggleOverviewLinkInNav } from './toggle_overview_link_in_nav'; -import { LensPublicStart } from '../../lens/public'; +import type { LensPublicStart } from '../../lens/public'; +import { createCallObservabilityApi } from './services/call_observability_api'; +import { observabilityRuleRegistrySettings } from '../common/observability_rule_registry'; +import { FormatterRuleRegistry } from './rules/formatter_rule_registry'; -export interface ObservabilityPublicSetup { - dashboard: { register: typeof registerDataHandler }; -} +export type ObservabilityPublicSetup = ReturnType; +export type ObservabilityRuleRegistry = ObservabilityPublicSetup['ruleRegistry']; export interface ObservabilityPublicPluginsSetup { data: DataPublicPluginSetup; + ruleRegistry: RuleRegistryPublicPluginSetupContract; home?: HomePublicPluginSetup; } @@ -52,22 +62,36 @@ export class Plugin constructor(context: PluginInitializerContext) {} public setup( - core: CoreSetup, - plugins: ObservabilityPublicPluginsSetup + coreSetup: CoreSetup, + pluginsSetup: ObservabilityPublicPluginsSetup ) { const category = DEFAULT_APP_CATEGORIES.observability; const euiIconType = 'logoObservability'; + + createCallObservabilityApi(coreSetup.http); + + const observabilityRuleRegistry = pluginsSetup.ruleRegistry.registry.create({ + ...observabilityRuleRegistrySettings, + ctor: FormatterRuleRegistry, + }); + const mount = async (params: AppMountParameters) => { // Load application bundle const { renderApp } = await import('./application'); // Get start services - const [coreStart, startPlugins] = await core.getStartServices(); + const [coreStart, pluginsStart] = await coreSetup.getStartServices(); - return renderApp(coreStart, startPlugins, params); + return renderApp({ + core: coreStart, + plugins: pluginsStart, + appMountParameters: params, + observabilityRuleRegistry, + }); }; + const updater$ = this.appUpdater$; - core.application.register({ + coreSetup.application.register({ id: 'observability-overview', title: 'Overview', appRoute: '/app/observability', @@ -78,8 +102,8 @@ export class Plugin updater$, }); - if (core.uiSettings.get('observability:enableAlertingExperience')) { - core.application.register({ + if (coreSetup.uiSettings.get('observability:enableAlertingExperience')) { + coreSetup.application.register({ id: 'observability-alerts', title: 'Alerts', appRoute: '/app/observability/alerts', @@ -90,7 +114,7 @@ export class Plugin updater$, }); - core.application.register({ + coreSetup.application.register({ id: 'observability-cases', title: 'Cases', appRoute: '/app/observability/cases', @@ -102,8 +126,8 @@ export class Plugin }); } - if (plugins.home) { - plugins.home.featureCatalogue.registerSolution({ + if (pluginsSetup.home) { + pluginsSetup.home.featureCatalogue.registerSolution({ id: 'observability', title: i18n.translate('xpack.observability.featureCatalogueTitle', { defaultMessage: 'Observability', @@ -134,6 +158,7 @@ export class Plugin return { dashboard: { register: registerDataHandler }, + ruleRegistry: observabilityRuleRegistry, }; } public start({ application }: CoreStart) { diff --git a/x-pack/plugins/observability/public/routes/index.tsx b/x-pack/plugins/observability/public/routes/index.tsx index 49cc55832dcf2..3e5c3ddc553ef 100644 --- a/x-pack/plugins/observability/public/routes/index.tsx +++ b/x-pack/plugins/observability/public/routes/index.tsx @@ -104,6 +104,7 @@ export const routes = { query: t.partial({ rangeFrom: t.string, rangeTo: t.string, + kuery: t.string, refreshPaused: jsonRt.pipe(t.boolean), refreshInterval: jsonRt.pipe(t.number), }), diff --git a/x-pack/plugins/observability/public/rules/formatter_rule_registry.ts b/x-pack/plugins/observability/public/rules/formatter_rule_registry.ts new file mode 100644 index 0000000000000..87e6b3c324634 --- /dev/null +++ b/x-pack/plugins/observability/public/rules/formatter_rule_registry.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import type { RuleType } from '../../../rule_registry/public'; +import type { BaseRuleFieldMap, OutputOfFieldMap } from '../../../rule_registry/common'; +import { RuleRegistry } from '../../../rule_registry/public'; + +type AlertTypeOf = OutputOfFieldMap; + +type FormattableRuleType = RuleType & { + format?: (options: { + alert: AlertTypeOf; + }) => { + reason?: string; + link?: string; + }; +}; + +export class FormatterRuleRegistry extends RuleRegistry< + TFieldMap, + FormattableRuleType +> {} diff --git a/x-pack/plugins/observability/public/rules/observability_rule_registry_mock.ts b/x-pack/plugins/observability/public/rules/observability_rule_registry_mock.ts new file mode 100644 index 0000000000000..939e3a3608f8b --- /dev/null +++ b/x-pack/plugins/observability/public/rules/observability_rule_registry_mock.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ObservabilityRuleRegistry } from '../plugin'; + +const createRuleRegistryMock = () => ({ + registerType: () => {}, + getTypeByRuleId: () => {}, + create: () => createRuleRegistryMock(), +}); + +export const createObservabilityRuleRegistryMock = () => + createRuleRegistryMock() as ObservabilityRuleRegistry & ReturnType; diff --git a/x-pack/plugins/observability/public/services/call_observability_api/index.ts b/x-pack/plugins/observability/public/services/call_observability_api/index.ts new file mode 100644 index 0000000000000..c87a97fb1dc8a --- /dev/null +++ b/x-pack/plugins/observability/public/services/call_observability_api/index.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { formatRequest } from '@kbn/server-route-repository/target/format_request'; +import type { HttpSetup } from 'kibana/public'; +import type { AbstractObservabilityClient, ObservabilityClient } from './types'; + +export let callObservabilityApi: ObservabilityClient = () => { + throw new Error('callObservabilityApi has not been initialized via createCallObservabilityApi'); +}; + +export function createCallObservabilityApi(http: HttpSetup) { + const client: AbstractObservabilityClient = (options) => { + const { params: { path, body, query } = {}, endpoint, ...rest } = options; + + const { method, pathname } = formatRequest(endpoint, path); + + return http[method](pathname, { + ...rest, + body, + query, + }); + }; + + callObservabilityApi = client; +} diff --git a/x-pack/plugins/observability/public/services/call_observability_api/types.ts b/x-pack/plugins/observability/public/services/call_observability_api/types.ts new file mode 100644 index 0000000000000..8722aecd90800 --- /dev/null +++ b/x-pack/plugins/observability/public/services/call_observability_api/types.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { RouteRepositoryClient } from '@kbn/server-route-repository'; +import { HttpFetchOptions } from 'kibana/public'; +import type { + AbstractObservabilityServerRouteRepository, + ObservabilityServerRouteRepository, + ObservabilityAPIReturnType, + // eslint-disable-next-line @kbn/eslint/no-restricted-paths +} from '../../../server'; + +export type ObservabilityClientOptions = Omit< + HttpFetchOptions, + 'query' | 'body' | 'pathname' | 'signal' +> & { + signal: AbortSignal | null; +}; + +export type AbstractObservabilityClient = RouteRepositoryClient< + AbstractObservabilityServerRouteRepository, + ObservabilityClientOptions & { params?: Record } +>; + +export type ObservabilityClient = RouteRepositoryClient< + ObservabilityServerRouteRepository, + ObservabilityClientOptions +>; + +export { ObservabilityAPIReturnType }; diff --git a/x-pack/plugins/observability/public/utils/date.ts b/x-pack/plugins/observability/public/utils/date.ts index a91a9f519a4f3..b694bd61d39a9 100644 --- a/x-pack/plugins/observability/public/utils/date.ts +++ b/x-pack/plugins/observability/public/utils/date.ts @@ -7,9 +7,33 @@ import datemath from '@elastic/datemath'; -export function getAbsoluteTime(range: string, opts = {}) { +export function getAbsoluteTime(range: string, opts: Parameters[1] = {}) { const parsed = datemath.parse(range, opts); if (parsed) { return parsed.valueOf(); } } + +export function getAbsoluteDateRange({ + rangeFrom, + rangeTo, +}: { + rangeFrom?: string; + rangeTo?: string; +}) { + if (!rangeFrom || !rangeTo) { + return { start: undefined, end: undefined }; + } + + const absoluteStart = getAbsoluteTime(rangeFrom); + const absoluteEnd = getAbsoluteTime(rangeTo, { roundUp: true }); + + if (!absoluteStart || !absoluteEnd) { + throw new Error('Could not parse date range'); + } + + return { + start: new Date(absoluteStart).toISOString(), + end: new Date(absoluteEnd).toISOString(), + }; +} diff --git a/x-pack/plugins/observability/public/utils/test_helper.tsx b/x-pack/plugins/observability/public/utils/test_helper.tsx index 885303ea0c54b..97916b414330f 100644 --- a/x-pack/plugins/observability/public/utils/test_helper.tsx +++ b/x-pack/plugins/observability/public/utils/test_helper.tsx @@ -15,6 +15,7 @@ import translations from '../../../translations/translations/ja-JP.json'; import { PluginContext } from '../context/plugin_context'; import { ObservabilityPublicPluginsStart } from '../plugin'; import { EuiThemeProvider } from '../../../../../src/plugins/kibana_react/common'; +import { createObservabilityRuleRegistryMock } from '../rules/observability_rule_registry_mock'; const appMountParameters = ({ setHeaderActionMenu: () => {} } as unknown) as AppMountParameters; @@ -34,11 +35,15 @@ const plugins = ({ data: { query: { timefilter: { timefilter: { setTime: jest.fn() } } } }, } as unknown) as ObservabilityPublicPluginsStart; +const observabilityRuleRegistry = createObservabilityRuleRegistryMock(); + export const render = (component: React.ReactNode) => { return testLibRender( - + {component} diff --git a/x-pack/plugins/observability/server/index.ts b/x-pack/plugins/observability/server/index.ts index 2676e40a4902f..6785436042f97 100644 --- a/x-pack/plugins/observability/server/index.ts +++ b/x-pack/plugins/observability/server/index.ts @@ -11,6 +11,9 @@ import { ObservabilityPlugin, ObservabilityPluginSetup } from './plugin'; import { createOrUpdateIndex, Mappings } from './utils/create_or_update_index'; import { ScopedAnnotationsClient } from './lib/annotations/bootstrap_annotations'; import { unwrapEsResponse, WrappedElasticsearchClientError } from './utils/unwrap_es_response'; +export { rangeQuery, kqlQuery } from './utils/queries'; + +export * from './types'; export const config = { schema: schema.object({ diff --git a/x-pack/plugins/observability/server/lib/annotations/bootstrap_annotations.ts b/x-pack/plugins/observability/server/lib/annotations/bootstrap_annotations.ts index 268e8e027736a..c4a44f47ecf09 100644 --- a/x-pack/plugins/observability/server/lib/annotations/bootstrap_annotations.ts +++ b/x-pack/plugins/observability/server/lib/annotations/bootstrap_annotations.ts @@ -5,11 +5,16 @@ * 2.0. */ -import { CoreSetup, PluginInitializerContext, KibanaRequest } from 'kibana/server'; +import { + CoreSetup, + PluginInitializerContext, + KibanaRequest, + RequestHandlerContext, +} from 'kibana/server'; +import { LicensingApiRequestHandlerContext } from '../../../../licensing/server'; import { PromiseReturnType } from '../../../typings/common'; import { createAnnotationsClient } from './create_annotations_client'; import { registerAnnotationAPIs } from './register_annotation_apis'; -import type { ObservabilityRequestHandlerContext } from '../../types'; interface Params { index: string; @@ -35,7 +40,7 @@ export async function bootstrapAnnotations({ index, core, context }: Params) { return { getScopedAnnotationsClient: ( - requestContext: ObservabilityRequestHandlerContext, + requestContext: RequestHandlerContext & { licensing: LicensingApiRequestHandlerContext }, request: KibanaRequest ) => { return createAnnotationsClient({ diff --git a/x-pack/plugins/observability/server/lib/rules/get_top_alerts.ts b/x-pack/plugins/observability/server/lib/rules/get_top_alerts.ts new file mode 100644 index 0000000000000..0045c0f0c6757 --- /dev/null +++ b/x-pack/plugins/observability/server/lib/rules/get_top_alerts.ts @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { Required } from 'utility-types'; +import { ObservabilityRuleRegistryClient } from '../../types'; +import { kqlQuery, rangeQuery } from '../../utils/queries'; + +export async function getTopAlerts({ + ruleRegistryClient, + start, + end, + kuery, + size, +}: { + ruleRegistryClient: ObservabilityRuleRegistryClient; + start: number; + end: number; + kuery?: string; + size: number; +}) { + const response = await ruleRegistryClient.search({ + body: { + query: { + bool: { + filter: [...rangeQuery(start, end), ...kqlQuery(kuery)], + }, + }, + fields: ['*'], + collapse: { + field: 'kibana.rac.alert.uuid', + }, + size, + sort: { + '@timestamp': 'desc', + }, + _source: false, + }, + }); + + return response.events.map((event) => { + return event as Required< + typeof event, + | 'rule.id' + | 'rule.name' + | 'kibana.rac.alert.start' + | 'event.action' + | 'rule.category' + | 'rule.name' + | 'kibana.rac.alert.duration.us' + >; + }); +} diff --git a/x-pack/plugins/observability/server/plugin.ts b/x-pack/plugins/observability/server/plugin.ts index c59b4dbe373dd..b167600e788a4 100644 --- a/x-pack/plugins/observability/server/plugin.ts +++ b/x-pack/plugins/observability/server/plugin.ts @@ -6,7 +6,6 @@ */ import { PluginInitializerContext, Plugin, CoreSetup } from 'src/core/server'; -import { pickWithPatterns } from '../../rule_registry/server'; import { ObservabilityConfig } from '.'; import { bootstrapAnnotations, @@ -15,9 +14,12 @@ import { } from './lib/annotations/bootstrap_annotations'; import type { RuleRegistryPluginSetupContract } from '../../rule_registry/server'; import { uiSettings } from './ui_settings'; -import { ecsFieldMap } from '../../rule_registry/server'; +import { registerRoutes } from './routes/register_routes'; +import { getGlobalObservabilityServerRouteRepository } from './routes/get_global_observability_server_route_repository'; +import { observabilityRuleRegistrySettings } from '../common/observability_rule_registry'; export type ObservabilityPluginSetup = ReturnType; +export type ObservabilityRuleRegistry = ObservabilityPluginSetup['ruleRegistry']; export class ObservabilityPlugin implements Plugin { constructor(private readonly initContext: PluginInitializerContext) { @@ -48,17 +50,26 @@ export class ObservabilityPlugin implements Plugin { }); } + const observabilityRuleRegistry = plugins.ruleRegistry.create( + observabilityRuleRegistrySettings + ); + + registerRoutes({ + core: { + setup: core, + start: () => core.getStartServices().then(([coreStart]) => coreStart), + }, + ruleRegistry: observabilityRuleRegistry, + logger: this.initContext.logger.get(), + repository: getGlobalObservabilityServerRouteRepository(), + }); + return { getScopedAnnotationsClient: async (...args: Parameters) => { const api = await annotationsApiPromise; return api?.getScopedAnnotationsClient(...args); }, - ruleRegistry: plugins.ruleRegistry.create({ - name: 'observability', - fieldMap: { - ...pickWithPatterns(ecsFieldMap, 'host.name', 'service.name'), - }, - }), + ruleRegistry: observabilityRuleRegistry, }; } diff --git a/x-pack/plugins/observability/server/routes/create_observability_server_route.ts b/x-pack/plugins/observability/server/routes/create_observability_server_route.ts new file mode 100644 index 0000000000000..6a3a29028b2a4 --- /dev/null +++ b/x-pack/plugins/observability/server/routes/create_observability_server_route.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { createServerRouteFactory } from '@kbn/server-route-repository'; +import { ObservabilityRouteCreateOptions, ObservabilityRouteHandlerResources } from './types'; + +export const createObservabilityServerRoute = createServerRouteFactory< + ObservabilityRouteHandlerResources, + ObservabilityRouteCreateOptions +>(); diff --git a/x-pack/plugins/observability/server/routes/create_observability_server_route_repository.ts b/x-pack/plugins/observability/server/routes/create_observability_server_route_repository.ts new file mode 100644 index 0000000000000..dab1ecdef7cf8 --- /dev/null +++ b/x-pack/plugins/observability/server/routes/create_observability_server_route_repository.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { createServerRouteRepository } from '@kbn/server-route-repository'; +import { ObservabilityRouteHandlerResources, ObservabilityRouteCreateOptions } from './types'; + +export const createObservabilityServerRouteRepository = () => { + return createServerRouteRepository< + ObservabilityRouteHandlerResources, + ObservabilityRouteCreateOptions + >(); +}; diff --git a/x-pack/plugins/observability/server/routes/get_global_observability_server_route_repository.ts b/x-pack/plugins/observability/server/routes/get_global_observability_server_route_repository.ts new file mode 100644 index 0000000000000..8bc7c79a40b1b --- /dev/null +++ b/x-pack/plugins/observability/server/routes/get_global_observability_server_route_repository.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { rulesRouteRepository } from './rules'; + +export function getGlobalObservabilityServerRouteRepository() { + return rulesRouteRepository; +} + +export type ObservabilityServerRouteRepository = ReturnType< + typeof getGlobalObservabilityServerRouteRepository +>; diff --git a/x-pack/plugins/observability/server/routes/register_routes.ts b/x-pack/plugins/observability/server/routes/register_routes.ts new file mode 100644 index 0000000000000..85ee456b812b8 --- /dev/null +++ b/x-pack/plugins/observability/server/routes/register_routes.ts @@ -0,0 +1,92 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import * as t from 'io-ts'; +import { + decodeRequestParams, + parseEndpoint, + routeValidationObject, +} from '@kbn/server-route-repository'; +import { CoreSetup, CoreStart, Logger, RouteRegistrar } from 'kibana/server'; +import Boom from '@hapi/boom'; +import { RequestAbortedError } from '@elastic/elasticsearch/lib/errors'; +import { ObservabilityRuleRegistry } from '../plugin'; +import { ObservabilityRequestHandlerContext } from '../types'; +import { AbstractObservabilityServerRouteRepository } from './types'; + +export function registerRoutes({ + ruleRegistry, + repository, + core, + logger, +}: { + core: { + setup: CoreSetup; + start: () => Promise; + }; + ruleRegistry: ObservabilityRuleRegistry; + repository: AbstractObservabilityServerRouteRepository; + logger: Logger; +}) { + const routes = repository.getRoutes(); + + const router = core.setup.http.createRouter(); + + routes.forEach((route) => { + const { endpoint, options, handler, params } = route; + const { pathname, method } = parseEndpoint(endpoint); + + (router[method] as RouteRegistrar)( + { + path: pathname, + validate: routeValidationObject, + options, + }, + async (context, request, response) => { + try { + const decodedParams = decodeRequestParams( + { + params: request.params, + body: request.body, + query: request.query, + }, + params ?? t.strict({}) + ); + + const data = (await handler({ + context, + request, + ruleRegistry, + core, + logger, + params: decodedParams, + })) as any; + + return response.ok({ body: data }); + } catch (error) { + logger.error(error); + const opts = { + statusCode: 500, + body: { + message: error.message, + }, + }; + + if (Boom.isBoom(error)) { + opts.statusCode = error.output.statusCode; + } + + if (error instanceof RequestAbortedError) { + opts.statusCode = 499; + opts.body.message = 'Client closed request'; + } + + return response.custom(opts); + } + } + ); + }); +} diff --git a/x-pack/plugins/observability/server/routes/rules.ts b/x-pack/plugins/observability/server/routes/rules.ts new file mode 100644 index 0000000000000..10f2f50886f07 --- /dev/null +++ b/x-pack/plugins/observability/server/routes/rules.ts @@ -0,0 +1,76 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import * as t from 'io-ts'; +import { isoToEpochRt, toNumberRt } from '@kbn/io-ts-utils'; +import Boom from '@hapi/boom'; +import { createObservabilityServerRoute } from './create_observability_server_route'; +import { createObservabilityServerRouteRepository } from './create_observability_server_route_repository'; +import { getTopAlerts } from '../lib/rules/get_top_alerts'; + +const alertsListRoute = createObservabilityServerRoute({ + endpoint: 'GET /api/observability/rules/alerts/top', + options: { + tags: [], + }, + params: t.type({ + query: t.intersection([ + t.type({ + start: isoToEpochRt, + end: isoToEpochRt, + }), + t.partial({ + kuery: t.string, + size: toNumberRt, + }), + ]), + }), + handler: async ({ ruleRegistry, context, params }) => { + const ruleRegistryClient = await ruleRegistry.createScopedRuleRegistryClient({ + context, + alertsClient: context.alerting.getAlertsClient(), + }); + + if (!ruleRegistryClient) { + throw Boom.failedDependency(); + } + + const { + query: { start, end, kuery, size = 100 }, + } = params; + + return getTopAlerts({ + ruleRegistryClient, + start, + end, + kuery, + size, + }); + }, +}); + +const alertsDynamicIndexPatternRoute = createObservabilityServerRoute({ + endpoint: 'GET /api/observability/rules/alerts/dynamic_index_pattern', + options: { + tags: [], + }, + handler: async ({ ruleRegistry, context }) => { + const ruleRegistryClient = await ruleRegistry.createScopedRuleRegistryClient({ + context, + alertsClient: context.alerting.getAlertsClient(), + }); + + if (!ruleRegistryClient) { + throw Boom.failedDependency(); + } + + return ruleRegistryClient.getDynamicIndexPattern(); + }, +}); + +export const rulesRouteRepository = createObservabilityServerRouteRepository() + .add(alertsListRoute) + .add(alertsDynamicIndexPatternRoute); diff --git a/x-pack/plugins/observability/server/routes/types.ts b/x-pack/plugins/observability/server/routes/types.ts new file mode 100644 index 0000000000000..0588bf8df2292 --- /dev/null +++ b/x-pack/plugins/observability/server/routes/types.ts @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import * as t from 'io-ts'; +import type { + EndpointOf, + ReturnOf, + ServerRoute, + ServerRouteRepository, +} from '@kbn/server-route-repository'; +import { CoreSetup, CoreStart, KibanaRequest, Logger } from 'kibana/server'; +import { ObservabilityRuleRegistry } from '../plugin'; + +import { ObservabilityServerRouteRepository } from './get_global_observability_server_route_repository'; +import { ObservabilityRequestHandlerContext } from '../types'; + +export { ObservabilityServerRouteRepository }; + +export interface ObservabilityRouteHandlerResources { + core: { + start: () => Promise; + setup: CoreSetup; + }; + ruleRegistry: ObservabilityRuleRegistry; + request: KibanaRequest; + context: ObservabilityRequestHandlerContext; + logger: Logger; +} + +export interface ObservabilityRouteCreateOptions { + options: { + tags: string[]; + }; +} + +export type AbstractObservabilityServerRouteRepository = ServerRouteRepository< + ObservabilityRouteHandlerResources, + ObservabilityRouteCreateOptions, + Record< + string, + ServerRoute< + string, + t.Mixed | undefined, + ObservabilityRouteHandlerResources, + any, + ObservabilityRouteCreateOptions + > + > +>; + +export type ObservabilityAPIReturnType< + TEndpoint extends EndpointOf +> = ReturnOf; diff --git a/x-pack/plugins/observability/server/types.ts b/x-pack/plugins/observability/server/types.ts index 5178bddfd6f74..81b32b3f8db7b 100644 --- a/x-pack/plugins/observability/server/types.ts +++ b/x-pack/plugins/observability/server/types.ts @@ -6,16 +6,32 @@ */ import type { IRouter, RequestHandlerContext } from 'src/core/server'; +import type { AlertingApiRequestHandlerContext } from '../../alerting/server'; +import type { ScopedRuleRegistryClient, FieldMapOf } from '../../rule_registry/server'; import type { LicensingApiRequestHandlerContext } from '../../licensing/server'; +import type { ObservabilityRuleRegistry } from './plugin'; + +export type { + ObservabilityRouteCreateOptions, + ObservabilityRouteHandlerResources, + AbstractObservabilityServerRouteRepository, + ObservabilityServerRouteRepository, + ObservabilityAPIReturnType, +} from './routes/types'; /** * @internal */ export interface ObservabilityRequestHandlerContext extends RequestHandlerContext { licensing: LicensingApiRequestHandlerContext; + alerting: AlertingApiRequestHandlerContext; } /** * @internal */ export type ObservabilityPluginRouter = IRouter; + +export type ObservabilityRuleRegistryClient = ScopedRuleRegistryClient< + FieldMapOf +>; diff --git a/x-pack/plugins/observability/server/utils/queries.ts b/x-pack/plugins/observability/server/utils/queries.ts new file mode 100644 index 0000000000000..584719532ddee --- /dev/null +++ b/x-pack/plugins/observability/server/utils/queries.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { QueryContainer } from '@elastic/elasticsearch/api/types'; +import { esKuery } from '../../../../../src/plugins/data/server'; + +export function rangeQuery(start: number, end: number, field = '@timestamp'): QueryContainer[] { + return [ + { + range: { + [field]: { + gte: start, + lte: end, + format: 'epoch_millis', + }, + }, + }, + ]; +} + +export function kqlQuery(kql?: string): QueryContainer[] { + if (!kql) { + return []; + } + + const ast = esKuery.fromKueryExpression(kql); + return [esKuery.toElasticsearchQuery(ast)]; +} diff --git a/x-pack/plugins/observability/tsconfig.json b/x-pack/plugins/observability/tsconfig.json index bd37bc09bc130..814d55bfd61fb 100644 --- a/x-pack/plugins/observability/tsconfig.json +++ b/x-pack/plugins/observability/tsconfig.json @@ -23,9 +23,9 @@ { "path": "../../../src/plugins/kibana_utils/tsconfig.json" }, { "path": "../../../src/plugins/usage_collection/tsconfig.json" }, { "path": "../alerting/tsconfig.json" }, - { "path": "../rule_registry/tsconfig.json" }, { "path": "../licensing/tsconfig.json" }, { "path": "../lens/tsconfig.json" }, + { "path": "../rule_registry/tsconfig.json" }, { "path": "../translations/tsconfig.json" } ] } diff --git a/x-pack/plugins/rule_registry/server/rule_registry/defaults/field_map.ts b/x-pack/plugins/rule_registry/common/field_map/base_rule_field_map.ts similarity index 80% rename from x-pack/plugins/rule_registry/server/rule_registry/defaults/field_map.ts rename to x-pack/plugins/rule_registry/common/field_map/base_rule_field_map.ts index db851b7b94c76..22a74212d2ce0 100644 --- a/x-pack/plugins/rule_registry/server/rule_registry/defaults/field_map.ts +++ b/x-pack/plugins/rule_registry/common/field_map/base_rule_field_map.ts @@ -4,11 +4,10 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { ecsFieldMap } from './ecs_field_map'; +import { pickWithPatterns } from '../pick_with_patterns'; -import { ecsFieldMap } from '../../generated/ecs_field_map'; -import { pickWithPatterns } from '../field_map/pick_with_patterns'; - -export const defaultFieldMap = { +export const baseRuleFieldMap = { ...pickWithPatterns( ecsFieldMap, '@timestamp', @@ -31,4 +30,4 @@ export const defaultFieldMap = { 'kibana.rac.alert.status': { type: 'keyword' }, } as const; -export type DefaultFieldMap = typeof defaultFieldMap; +export type BaseRuleFieldMap = typeof baseRuleFieldMap; diff --git a/x-pack/plugins/rule_registry/server/generated/ecs_field_map.ts b/x-pack/plugins/rule_registry/common/field_map/ecs_field_map.ts similarity index 99% rename from x-pack/plugins/rule_registry/server/generated/ecs_field_map.ts rename to x-pack/plugins/rule_registry/common/field_map/ecs_field_map.ts index cd8865a3f57c2..7ed76328ba919 100644 --- a/x-pack/plugins/rule_registry/server/generated/ecs_field_map.ts +++ b/x-pack/plugins/rule_registry/common/field_map/ecs_field_map.ts @@ -5,6 +5,10 @@ * 2.0. */ +/* This file is generated by x-pack/plugins/rule_registry/scripts/generate_ecs_fieldmap/index.js, +do not manually edit +*/ + export const ecsFieldMap = { '@timestamp': { type: 'date', @@ -3372,3 +3376,5 @@ export const ecsFieldMap = { required: false, }, } as const; + +export type EcsFieldMap = typeof ecsFieldMap; diff --git a/x-pack/plugins/rule_registry/common/field_map/es_field_type_map.ts b/x-pack/plugins/rule_registry/common/field_map/es_field_type_map.ts new file mode 100644 index 0000000000000..df41a020d274b --- /dev/null +++ b/x-pack/plugins/rule_registry/common/field_map/es_field_type_map.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import * as t from 'io-ts'; + +export const esFieldTypeMap = { + keyword: t.string, + text: t.string, + date: t.string, + boolean: t.boolean, + byte: t.number, + long: t.number, + integer: t.number, + short: t.number, + double: t.number, + float: t.number, + scaled_float: t.number, + unsigned_long: t.number, + flattened: t.record(t.string, t.array(t.string)), +}; diff --git a/x-pack/plugins/rule_registry/common/field_map/index.ts b/x-pack/plugins/rule_registry/common/field_map/index.ts new file mode 100644 index 0000000000000..8db5c2738439b --- /dev/null +++ b/x-pack/plugins/rule_registry/common/field_map/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export * from './base_rule_field_map'; +export * from './ecs_field_map'; +export * from './merge_field_maps'; +export * from './runtime_type_from_fieldmap'; +export * from './types'; diff --git a/x-pack/plugins/rule_registry/server/rule_registry/field_map/merge_field_maps.ts b/x-pack/plugins/rule_registry/common/field_map/merge_field_maps.ts similarity index 89% rename from x-pack/plugins/rule_registry/server/rule_registry/field_map/merge_field_maps.ts rename to x-pack/plugins/rule_registry/common/field_map/merge_field_maps.ts index e15b228b0f287..124de243352ea 100644 --- a/x-pack/plugins/rule_registry/server/rule_registry/field_map/merge_field_maps.ts +++ b/x-pack/plugins/rule_registry/common/field_map/merge_field_maps.ts @@ -4,8 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import util from 'util'; -import { FieldMap } from '../types'; +import { FieldMap } from './types'; export function mergeFieldMaps( first: T1, @@ -39,7 +38,7 @@ export function mergeFieldMaps( if (conflicts.length) { const err = new Error(`Could not merge mapping due to conflicts`); - Object.assign(err, { conflicts: util.inspect(conflicts, { depth: null }) }); + Object.assign(err, { conflicts }); throw err; } diff --git a/x-pack/plugins/rule_registry/server/rule_registry/field_map/runtime_type_from_fieldmap.test.ts b/x-pack/plugins/rule_registry/common/field_map/runtime_type_from_fieldmap.test.ts similarity index 100% rename from x-pack/plugins/rule_registry/server/rule_registry/field_map/runtime_type_from_fieldmap.test.ts rename to x-pack/plugins/rule_registry/common/field_map/runtime_type_from_fieldmap.test.ts diff --git a/x-pack/plugins/rule_registry/server/rule_registry/field_map/runtime_type_from_fieldmap.ts b/x-pack/plugins/rule_registry/common/field_map/runtime_type_from_fieldmap.ts similarity index 67% rename from x-pack/plugins/rule_registry/server/rule_registry/field_map/runtime_type_from_fieldmap.ts rename to x-pack/plugins/rule_registry/common/field_map/runtime_type_from_fieldmap.ts index 6dc557c016d1a..039424d34bfa1 100644 --- a/x-pack/plugins/rule_registry/server/rule_registry/field_map/runtime_type_from_fieldmap.ts +++ b/x-pack/plugins/rule_registry/common/field_map/runtime_type_from_fieldmap.ts @@ -4,11 +4,10 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { Optional } from 'utility-types'; import { mapValues, pickBy } from 'lodash'; import * as t from 'io-ts'; -import { Mutable, PickByValueExact } from 'utility-types'; -import { FieldMap } from '../types'; +import { FieldMap } from './types'; const esFieldTypeMap = { keyword: t.string, @@ -32,22 +31,6 @@ type EsFieldTypeOf = T extends keyof EsFieldTypeMap ? EsFieldTypeMap[T] : t.UnknownC; -type RequiredKeysOf> = keyof PickByValueExact< - { - [key in keyof T]: T[key]['required']; - }, - true ->; - -type IntersectionTypeOf< - T extends Record -> = t.IntersectionC< - [ - t.TypeC>>, - t.PartialC<{ [key in keyof T]: T[key]['type'] }> - ] ->; - type CastArray> = t.Type< t.TypeOf | Array>, Array>, @@ -71,25 +54,39 @@ const createCastSingleRt = >(type: T): CastSingle => { return new t.Type('castSingle', union.is, union.validate, (a) => (Array.isArray(a) ? a[0] : a)); }; -type MapTypeValues = { - [key in keyof T]: { - required: T[key]['required']; - type: T[key]['array'] extends true - ? CastArray> - : CastSingle>; - }; +type SetOptional = Optional< + T, + { + [key in keyof T]: T[key]['required'] extends true ? never : key; + }[keyof T] +>; + +type OutputOfField = T['array'] extends true + ? Array>> + : t.OutputOf>; + +type TypeOfField = + | t.TypeOf> + | Array>>; + +type OutputOf = { + [key in keyof T]: OutputOfField>; +}; + +type TypeOf = { + [key in keyof T]: TypeOfField>; }; -type FieldMapType = IntersectionTypeOf>; +export type TypeOfFieldMap = TypeOf>; +export type OutputOfFieldMap = OutputOf>; -export type TypeOfFieldMap = Mutable>>; -export type OutputOfFieldMap = Mutable>>; +export type FieldMapType = t.Type, OutputOfFieldMap>; export function runtimeTypeFromFieldMap( fieldMap: TFieldMap ): FieldMapType { function mapToType(fields: FieldMap) { - return mapValues(fields, (field, key) => { + return mapValues(fields, (field) => { const type = field.type in esFieldTypeMap ? esFieldTypeMap[field.type as keyof EsFieldTypeMap] diff --git a/x-pack/plugins/rule_registry/common/field_map/types.ts b/x-pack/plugins/rule_registry/common/field_map/types.ts new file mode 100644 index 0000000000000..3ff68315e93a6 --- /dev/null +++ b/x-pack/plugins/rule_registry/common/field_map/types.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export interface FieldMap { + [key: string]: { type: string; required?: boolean; array?: boolean }; +} diff --git a/x-pack/plugins/rule_registry/common/index.ts b/x-pack/plugins/rule_registry/common/index.ts index 6cc0ccaa93a6d..b614feebc974a 100644 --- a/x-pack/plugins/rule_registry/common/index.ts +++ b/x-pack/plugins/rule_registry/common/index.ts @@ -4,5 +4,5 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - -export * from './types'; +export * from './field_map'; +export * from './pick_with_patterns'; diff --git a/x-pack/plugins/rule_registry/server/rule_registry/field_map/pick_with_patterns.test.ts b/x-pack/plugins/rule_registry/common/pick_with_patterns/index.test.ts similarity index 97% rename from x-pack/plugins/rule_registry/server/rule_registry/field_map/pick_with_patterns.test.ts rename to x-pack/plugins/rule_registry/common/pick_with_patterns/index.test.ts index 48ba7c873db25..e93254c3c5a66 100644 --- a/x-pack/plugins/rule_registry/server/rule_registry/field_map/pick_with_patterns.test.ts +++ b/x-pack/plugins/rule_registry/common/pick_with_patterns/index.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { pickWithPatterns } from './pick_with_patterns'; +import { pickWithPatterns } from './'; describe('pickWithPatterns', () => { const fieldMap = { diff --git a/x-pack/plugins/rule_registry/server/rule_registry/field_map/pick_with_patterns.ts b/x-pack/plugins/rule_registry/common/pick_with_patterns/index.ts similarity index 100% rename from x-pack/plugins/rule_registry/server/rule_registry/field_map/pick_with_patterns.ts rename to x-pack/plugins/rule_registry/common/pick_with_patterns/index.ts diff --git a/x-pack/plugins/rule_registry/common/types.ts b/x-pack/plugins/rule_registry/common/types.ts deleted file mode 100644 index d0d15d86a2248..0000000000000 --- a/x-pack/plugins/rule_registry/common/types.ts +++ /dev/null @@ -1,20 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export enum AlertSeverityLevel { - warning = 'warning', - critical = 'critical', -} - -const alertSeverityLevelValues = { - [AlertSeverityLevel.warning]: 70, - [AlertSeverityLevel.critical]: 90, -}; - -export function getAlertSeverityLevelValue(level: AlertSeverityLevel) { - return alertSeverityLevelValues[level]; -} diff --git a/x-pack/plugins/rule_registry/kibana.json b/x-pack/plugins/rule_registry/kibana.json index dea6ef560cc2d..1636f88a21a61 100644 --- a/x-pack/plugins/rule_registry/kibana.json +++ b/x-pack/plugins/rule_registry/kibana.json @@ -7,7 +7,12 @@ "ruleRegistry" ], "requiredPlugins": [ - "alerting" + "alerting", + "triggersActionsUi" ], - "server": true + "server": true, + "ui": true, + "extraPublicDirs": [ + "common" + ] } diff --git a/x-pack/plugins/rule_registry/public/index.ts b/x-pack/plugins/rule_registry/public/index.ts new file mode 100644 index 0000000000000..55662dbcc8bfc --- /dev/null +++ b/x-pack/plugins/rule_registry/public/index.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { PluginInitializerContext } from 'kibana/public'; +import { Plugin } from './plugin'; + +export { RuleRegistryPublicPluginSetupContract } from './plugin'; +export { RuleRegistry } from './rule_registry'; +export type { IRuleRegistry, RuleType } from './rule_registry/types'; + +export const plugin = (context: PluginInitializerContext) => { + return new Plugin(context); +}; diff --git a/x-pack/plugins/rule_registry/public/plugin.ts b/x-pack/plugins/rule_registry/public/plugin.ts new file mode 100644 index 0000000000000..66c9a4fa224a5 --- /dev/null +++ b/x-pack/plugins/rule_registry/public/plugin.ts @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { + CoreSetup, + CoreStart, + Plugin as PluginClass, + PluginInitializerContext, +} from '../../../../src/core/public'; +import type { + PluginSetupContract as AlertingPluginPublicSetupContract, + PluginStartContract as AlertingPluginPublicStartContract, +} from '../../alerting/public'; +import type { + TriggersAndActionsUIPublicPluginSetup, + TriggersAndActionsUIPublicPluginStart, +} from '../../triggers_actions_ui/public'; +import { baseRuleFieldMap } from '../common'; +import { RuleRegistry } from './rule_registry'; + +interface RuleRegistrySetupPlugins { + alerting: AlertingPluginPublicSetupContract; + triggersActionsUi: TriggersAndActionsUIPublicPluginSetup; +} + +interface RuleRegistryStartPlugins { + alerting: AlertingPluginPublicStartContract; + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; +} + +export type RuleRegistryPublicPluginSetupContract = ReturnType; + +export class Plugin + implements PluginClass { + constructor(context: PluginInitializerContext) {} + + public setup(core: CoreSetup, plugins: RuleRegistrySetupPlugins) { + const rootRegistry = new RuleRegistry({ + fieldMap: baseRuleFieldMap, + alertTypeRegistry: plugins.triggersActionsUi.alertTypeRegistry, + }); + return { + registry: rootRegistry, + }; + } + + start(core: CoreStart, plugins: RuleRegistryStartPlugins) { + return { + registerType: plugins.triggersActionsUi.alertTypeRegistry, + }; + } +} diff --git a/x-pack/plugins/rule_registry/public/rule_registry/index.ts b/x-pack/plugins/rule_registry/public/rule_registry/index.ts new file mode 100644 index 0000000000000..ea47fe2e26aad --- /dev/null +++ b/x-pack/plugins/rule_registry/public/rule_registry/index.ts @@ -0,0 +1,47 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { BaseRuleFieldMap } from '../../common'; +import type { RuleType, CreateRuleRegistry, RuleRegistryConstructorOptions } from './types'; + +export class RuleRegistry { + protected types: TRuleType[] = []; + + constructor(private readonly options: RuleRegistryConstructorOptions) {} + + getTypes(): TRuleType[] { + return this.types; + } + + getTypeByRuleId(id: string): TRuleType | undefined { + return this.types.find((type) => type.id === id); + } + + registerType(type: TRuleType) { + this.types.push(type); + if (this.options.parent) { + this.options.parent.registerType(type); + } else { + this.options.alertTypeRegistry.register(type); + } + } + + create: CreateRuleRegistry = ({ fieldMap, ctor }) => { + const createOptions = { + fieldMap: { + ...this.options.fieldMap, + ...fieldMap, + }, + alertTypeRegistry: this.options.alertTypeRegistry, + parent: this, + }; + + const registry = ctor ? new ctor(createOptions) : new RuleRegistry(createOptions); + + return registry as any; + }; +} diff --git a/x-pack/plugins/rule_registry/public/rule_registry/types.ts b/x-pack/plugins/rule_registry/public/rule_registry/types.ts new file mode 100644 index 0000000000000..bb16227cbab5f --- /dev/null +++ b/x-pack/plugins/rule_registry/public/rule_registry/types.ts @@ -0,0 +1,63 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { AlertTypeRegistryContract } from '../../../triggers_actions_ui/public'; +import { BaseRuleFieldMap, FieldMap } from '../../common'; + +export interface RuleRegistryConstructorOptions { + fieldMap: TFieldMap; + alertTypeRegistry: AlertTypeRegistryContract; + parent?: IRuleRegistry; +} + +export type RuleType = Parameters[0]; + +export type RegisterRuleType< + TFieldMap extends BaseRuleFieldMap, + TAdditionalRegisterOptions = {} +> = (type: RuleType & TAdditionalRegisterOptions) => void; + +export type RuleRegistryExtensions = Record< + T, + (...args: any[]) => any +>; + +export type CreateRuleRegistry< + TFieldMap extends BaseRuleFieldMap, + TRuleType extends RuleType, + TInstanceType = undefined +> = < + TNextFieldMap extends FieldMap, + TRuleRegistryInstance extends IRuleRegistry< + TFieldMap & TNextFieldMap, + any + > = TInstanceType extends IRuleRegistry + ? TInstanceType + : IRuleRegistry +>(options: { + fieldMap: TNextFieldMap; + ctor?: new ( + options: RuleRegistryConstructorOptions + ) => TRuleRegistryInstance; +}) => TRuleRegistryInstance; + +export interface IRuleRegistry< + TFieldMap extends BaseRuleFieldMap, + TRuleType extends RuleType, + TInstanceType = undefined +> { + create: CreateRuleRegistry; + registerType(type: TRuleType): void; + getTypeByRuleId(ruleId: string): TRuleType; + getTypes(): TRuleType[]; +} + +export type FieldMapOfRuleRegistry = TRuleRegistry extends IRuleRegistry< + infer TFieldMap, + any +> + ? TFieldMap + : never; diff --git a/x-pack/plugins/rule_registry/scripts/generate_ecs_fieldmap/index.js b/x-pack/plugins/rule_registry/scripts/generate_ecs_fieldmap/index.js index 6e3a8f7cbe663..6b10ca5f837d5 100644 --- a/x-pack/plugins/rule_registry/scripts/generate_ecs_fieldmap/index.js +++ b/x-pack/plugins/rule_registry/scripts/generate_ecs_fieldmap/index.js @@ -14,36 +14,23 @@ const { mapValues } = require('lodash'); const exists = util.promisify(fs.exists); const readFile = util.promisify(fs.readFile); const writeFile = util.promisify(fs.writeFile); -const mkdir = util.promisify(fs.mkdir); -const rmdir = util.promisify(fs.rmdir); const exec = util.promisify(execCb); const ecsDir = path.resolve(__dirname, '../../../../../../ecs'); -const ecsTemplateFilename = path.join(ecsDir, 'generated/elasticsearch/7/template.json'); -const flatYamlFilename = path.join(ecsDir, 'generated/ecs/ecs_flat.yml'); +const ecsYamlFilename = path.join(ecsDir, 'generated/ecs/ecs_flat.yml'); -const outputDir = path.join(__dirname, '../../server/generated'); +const outputDir = path.join(__dirname, '../../common/field_map'); const outputFieldMapFilename = path.join(outputDir, 'ecs_field_map.ts'); -const outputMappingFilename = path.join(outputDir, 'ecs_mappings.json'); async function generate() { - const allExists = await Promise.all([exists(ecsDir), exists(ecsTemplateFilename)]); - - if (!allExists.every(Boolean)) { + if (!(await exists(ecsYamlFilename))) { throw new Error( - `Directory not found: ${ecsDir} - did you checkout elastic/ecs as a peer of this repo?` + `Directory not found: ${ecsYamlFilename} - did you checkout elastic/ecs as a peer of this repo?` ); } - const [template, flatYaml] = await Promise.all([ - readFile(ecsTemplateFilename, { encoding: 'utf-8' }).then((str) => JSON.parse(str)), - (async () => yaml.safeLoad(await readFile(flatYamlFilename)))(), - ]); - - const mappings = { - properties: template.mappings.properties, - }; + const flatYaml = await yaml.safeLoad(await readFile(ecsYamlFilename)); const fields = mapValues(flatYaml, (description) => { return { @@ -53,25 +40,22 @@ async function generate() { }; }); - const hasOutputDir = await exists(outputDir); - - if (hasOutputDir) { - await rmdir(outputDir, { recursive: true }); - } - - await mkdir(outputDir); - await Promise.all([ writeFile( outputFieldMapFilename, ` +/* This file is generated by x-pack/plugins/rule_registry/scripts/generate_ecs_fieldmap/index.js, +do not manually edit +*/ + export const ecsFieldMap = ${JSON.stringify(fields, null, 2)} as const + + export type EcsFieldMap = typeof ecsFieldMap; `, { encoding: 'utf-8' } ).then(() => { return exec(`node scripts/eslint --fix ${outputFieldMapFilename}`); }), - writeFile(outputMappingFilename, JSON.stringify(mappings, null, 2)), ]); } diff --git a/x-pack/plugins/rule_registry/server/generated/ecs_mappings.json b/x-pack/plugins/rule_registry/server/generated/ecs_mappings.json deleted file mode 100644 index f7cbfc3dfaae3..0000000000000 --- a/x-pack/plugins/rule_registry/server/generated/ecs_mappings.json +++ /dev/null @@ -1,3416 +0,0 @@ -{ - "properties": { - "@timestamp": { - "type": "date" - }, - "agent": { - "properties": { - "build": { - "properties": { - "original": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "ephemeral_id": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "client": { - "properties": { - "address": { - "ignore_above": 1024, - "type": "keyword" - }, - "as": { - "properties": { - "number": { - "type": "long" - }, - "organization": { - "properties": { - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "bytes": { - "type": "long" - }, - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "geo": { - "properties": { - "city_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "continent_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "location": { - "type": "geo_point" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "ip": { - "type": "ip" - }, - "mac": { - "ignore_above": 1024, - "type": "keyword" - }, - "nat": { - "properties": { - "ip": { - "type": "ip" - }, - "port": { - "type": "long" - } - } - }, - "packets": { - "type": "long" - }, - "port": { - "type": "long" - }, - "registered_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "subdomain": { - "ignore_above": 1024, - "type": "keyword" - }, - "top_level_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "user": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "email": { - "ignore_above": 1024, - "type": "keyword" - }, - "full_name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "group": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "roles": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "cloud": { - "properties": { - "account": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "availability_zone": { - "ignore_above": 1024, - "type": "keyword" - }, - "instance": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "machine": { - "properties": { - "type": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "project": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "provider": { - "ignore_above": 1024, - "type": "keyword" - }, - "region": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "container": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "image": { - "properties": { - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "tag": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "labels": { - "type": "object" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "runtime": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "destination": { - "properties": { - "address": { - "ignore_above": 1024, - "type": "keyword" - }, - "as": { - "properties": { - "number": { - "type": "long" - }, - "organization": { - "properties": { - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "bytes": { - "type": "long" - }, - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "geo": { - "properties": { - "city_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "continent_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "location": { - "type": "geo_point" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "ip": { - "type": "ip" - }, - "mac": { - "ignore_above": 1024, - "type": "keyword" - }, - "nat": { - "properties": { - "ip": { - "type": "ip" - }, - "port": { - "type": "long" - } - } - }, - "packets": { - "type": "long" - }, - "port": { - "type": "long" - }, - "registered_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "subdomain": { - "ignore_above": 1024, - "type": "keyword" - }, - "top_level_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "user": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "email": { - "ignore_above": 1024, - "type": "keyword" - }, - "full_name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "group": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "roles": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "dll": { - "properties": { - "code_signature": { - "properties": { - "exists": { - "type": "boolean" - }, - "status": { - "ignore_above": 1024, - "type": "keyword" - }, - "subject_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "trusted": { - "type": "boolean" - }, - "valid": { - "type": "boolean" - } - } - }, - "hash": { - "properties": { - "md5": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha1": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha256": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha512": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "path": { - "ignore_above": 1024, - "type": "keyword" - }, - "pe": { - "properties": { - "architecture": { - "ignore_above": 1024, - "type": "keyword" - }, - "company": { - "ignore_above": 1024, - "type": "keyword" - }, - "description": { - "ignore_above": 1024, - "type": "keyword" - }, - "file_version": { - "ignore_above": 1024, - "type": "keyword" - }, - "imphash": { - "ignore_above": 1024, - "type": "keyword" - }, - "original_file_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "product": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "dns": { - "properties": { - "answers": { - "properties": { - "class": { - "ignore_above": 1024, - "type": "keyword" - }, - "data": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "ttl": { - "type": "long" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - } - }, - "type": "object" - }, - "header_flags": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "op_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "question": { - "properties": { - "class": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "registered_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "subdomain": { - "ignore_above": 1024, - "type": "keyword" - }, - "top_level_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "resolved_ip": { - "type": "ip" - }, - "response_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "ecs": { - "properties": { - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "error": { - "properties": { - "code": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "message": { - "norms": false, - "type": "text" - }, - "stack_trace": { - "doc_values": false, - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "index": false, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "event": { - "properties": { - "action": { - "ignore_above": 1024, - "type": "keyword" - }, - "category": { - "ignore_above": 1024, - "type": "keyword" - }, - "code": { - "ignore_above": 1024, - "type": "keyword" - }, - "created": { - "type": "date" - }, - "dataset": { - "ignore_above": 1024, - "type": "keyword" - }, - "duration": { - "type": "long" - }, - "end": { - "type": "date" - }, - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "ingested": { - "type": "date" - }, - "kind": { - "ignore_above": 1024, - "type": "keyword" - }, - "module": { - "ignore_above": 1024, - "type": "keyword" - }, - "original": { - "doc_values": false, - "ignore_above": 1024, - "index": false, - "type": "keyword" - }, - "outcome": { - "ignore_above": 1024, - "type": "keyword" - }, - "provider": { - "ignore_above": 1024, - "type": "keyword" - }, - "reason": { - "ignore_above": 1024, - "type": "keyword" - }, - "reference": { - "ignore_above": 1024, - "type": "keyword" - }, - "risk_score": { - "type": "float" - }, - "risk_score_norm": { - "type": "float" - }, - "sequence": { - "type": "long" - }, - "severity": { - "type": "long" - }, - "start": { - "type": "date" - }, - "timezone": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "url": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "file": { - "properties": { - "accessed": { - "type": "date" - }, - "attributes": { - "ignore_above": 1024, - "type": "keyword" - }, - "code_signature": { - "properties": { - "exists": { - "type": "boolean" - }, - "status": { - "ignore_above": 1024, - "type": "keyword" - }, - "subject_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "trusted": { - "type": "boolean" - }, - "valid": { - "type": "boolean" - } - } - }, - "created": { - "type": "date" - }, - "ctime": { - "type": "date" - }, - "device": { - "ignore_above": 1024, - "type": "keyword" - }, - "directory": { - "ignore_above": 1024, - "type": "keyword" - }, - "drive_letter": { - "ignore_above": 1, - "type": "keyword" - }, - "extension": { - "ignore_above": 1024, - "type": "keyword" - }, - "gid": { - "ignore_above": 1024, - "type": "keyword" - }, - "group": { - "ignore_above": 1024, - "type": "keyword" - }, - "hash": { - "properties": { - "md5": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha1": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha256": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha512": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "inode": { - "ignore_above": 1024, - "type": "keyword" - }, - "mime_type": { - "ignore_above": 1024, - "type": "keyword" - }, - "mode": { - "ignore_above": 1024, - "type": "keyword" - }, - "mtime": { - "type": "date" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "owner": { - "ignore_above": 1024, - "type": "keyword" - }, - "path": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "pe": { - "properties": { - "architecture": { - "ignore_above": 1024, - "type": "keyword" - }, - "company": { - "ignore_above": 1024, - "type": "keyword" - }, - "description": { - "ignore_above": 1024, - "type": "keyword" - }, - "file_version": { - "ignore_above": 1024, - "type": "keyword" - }, - "imphash": { - "ignore_above": 1024, - "type": "keyword" - }, - "original_file_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "product": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "size": { - "type": "long" - }, - "target_path": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "uid": { - "ignore_above": 1024, - "type": "keyword" - }, - "x509": { - "properties": { - "alternative_names": { - "ignore_above": 1024, - "type": "keyword" - }, - "issuer": { - "properties": { - "common_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country": { - "ignore_above": 1024, - "type": "keyword" - }, - "distinguished_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "locality": { - "ignore_above": 1024, - "type": "keyword" - }, - "organization": { - "ignore_above": 1024, - "type": "keyword" - }, - "organizational_unit": { - "ignore_above": 1024, - "type": "keyword" - }, - "state_or_province": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "not_after": { - "type": "date" - }, - "not_before": { - "type": "date" - }, - "public_key_algorithm": { - "ignore_above": 1024, - "type": "keyword" - }, - "public_key_curve": { - "ignore_above": 1024, - "type": "keyword" - }, - "public_key_exponent": { - "doc_values": false, - "index": false, - "type": "long" - }, - "public_key_size": { - "type": "long" - }, - "serial_number": { - "ignore_above": 1024, - "type": "keyword" - }, - "signature_algorithm": { - "ignore_above": 1024, - "type": "keyword" - }, - "subject": { - "properties": { - "common_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country": { - "ignore_above": 1024, - "type": "keyword" - }, - "distinguished_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "locality": { - "ignore_above": 1024, - "type": "keyword" - }, - "organization": { - "ignore_above": 1024, - "type": "keyword" - }, - "organizational_unit": { - "ignore_above": 1024, - "type": "keyword" - }, - "state_or_province": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "version_number": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "group": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "host": { - "properties": { - "architecture": { - "ignore_above": 1024, - "type": "keyword" - }, - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "geo": { - "properties": { - "city_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "continent_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "location": { - "type": "geo_point" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hostname": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "ip": { - "type": "ip" - }, - "mac": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "os": { - "properties": { - "family": { - "ignore_above": 1024, - "type": "keyword" - }, - "full": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "kernel": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "platform": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "uptime": { - "type": "long" - }, - "user": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "email": { - "ignore_above": 1024, - "type": "keyword" - }, - "full_name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "group": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "roles": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "http": { - "properties": { - "request": { - "properties": { - "body": { - "properties": { - "bytes": { - "type": "long" - }, - "content": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "bytes": { - "type": "long" - }, - "method": { - "ignore_above": 1024, - "type": "keyword" - }, - "mime_type": { - "ignore_above": 1024, - "type": "keyword" - }, - "referrer": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "response": { - "properties": { - "body": { - "properties": { - "bytes": { - "type": "long" - }, - "content": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "bytes": { - "type": "long" - }, - "mime_type": { - "ignore_above": 1024, - "type": "keyword" - }, - "status_code": { - "type": "long" - } - } - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "labels": { - "type": "object" - }, - "log": { - "properties": { - "file": { - "properties": { - "path": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "level": { - "ignore_above": 1024, - "type": "keyword" - }, - "logger": { - "ignore_above": 1024, - "type": "keyword" - }, - "origin": { - "properties": { - "file": { - "properties": { - "line": { - "type": "integer" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "function": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "original": { - "doc_values": false, - "ignore_above": 1024, - "index": false, - "type": "keyword" - }, - "syslog": { - "properties": { - "facility": { - "properties": { - "code": { - "type": "long" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "priority": { - "type": "long" - }, - "severity": { - "properties": { - "code": { - "type": "long" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - }, - "type": "object" - } - } - }, - "message": { - "norms": false, - "type": "text" - }, - "network": { - "properties": { - "application": { - "ignore_above": 1024, - "type": "keyword" - }, - "bytes": { - "type": "long" - }, - "community_id": { - "ignore_above": 1024, - "type": "keyword" - }, - "direction": { - "ignore_above": 1024, - "type": "keyword" - }, - "forwarded_ip": { - "type": "ip" - }, - "iana_number": { - "ignore_above": 1024, - "type": "keyword" - }, - "inner": { - "properties": { - "vlan": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - }, - "type": "object" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "packets": { - "type": "long" - }, - "protocol": { - "ignore_above": 1024, - "type": "keyword" - }, - "transport": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "vlan": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "observer": { - "properties": { - "egress": { - "properties": { - "interface": { - "properties": { - "alias": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "vlan": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "zone": { - "ignore_above": 1024, - "type": "keyword" - } - }, - "type": "object" - }, - "geo": { - "properties": { - "city_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "continent_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "location": { - "type": "geo_point" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hostname": { - "ignore_above": 1024, - "type": "keyword" - }, - "ingress": { - "properties": { - "interface": { - "properties": { - "alias": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "vlan": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "zone": { - "ignore_above": 1024, - "type": "keyword" - } - }, - "type": "object" - }, - "ip": { - "type": "ip" - }, - "mac": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "os": { - "properties": { - "family": { - "ignore_above": 1024, - "type": "keyword" - }, - "full": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "kernel": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "platform": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "product": { - "ignore_above": 1024, - "type": "keyword" - }, - "serial_number": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "vendor": { - "ignore_above": 1024, - "type": "keyword" - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "organization": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "package": { - "properties": { - "architecture": { - "ignore_above": 1024, - "type": "keyword" - }, - "build_version": { - "ignore_above": 1024, - "type": "keyword" - }, - "checksum": { - "ignore_above": 1024, - "type": "keyword" - }, - "description": { - "ignore_above": 1024, - "type": "keyword" - }, - "install_scope": { - "ignore_above": 1024, - "type": "keyword" - }, - "installed": { - "type": "date" - }, - "license": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "path": { - "ignore_above": 1024, - "type": "keyword" - }, - "reference": { - "ignore_above": 1024, - "type": "keyword" - }, - "size": { - "type": "long" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "process": { - "properties": { - "args": { - "ignore_above": 1024, - "type": "keyword" - }, - "args_count": { - "type": "long" - }, - "code_signature": { - "properties": { - "exists": { - "type": "boolean" - }, - "status": { - "ignore_above": 1024, - "type": "keyword" - }, - "subject_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "trusted": { - "type": "boolean" - }, - "valid": { - "type": "boolean" - } - } - }, - "command_line": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "entity_id": { - "ignore_above": 1024, - "type": "keyword" - }, - "executable": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "exit_code": { - "type": "long" - }, - "hash": { - "properties": { - "md5": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha1": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha256": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha512": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "parent": { - "properties": { - "args": { - "ignore_above": 1024, - "type": "keyword" - }, - "args_count": { - "type": "long" - }, - "code_signature": { - "properties": { - "exists": { - "type": "boolean" - }, - "status": { - "ignore_above": 1024, - "type": "keyword" - }, - "subject_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "trusted": { - "type": "boolean" - }, - "valid": { - "type": "boolean" - } - } - }, - "command_line": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "entity_id": { - "ignore_above": 1024, - "type": "keyword" - }, - "executable": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "exit_code": { - "type": "long" - }, - "hash": { - "properties": { - "md5": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha1": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha256": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha512": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "pe": { - "properties": { - "architecture": { - "ignore_above": 1024, - "type": "keyword" - }, - "company": { - "ignore_above": 1024, - "type": "keyword" - }, - "description": { - "ignore_above": 1024, - "type": "keyword" - }, - "file_version": { - "ignore_above": 1024, - "type": "keyword" - }, - "imphash": { - "ignore_above": 1024, - "type": "keyword" - }, - "original_file_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "product": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "pgid": { - "type": "long" - }, - "pid": { - "type": "long" - }, - "ppid": { - "type": "long" - }, - "start": { - "type": "date" - }, - "thread": { - "properties": { - "id": { - "type": "long" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "title": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "uptime": { - "type": "long" - }, - "working_directory": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "pe": { - "properties": { - "architecture": { - "ignore_above": 1024, - "type": "keyword" - }, - "company": { - "ignore_above": 1024, - "type": "keyword" - }, - "description": { - "ignore_above": 1024, - "type": "keyword" - }, - "file_version": { - "ignore_above": 1024, - "type": "keyword" - }, - "imphash": { - "ignore_above": 1024, - "type": "keyword" - }, - "original_file_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "product": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "pgid": { - "type": "long" - }, - "pid": { - "type": "long" - }, - "ppid": { - "type": "long" - }, - "start": { - "type": "date" - }, - "thread": { - "properties": { - "id": { - "type": "long" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "title": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "uptime": { - "type": "long" - }, - "working_directory": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "registry": { - "properties": { - "data": { - "properties": { - "bytes": { - "ignore_above": 1024, - "type": "keyword" - }, - "strings": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hive": { - "ignore_above": 1024, - "type": "keyword" - }, - "key": { - "ignore_above": 1024, - "type": "keyword" - }, - "path": { - "ignore_above": 1024, - "type": "keyword" - }, - "value": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "related": { - "properties": { - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "hosts": { - "ignore_above": 1024, - "type": "keyword" - }, - "ip": { - "type": "ip" - }, - "user": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "rule": { - "properties": { - "author": { - "ignore_above": 1024, - "type": "keyword" - }, - "category": { - "ignore_above": 1024, - "type": "keyword" - }, - "description": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "license": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "reference": { - "ignore_above": 1024, - "type": "keyword" - }, - "ruleset": { - "ignore_above": 1024, - "type": "keyword" - }, - "uuid": { - "ignore_above": 1024, - "type": "keyword" - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "server": { - "properties": { - "address": { - "ignore_above": 1024, - "type": "keyword" - }, - "as": { - "properties": { - "number": { - "type": "long" - }, - "organization": { - "properties": { - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "bytes": { - "type": "long" - }, - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "geo": { - "properties": { - "city_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "continent_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "location": { - "type": "geo_point" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "ip": { - "type": "ip" - }, - "mac": { - "ignore_above": 1024, - "type": "keyword" - }, - "nat": { - "properties": { - "ip": { - "type": "ip" - }, - "port": { - "type": "long" - } - } - }, - "packets": { - "type": "long" - }, - "port": { - "type": "long" - }, - "registered_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "subdomain": { - "ignore_above": 1024, - "type": "keyword" - }, - "top_level_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "user": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "email": { - "ignore_above": 1024, - "type": "keyword" - }, - "full_name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "group": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "roles": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "service": { - "properties": { - "ephemeral_id": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "node": { - "properties": { - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "state": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "source": { - "properties": { - "address": { - "ignore_above": 1024, - "type": "keyword" - }, - "as": { - "properties": { - "number": { - "type": "long" - }, - "organization": { - "properties": { - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "bytes": { - "type": "long" - }, - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "geo": { - "properties": { - "city_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "continent_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "location": { - "type": "geo_point" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "ip": { - "type": "ip" - }, - "mac": { - "ignore_above": 1024, - "type": "keyword" - }, - "nat": { - "properties": { - "ip": { - "type": "ip" - }, - "port": { - "type": "long" - } - } - }, - "packets": { - "type": "long" - }, - "port": { - "type": "long" - }, - "registered_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "subdomain": { - "ignore_above": 1024, - "type": "keyword" - }, - "top_level_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "user": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "email": { - "ignore_above": 1024, - "type": "keyword" - }, - "full_name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "group": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "roles": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "span": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "tags": { - "ignore_above": 1024, - "type": "keyword" - }, - "threat": { - "properties": { - "framework": { - "ignore_above": 1024, - "type": "keyword" - }, - "tactic": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "reference": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "technique": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "reference": { - "ignore_above": 1024, - "type": "keyword" - }, - "subtechnique": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "reference": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - } - } - }, - "tls": { - "properties": { - "cipher": { - "ignore_above": 1024, - "type": "keyword" - }, - "client": { - "properties": { - "certificate": { - "ignore_above": 1024, - "type": "keyword" - }, - "certificate_chain": { - "ignore_above": 1024, - "type": "keyword" - }, - "hash": { - "properties": { - "md5": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha1": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha256": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "issuer": { - "ignore_above": 1024, - "type": "keyword" - }, - "ja3": { - "ignore_above": 1024, - "type": "keyword" - }, - "not_after": { - "type": "date" - }, - "not_before": { - "type": "date" - }, - "server_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "subject": { - "ignore_above": 1024, - "type": "keyword" - }, - "supported_ciphers": { - "ignore_above": 1024, - "type": "keyword" - }, - "x509": { - "properties": { - "alternative_names": { - "ignore_above": 1024, - "type": "keyword" - }, - "issuer": { - "properties": { - "common_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country": { - "ignore_above": 1024, - "type": "keyword" - }, - "distinguished_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "locality": { - "ignore_above": 1024, - "type": "keyword" - }, - "organization": { - "ignore_above": 1024, - "type": "keyword" - }, - "organizational_unit": { - "ignore_above": 1024, - "type": "keyword" - }, - "state_or_province": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "not_after": { - "type": "date" - }, - "not_before": { - "type": "date" - }, - "public_key_algorithm": { - "ignore_above": 1024, - "type": "keyword" - }, - "public_key_curve": { - "ignore_above": 1024, - "type": "keyword" - }, - "public_key_exponent": { - "doc_values": false, - "index": false, - "type": "long" - }, - "public_key_size": { - "type": "long" - }, - "serial_number": { - "ignore_above": 1024, - "type": "keyword" - }, - "signature_algorithm": { - "ignore_above": 1024, - "type": "keyword" - }, - "subject": { - "properties": { - "common_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country": { - "ignore_above": 1024, - "type": "keyword" - }, - "distinguished_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "locality": { - "ignore_above": 1024, - "type": "keyword" - }, - "organization": { - "ignore_above": 1024, - "type": "keyword" - }, - "organizational_unit": { - "ignore_above": 1024, - "type": "keyword" - }, - "state_or_province": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "version_number": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "curve": { - "ignore_above": 1024, - "type": "keyword" - }, - "established": { - "type": "boolean" - }, - "next_protocol": { - "ignore_above": 1024, - "type": "keyword" - }, - "resumed": { - "type": "boolean" - }, - "server": { - "properties": { - "certificate": { - "ignore_above": 1024, - "type": "keyword" - }, - "certificate_chain": { - "ignore_above": 1024, - "type": "keyword" - }, - "hash": { - "properties": { - "md5": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha1": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha256": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "issuer": { - "ignore_above": 1024, - "type": "keyword" - }, - "ja3s": { - "ignore_above": 1024, - "type": "keyword" - }, - "not_after": { - "type": "date" - }, - "not_before": { - "type": "date" - }, - "subject": { - "ignore_above": 1024, - "type": "keyword" - }, - "x509": { - "properties": { - "alternative_names": { - "ignore_above": 1024, - "type": "keyword" - }, - "issuer": { - "properties": { - "common_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country": { - "ignore_above": 1024, - "type": "keyword" - }, - "distinguished_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "locality": { - "ignore_above": 1024, - "type": "keyword" - }, - "organization": { - "ignore_above": 1024, - "type": "keyword" - }, - "organizational_unit": { - "ignore_above": 1024, - "type": "keyword" - }, - "state_or_province": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "not_after": { - "type": "date" - }, - "not_before": { - "type": "date" - }, - "public_key_algorithm": { - "ignore_above": 1024, - "type": "keyword" - }, - "public_key_curve": { - "ignore_above": 1024, - "type": "keyword" - }, - "public_key_exponent": { - "doc_values": false, - "index": false, - "type": "long" - }, - "public_key_size": { - "type": "long" - }, - "serial_number": { - "ignore_above": 1024, - "type": "keyword" - }, - "signature_algorithm": { - "ignore_above": 1024, - "type": "keyword" - }, - "subject": { - "properties": { - "common_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country": { - "ignore_above": 1024, - "type": "keyword" - }, - "distinguished_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "locality": { - "ignore_above": 1024, - "type": "keyword" - }, - "organization": { - "ignore_above": 1024, - "type": "keyword" - }, - "organizational_unit": { - "ignore_above": 1024, - "type": "keyword" - }, - "state_or_province": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "version_number": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - }, - "version_protocol": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "trace": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "transaction": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "url": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "extension": { - "ignore_above": 1024, - "type": "keyword" - }, - "fragment": { - "ignore_above": 1024, - "type": "keyword" - }, - "full": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "original": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "password": { - "ignore_above": 1024, - "type": "keyword" - }, - "path": { - "ignore_above": 1024, - "type": "keyword" - }, - "port": { - "type": "long" - }, - "query": { - "ignore_above": 1024, - "type": "keyword" - }, - "registered_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "scheme": { - "ignore_above": 1024, - "type": "keyword" - }, - "subdomain": { - "ignore_above": 1024, - "type": "keyword" - }, - "top_level_domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "username": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "user": { - "properties": { - "changes": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "email": { - "ignore_above": 1024, - "type": "keyword" - }, - "full_name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "group": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "roles": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "effective": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "email": { - "ignore_above": 1024, - "type": "keyword" - }, - "full_name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "group": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "roles": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "email": { - "ignore_above": 1024, - "type": "keyword" - }, - "full_name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "group": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "roles": { - "ignore_above": 1024, - "type": "keyword" - }, - "target": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "email": { - "ignore_above": 1024, - "type": "keyword" - }, - "full_name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "group": { - "properties": { - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hash": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "roles": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "user_agent": { - "properties": { - "device": { - "properties": { - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "original": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "os": { - "properties": { - "family": { - "ignore_above": 1024, - "type": "keyword" - }, - "full": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "kernel": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "platform": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "vulnerability": { - "properties": { - "category": { - "ignore_above": 1024, - "type": "keyword" - }, - "classification": { - "ignore_above": 1024, - "type": "keyword" - }, - "description": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "enumeration": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "reference": { - "ignore_above": 1024, - "type": "keyword" - }, - "report_id": { - "ignore_above": 1024, - "type": "keyword" - }, - "scanner": { - "properties": { - "vendor": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "score": { - "properties": { - "base": { - "type": "float" - }, - "environmental": { - "type": "float" - }, - "temporal": { - "type": "float" - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "severity": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } -} \ No newline at end of file diff --git a/x-pack/plugins/rule_registry/server/index.ts b/x-pack/plugins/rule_registry/server/index.ts index 7c46717300819..3d492bb690b05 100644 --- a/x-pack/plugins/rule_registry/server/index.ts +++ b/x-pack/plugins/rule_registry/server/index.ts @@ -11,8 +11,6 @@ import { RuleRegistryPlugin } from './plugin'; export { RuleRegistryPluginSetupContract } from './plugin'; export { createLifecycleRuleTypeFactory } from './rule_registry/rule_type_helpers/create_lifecycle_rule_type_factory'; -export { ecsFieldMap } from './generated/ecs_field_map'; -export { pickWithPatterns } from './rule_registry/field_map/pick_with_patterns'; export { FieldMapOf } from './types'; export { ScopedRuleRegistryClient } from './rule_registry/create_scoped_rule_registry_client/types'; diff --git a/x-pack/plugins/rule_registry/server/plugin.ts b/x-pack/plugins/rule_registry/server/plugin.ts index 9e83d938d508b..dabedc2849d07 100644 --- a/x-pack/plugins/rule_registry/server/plugin.ts +++ b/x-pack/plugins/rule_registry/server/plugin.ts @@ -9,10 +9,10 @@ import { PluginInitializerContext, Plugin, CoreSetup } from 'src/core/server'; import { PluginSetupContract as AlertingPluginSetupContract } from '../../alerting/server'; import { RuleRegistry } from './rule_registry'; import { defaultIlmPolicy } from './rule_registry/defaults/ilm_policy'; -import { defaultFieldMap } from './rule_registry/defaults/field_map'; +import { BaseRuleFieldMap, baseRuleFieldMap } from '../common'; import { RuleRegistryConfig } from '.'; -export type RuleRegistryPluginSetupContract = RuleRegistry; +export type RuleRegistryPluginSetupContract = RuleRegistry; export class RuleRegistryPlugin implements Plugin { constructor(private readonly initContext: PluginInitializerContext) { @@ -31,7 +31,7 @@ export class RuleRegistryPlugin implements Plugin { - const options = { - type: 'alert', - ...(namespace ? { namespace } : {}), - }; - - const pitFinder = savedObjectsClient.createPointInTimeFinder({ - ...options, - }); - - const ruleUuids: string[] = []; - - for await (const response of pitFinder.find()) { - ruleUuids.push(...response.saved_objects.map((object) => object.id)); - } - - await pitFinder.close(); - - return ruleUuids; -}; +import { BaseRuleFieldMap } from '../../../common'; +import { RuleRegistry } from '..'; const createPathReporterError = (either: Either) => { const error = new Error(`Failed to validate alert event`); @@ -49,28 +24,26 @@ const createPathReporterError = (either: Either) => { return error; }; -export function createScopedRuleRegistryClient({ - fieldMap, +export function createScopedRuleRegistryClient({ + ruleUuids, scopedClusterClient, - savedObjectsClient, - namespace, clusterClientAdapter, indexAliasName, indexTarget, logger, + registry, ruleData, }: { - fieldMap: TFieldMap; + ruleUuids: string[]; scopedClusterClient: ScopedClusterClient; - savedObjectsClient: SavedObjectsClientContract; - namespace?: string; clusterClientAdapter: ClusterClientAdapter<{ - body: OutputOfFieldMap; + body: TypeOfFieldMap; index: string; }>; indexAliasName: string; indexTarget: string; logger: Logger; + registry: RuleRegistry; ruleData?: { rule: { id: string; @@ -82,9 +55,9 @@ export function createScopedRuleRegistryClient { - const docRt = runtimeTypeFromFieldMap(fieldMap); + const fieldmapType = registry.getFieldMapType(); - const defaults: Partial> = ruleData + const defaults = ruleData ? { 'rule.uuid': ruleData.rule.uuid, 'rule.id': ruleData.rule.id, @@ -95,12 +68,12 @@ export function createScopedRuleRegistryClient = { + const client: ScopedRuleRegistryClient = { search: async (searchRequest) => { - const ruleUuids = await getRuleUuids({ - savedObjectsClient, - namespace, - }); + const fields = [ + 'rule.id', + ...(searchRequest.body?.fields ? castArray(searchRequest.body.fields) : []), + ]; const response = await scopedClusterClient.asInternalUser.search({ ...searchRequest, @@ -111,10 +84,11 @@ export function createScopedRuleRegistryClient { - const validation = docRt.decode(hit.fields); + const ruleTypeId: string = hit.fields!['rule.id'][0]; + + const registryOfType = registry.getRegistryByRuleTypeId(ruleTypeId); + + if (ruleTypeId && !registryOfType) { + logger.warn( + `Could not find type ${ruleTypeId} in registry, decoding with default type` + ); + } + + const type = registryOfType?.getFieldMapType() ?? fieldmapType; + + const validation = type.decode(hit.fields); if (isLeft(validation)) { const error = createPathReporterError(validation); logger.error(error); return undefined; } - return docRt.encode(validation.right); + return type.encode(validation.right); }) ) as EventsOf, }; }, + getDynamicIndexPattern: async () => { + const indexPatternsFetcher = new IndexPatternsFetcher(scopedClusterClient.asInternalUser); + + const fields = await indexPatternsFetcher.getFieldsForWildcard({ + pattern: indexTarget, + }); + + return { + fields, + timeFieldName: '@timestamp', + title: indexTarget, + }; + }, index: (doc) => { - const validation = docRt.decode({ + const validation = fieldmapType.decode({ ...doc, ...defaults, }); @@ -143,11 +142,14 @@ export function createScopedRuleRegistryClient { const validations = docs.map((doc) => { - return docRt.decode({ + return fieldmapType.decode({ ...doc, ...defaults, }); @@ -170,5 +172,8 @@ export function createScopedRuleRegistryClient + // when creating the client, due to #41693 which will be fixed in 4.2 return client; } diff --git a/x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts b/x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts index 95aa180709a51..f7b2394fe3a32 100644 --- a/x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts +++ b/x-pack/plugins/rule_registry/server/rule_registry/create_scoped_rule_registry_client/types.ts @@ -5,45 +5,51 @@ * 2.0. */ +import { FieldDescriptor } from 'src/plugins/data/server'; import { ESSearchRequest, ESSearchResponse } from 'typings/elasticsearch'; -import { DefaultFieldMap } from '../defaults/field_map'; -import { PatternsUnionOf, PickWithPatterns } from '../field_map/pick_with_patterns'; -import { OutputOfFieldMap } from '../field_map/runtime_type_from_fieldmap'; +import { + PatternsUnionOf, + PickWithPatterns, + OutputOfFieldMap, + BaseRuleFieldMap, +} from '../../../common'; -export type PrepopulatedRuleEventFields = - | 'rule.uuid' - | 'rule.id' - | 'rule.name' - | 'rule.type' - | 'rule.category' - | 'producer'; +export type PrepopulatedRuleEventFields = keyof Pick< + BaseRuleFieldMap, + 'rule.uuid' | 'rule.id' | 'rule.name' | 'rule.category' | 'kibana.rac.producer' +>; -type FieldsOf = +type FieldsOf = | Array<{ field: PatternsUnionOf } | PatternsUnionOf> | PatternsUnionOf; type Fields = Array<{ field: TPattern } | TPattern> | TPattern; -type FieldsESSearchRequest = ESSearchRequest & { +type FieldsESSearchRequest = ESSearchRequest & { body?: { fields: FieldsOf }; }; export type EventsOf< TFieldsESSearchRequest extends ESSearchRequest, - TFieldMap extends DefaultFieldMap + TFieldMap extends BaseRuleFieldMap > = TFieldsESSearchRequest extends { body: { fields: infer TFields } } ? TFields extends Fields ? Array>> : never : never; -export interface ScopedRuleRegistryClient { +export interface ScopedRuleRegistryClient { search>( request: TSearchRequest ): Promise<{ body: ESSearchResponse; events: EventsOf; }>; + getDynamicIndexPattern(): Promise<{ + title: string; + timeFieldName: string; + fields: FieldDescriptor[]; + }>; index(doc: Omit, PrepopulatedRuleEventFields>): void; bulkIndex( doc: Array, PrepopulatedRuleEventFields>> diff --git a/x-pack/plugins/rule_registry/server/rule_registry/field_map/mapping_from_field_map.ts b/x-pack/plugins/rule_registry/server/rule_registry/field_map/mapping_from_field_map.ts index 6e4e13b01d2c5..f1d7126906431 100644 --- a/x-pack/plugins/rule_registry/server/rule_registry/field_map/mapping_from_field_map.ts +++ b/x-pack/plugins/rule_registry/server/rule_registry/field_map/mapping_from_field_map.ts @@ -6,7 +6,8 @@ */ import { set } from '@elastic/safer-lodash-set'; -import { FieldMap, Mappings } from '../types'; +import { FieldMap } from '../../../common'; +import { Mappings } from '../types'; export function mappingFromFieldMap(fieldMap: FieldMap): Mappings { const mappings = { diff --git a/x-pack/plugins/rule_registry/server/rule_registry/index.ts b/x-pack/plugins/rule_registry/server/rule_registry/index.ts index f1d24550ade0a..bbc381f60a809 100644 --- a/x-pack/plugins/rule_registry/server/rule_registry/index.ts +++ b/x-pack/plugins/rule_registry/server/rule_registry/index.ts @@ -7,6 +7,7 @@ import { CoreSetup, Logger, RequestHandlerContext } from 'kibana/server'; import { inspect } from 'util'; +import { AlertsClient } from '../../../alerting/server'; import { SpacesServiceStart } from '../../../spaces/server'; import { ActionVariable, @@ -15,14 +16,19 @@ import { AlertTypeState, } from '../../../alerting/common'; import { createReadySignal, ClusterClientAdapter } from '../../../event_log/server'; -import { FieldMap, ILMPolicy } from './types'; +import { ILMPolicy } from './types'; import { RuleParams, RuleType } from '../types'; -import { mergeFieldMaps } from './field_map/merge_field_maps'; -import { OutputOfFieldMap } from './field_map/runtime_type_from_fieldmap'; +import { + mergeFieldMaps, + TypeOfFieldMap, + FieldMap, + FieldMapType, + BaseRuleFieldMap, + runtimeTypeFromFieldMap, +} from '../../common'; import { mappingFromFieldMap } from './field_map/mapping_from_field_map'; import { PluginSetupContract as AlertingPluginSetupContract } from '../../../alerting/server'; import { createScopedRuleRegistryClient } from './create_scoped_rule_registry_client'; -import { DefaultFieldMap } from './defaults/field_map'; import { ScopedRuleRegistryClient } from './create_scoped_rule_registry_client/types'; interface RuleRegistryOptions { @@ -38,20 +44,25 @@ interface RuleRegistryOptions { writeEnabled: boolean; } -export class RuleRegistry { +export class RuleRegistry { private readonly esAdapter: ClusterClientAdapter<{ - body: OutputOfFieldMap; + body: TypeOfFieldMap; index: string; }>; private readonly children: Array> = []; + private readonly types: Array> = []; + + private readonly fieldmapType: FieldMapType; constructor(private readonly options: RuleRegistryOptions) { const { logger, coreSetup } = options; + this.fieldmapType = runtimeTypeFromFieldMap(options.fieldMap); + const { wait, signal } = createReadySignal(); this.esAdapter = new ClusterClientAdapter<{ - body: OutputOfFieldMap; + body: TypeOfFieldMap; index: string; }>({ wait, @@ -103,6 +114,11 @@ export class RuleRegistry { const templateExists = await this.esAdapter.doesIndexTemplateExist(indexAliasName); + const mappings = mappingFromFieldMap(this.options.fieldMap); + + const esClient = (await this.options.coreSetup.getStartServices())[0].elasticsearch.client + .asInternalUser; + if (!templateExists) { await this.esAdapter.createIndexTemplate(indexAliasName, { index_patterns: [`${indexAliasName}-*`], @@ -114,7 +130,16 @@ export class RuleRegistry { 'sort.field': '@timestamp', 'sort.order': 'desc', }, - mappings: mappingFromFieldMap(this.options.fieldMap), + mappings, + }); + } else { + await esClient.indices.putTemplate({ + name: indexAliasName, + body: { + index_patterns: [`${indexAliasName}-*`], + mappings, + }, + create: false, }); } @@ -128,24 +153,86 @@ export class RuleRegistry { }, }, }); + } else { + const { body: aliases } = (await esClient.indices.getAlias({ + index: indexAliasName, + })) as { body: Record }> }; + + const writeIndex = Object.entries(aliases).find( + ([indexName, alias]) => alias.aliases[indexAliasName]?.is_write_index === true + )![0]; + + const { body: fieldsInWriteIndex } = await esClient.fieldCaps({ + index: writeIndex, + fields: '*', + }); + + const fieldsNotOrDifferentInIndex = Object.entries(this.options.fieldMap).filter( + ([fieldName, descriptor]) => { + return ( + !fieldsInWriteIndex.fields[fieldName] || + !fieldsInWriteIndex.fields[fieldName][descriptor.type] + ); + } + ); + + if (fieldsNotOrDifferentInIndex.length > 0) { + this.options.logger.debug( + `Some fields were not found in write index mapping: ${Object.keys( + Object.fromEntries(fieldsNotOrDifferentInIndex) + ).join(',')}` + ); + this.options.logger.info(`Updating index mapping due to new fields`); + + await esClient.indices.putMapping({ + index: indexAliasName, + body: mappings, + }); + } + } + } + + getFieldMapType() { + return this.fieldmapType; + } + + getRuleTypeById(ruleTypeId: string) { + return this.types.find((type) => type.id === ruleTypeId); + } + + getRegistryByRuleTypeId(ruleTypeId: string): RuleRegistry | undefined { + if (this.getRuleTypeById(ruleTypeId)) { + return this; } + + return this.children.find((child) => child.getRegistryByRuleTypeId(ruleTypeId)); } - createScopedRuleRegistryClient({ + async createScopedRuleRegistryClient({ context, + alertsClient, }: { context: RequestHandlerContext; - }): ScopedRuleRegistryClient | undefined { + alertsClient: AlertsClient; + }): Promise | undefined> { if (!this.options.writeEnabled) { return undefined; } const { indexAliasName, indexTarget } = this.getEsNames(); + const frameworkAlerts = ( + await alertsClient.find({ + options: { + perPage: 1000, + }, + }) + ).data; + return createScopedRuleRegistryClient({ - savedObjectsClient: context.core.savedObjects.getClient({ includedHiddenTypes: ['alert'] }), + ruleUuids: frameworkAlerts.map((frameworkAlert) => frameworkAlert.id), scopedClusterClient: context.core.elasticsearch.client, clusterClientAdapter: this.esAdapter, - fieldMap: this.options.fieldMap, + registry: this, indexAliasName, indexTarget, logger: this.options.logger, @@ -159,6 +246,8 @@ export class RuleRegistry { const { indexAliasName, indexTarget } = this.getEsNames(); + this.types.push(type); + this.options.alertingPluginSetupContract.registerType< AlertTypeParams, AlertTypeState, @@ -168,7 +257,7 @@ export class RuleRegistry { >({ ...type, executor: async (executorOptions) => { - const { services, namespace, alertId, name, tags } = executorOptions; + const { services, alertId, name, tags } = executorOptions; const rule = { id: type.id, @@ -189,13 +278,12 @@ export class RuleRegistry { ...(this.options.writeEnabled ? { scopedRuleRegistryClient: createScopedRuleRegistryClient({ - savedObjectsClient: services.savedObjectsClient, scopedClusterClient: services.scopedClusterClient, + ruleUuids: [rule.uuid], clusterClientAdapter: this.esAdapter, - fieldMap: this.options.fieldMap, + registry: this, indexAliasName, indexTarget, - namespace, ruleData: { producer, rule, diff --git a/x-pack/plugins/rule_registry/server/rule_registry/rule_type_helpers/create_lifecycle_rule_type_factory.ts b/x-pack/plugins/rule_registry/server/rule_registry/rule_type_helpers/create_lifecycle_rule_type_factory.ts index 9c64e85f839bb..65eaf0964cfca 100644 --- a/x-pack/plugins/rule_registry/server/rule_registry/rule_type_helpers/create_lifecycle_rule_type_factory.ts +++ b/x-pack/plugins/rule_registry/server/rule_registry/rule_type_helpers/create_lifecycle_rule_type_factory.ts @@ -7,28 +7,28 @@ import * as t from 'io-ts'; import { isLeft } from 'fp-ts/lib/Either'; import v4 from 'uuid/v4'; +import { Mutable } from 'utility-types'; import { AlertInstance } from '../../../../alerting/server'; import { ActionVariable, AlertInstanceState } from '../../../../alerting/common'; import { RuleParams, RuleType } from '../../types'; -import { DefaultFieldMap } from '../defaults/field_map'; -import { OutputOfFieldMap } from '../field_map/runtime_type_from_fieldmap'; +import { BaseRuleFieldMap, OutputOfFieldMap } from '../../../common'; import { PrepopulatedRuleEventFields } from '../create_scoped_rule_registry_client/types'; import { RuleRegistry } from '..'; -type UserDefinedAlertFields = Omit< +type UserDefinedAlertFields = Omit< OutputOfFieldMap, PrepopulatedRuleEventFields | 'kibana.rac.alert.id' | 'kibana.rac.alert.uuid' | '@timestamp' >; type LifecycleAlertService< - TFieldMap extends DefaultFieldMap, + TFieldMap extends BaseRuleFieldMap, TActionVariable extends ActionVariable > = (alert: { id: string; fields: UserDefinedAlertFields; }) => AlertInstance; -type CreateLifecycleRuleType = < +type CreateLifecycleRuleType = < TRuleParams extends RuleParams, TActionVariable extends ActionVariable >( @@ -52,12 +52,12 @@ const wrappedStateRt = t.type({ }); export function createLifecycleRuleTypeFactory< - TRuleRegistry extends RuleRegistry + TRuleRegistry extends RuleRegistry >(): TRuleRegistry extends RuleRegistry ? CreateLifecycleRuleType : never; -export function createLifecycleRuleTypeFactory(): CreateLifecycleRuleType { +export function createLifecycleRuleTypeFactory(): CreateLifecycleRuleType { return (type) => { return { ...type, @@ -79,7 +79,7 @@ export function createLifecycleRuleTypeFactory(): CreateLifecycleRuleType & { 'kibana.rac.alert.id': string } + UserDefinedAlertFields & { 'kibana.rac.alert.id': string } > = {}; const timestamp = options.startedAt.toISOString(); @@ -113,7 +113,7 @@ export function createLifecycleRuleTypeFactory(): CreateLifecycleRuleType> = { + const alertsDataMap: Record> = { ...currentAlerts, }; @@ -156,7 +156,7 @@ export function createLifecycleRuleTypeFactory(): CreateLifecycleRuleType> = allAlertIds.map( + const eventsToIndex: Array> = allAlertIds.map( (alertId) => { const alertData = alertsDataMap[alertId]; @@ -164,7 +164,7 @@ export function createLifecycleRuleTypeFactory(): CreateLifecycleRuleType = { + const event: Mutable> = { ...alertData, '@timestamp': timestamp, 'event.kind': 'state', diff --git a/x-pack/plugins/rule_registry/server/rule_registry/types.ts b/x-pack/plugins/rule_registry/server/rule_registry/types.ts index f6baf8bcecbd0..ec7293d1c1d4c 100644 --- a/x-pack/plugins/rule_registry/server/rule_registry/types.ts +++ b/x-pack/plugins/rule_registry/server/rule_registry/types.ts @@ -40,5 +40,3 @@ export interface ILMPolicy { >; }; } - -export type FieldMap = Record; diff --git a/x-pack/plugins/rule_registry/server/types.ts b/x-pack/plugins/rule_registry/server/types.ts index e6b53a8558964..dd54046365d98 100644 --- a/x-pack/plugins/rule_registry/server/types.ts +++ b/x-pack/plugins/rule_registry/server/types.ts @@ -16,14 +16,14 @@ import { import { ActionGroup, AlertExecutorOptions } from '../../alerting/server'; import { RuleRegistry } from './rule_registry'; import { ScopedRuleRegistryClient } from './rule_registry/create_scoped_rule_registry_client/types'; -import { DefaultFieldMap } from './rule_registry/defaults/field_map'; +import { BaseRuleFieldMap } from '../common'; export type RuleParams = Type; type TypeOfRuleParams = TypeOf; type RuleExecutorServices< - TFieldMap extends DefaultFieldMap, + TFieldMap extends BaseRuleFieldMap, TActionVariable extends ActionVariable > = AlertExecutorOptions< AlertTypeParams, @@ -48,7 +48,7 @@ type PassthroughAlertExecutorOptions = Pick< >; type RuleExecutorFunction< - TFieldMap extends DefaultFieldMap, + TFieldMap extends BaseRuleFieldMap, TRuleParams extends RuleParams, TActionVariable extends ActionVariable, TAdditionalRuleExecutorServices extends Record @@ -76,7 +76,7 @@ interface RuleTypeBase { } export type RuleType< - TFieldMap extends DefaultFieldMap, + TFieldMap extends BaseRuleFieldMap, TRuleParams extends RuleParams, TActionVariable extends ActionVariable, TAdditionalRuleExecutorServices extends Record = {} diff --git a/x-pack/plugins/rule_registry/tsconfig.json b/x-pack/plugins/rule_registry/tsconfig.json index 2961abe6cfecd..707e1ccb98dad 100644 --- a/x-pack/plugins/rule_registry/tsconfig.json +++ b/x-pack/plugins/rule_registry/tsconfig.json @@ -7,9 +7,10 @@ "declaration": true, "declarationMap": true }, - "include": ["common/**/*", "server/**/*", "../../../typings/**/*"], + "include": ["common/**/*", "server/**/*", "public/**/*", "../../../typings/**/*"], "references": [ { "path": "../../../src/core/tsconfig.json" }, { "path": "../alerting/tsconfig.json" }, + { "path": "../triggers_actions_ui/tsconfig.json" } ] } diff --git a/x-pack/test/apm_api_integration/tests/alerts/rule_registry.ts b/x-pack/test/apm_api_integration/tests/alerts/rule_registry.ts index 97026d126d2a1..8d0b87782ff7c 100644 --- a/x-pack/test/apm_api_integration/tests/alerts/rule_registry.ts +++ b/x-pack/test/apm_api_integration/tests/alerts/rule_registry.ts @@ -7,6 +7,7 @@ import expect from '@kbn/expect'; import { get, merge, omit } from 'lodash'; +import { format } from 'url'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import { registry } from '../../common/registry'; @@ -276,8 +277,11 @@ export default function ApiTest({ getService }: FtrProviderContext) { query: { match_all: {}, }, + size: 1, + sort: { + '@timestamp': 'desc', + }, }, - size: 1, }); expect(beforeDataResponse.body.hits.hits.length).to.be(0); @@ -300,8 +304,11 @@ export default function ApiTest({ getService }: FtrProviderContext) { query: { match_all: {}, }, + size: 1, + sort: { + '@timestamp': 'desc', + }, }, - size: 1, }); expect(afterInitialDataResponse.body.hits.hits.length).to.be(0); @@ -324,8 +331,11 @@ export default function ApiTest({ getService }: FtrProviderContext) { query: { match_all: {}, }, + size: 1, + sort: { + '@timestamp': 'desc', + }, }, - size: 1, }); expect(afterViolatingDataResponse.body.hits.hits.length).to.be(1); @@ -335,33 +345,142 @@ export default function ApiTest({ getService }: FtrProviderContext) { any >; - const toCompare = omit( - alertEvent, + const exclude = [ '@timestamp', 'kibana.rac.alert.start', 'kibana.rac.alert.uuid', - 'rule.uuid' + 'rule.uuid', + ]; + + const toCompare = omit(alertEvent, exclude); + + expect(toCompare).to.eql({ + 'event.action': 'open', + 'event.kind': 'state', + 'kibana.rac.alert.duration.us': 0, + 'kibana.rac.alert.id': 'apm.transaction_error_rate_opbeans-go_request', + 'kibana.rac.alert.status': 'open', + 'kibana.rac.producer': 'apm', + 'kibana.observability.evaluation.threshold': 30, + 'kibana.observability.evaluation.value': 50, + 'processor.event': 'transaction', + 'rule.category': 'Transaction error rate threshold', + 'rule.id': 'apm.transaction_error_rate', + 'rule.name': 'Transaction error rate threshold | opbeans-go', + 'service.name': 'opbeans-go', + tags: ['apm', 'service.name:opbeans-go'], + 'transaction.type': 'request', + }); + + const now = new Date().getTime(); + + const { body: topAlerts, status: topAlertStatus } = await supertest + .get( + format({ + pathname: '/api/observability/rules/alerts/top', + query: { + start: new Date(now - 30 * 60 * 1000).toISOString(), + end: new Date(now).toISOString(), + }, + }) + ) + .set('kbn-xsrf', 'foo'); + + expect(topAlertStatus).to.eql(200); + + expect(topAlerts.length).to.be.greaterThan(0); + + expect(omit(topAlerts[0], exclude)).to.eql(toCompare); + + await es.bulk({ + index: APM_TRANSACTION_INDEX_NAME, + body: [ + { index: {} }, + createTransactionEvent({ + event: { + outcome: 'success', + }, + }), + { index: {} }, + createTransactionEvent({ + event: { + outcome: 'success', + }, + }), + ], + refresh: true, + }); + + alert = await waitUntilNextExecution(alert); + + const afterRecoveryResponse = await es.search({ + index: ALERTS_INDEX_TARGET, + body: { + query: { + match_all: {}, + }, + size: 1, + sort: { + '@timestamp': 'desc', + }, + }, + }); + + expect(afterRecoveryResponse.body.hits.hits.length).to.be(1); + + const recoveredAlertEvent = afterRecoveryResponse.body.hits.hits[0]._source as Record< + string, + any + >; + + expect(recoveredAlertEvent['kibana.rac.alert.status']).to.eql('closed'); + expect(recoveredAlertEvent['kibana.rac.alert.duration.us']).to.be.greaterThan(0); + expect(new Date(recoveredAlertEvent['kibana.rac.alert.end']).getTime()).to.be.greaterThan( + 0 ); - expectSnapshot(toCompare).toMatchInline(` - Object { - "event.action": "open", - "event.kind": "state", - "kibana.rac.alert.duration.us": 0, - "kibana.rac.alert.id": "apm.transaction_error_rate_opbeans-go_request", - "kibana.rac.alert.status": "open", - "kibana.rac.producer": "apm", - "rule.category": "Transaction error rate threshold", - "rule.id": "apm.transaction_error_rate", - "rule.name": "Transaction error rate threshold | opbeans-go", - "service.name": "opbeans-go", - "tags": Array [ - "apm", - "service.name:opbeans-go", - ], - "transaction.type": "request", - } - `); + expect( + omit( + recoveredAlertEvent, + exclude.concat(['kibana.rac.alert.duration.us', 'kibana.rac.alert.end']) + ) + ).to.eql({ + 'event.action': 'close', + 'event.kind': 'state', + 'kibana.rac.alert.id': 'apm.transaction_error_rate_opbeans-go_request', + 'kibana.rac.alert.status': 'closed', + 'kibana.rac.producer': 'apm', + 'kibana.observability.evaluation.threshold': 30, + 'kibana.observability.evaluation.value': 50, + 'processor.event': 'transaction', + 'rule.category': 'Transaction error rate threshold', + 'rule.id': 'apm.transaction_error_rate', + 'rule.name': 'Transaction error rate threshold | opbeans-go', + 'service.name': 'opbeans-go', + tags: ['apm', 'service.name:opbeans-go'], + 'transaction.type': 'request', + }); + + const { + body: topAlertsAfterRecovery, + status: topAlertStatusAfterRecovery, + } = await supertest + .get( + format({ + pathname: '/api/observability/rules/alerts/top', + query: { + start: new Date(now - 30 * 60 * 1000).toISOString(), + end: new Date().toISOString(), + }, + }) + ) + .set('kbn-xsrf', 'foo'); + + expect(topAlertStatusAfterRecovery).to.eql(200); + + expect(topAlertsAfterRecovery.length).to.be(1); + + expect(topAlertsAfterRecovery[0]['kibana.rac.alert.status']).to.be('closed'); }); }); }); From e11ac98b3a9c656578e0a86e2979398aad9c04d7 Mon Sep 17 00:00:00 2001 From: Phillip Burch Date: Thu, 15 Apr 2021 11:37:47 -0500 Subject: [PATCH 26/68] [Metrics UI] Add anomalies tab to enhanced node details (#96967) * Adapt the anomalies table to work in overlay * Wire up the onClose function * Make "show in inventory" filter waffle map * Remove unused variable Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../results/metrics_hosts_anomalies.ts | 1 + .../anomalies_table/anomalies_table.tsx | 141 +++++++++++------- .../components/node_details/overlay.tsx | 13 +- .../node_details/tabs/anomalies/anomalies.tsx | 29 ++++ .../components/node_details/tabs/shared.tsx | 1 + .../hooks/use_metrics_hosts_anomalies.ts | 6 +- .../results/metrics_hosts_anomalies.ts | 7 + 7 files changed, 136 insertions(+), 62 deletions(-) create mode 100644 x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/anomalies/anomalies.tsx diff --git a/x-pack/plugins/infra/common/http_api/infra_ml/results/metrics_hosts_anomalies.ts b/x-pack/plugins/infra/common/http_api/infra_ml/results/metrics_hosts_anomalies.ts index 7c6a0f6d2ada7..bd9776741d165 100644 --- a/x-pack/plugins/infra/common/http_api/infra_ml/results/metrics_hosts_anomalies.ts +++ b/x-pack/plugins/infra/common/http_api/infra_ml/results/metrics_hosts_anomalies.ts @@ -74,6 +74,7 @@ export const getMetricsHostsAnomaliesRequestPayloadRT = rt.type({ }), rt.partial({ query: rt.string, + hostName: rt.string, metric: metricRT, // Pagination properties pagination: paginationRT, diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/anomalies_table/anomalies_table.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/anomalies_table/anomalies_table.tsx index 409c11cbbe897..4915f4cc6422a 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/anomalies_table/anomalies_table.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/anomalies_table/anomalies_table.tsx @@ -30,7 +30,6 @@ import { FormattedDate, FormattedMessage } from 'react-intl'; import { datemathToEpochMillis } from '../../../../../../../utils/datemath'; import { SnapshotMetricType } from '../../../../../../../../common/inventory_models/types'; import { withTheme } from '../../../../../../../../../../../src/plugins/kibana_react/common'; -import { PrefilledAnomalyAlertFlyout } from '../../../../../../../alerting/metric_anomaly/components/alert_flyout'; import { useLinkProps } from '../../../../../../../hooks/use_link_props'; import { useSorting } from '../../../../../../../hooks/use_sorting'; import { useMetricsK8sAnomaliesResults } from '../../../../hooks/use_metrics_k8s_anomalies'; @@ -46,6 +45,7 @@ import { AnomalySeverityIndicator } from '../../../../../../../components/loggin import { useSourceContext } from '../../../../../../../containers/metrics_source'; import { createResultsUrl } from '../flyout_home'; import { useWaffleViewState, WaffleViewState } from '../../../../hooks/use_waffle_view_state'; +import { useUiTracker } from '../../../../../../../../../observability/public'; type JobType = 'k8s' | 'hosts'; type SortField = 'anomalyScore' | 'startTime'; interface JobOption { @@ -57,22 +57,21 @@ const AnomalyActionMenu = ({ type, startTime, closeFlyout, - partitionFieldName, - partitionFieldValue, + influencerField, + influencers, + disableShowInInventory, }: { jobId: string; type: string; startTime: number; closeFlyout: () => void; - partitionFieldName?: string; - partitionFieldValue?: string; + influencerField: string; + influencers: string[]; + disableShowInInventory?: boolean; }) => { const [isOpen, setIsOpen] = useState(false); - const [isAlertOpen, setIsAlertOpen] = useState(false); const close = useCallback(() => setIsOpen(false), [setIsOpen]); const handleToggleMenu = useCallback(() => setIsOpen(!isOpen), [isOpen]); - const openAlert = useCallback(() => setIsAlertOpen(true), [setIsAlertOpen]); - const closeAlert = useCallback(() => setIsAlertOpen(false), [setIsAlertOpen]); const { onViewChange } = useWaffleViewState(); const showInInventory = useCallback(() => { @@ -99,10 +98,12 @@ const AnomalyActionMenu = ({ region: '', autoReload: false, filterQuery: { - expression: - partitionFieldName && partitionFieldValue - ? `${partitionFieldName}: "${partitionFieldValue}"` - : ``, + expression: influencers.reduce((query, i) => { + if (query) { + query = `${query} or `; + } + return `${query} ${influencerField}: "${i}"`; + }, ''), kind: 'kuery', }, legend: { palette: 'cool', reverseColors: false, steps: 10 }, @@ -110,7 +111,7 @@ const AnomalyActionMenu = ({ }; onViewChange(anomalyViewParams); closeFlyout(); - }, [jobId, onViewChange, startTime, type, partitionFieldName, partitionFieldValue, closeFlyout]); + }, [jobId, onViewChange, startTime, type, influencers, influencerField, closeFlyout]); const anomaliesUrl = useLinkProps({ app: 'ml', @@ -118,26 +119,25 @@ const AnomalyActionMenu = ({ }); const items = [ - - - , , - - - , ]; + if (!disableShowInInventory) { + items.push( + + + + ); + } + return ( <> } - isOpen={isOpen && !isAlertOpen} + isOpen={isOpen} closePopover={close} > - {isAlertOpen && } ); }; @@ -184,12 +183,14 @@ export const NoAnomaliesFound = withTheme(({ theme }) => ( )); interface Props { closeFlyout(): void; + hostName?: string; } export const AnomaliesTable = (props: Props) => { - const { closeFlyout } = props; + const { closeFlyout, hostName } = props; const [search, setSearch] = useState(''); const [start, setStart] = useState('now-30d'); const [end, setEnd] = useState('now'); + const trackMetric = useUiTracker({ app: 'infra_metrics' }); const [timeRange, setTimeRange] = useState<{ start: number; end: number }>({ start: datemathToEpochMillis(start) || 0, end: datemathToEpochMillis(end, 'up') || 0, @@ -321,6 +322,16 @@ export const AnomaliesTable = (props: Props) => { [hostChangeSort, k8sChangeSort, jobType] ); + useEffect(() => { + if (results) { + results.forEach((r) => { + if (r.influencers.length > 100) { + trackMetric({ metric: 'metrics_ml_anomaly_detection_more_than_100_influencers' }); + } + }); + } + }, [results, trackMetric]); + const onTableChange = (criteria: Criteria) => { setSorting(criteria.sort); changeSortOptions({ @@ -329,7 +340,7 @@ export const AnomaliesTable = (props: Props) => { }); }; - const columns: Array< + let columns: Array< | EuiTableFieldDataColumnType | EuiTableActionsColumnType > = [ @@ -394,8 +405,11 @@ export const AnomaliesTable = (props: Props) => { 100} + influencers={anomaly.influencers} startTime={anomaly.startTime} closeFlyout={closeFlyout} /> @@ -406,11 +420,20 @@ export const AnomaliesTable = (props: Props) => { }, ]; + columns = hostName + ? columns.filter((c) => { + if ('field' in c) { + return c.field !== 'influencers'; + } + return true; + }) + : columns; + useEffect(() => { if (getAnomalies) { - getAnomalies(undefined, search); + getAnomalies(undefined, search, hostName); } - }, [getAnomalies, search]); + }, [getAnomalies, search, hostName]); return (
@@ -425,31 +448,33 @@ export const AnomaliesTable = (props: Props) => { - - - - - - - - + {!hostName && ( + + + + + + + + + )} diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/overlay.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/overlay.tsx index f21a9d1e1f591..eb5a3f3f9fee1 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/overlay.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/overlay.tsx @@ -19,6 +19,7 @@ import { MetricsTab } from './tabs/metrics/metrics'; import { LogsTab } from './tabs/logs'; import { ProcessesTab } from './tabs/processes'; import { PropertiesTab } from './tabs/properties/index'; +import { AnomaliesTab } from './tabs/anomalies/anomalies'; import { OVERLAY_Y_START, OVERLAY_BOTTOM_MARGIN } from './tabs/shared'; import { useLinkProps } from '../../../../../hooks/use_link_props'; import { getNodeDetailUrl } from '../../../../link_to'; @@ -44,7 +45,7 @@ export const NodeContextPopover = ({ openAlertFlyout, }: Props) => { // eslint-disable-next-line react-hooks/exhaustive-deps - const tabConfigs = [MetricsTab, LogsTab, ProcessesTab, PropertiesTab]; + const tabConfigs = [MetricsTab, LogsTab, ProcessesTab, PropertiesTab, AnomaliesTab]; const inventoryModel = findInventoryModel(nodeType); const nodeDetailFrom = currentTime - inventoryModel.metrics.defaultTimeRangeInSeconds * 1000; const uiCapabilities = useKibana().services.application?.capabilities; @@ -58,11 +59,17 @@ export const NodeContextPopover = ({ return { ...m, content: ( - + ), }; }); - }, [tabConfigs, node, nodeType, currentTime, options]); + }, [tabConfigs, node, nodeType, currentTime, onClose, options]); const [selectedTab, setSelectedTab] = useState(0); diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/anomalies/anomalies.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/anomalies/anomalies.tsx new file mode 100644 index 0000000000000..40dad03f73366 --- /dev/null +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/anomalies/anomalies.tsx @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import React from 'react'; +import { AnomaliesTable } from '../../../ml/anomaly_detection/anomalies_table/anomalies_table'; +import { TabContent, TabProps } from '../shared'; + +const TabComponent = (props: TabProps) => { + const { node, onClose } = props; + + return ( + + + + ); +}; + +export const AnomaliesTab = { + id: 'anomalies', + name: i18n.translate('xpack.infra.nodeDetails.tabs.anomalies', { + defaultMessage: 'Anomalies', + }), + content: TabComponent, +}; diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/shared.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/shared.tsx index 979048ca685f8..f011f91a2e9df 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/shared.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/shared.tsx @@ -14,6 +14,7 @@ export interface TabProps { currentTime: number; node: InfraWaffleMapNode; nodeType: InventoryItemType; + onClose(): void; } export const OVERLAY_Y_START = 266; diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_hosts_anomalies.ts b/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_hosts_anomalies.ts index 5ef6c9429c4b3..b1401f268dc51 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_hosts_anomalies.ts +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_hosts_anomalies.ts @@ -174,7 +174,7 @@ export const useMetricsHostsAnomaliesResults = ({ const [getMetricsHostsAnomaliesRequest, getMetricsHostsAnomalies] = useTrackedPromise( { cancelPreviousOn: 'creation', - createPromise: async (metric?: Metric, query?: string) => { + createPromise: async (metric?: Metric, query?: string, hostName?: string) => { const { timeRange: { start: queryStartTime, end: queryEndTime }, sortOptions, @@ -195,6 +195,7 @@ export const useMetricsHostsAnomaliesResults = ({ ...paginationOptions, cursor: paginationCursor, }, + hostName, }, services.http.fetch ); @@ -309,6 +310,7 @@ interface RequestArgs { endTime: number; metric?: Metric; query?: string; + hostName?: string; sort: Sort; pagination: Pagination; } @@ -326,6 +328,7 @@ export const callGetMetricHostsAnomaliesAPI = async ( sort, pagination, query, + hostName, } = requestArgs; const response = await fetch(INFA_ML_GET_METRICS_HOSTS_ANOMALIES_PATH, { method: 'POST', @@ -342,6 +345,7 @@ export const callGetMetricHostsAnomaliesAPI = async ( metric, sort, pagination, + hostName, }, }) ), diff --git a/x-pack/plugins/infra/server/routes/infra_ml/results/metrics_hosts_anomalies.ts b/x-pack/plugins/infra/server/routes/infra_ml/results/metrics_hosts_anomalies.ts index 15ff6c0834a75..1b5ed62a006be 100644 --- a/x-pack/plugins/infra/server/routes/infra_ml/results/metrics_hosts_anomalies.ts +++ b/x-pack/plugins/infra/server/routes/infra_ml/results/metrics_hosts_anomalies.ts @@ -40,6 +40,7 @@ export const initGetHostsAnomaliesRoute = ({ framework }: InfraBackendLibs) => { pagination: paginationParam, metric, query, + hostName, }, } = request.body; @@ -63,6 +64,12 @@ export const initGetHostsAnomaliesRoute = ({ framework }: InfraBackendLibs) => { query, sort, pagination, + influencerFilter: hostName + ? { + fieldName: 'host.name', + fieldValue: hostName, + } + : undefined, }); return response.ok({ From 53e2d5d7254845399a65e769f1961cccb2524d36 Mon Sep 17 00:00:00 2001 From: Melissa Alvarez Date: Thu, 15 Apr 2021 12:52:09 -0400 Subject: [PATCH 27/68] [ML] Data Frame Analytics: Ensure creation and results views display nested fields correctly (#96905) * create analytics field service * remove unnecessary field filter. update types * create common base class for newJobCapabilites classes for AD and DFA * fix column schema for histogram * update endpoint to be consistent with AD job caps * add unit test for removeNestedFieldChildren helper function * removes obsolete const --- x-pack/plugins/ml/common/types/fields.ts | 4 + .../components/data_grid/common.ts | 6 +- .../data_frame_analytics/common/fields.ts | 58 +- .../common/get_index_fields.ts | 4 +- .../common/use_results_view_config.ts | 4 +- .../configuration_step_form.tsx | 4 +- .../supported_fields_message.tsx | 10 +- .../hooks/use_index_data.ts | 67 +- .../common/job_creator/util/general.ts | 2 +- .../components/time_field/time_field.tsx | 2 +- .../advanced_view/metric_selection.tsx | 2 +- .../categorization_field.tsx | 2 +- .../categorization_per_partition_dropdown.tsx | 2 +- .../components/influencers/influencers.tsx | 2 +- .../multi_metric_view/metric_selection.tsx | 2 +- .../population_view/metric_selection.tsx | 2 +- .../single_metric_view/metric_selection.tsx | 2 +- .../components/split_field/by_field.tsx | 2 +- .../components/split_field/split_field.tsx | 2 +- .../summary_count_field.tsx | 2 +- .../jobs/new_job/pages/new_job/page.tsx | 2 +- .../jobs/new_job/pages/new_job/wizard.tsx | 2 +- .../analytics_job_creation.tsx | 8 +- .../routing/routes/new_job/wizard.tsx | 8 +- .../nested_field_index_response.json | 611 ++++++++++++++++++ .../ml_api_service/data_frame_analytics.ts | 9 + .../services/new_job_capabilities/index.ts | 8 + .../load_new_job_capabilities.ts | 49 ++ .../new_job_capabilities._service.test.ts | 6 +- .../new_job_capabilities.ts | 65 ++ .../new_job_capabilities_service.ts | 95 +-- .../new_job_capabilities_service_analytics.ts | 66 ++ .../remove_nested_field_children.test.ts | 33 + .../job_service/new_job_caps/field_service.ts | 11 +- .../job_service/new_job_caps/new_job_caps.ts | 6 +- x-pack/plugins/ml/server/routes/apidoc.json | 1 + .../ml/server/routes/data_frame_analytics.ts | 68 ++ .../routes/schemas/data_analytics_schema.ts | 6 + 38 files changed, 1044 insertions(+), 191 deletions(-) create mode 100644 x-pack/plugins/ml/public/application/services/__mocks__/nested_field_index_response.json create mode 100644 x-pack/plugins/ml/public/application/services/new_job_capabilities/index.ts create mode 100644 x-pack/plugins/ml/public/application/services/new_job_capabilities/load_new_job_capabilities.ts rename x-pack/plugins/ml/public/application/services/{ => new_job_capabilities}/new_job_capabilities._service.test.ts (91%) create mode 100644 x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities.ts rename x-pack/plugins/ml/public/application/services/{ => new_job_capabilities}/new_job_capabilities_service.ts (64%) create mode 100644 x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities_service_analytics.ts create mode 100644 x-pack/plugins/ml/public/application/services/new_job_capabilities/remove_nested_field_children.test.ts diff --git a/x-pack/plugins/ml/common/types/fields.ts b/x-pack/plugins/ml/common/types/fields.ts index 45fcfac7e930c..cf017192353e9 100644 --- a/x-pack/plugins/ml/common/types/fields.ts +++ b/x-pack/plugins/ml/common/types/fields.ts @@ -50,6 +50,10 @@ export interface NewJobCaps { aggs: Aggregation[]; } +export interface NewJobCapsResponse { + [indexPattern: string]: NewJobCaps; +} + export interface AggFieldPair { agg: Aggregation; field: Field; diff --git a/x-pack/plugins/ml/public/application/components/data_grid/common.ts b/x-pack/plugins/ml/public/application/components/data_grid/common.ts index f723c1d72b818..b897ca3dccc51 100644 --- a/x-pack/plugins/ml/public/application/components/data_grid/common.ts +++ b/x-pack/plugins/ml/public/application/components/data_grid/common.ts @@ -103,7 +103,7 @@ export function getCombinedRuntimeMappings( ): RuntimeMappings | undefined { let combinedRuntimeMappings = {}; - // And runtime field mappings defined by index pattern + // Add runtime field mappings defined by index pattern if (indexPattern) { const computedFields = indexPattern?.getComputedFields(); if (computedFields?.runtimeFields !== undefined) { @@ -147,6 +147,7 @@ export const getDataGridSchemasFromFieldTypes = (fieldTypes: FieldTypes, results case 'date': schema = 'datetime'; break; + case 'nested': case 'geo_point': schema = 'json'; break; @@ -238,6 +239,9 @@ export const getDataGridSchemaFromKibanaFieldType = ( case KBN_FIELD_TYPES.NUMBER: schema = 'numeric'; break; + case KBN_FIELD_TYPES.NESTED: + schema = 'json'; + break; } if (schema === undefined && field?.aggregatable === false) { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/common/fields.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/common/fields.ts index e62f7dfdf3a91..fee610797577f 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/common/fields.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/common/fields.ts @@ -16,7 +16,7 @@ import { isRegressionAnalysis, } from '../../../../common/util/analytics_utils'; import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; -import { newJobCapsService } from '../../services/new_job_capabilities_service'; +import { newJobCapsServiceAnalytics } from '../../services/new_job_capabilities/new_job_capabilities_service_analytics'; import { FEATURE_IMPORTANCE, FEATURE_INFLUENCE, OUTLIER_SCORE, TOP_CLASSES } from './constants'; import { DataFrameAnalyticsConfig } from '../../../../common/types/data_frame_analytics'; @@ -54,18 +54,18 @@ export const ML__ID_COPY = 'ml__id_copy'; export const ML__INCREMENTAL_ID = 'ml__incremental_id'; export const isKeywordAndTextType = (fieldName: string): boolean => { - const { fields } = newJobCapsService; + const { fields } = newJobCapsServiceAnalytics; const fieldType = fields.find((field) => field.name === fieldName)?.type; let isBothTypes = false; // If it's a keyword type - check if it has a corresponding text type if (fieldType !== undefined && fieldType === ES_FIELD_TYPES.KEYWORD) { - const field = newJobCapsService.getFieldById(fieldName.replace(/\.keyword$/, '')); + const field = newJobCapsServiceAnalytics.getFieldById(fieldName.replace(/\.keyword$/, '')); isBothTypes = field !== null && field.type === ES_FIELD_TYPES.TEXT; } else if (fieldType !== undefined && fieldType === ES_FIELD_TYPES.TEXT) { // If text, check if has corresponding keyword type - const field = newJobCapsService.getFieldById(`${fieldName}.keyword`); + const field = newJobCapsServiceAnalytics.getFieldById(`${fieldName}.keyword`); isBothTypes = field !== null && field.type === ES_FIELD_TYPES.KEYWORD; } @@ -180,24 +180,22 @@ export const getDefaultFieldsFromJobCaps = ( // default is 'ml' const resultsField = jobConfig.dest.results_field; - const featureImportanceFields = []; - const topClassesFields = []; const allFields: any = []; let type: ES_FIELD_TYPES | undefined; let predictedField: string | undefined; if (isOutlierAnalysis(jobConfig.analysis)) { - if (jobConfig.analysis.outlier_detection.compute_feature_influence) { - featureImportanceFields.push({ - id: `${resultsField}.${FEATURE_INFLUENCE}`, - name: `${resultsField}.${FEATURE_INFLUENCE}`, - type: KBN_FIELD_TYPES.UNKNOWN, - }); + if (!jobConfig.analysis.outlier_detection.compute_feature_influence) { + // remove all feature influence fields + fields = fields.filter( + (field) => !field.name.includes(`${resultsField}.${FEATURE_INFLUENCE}`) + ); + } else { + // remove flattened feature influence fields + fields = fields.filter( + (field: any) => !field.name.includes(`${resultsField}.${FEATURE_INFLUENCE}.`) + ); } - // remove flattened feature influence fields - fields = fields.filter( - (field) => !field.name.includes(`${resultsField}.${FEATURE_INFLUENCE}.`) - ); // Only need to add these fields if we didn't use dest index pattern to get the fields if (needsDestIndexFields === true) { @@ -211,7 +209,7 @@ export const getDefaultFieldsFromJobCaps = ( if (isClassificationAnalysis(jobConfig.analysis) || isRegressionAnalysis(jobConfig.analysis)) { const dependentVariable = getDependentVar(jobConfig.analysis); - type = newJobCapsService.getFieldById(dependentVariable)?.type; + type = newJobCapsServiceAnalytics.getFieldById(dependentVariable)?.type; const predictionFieldName = getPredictionFieldName(jobConfig.analysis); const numTopFeatureImportanceValues = getNumTopFeatureImportanceValues(jobConfig.analysis); const numTopClasses = getNumTopClasses(jobConfig.analysis); @@ -221,24 +219,24 @@ export const getDefaultFieldsFromJobCaps = ( predictionFieldName ? predictionFieldName : defaultPredictionField }`; - if ((numTopFeatureImportanceValues ?? 0) > 0) { - featureImportanceFields.push({ - id: `${resultsField}.${FEATURE_IMPORTANCE}`, - name: `${resultsField}.${FEATURE_IMPORTANCE}`, - type: KBN_FIELD_TYPES.UNKNOWN, - }); + if ((numTopFeatureImportanceValues ?? 0) === 0) { + // remove all feature importance fields + fields = fields.filter( + (field: any) => !field.name.includes(`${resultsField}.${FEATURE_IMPORTANCE}`) + ); + } else { // remove flattened feature importance fields fields = fields.filter( (field: any) => !field.name.includes(`${resultsField}.${FEATURE_IMPORTANCE}.`) ); } - if ((numTopClasses ?? 0) > 0) { - topClassesFields.push({ - id: `${resultsField}.${TOP_CLASSES}`, - name: `${resultsField}.${TOP_CLASSES}`, - type: KBN_FIELD_TYPES.UNKNOWN, - }); + if ((numTopClasses ?? 0) === 0) { + // remove all top classes fields + fields = fields.filter( + (field: any) => !field.name.includes(`${resultsField}.${TOP_CLASSES}`) + ); + } else { // remove flattened top classes fields fields = fields.filter( (field: any) => !field.name.includes(`${resultsField}.${TOP_CLASSES}.`) @@ -258,7 +256,7 @@ export const getDefaultFieldsFromJobCaps = ( } } - allFields.push(...fields, ...featureImportanceFields, ...topClassesFields); + allFields.push(...fields); allFields.sort(({ name: a }: { name: string }, { name: b }: { name: string }) => sortExplorationResultsFields(a, b, jobConfig) ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/common/get_index_fields.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/common/get_index_fields.ts index b3ad553c9aad2..58146474815c4 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/common/get_index_fields.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/common/get_index_fields.ts @@ -7,7 +7,7 @@ import { ES_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; -import { newJobCapsService } from '../../services/new_job_capabilities_service'; +import { newJobCapsServiceAnalytics } from '../../services/new_job_capabilities/new_job_capabilities_service_analytics'; import { getDefaultFieldsFromJobCaps, DataFrameAnalyticsConfig } from '../common'; @@ -19,7 +19,7 @@ export const getIndexFields = ( jobConfig: DataFrameAnalyticsConfig | undefined, needsDestIndexFields: boolean ) => { - const { fields } = newJobCapsService; + const { fields } = newJobCapsServiceAnalytics; if (jobConfig !== undefined) { const { selectedFields: defaultSelected, docFields } = getDefaultFieldsFromJobCaps( fields, diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/common/use_results_view_config.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/common/use_results_view_config.ts index 730b3b632398f..e1f0db4e9291c 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/common/use_results_view_config.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/common/use_results_view_config.ts @@ -15,7 +15,7 @@ import { extractErrorMessage } from '../../../../common/util/errors'; import { getIndexPatternIdFromName } from '../../util/index_utils'; import { ml } from '../../services/ml_api_service'; -import { newJobCapsService } from '../../services/new_job_capabilities_service'; +import { newJobCapsServiceAnalytics } from '../../services/new_job_capabilities/new_job_capabilities_service_analytics'; import { useMlContext } from '../../contexts/ml'; import { DataFrameAnalyticsConfig } from '../common'; @@ -125,7 +125,7 @@ export const useResultsViewConfig = (jobId: string) => { } if (indexP !== undefined) { - await newJobCapsService.initializeFromIndexPattern(indexP, false, false); + await newJobCapsServiceAnalytics.initializeFromIndexPattern(indexP); setJobConfig(analyticsConfigs.data_frame_analytics[0]); setIndexPattern(indexP); setIsInitialized(true); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx index 1046f1a8c3e92..810f59d904696 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx @@ -19,7 +19,7 @@ import { import { i18n } from '@kbn/i18n'; import { debounce, cloneDeep } from 'lodash'; -import { newJobCapsService } from '../../../../../services/new_job_capabilities_service'; +import { newJobCapsServiceAnalytics } from '../../../../../services/new_job_capabilities/new_job_capabilities_service_analytics'; import { useMlContext } from '../../../../../contexts/ml'; import { getCombinedRuntimeMappings } from '../../../../../components/data_grid/common'; @@ -196,7 +196,7 @@ export const ConfigurationStepForm: FC = ({ const depVarOptions = []; let depVarUpdate = formState.dependentVariable; // Get fields and filter for supported types for job type - const { fields } = newJobCapsService; + const { fields } = newJobCapsServiceAnalytics; let resetDependentVariable = true; for (const field of fields) { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx index 24e1e01b52124..eae1d240be8af 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx @@ -16,7 +16,7 @@ import { OMIT_FIELDS } from '../../../../../../../common/constants/field_types'; import { BASIC_NUMERICAL_TYPES, EXTENDED_NUMERICAL_TYPES } from '../../../../common/fields'; import { CATEGORICAL_TYPES } from './form_options_validation'; import { ES_FIELD_TYPES } from '../../../../../../../../../../src/plugins/data/public'; -import { newJobCapsService } from '../../../../../services/new_job_capabilities_service'; +import { newJobCapsServiceAnalytics } from '../../../../../services/new_job_capabilities/new_job_capabilities_service_analytics'; import { DataFrameAnalysisConfigType } from '../../../../../../../common/types/data_frame_analytics'; const containsClassificationFieldsCb = ({ name, type }: Field) => @@ -32,7 +32,9 @@ const containsRegressionFieldsCb = ({ name, type }: Field) => (BASIC_NUMERICAL_TYPES.has(type) || EXTENDED_NUMERICAL_TYPES.has(type)); const containsOutlierFieldsCb = ({ name, type }: Field) => - !OMIT_FIELDS.includes(name) && name !== EVENT_RATE_FIELD_ID && BASIC_NUMERICAL_TYPES.has(type); + !OMIT_FIELDS.includes(name) && + name !== EVENT_RATE_FIELD_ID && + (BASIC_NUMERICAL_TYPES.has(type) || EXTENDED_NUMERICAL_TYPES.has(type)); const callbacks: Record boolean> = { [ANALYSIS_CONFIG_TYPE.CLASSIFICATION]: containsClassificationFieldsCb, @@ -71,7 +73,7 @@ export const SupportedFieldsMessage: FC = ({ jobType }) => { setSourceIndexContainsSupportedFields, ] = useState(true); const [sourceIndexFieldsCheckFailed, setSourceIndexFieldsCheckFailed] = useState(false); - const { fields } = newJobCapsService; + const { fields } = newJobCapsServiceAnalytics; // Find out if index pattern contains supported fields for job type. Provides a hint in the form // that job may not run correctly if no supported fields are found. @@ -90,8 +92,6 @@ export const SupportedFieldsMessage: FC = ({ jobType }) => { useEffect(() => { if (jobType !== undefined) { - setSourceIndexContainsSupportedFields(true); - setSourceIndexFieldsCheckFailed(false); validateFields(); } }, [jobType]); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts index 2d9ae1cd4689b..2ae75083bff43 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts @@ -15,6 +15,7 @@ import { IndexPattern } from '../../../../../../../../../src/plugins/data/public import { isRuntimeMappings } from '../../../../../../common/util/runtime_field_utils'; import { RuntimeMappings } from '../../../../../../common/types/fields'; import { DEFAULT_SAMPLER_SHARD_SIZE } from '../../../../../../common/constants/field_histograms'; +import { newJobCapsServiceAnalytics } from '../../../../services/new_job_capabilities/new_job_capabilities_service_analytics'; import { DataLoader } from '../../../../datavisualizer/index_based/data_loader'; @@ -49,6 +50,41 @@ function getRuntimeFieldColumns(runtimeMappings: RuntimeMappings) { }); } +function getInitialColumns(indexPattern: IndexPattern) { + const { fields } = newJobCapsServiceAnalytics; + const columns = fields.map((field: any) => { + const schema = + getDataGridSchemaFromESFieldType(field.type) || getDataGridSchemaFromKibanaFieldType(field); + + return { + id: field.name, + schema, + isExpandable: schema !== 'boolean', + isRuntimeFieldColumn: false, + }; + }); + + // Add runtime fields defined in index pattern to columns + if (indexPattern) { + const computedFields = indexPattern?.getComputedFields(); + + if (isRuntimeMappings(computedFields.runtimeFields)) { + Object.keys(computedFields.runtimeFields).forEach((runtimeField) => { + const schema = getDataGridSchemaFromESFieldType( + computedFields.runtimeFields[runtimeField].type + ); + columns.push({ + id: runtimeField, + schema, + isExpandable: schema !== 'boolean', + isRuntimeFieldColumn: true, + }); + }); + } + } + return columns; +} + export const useIndexData = ( indexPattern: IndexPattern, query: Record | undefined, @@ -58,23 +94,7 @@ export const useIndexData = ( const indexPatternFields = useMemo(() => getFieldsFromKibanaIndexPattern(indexPattern), [ indexPattern, ]); - - const [columns, setColumns] = useState([ - ...indexPatternFields.map((id) => { - const field = indexPattern.fields.getByName(id); - const isRuntimeFieldColumn = field?.runtimeField !== undefined; - const schema = isRuntimeFieldColumn - ? getDataGridSchemaFromESFieldType(field?.type as estypes.RuntimeField['type']) - : getDataGridSchemaFromKibanaFieldType(field); - return { - id, - schema, - isExpandable: schema !== 'boolean', - isRuntimeFieldColumn, - }; - }), - ]); - + const [columns, setColumns] = useState(getInitialColumns(indexPattern)); const dataGrid = useDataGrid(columns); const { @@ -131,18 +151,7 @@ export const useIndexData = ( ...(combinedRuntimeMappings ? getRuntimeFieldColumns(combinedRuntimeMappings) : []), ]); } else { - setColumns([ - ...indexPatternFields.map((id) => { - const field = indexPattern.fields.getByName(id); - const schema = getDataGridSchemaFromKibanaFieldType(field); - return { - id, - schema, - isExpandable: schema !== 'boolean', - isRuntimeFieldColumn: field?.runtimeField !== undefined, - }; - }), - ]); + setColumns(getInitialColumns(indexPattern)); } setRowCount(typeof resp.hits.total === 'number' ? resp.hits.total : resp.hits.total.value); setRowCountRelation( diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/general.ts b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/general.ts index 9ae8585933ca8..3f306f9bcc996 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/general.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/general.ts @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import { Job, Datafeed, Detector } from '../../../../../../../common/types/anomaly_detection_jobs'; -import { newJobCapsService } from '../../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { NavigateToPath } from '../../../../../contexts/kibana'; import { ML_JOB_AGGREGATION, diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx index ad0f7ee072f09..a25e3b8097bd9 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx @@ -9,7 +9,7 @@ import React, { FC, useContext, useEffect, useState } from 'react'; import { TimeFieldSelect } from './time_field_select'; import { JobCreatorContext } from '../../../job_creator_context'; -import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { AdvancedJobCreator } from '../../../../../common/job_creator'; import { Description } from './description'; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx index 8f477043b3908..b4508af7803dd 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx @@ -9,7 +9,7 @@ import React, { Fragment, FC, useContext, useState } from 'react'; import { JobCreatorContext } from '../../../job_creator_context'; import { AdvancedJobCreator } from '../../../../../common/job_creator'; -import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { Aggregation, Field } from '../../../../../../../../../common/types/fields'; import { MetricSelector } from './metric_selector'; import { RichDetector } from '../../../../../common/job_creator/advanced_job_creator'; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx index 18b10320b7e2f..6a441a909692b 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx @@ -9,7 +9,7 @@ import React, { FC, useContext, useEffect, useState } from 'react'; import { CategorizationFieldSelect } from './categorization_field_select'; import { JobCreatorContext } from '../../../job_creator_context'; -import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { AdvancedJobCreator, CategorizationJobCreator, diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_dropdown.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_dropdown.tsx index 7ea7d09d06b34..b404d8238fd5f 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_dropdown.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_partition_field/categorization_per_partition_dropdown.tsx @@ -10,7 +10,7 @@ import { EuiFormRow } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { JobCreatorContext } from '../../../job_creator_context'; import { CategorizationJobCreator } from '../../../../../common/job_creator'; -import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { CategorizationPerPartitionFieldSelect } from './categorization_per_partition_input'; export const CategorizationPerPartitionFieldDropdown = ({ diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx index 091864cf330ef..5050a4f3be8ea 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx @@ -9,7 +9,7 @@ import React, { FC, useContext, useEffect, useState } from 'react'; import { InfluencersSelect } from './influencers_select'; import { JobCreatorContext } from '../../../job_creator_context'; -import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { MultiMetricJobCreator, PopulationJobCreator, diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx index 0515496469030..6cbf96fcb04e8 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx @@ -11,7 +11,7 @@ import { JobCreatorContext } from '../../../job_creator_context'; import { MultiMetricJobCreator } from '../../../../../common/job_creator'; import { LineChartData } from '../../../../../common/chart_loader'; import { DropDownLabel, DropDownProps } from '../agg_select'; -import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { AggFieldPair } from '../../../../../../../../../common/types/fields'; import { sortFields } from '../../../../../../../../../common/util/fields_utils'; import { getChartSettings, defaultChartSettings } from '../../../charts/common/settings'; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx index 7f5a06925c7e8..c5efd4b226d5c 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx @@ -12,7 +12,7 @@ import { JobCreatorContext } from '../../../job_creator_context'; import { PopulationJobCreator } from '../../../../../common/job_creator'; import { LineChartData } from '../../../../../common/chart_loader'; import { DropDownLabel, DropDownProps } from '../agg_select'; -import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { Field, AggFieldPair } from '../../../../../../../../../common/types/fields'; import { sortFields } from '../../../../../../../../../common/util/fields_utils'; import { getChartSettings, defaultChartSettings } from '../../../charts/common/settings'; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx index c5c5cd4d8b744..b2a97d8e0589a 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx @@ -10,7 +10,7 @@ import { JobCreatorContext } from '../../../job_creator_context'; import { SingleMetricJobCreator } from '../../../../../common/job_creator'; import { LineChartData } from '../../../../../common/chart_loader'; import { AggSelect, DropDownLabel, DropDownProps, createLabel } from '../agg_select'; -import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { AggFieldPair } from '../../../../../../../../../common/types/fields'; import { sortFields } from '../../../../../../../../../common/util/fields_utils'; import { AnomalyChart, CHART_TYPE } from '../../../charts/anomaly_chart'; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/by_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/by_field.tsx index 01c538f7ceb01..b197b950bbe28 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/by_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/by_field.tsx @@ -14,7 +14,7 @@ import { Field } from '../../../../../../../../../common/types/fields'; import { newJobCapsService, filterCategoryFields, -} from '../../../../../../../services/new_job_capabilities_service'; +} from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { MultiMetricJobCreator, PopulationJobCreator } from '../../../../../common/job_creator'; interface Props { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx index 7a99d4da13185..9837fe924fb01 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx @@ -12,7 +12,7 @@ import { JobCreatorContext } from '../../../job_creator_context'; import { newJobCapsService, filterCategoryFields, -} from '../../../../../../../services/new_job_capabilities_service'; +} from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { Description } from './description'; import { MultiMetricJobCreator, diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx index 39ec89f8424fc..3345b60ddd4d9 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx @@ -9,7 +9,7 @@ import React, { FC, useContext, useEffect, useState } from 'react'; import { SummaryCountFieldSelect } from './summary_count_field_select'; import { JobCreatorContext } from '../../../job_creator_context'; -import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../../../../services/new_job_capabilities/new_job_capabilities_service'; import { MultiMetricJobCreator, PopulationJobCreator, diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/page.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/page.tsx index 3a01ce8c70fc8..442bdba717f28 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/page.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/page.tsx @@ -37,7 +37,7 @@ import { useMlContext } from '../../../../contexts/ml'; import { getTimeFilterRange } from '../../../../components/full_time_range_selector'; import { getTimeBucketsFromCache } from '../../../../util/time_buckets'; import { ExistingJobsAndGroups, mlJobService } from '../../../../services/job_service'; -import { newJobCapsService } from '../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../services/new_job_capabilities/new_job_capabilities_service'; import { EVENT_RATE_FIELD_ID } from '../../../../../../common/types/fields'; import { getNewJobDefaults } from '../../../../services/ml_server_info'; import { useToastNotificationService } from '../../../../services/toast_notification_service'; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard.tsx index 5764e0fee511b..06d532e4bd793 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard.tsx @@ -19,7 +19,7 @@ import { JobCreatorType } from '../../common/job_creator'; import { ChartLoader } from '../../common/chart_loader'; import { ResultsLoader } from '../../common/results_loader'; import { JobValidator } from '../../common/job_validator'; -import { newJobCapsService } from '../../../../services/new_job_capabilities_service'; +import { newJobCapsService } from '../../../../services/new_job_capabilities/new_job_capabilities_service'; import { WizardSteps } from './wizard_steps'; import { WizardHorizontalSteps } from './wizard_horizontal_steps'; import { JOB_TYPE } from '../../../../../../common/constants/new_job'; diff --git a/x-pack/plugins/ml/public/application/routing/routes/data_frame_analytics/analytics_job_creation.tsx b/x-pack/plugins/ml/public/application/routing/routes/data_frame_analytics/analytics_job_creation.tsx index 7c011952edd68..ab57c264683ca 100644 --- a/x-pack/plugins/ml/public/application/routing/routes/data_frame_analytics/analytics_job_creation.tsx +++ b/x-pack/plugins/ml/public/application/routing/routes/data_frame_analytics/analytics_job_creation.tsx @@ -17,7 +17,10 @@ import { useResolver } from '../../use_resolver'; import { basicResolvers } from '../../resolvers'; import { Page } from '../../../data_frame_analytics/pages/analytics_creation'; import { breadcrumbOnClickFactory, getBreadcrumbWithUrlForApp } from '../../breadcrumbs'; -import { loadNewJobCapabilities } from '../../../services/new_job_capabilities_service'; +import { + loadNewJobCapabilities, + DATA_FRAME_ANALYTICS, +} from '../../../services/new_job_capabilities/load_new_job_capabilities'; export const analyticsJobsCreationRouteFactory = ( navigateToPath: NavigateToPath, @@ -43,7 +46,8 @@ const PageWrapper: FC = ({ location, deps }) => { const { context } = useResolver(index, savedSearchId, deps.config, { ...basicResolvers(deps), - jobCaps: () => loadNewJobCapabilities(index, savedSearchId, deps.indexPatterns), + analyticsFields: () => + loadNewJobCapabilities(index, savedSearchId, deps.indexPatterns, DATA_FRAME_ANALYTICS), }); return ( diff --git a/x-pack/plugins/ml/public/application/routing/routes/new_job/wizard.tsx b/x-pack/plugins/ml/public/application/routing/routes/new_job/wizard.tsx index 00f3e85343553..726ec328d1cb2 100644 --- a/x-pack/plugins/ml/public/application/routing/routes/new_job/wizard.tsx +++ b/x-pack/plugins/ml/public/application/routing/routes/new_job/wizard.tsx @@ -17,7 +17,10 @@ import { useResolver } from '../../use_resolver'; import { Page } from '../../../jobs/new_job/pages/new_job'; import { JOB_TYPE } from '../../../../../common/constants/new_job'; import { mlJobService } from '../../../services/job_service'; -import { loadNewJobCapabilities } from '../../../services/new_job_capabilities_service'; +import { + loadNewJobCapabilities, + ANOMALY_DETECTOR, +} from '../../../services/new_job_capabilities/load_new_job_capabilities'; import { checkCreateJobsCapabilitiesResolver } from '../../../capabilities/check_capabilities'; import { getBreadcrumbWithUrlForApp } from '../../breadcrumbs'; import { useCreateAndNavigateToMlLink } from '../../../contexts/kibana/use_create_url'; @@ -137,7 +140,8 @@ const PageWrapper: FC = ({ location, jobType, deps }) => { const { context, results } = useResolver(index, savedSearchId, deps.config, { ...basicResolvers(deps), privileges: () => checkCreateJobsCapabilitiesResolver(redirectToJobsManagementPage), - jobCaps: () => loadNewJobCapabilities(index, savedSearchId, deps.indexPatterns), + jobCaps: () => + loadNewJobCapabilities(index, savedSearchId, deps.indexPatterns, ANOMALY_DETECTOR), existingJobsAndGroups: mlJobService.getJobAndGroupIds, }); diff --git a/x-pack/plugins/ml/public/application/services/__mocks__/nested_field_index_response.json b/x-pack/plugins/ml/public/application/services/__mocks__/nested_field_index_response.json new file mode 100644 index 0000000000000..49baa9fb7e427 --- /dev/null +++ b/x-pack/plugins/ml/public/application/services/__mocks__/nested_field_index_response.json @@ -0,0 +1,611 @@ +{ + "nested-field-index":{ + "aggs":[ + { + "id":"count", + "title":"Count", + "kibanaName":"count", + "dslName":"count", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + } + }, + { + "id":"high_count", + "title":"High count", + "kibanaName":"count", + "dslName":"count", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + } + }, + { + "id":"low_count", + "title":"Low count", + "kibanaName":"count", + "dslName":"count", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + } + }, + { + "id":"mean", + "title":"Mean", + "kibanaName":"avg", + "dslName":"avg", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"avg", + "min":"avg" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"high_mean", + "title":"High mean", + "kibanaName":"avg", + "dslName":"avg", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"avg", + "min":"avg" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"low_mean", + "title":"Low mean", + "kibanaName":"avg", + "dslName":"avg", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"avg", + "min":"avg" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"sum", + "title":"Sum", + "kibanaName":"sum", + "dslName":"sum", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"sum", + "min":"sum" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"high_sum", + "title":"High sum", + "kibanaName":"sum", + "dslName":"sum", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"sum", + "min":"sum" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"low_sum", + "title":"Low sum", + "kibanaName":"sum", + "dslName":"sum", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"sum", + "min":"sum" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"median", + "title":"Median", + "kibanaName":"median", + "dslName":"percentiles", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds": [ + "time_spent" + ] + }, + { + "id":"high_median", + "title":"High median", + "kibanaName":"median", + "dslName":"percentiles", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"low_median", + "title":"Low median", + "kibanaName":"median", + "dslName":"percentiles", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"min", + "title":"Min", + "kibanaName":"min", + "dslName":"min", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"min", + "min":"min" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"max", + "title":"Max", + "kibanaName":"max", + "dslName":"max", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"max" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"distinct_count", + "title":"Distinct count", + "kibanaName":"cardinality", + "dslName":"cardinality", + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "group.keyword", + "user.first.keyword", + "user.last.keyword", + "time_spent" + ] + }, + { + "id":"non_zero_count", + "title":"Non zero count", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + } + }, + { + "id":"high_non_zero_count", + "title":"High non zero count", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + } + }, + { + "id":"low_non_zero_count", + "title":"Low non zero count", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + } + }, + { + "id":"high_distinct_count", + "title":"High distinct count", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "group.keyword", + "user.first.keyword", + "user.last.keyword", + "time_spent" + ] + }, + { + "id":"low_distinct_count", + "title":"Low distinct count", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "group.keyword", + "user.first.keyword", + "user.last.keyword", + "time_spent" + ] + }, + { + "id":"metric", + "title":"Metric", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"varp", + "title":"varp", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"high_varp", + "title":"High varp", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"low_varp", + "title":"Low varp", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"non_null_sum", + "title":"Non null sum", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"high_non_null_sum", + "title":"High non null sum", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"low_non_null_sum", + "title":"Low non null sum", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "time_spent" + ] + }, + { + "id":"rare", + "title":"Rare", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + } + }, + { + "id":"freq_rare", + "title":"Freq rare", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + } + }, + { + "id":"info_content", + "title":"Info content", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "group", + "user.first", + "user.last", + "group.keyword", + "user.first.keyword", + "user.last.keyword", + "time_spent" + ] + }, + { + "id":"high_info_content", + "title":"High info content", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "group", + "user.first", + "user.last", + "group.keyword", + "usr.first.keyword", + "user.last.keyword", + "time_spent" + ] + }, + { + "id":"low_info_content", + "title":"Low info content", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + "group", + "user.first", + "user.last", + "group.keyword", + "user.first.keyword", + "user.last.keyword", + "time_spent" + ] + }, + { + "id":"time_of_day", + "title":"Time of day", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + } + }, + { + "id":"time_of_week", + "title":"Time of week", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + } + }, + { + "id":"lat_long", + "title":"Lat long", + "kibanaName":null, + "dslName":null, + "type":"metrics", + "mlModelPlotAgg":{ + "max":"max", + "min":"min" + }, + "fieldIds":[ + + ] + } + ], + "fields":[ + { + "id":"group", + "name":"group", + "type":"text", + "aggregatable":false, + "aggIds":[ + "info_content", + "high_info_content", + "low_info_content" + ] + }, + { + "id":"group.keyword", + "name":"group.keyword", + "type":"keyword", + "aggregatable":true, + "aggIds":[ + "distinct_count", + "high_distinct_count", + "low_distinct_count", + "info_content", + "high_info_content", + "low_info_content" + ] + }, + { + "id":"time_spent", + "name":"time_spent", + "type":"long", + "aggregatable":true, + "aggIds":[ + "mean", + "high_mean", + "low_mean", + "sum", + "high_sum", + "low_sum", + "median", + "high_median", + "low_median", + "min", + "max", + "distinct_count", + "high_distinct_count", + "low_distinct_count", + "metric", + "varp", + "high_varp", + "low_varp", + "non_null_sum", + "high_non_null_sum", + "low_non_null_sum", + "info_content", + "high_info_content", + "low_info_content" + ] + }, + { + "id":"user", + "name":"user", + "type":"nested", + "aggregatable":false, + "aggIds":[ + + ] + }, + { + "id":"user.first", + "name":"user.first", + "type":"text", + "aggregatable":false, + "aggIds":[ + "info_content", + "high_info_content", + "low_info_content" + ] + }, + { + "id":"user.first.keyword", + "name":"user.first.keyword", + "type":"keyword", + "aggregatable":true, + "aggIds":[ + "distinct_count", + "high_distinct_count", + "low_distinct_count", + "info_content", + "high_info_content", + "low_info_content" + ] + }, + { + "id":"user.last", + "name":"user.last", + "type":"text", + "aggregatable":false, + "aggIds":[ + "info_content", + "high_info_content", + "low_info_content" + ] + }, + { + "id":"user.last.keyword", + "name":"user.last.keyword", + "type":"keyword", + "aggregatable":true, + "aggIds":[ + "distinct_count", + "high_distinct_count", + "low_distinct_count", + "info_content", + "high_info_content", + "low_info_content" + ] + } + ] + } +} diff --git a/x-pack/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.ts b/x-pack/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.ts index 8fe34932ffa88..39662cfedd901 100644 --- a/x-pack/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.ts +++ b/x-pack/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.ts @@ -15,6 +15,7 @@ import { UpdateDataFrameAnalyticsConfig, } from '../../data_frame_analytics/common'; import { DeepPartial } from '../../../../common/types/common'; +import { NewJobCapsResponse } from '../../../../common/types/fields'; import { DeleteDataFrameAnalyticsWithIndexStatus, AnalyticsMapReturnType, @@ -175,4 +176,12 @@ export const dataFrameAnalytics = { body, }); }, + newJobCapsAnalytics(indexPatternTitle: string, isRollup: boolean = false) { + const query = isRollup === true ? { rollup: true } : {}; + return http({ + path: `${basePath()}/data_frame/analytics/new_job_caps/${indexPatternTitle}`, + method: 'GET', + query, + }); + }, }; diff --git a/x-pack/plugins/ml/public/application/services/new_job_capabilities/index.ts b/x-pack/plugins/ml/public/application/services/new_job_capabilities/index.ts new file mode 100644 index 0000000000000..d4d01143b8a69 --- /dev/null +++ b/x-pack/plugins/ml/public/application/services/new_job_capabilities/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { NewJobCapabilitiesServiceBase, processTextAndKeywordFields } from './new_job_capabilities'; diff --git a/x-pack/plugins/ml/public/application/services/new_job_capabilities/load_new_job_capabilities.ts b/x-pack/plugins/ml/public/application/services/new_job_capabilities/load_new_job_capabilities.ts new file mode 100644 index 0000000000000..a998343535249 --- /dev/null +++ b/x-pack/plugins/ml/public/application/services/new_job_capabilities/load_new_job_capabilities.ts @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { IIndexPattern, IndexPatternsContract } from '../../../../../../../src/plugins/data/public'; +import { getIndexPatternAndSavedSearch } from '../../util/index_utils'; +import { JobType } from '../../../../common/types/saved_objects'; +import { newJobCapsServiceAnalytics } from '../new_job_capabilities/new_job_capabilities_service_analytics'; +import { newJobCapsService } from '../new_job_capabilities/new_job_capabilities_service'; + +export const ANOMALY_DETECTOR = 'anomaly-detector'; +export const DATA_FRAME_ANALYTICS = 'data-frame-analytics'; + +// called in the routing resolve block to initialize the NewJobCapabilites +// service for the corresponding job type with the currently selected index pattern +export function loadNewJobCapabilities( + indexPatternId: string, + savedSearchId: string, + indexPatterns: IndexPatternsContract, + jobType: JobType +) { + return new Promise(async (resolve, reject) => { + const serviceToUse = + jobType === ANOMALY_DETECTOR ? newJobCapsService : newJobCapsServiceAnalytics; + if (indexPatternId !== undefined) { + // index pattern is being used + const indexPattern: IIndexPattern = await indexPatterns.get(indexPatternId); + await serviceToUse.initializeFromIndexPattern(indexPattern); + resolve(serviceToUse.newJobCaps); + } else if (savedSearchId !== undefined) { + // saved search is being used + // load the index pattern from the saved search + const { indexPattern } = await getIndexPatternAndSavedSearch(savedSearchId); + if (indexPattern === null) { + // eslint-disable-next-line no-console + console.error('Cannot retrieve index pattern from saved search'); + reject(); + return; + } + await serviceToUse.initializeFromIndexPattern(indexPattern); + resolve(serviceToUse.newJobCaps); + } else { + reject(); + } + }); +} diff --git a/x-pack/plugins/ml/public/application/services/new_job_capabilities._service.test.ts b/x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities._service.test.ts similarity index 91% rename from x-pack/plugins/ml/public/application/services/new_job_capabilities._service.test.ts rename to x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities._service.test.ts index 217344366b67a..4c0ee7b67a994 100644 --- a/x-pack/plugins/ml/public/application/services/new_job_capabilities._service.test.ts +++ b/x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities._service.test.ts @@ -6,13 +6,13 @@ */ import { newJobCapsService } from './new_job_capabilities_service'; -import { IndexPattern } from '../../../../../../src/plugins/data/public'; +import { IndexPattern } from '../../../../../../../src/plugins/data/public'; // there is magic happening here. starting the include name with `mock..` // ensures it can be lazily loaded by the jest.mock function below. -import mockCloudwatchResponse from './__mocks__/cloudwatch_job_caps_response.json'; +import mockCloudwatchResponse from '../__mocks__/cloudwatch_job_caps_response.json'; -jest.mock('./ml_api_service', () => ({ +jest.mock('../ml_api_service', () => ({ ml: { jobs: { newJobCaps: jest.fn(() => Promise.resolve(mockCloudwatchResponse)), diff --git a/x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities.ts b/x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities.ts new file mode 100644 index 0000000000000..bbb9b141c7349 --- /dev/null +++ b/x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities.ts @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Aggregation, Field, NewJobCaps } from '../../../../common/types/fields'; +import { ES_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; + +// create two lists, one removing text fields if there are keyword equivalents and vice versa +export function processTextAndKeywordFields(fields: Field[]) { + const keywordIds = fields.filter((f) => f.type === ES_FIELD_TYPES.KEYWORD).map((f) => f.id); + const textIds = fields.filter((f) => f.type === ES_FIELD_TYPES.TEXT).map((f) => f.id); + + const fieldsPreferringKeyword = fields.filter( + (f) => + f.type !== ES_FIELD_TYPES.TEXT || + (f.type === ES_FIELD_TYPES.TEXT && keywordIds.includes(`${f.id}.keyword`) === false) + ); + + const fieldsPreferringText = fields.filter( + (f) => + f.type !== ES_FIELD_TYPES.KEYWORD || + (f.type === ES_FIELD_TYPES.KEYWORD && + textIds.includes(f.id.replace(/\.keyword$/, '')) === false) + ); + + return { fieldsPreferringKeyword, fieldsPreferringText }; +} + +export class NewJobCapabilitiesServiceBase { + protected _fields: Field[]; + protected _aggs: Aggregation[]; + + constructor() { + this._fields = []; + this._aggs = []; + } + + public get fields(): Field[] { + return this._fields; + } + + public get aggs(): Aggregation[] { + return this._aggs; + } + + public get newJobCaps(): NewJobCaps { + return { + fields: this._fields, + aggs: this._aggs, + }; + } + + public getFieldById(id: string): Field | null { + const field = this._fields.find((f) => f.id === id); + return field === undefined ? null : field; + } + + public getAggById(id: string): Aggregation | null { + const agg = this._aggs.find((f) => f.id === id); + return agg === undefined ? null : agg; + } +} diff --git a/x-pack/plugins/ml/public/application/services/new_job_capabilities_service.ts b/x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities_service.ts similarity index 64% rename from x-pack/plugins/ml/public/application/services/new_job_capabilities_service.ts rename to x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities_service.ts index b9520df4e710f..9324b3c0f0824 100644 --- a/x-pack/plugins/ml/public/application/services/new_job_capabilities_service.ts +++ b/x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities_service.ts @@ -4,68 +4,25 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - import { Field, Aggregation, AggId, FieldId, - NewJobCaps, EVENT_RATE_FIELD_ID, -} from '../../../common/types/fields'; -import { - ES_FIELD_TYPES, - IIndexPattern, - IndexPatternsContract, -} from '../../../../../../src/plugins/data/public'; -import { ml } from './ml_api_service'; -import { getIndexPatternAndSavedSearch } from '../util/index_utils'; - -// called in the routing resolve block to initialize the -// newJobCapsService with the currently selected index pattern -export function loadNewJobCapabilities( - indexPatternId: string, - savedSearchId: string, - indexPatterns: IndexPatternsContract -) { - return new Promise(async (resolve, reject) => { - if (indexPatternId !== undefined) { - // index pattern is being used - const indexPattern: IIndexPattern = await indexPatterns.get(indexPatternId); - await newJobCapsService.initializeFromIndexPattern(indexPattern); - resolve(newJobCapsService.newJobCaps); - } else if (savedSearchId !== undefined) { - // saved search is being used - // load the index pattern from the saved search - const { indexPattern } = await getIndexPatternAndSavedSearch(savedSearchId); - if (indexPattern === null) { - // eslint-disable-next-line no-console - console.error('Cannot retrieve index pattern from saved search'); - reject(); - return; - } - await newJobCapsService.initializeFromIndexPattern(indexPattern); - resolve(newJobCapsService.newJobCaps); - } else { - reject(); - } - }); -} +} from '../../../../common/types/fields'; +import { ES_FIELD_TYPES, IIndexPattern } from '../../../../../../../src/plugins/data/public'; +import { ml } from '../ml_api_service'; +import { processTextAndKeywordFields, NewJobCapabilitiesServiceBase } from './new_job_capabilities'; const categoryFieldTypes = [ES_FIELD_TYPES.TEXT, ES_FIELD_TYPES.KEYWORD, ES_FIELD_TYPES.IP]; -class NewJobCapsService { - private _fields: Field[] = []; +class NewJobCapsService extends NewJobCapabilitiesServiceBase { private _catFields: Field[] = []; private _dateFields: Field[] = []; - private _aggs: Aggregation[] = []; private _includeEventRateField: boolean = true; private _removeTextFields: boolean = true; - public get fields(): Field[] { - return this._fields; - } - public get catFields(): Field[] { return this._catFields; } @@ -74,17 +31,6 @@ class NewJobCapsService { return this._dateFields; } - public get aggs(): Aggregation[] { - return this._aggs; - } - - public get newJobCaps(): NewJobCaps { - return { - fields: this._fields, - aggs: this._aggs, - }; - } - public get categoryFields(): Field[] { return filterCategoryFields(this._fields); } @@ -126,16 +72,6 @@ class NewJobCapsService { console.error('Unable to load new job capabilities', error); // eslint-disable-line no-console } } - - public getFieldById(id: string): Field | null { - const field = this._fields.find((f) => f.id === id); - return field === undefined ? null : field; - } - - public getAggById(id: string): Aggregation | null { - const agg = this._aggs.find((f) => f.id === id); - return agg === undefined ? null : agg; - } } // using the response from the endpoint, create the field and aggs objects @@ -231,27 +167,6 @@ function addEventRateField(aggs: Aggregation[], fields: Field[]) { fields.splice(0, 0, eventRateField); } -// create two lists, one removing text fields if there are keyword equivalents and vice versa -function processTextAndKeywordFields(fields: Field[]) { - const keywordIds = fields.filter((f) => f.type === ES_FIELD_TYPES.KEYWORD).map((f) => f.id); - const textIds = fields.filter((f) => f.type === ES_FIELD_TYPES.TEXT).map((f) => f.id); - - const fieldsPreferringKeyword = fields.filter( - (f) => - f.type !== ES_FIELD_TYPES.TEXT || - (f.type === ES_FIELD_TYPES.TEXT && keywordIds.includes(`${f.id}.keyword`) === false) - ); - - const fieldsPreferringText = fields.filter( - (f) => - f.type !== ES_FIELD_TYPES.KEYWORD || - (f.type === ES_FIELD_TYPES.KEYWORD && - textIds.includes(f.id.replace(/\.keyword$/, '')) === false) - ); - - return { fieldsPreferringKeyword, fieldsPreferringText }; -} - export function filterCategoryFields(fields: Field[]) { return fields.filter((f) => categoryFieldTypes.includes(f.type)); } diff --git a/x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities_service_analytics.ts b/x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities_service_analytics.ts new file mode 100644 index 0000000000000..3a362a88e40bb --- /dev/null +++ b/x-pack/plugins/ml/public/application/services/new_job_capabilities/new_job_capabilities_service_analytics.ts @@ -0,0 +1,66 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Field, NewJobCapsResponse } from '../../../../common/types/fields'; +import { ES_FIELD_TYPES, IIndexPattern } from '../../../../../../../src/plugins/data/public'; +import { processTextAndKeywordFields, NewJobCapabilitiesServiceBase } from './new_job_capabilities'; +import { ml } from '../ml_api_service'; + +// Keep top nested field and remove all .* fields +export function removeNestedFieldChildren(resp: NewJobCapsResponse, indexPatternTitle: string) { + const results = resp[indexPatternTitle]; + const fields: Field[] = []; + const nestedFields: Record = {}; + + if (results !== undefined) { + results.fields.forEach((field: Field) => { + if (field.type === ES_FIELD_TYPES.NESTED && nestedFields[field.name] === undefined) { + nestedFields[field.name] = true; + fields.push(field); + } + }); + + if (Object.keys(nestedFields).length > 0) { + results.fields.forEach((field: Field) => { + if (field.type !== ES_FIELD_TYPES.NESTED) { + const fieldNameParts = field.name.split('.'); + const rootOfField = fieldNameParts.shift(); + if (rootOfField && nestedFields[rootOfField] === undefined) { + fields.push(field); + } + } + }); + } else { + fields.push(...results.fields); + } + } + return fields; +} + +class NewJobCapsServiceAnalytics extends NewJobCapabilitiesServiceBase { + public async initializeFromIndexPattern(indexPattern: IIndexPattern) { + try { + const resp: NewJobCapsResponse = await ml.dataFrameAnalytics.newJobCapsAnalytics( + indexPattern.title, + indexPattern.type === 'rollup' + ); + + const allFields = removeNestedFieldChildren(resp, indexPattern.title); + + const { fieldsPreferringKeyword } = processTextAndKeywordFields(allFields); + + // set the main fields list to contain fields which have been filtered to prefer + // keyword fields over text fields. + // e.g. if foo.keyword and foo exist, don't add foo to the list. + this._fields = fieldsPreferringKeyword; + } catch (error) { + console.error('Unable to load analytics index fields', error); // eslint-disable-line no-console + } + } +} + +export const newJobCapsServiceAnalytics = new NewJobCapsServiceAnalytics(); diff --git a/x-pack/plugins/ml/public/application/services/new_job_capabilities/remove_nested_field_children.test.ts b/x-pack/plugins/ml/public/application/services/new_job_capabilities/remove_nested_field_children.test.ts new file mode 100644 index 0000000000000..e960095b5b2db --- /dev/null +++ b/x-pack/plugins/ml/public/application/services/new_job_capabilities/remove_nested_field_children.test.ts @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { removeNestedFieldChildren } from './new_job_capabilities_service_analytics'; +import { IndexPattern } from '../../../../../../../src/plugins/data/public'; + +// there is magic happening here. starting the include name with `mock..` +// ensures it can be lazily loaded by the jest.mock function below. +import nestedFieldIndexResponse from '../__mocks__/nested_field_index_response.json'; + +const indexPattern = ({ + id: 'nested-field-index', + title: 'nested-field-index', +} as unknown) as IndexPattern; + +describe('removeNestedFieldChildren', () => { + describe('cloudwatch newJobCapsAnalytics()', () => { + it('can get job caps fields from endpoint json', async () => { + // @ts-ignore + const fields = removeNestedFieldChildren(nestedFieldIndexResponse, indexPattern.title); + const nestedField = fields.find(({ type }) => type === 'nested'); + const nestedFieldRoot = nestedField?.name; + const regex = new RegExp(`^${nestedFieldRoot}\\.`, 'i'); + + expect(fields).toHaveLength(4); + expect(fields.some((field) => field.name.match(regex))).toBe(false); + }); + }); +}); diff --git a/x-pack/plugins/ml/server/models/job_service/new_job_caps/field_service.ts b/x-pack/plugins/ml/server/models/job_service/new_job_caps/field_service.ts index c6cf608fe1e0b..49c09742985d4 100644 --- a/x-pack/plugins/ml/server/models/job_service/new_job_caps/field_service.ts +++ b/x-pack/plugins/ml/server/models/job_service/new_job_caps/field_service.ts @@ -70,7 +70,7 @@ class FieldsService { } // create field object from the results from _field_caps - private async createFields(): Promise { + private async createFields(includeNested: boolean = false): Promise { const fieldCaps = await this.loadFieldCaps(); const fields: Field[] = []; if (fieldCaps && fieldCaps.fields) { @@ -80,7 +80,10 @@ class FieldsService { if (firstKey !== undefined) { const field = fc[firstKey]; // add to the list of fields if the field type can be used by ML - if (supportedTypes.includes(field.type) === true && field.metadata_field !== true) { + if ( + (supportedTypes.includes(field.type) === true && field.metadata_field !== true) || + (includeNested && field.type === ES_FIELD_TYPES.NESTED) + ) { fields.push({ id: k, name: k, @@ -101,7 +104,7 @@ class FieldsService { // based on what is available in the rollup job // the _indexPattern will be replaced with a comma separated list // of index patterns from all of the rollup jobs - public async getData(): Promise { + public async getData(includeNested: boolean = false): Promise { let rollupFields: RollupFields = {}; if (this._isRollup) { @@ -128,7 +131,7 @@ class FieldsService { } const aggs = cloneDeep([...aggregations, ...mlOnlyAggregations]); - const fields: Field[] = await this.createFields(); + const fields: Field[] = await this.createFields(includeNested); return combineFieldsAndAggs(fields, aggs, rollupFields); } diff --git a/x-pack/plugins/ml/server/models/job_service/new_job_caps/new_job_caps.ts b/x-pack/plugins/ml/server/models/job_service/new_job_caps/new_job_caps.ts index c85c393e6dba8..6444f9ae3f61a 100644 --- a/x-pack/plugins/ml/server/models/job_service/new_job_caps/new_job_caps.ts +++ b/x-pack/plugins/ml/server/models/job_service/new_job_caps/new_job_caps.ts @@ -7,13 +7,9 @@ import { IScopedClusterClient, SavedObjectsClientContract } from 'kibana/server'; import { _DOC_COUNT } from '../../../../common/constants/field_types'; -import { Aggregation, Field, NewJobCaps } from '../../../../common/types/fields'; +import { Aggregation, Field, NewJobCapsResponse } from '../../../../common/types/fields'; import { fieldServiceProvider } from './field_service'; -export interface NewJobCapsResponse { - [indexPattern: string]: NewJobCaps; -} - export function newJobCapsProvider(client: IScopedClusterClient) { async function newJobCaps( indexPattern: string, diff --git a/x-pack/plugins/ml/server/routes/apidoc.json b/x-pack/plugins/ml/server/routes/apidoc.json index ba61a987d69ef..55f66b354df27 100644 --- a/x-pack/plugins/ml/server/routes/apidoc.json +++ b/x-pack/plugins/ml/server/routes/apidoc.json @@ -18,6 +18,7 @@ "DeleteDataFrameAnalytics", "JobsExist", "GetDataFrameAnalyticsIdMap", + "AnalyticsNewJobCaps", "ValidateDataFrameAnalytics", "DataVisualizer", diff --git a/x-pack/plugins/ml/server/routes/data_frame_analytics.ts b/x-pack/plugins/ml/server/routes/data_frame_analytics.ts index 520f8ce6fb0a9..d8b88deb50a43 100644 --- a/x-pack/plugins/ml/server/routes/data_frame_analytics.ts +++ b/x-pack/plugins/ml/server/routes/data_frame_analytics.ts @@ -10,6 +10,7 @@ import { wrapError } from '../client/error_wrapper'; import { analyticsAuditMessagesProvider } from '../models/data_frame_analytics/analytics_audit_messages'; import { RouteInitialization } from '../types'; import { JOB_MAP_NODE_TYPES } from '../../common/constants/data_frame_analytics'; +import { Field, Aggregation } from '../../common/types/fields'; import { dataAnalyticsJobConfigSchema, dataAnalyticsJobUpdateSchema, @@ -21,11 +22,14 @@ import { deleteDataFrameAnalyticsJobSchema, jobsExistSchema, analyticsQuerySchema, + analyticsNewJobCapsParamsSchema, + analyticsNewJobCapsQuerySchema, } from './schemas/data_analytics_schema'; import { GetAnalyticsMapArgs, ExtendAnalyticsMapArgs } from '../models/data_frame_analytics/types'; import { IndexPatternHandler } from '../models/data_frame_analytics/index_patterns'; import { AnalyticsManager } from '../models/data_frame_analytics/analytics_manager'; import { validateAnalyticsJob } from '../models/data_frame_analytics/validation'; +import { fieldServiceProvider } from '../models/job_service/new_job_caps/field_service'; import { DeleteDataFrameAnalyticsWithIndexStatus } from '../../common/types/data_frame_analytics'; import { getAuthorizationHeader } from '../lib/request_authorization'; import type { MlClient } from '../lib/ml_client'; @@ -58,6 +62,24 @@ function getExtendedMap( return analytics.extendAnalyticsMapForAnalyticsJob(idOptions); } +// replace the recursive field and agg references with a +// map of ids to allow it to be stringified for transportation +// over the network. +function convertForStringify(aggs: Aggregation[], fields: Field[]): void { + fields.forEach((f) => { + f.aggIds = f.aggs ? f.aggs.map((a) => a.id) : []; + delete f.aggs; + }); + aggs.forEach((a) => { + if (a.fields !== undefined) { + // if the aggregation supports fields, i.e. it's fields list isn't undefined, + // create a list of field ids + a.fieldIds = a.fields.map((f) => f.id); + } + delete a.fields; + }); +} + /** * Routes for the data frame analytics */ @@ -671,6 +693,52 @@ export function dataFrameAnalyticsRoutes({ router, mlLicense, routeGuard }: Rout }) ); + /** + * @apiGroup DataFrameAnalytics + * + * @api {get} api/data_frame/analytics/fields/:indexPattern Get index pattern fields for analytics + * @apiName AnalyticsNewJobCaps + * @apiDescription Retrieve the index fields for analytics + */ + router.get( + { + path: '/api/ml/data_frame/analytics/new_job_caps/{indexPattern}', + validate: { + params: analyticsNewJobCapsParamsSchema, + query: analyticsNewJobCapsQuerySchema, + }, + options: { + tags: ['access:ml:canGetJobs'], + }, + }, + routeGuard.fullLicenseAPIGuard(async ({ client, request, response, context }) => { + try { + const { indexPattern } = request.params; + const isRollup = request.query.rollup === 'true'; + const savedObjectsClient = context.core.savedObjects.client; + const fieldService = fieldServiceProvider( + indexPattern, + isRollup, + client, + savedObjectsClient + ); + const { fields, aggs } = await fieldService.getData(true); + convertForStringify(aggs, fields); + + return response.ok({ + body: { + [indexPattern]: { + aggs, + fields, + }, + }, + }); + } catch (e) { + return response.customError(wrapError(e)); + } + }) + ); + /** * @apiGroup DataFrameAnalytics * diff --git a/x-pack/plugins/ml/server/routes/schemas/data_analytics_schema.ts b/x-pack/plugins/ml/server/routes/schemas/data_analytics_schema.ts index 1f5bcbc23423a..31ecd1bdd9ef0 100644 --- a/x-pack/plugins/ml/server/routes/schemas/data_analytics_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/data_analytics_schema.ts @@ -102,3 +102,9 @@ export const jobsExistSchema = schema.object({ export const analyticsMapQuerySchema = schema.maybe( schema.object({ treatAsRoot: schema.maybe(schema.any()), type: schema.maybe(schema.string()) }) ); + +export const analyticsNewJobCapsParamsSchema = schema.object({ indexPattern: schema.string() }); + +export const analyticsNewJobCapsQuerySchema = schema.maybe( + schema.object({ rollup: schema.maybe(schema.string()) }) +); From 83831ce99081da056c2dac59333267b56622b884 Mon Sep 17 00:00:00 2001 From: Marco Liberati Date: Thu, 15 Apr 2021 18:56:33 +0200 Subject: [PATCH 28/68] [Graph] Fix fields clearing within the Editor (#96767) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../components/field_manager/field_editor.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/graph/public/components/field_manager/field_editor.tsx b/x-pack/plugins/graph/public/components/field_manager/field_editor.tsx index d569d3016e579..75eda292ee6d7 100644 --- a/x-pack/plugins/graph/public/components/field_manager/field_editor.tsx +++ b/x-pack/plugins/graph/public/components/field_manager/field_editor.tsx @@ -71,6 +71,14 @@ export function FieldEditor({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [initialField]); + // In case of cleared field and the user closes the popover, restore the initial field + useEffect(() => { + if (!open) { + setCurrentField(initialField); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [open]); + function updateField() { const { name, selected, type, ...updatableProperties } = currentField; if (fieldName !== initialField.name) { @@ -218,8 +226,8 @@ export function FieldEditor({ > { - // value is always defined because it's an unclearable single selection - const newFieldName = choices[0].value!; + // when user hits backspace the selection gets cleared, so prevent it from breaking + const newFieldName = choices.length ? choices[0].value! : ''; updateProp('name', newFieldName); }} @@ -357,7 +365,7 @@ export function FieldEditor({ {i18n.translate('xpack.graph.fieldManager.updateLabel', { From 069b04bed637e38893c05134b8e9e84250bff607 Mon Sep 17 00:00:00 2001 From: Justin Ibarra Date: Thu, 15 Apr 2021 12:08:45 -0500 Subject: [PATCH 29/68] [Detection Rules] Remove empty values in threshold.field array for threshold rules (#97111) ## Issues related to https://github.com/elastic/detection-rules/issues/1097 related to https://github.com/elastic/detection-rules/pull/1099 ## Summary `threshold.field` is an array that currently requires at least one value. An empty string `""` was required if no value was supplied. Instead, this needs to be replaced with no string and just an empty array. ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md) --- .../credential_access_aws_iam_assume_role_brute_force.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_aws_iam_assume_role_brute_force.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_aws_iam_assume_role_brute_force.json index 623170d168815..d4fe403f5870a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_aws_iam_assume_role_brute_force.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_aws_iam_assume_role_brute_force.json @@ -46,11 +46,9 @@ } ], "threshold": { - "field": [ - "" - ], + "field": [], "value": 25 }, "type": "threshold", - "version": 3 + "version": 4 } From d47ee56e933e28939e913e3e18e85efe8536e714 Mon Sep 17 00:00:00 2001 From: Ashokaditya Date: Thu, 15 Apr 2021 19:16:56 +0200 Subject: [PATCH 30/68] [Security Solution] Breaks very long hostnames so they are readable (#97253) * Breaks very long hostnames so they are readable fixes elastic/kibana/issues/96282 * use utility class instead review change --- .../pages/endpoint_hosts/view/details/endpoint_details.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx index c97e097ea9b72..c9db78f425afa 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx @@ -245,7 +245,7 @@ export const EndpointDetails = memo( title: i18n.translate('xpack.securitySolution.endpoint.details.hostname', { defaultMessage: 'Hostname', }), - description: {details.host.hostname}, + description: {details.host.hostname}, }, { title: i18n.translate('xpack.securitySolution.endpoint.details.endpointVersion', { From f4e7941e7d08db596481c33910ac4db00e5adf10 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Thu, 15 Apr 2021 19:58:19 +0200 Subject: [PATCH 31/68] [Discover] Unskip doc navigation functional test (#96948) --- test/functional/apps/context/_discover_navigation.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/functional/apps/context/_discover_navigation.js b/test/functional/apps/context/_discover_navigation.js index db276c4b05002..572ee3dedf35a 100644 --- a/test/functional/apps/context/_discover_navigation.js +++ b/test/functional/apps/context/_discover_navigation.js @@ -105,8 +105,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.discover.waitForDocTableLoadingComplete(); }); - // flaky https://github.com/elastic/kibana/issues/93670 - it.skip('navigates to doc view from embeddable', async () => { + it('navigates to doc view from embeddable', async () => { await PageObjects.common.navigateToApp('discover'); await PageObjects.discover.saveSearch('my search'); await PageObjects.header.waitUntilLoadingHasFinished(); @@ -126,7 +125,9 @@ export default function ({ getService, getPageObjects }) { const alert = await browser.getAlert(); await alert?.accept(); expect(await browser.getCurrentUrl()).to.contain('#/doc'); - expect(await PageObjects.discover.isShowingDocViewer()).to.be(true); + retry.waitFor('doc view being rendered', async () => { + return await PageObjects.discover.isShowingDocViewer(); + }); }); }); } From b7067dea16e90d4eb3271ab6b2c5498914ab4fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Thu, 15 Apr 2021 20:04:52 +0200 Subject: [PATCH 32/68] [Usage Collection/Cloud Provider] Fix isReady bug (#97279) --- .../collectors/cloud/cloud_provider_collector.test.ts | 5 +++++ .../server/collectors/cloud/cloud_provider_collector.ts | 2 +- .../collectors/cloud/detector/cloud_detector.test.ts | 8 ++++---- .../server/collectors/cloud/detector/cloud_detector.ts | 6 +++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/plugins/kibana_usage_collection/server/collectors/cloud/cloud_provider_collector.test.ts b/src/plugins/kibana_usage_collection/server/collectors/cloud/cloud_provider_collector.test.ts index a2f08ddb465cc..b3f9c2a329468 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/cloud/cloud_provider_collector.test.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/cloud/cloud_provider_collector.test.ts @@ -46,6 +46,11 @@ describe('registerCloudProviderUsageCollector', () => { expect(collector.isReady()).toBe(true); }); + test('isReady() => true when cloud details have been retrieved but none have been found', () => { + cloudDetailsMock.mockReturnValueOnce(null); + expect(collector.isReady()).toBe(true); + }); + test('initiates CloudDetector.detectCloudDetails when called', () => { expect(detectCloudServiceMock).toHaveBeenCalledTimes(1); }); diff --git a/src/plugins/kibana_usage_collection/server/collectors/cloud/cloud_provider_collector.ts b/src/plugins/kibana_usage_collection/server/collectors/cloud/cloud_provider_collector.ts index eafce56d7cf2e..2b3cbce6fa3e1 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/cloud/cloud_provider_collector.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/cloud/cloud_provider_collector.ts @@ -23,7 +23,7 @@ export function registerCloudProviderUsageCollector(usageCollection: UsageCollec const collector = usageCollection.makeUsageCollector({ type: 'cloud_provider', - isReady: () => Boolean(cloudDetector.getCloudDetails()), + isReady: () => typeof cloudDetector.getCloudDetails() !== 'undefined', async fetch() { const details = cloudDetector.getCloudDetails(); if (!details) { diff --git a/src/plugins/kibana_usage_collection/server/collectors/cloud/detector/cloud_detector.test.ts b/src/plugins/kibana_usage_collection/server/collectors/cloud/detector/cloud_detector.test.ts index 4b88ed5b4064f..f0b54046565c9 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/cloud/detector/cloud_detector.test.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/cloud/detector/cloud_detector.test.ts @@ -69,16 +69,16 @@ describe('CloudDetector', () => { expect(detector.getCloudDetails()).toEqual({ name: 'good-match' }); }); - it('returns undefined if none match', async () => { + it('returns null if none match', async () => { const services = ([cloudService1, cloudService2] as unknown) as CloudService[]; const detector1 = new CloudDetector({ cloudServices: services }); await detector1.detectCloudService(); - expect(detector1.getCloudDetails()).toBeUndefined(); + expect(detector1.getCloudDetails()).toBeNull(); const detector2 = new CloudDetector({ cloudServices: [] }); await detector2.detectCloudService(); - expect(detector2.getCloudDetails()).toBeUndefined(); + expect(detector2.getCloudDetails()).toBeNull(); }); // this is already tested above, but this just tests it explicitly @@ -87,7 +87,7 @@ describe('CloudDetector', () => { const detector = new CloudDetector({ cloudServices: services }); await detector.detectCloudService(); - expect(detector.getCloudDetails()).toBeUndefined(); + expect(detector.getCloudDetails()).toBeNull(); }); }); }); diff --git a/src/plugins/kibana_usage_collection/server/collectors/cloud/detector/cloud_detector.ts b/src/plugins/kibana_usage_collection/server/collectors/cloud/detector/cloud_detector.ts index 6f6405d9852b6..3d093c81f8896 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/cloud/detector/cloud_detector.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/cloud/detector/cloud_detector.ts @@ -27,7 +27,7 @@ interface CloudDetectorOptions { */ export class CloudDetector { private readonly cloudServices: CloudService[]; - private cloudDetails?: CloudServiceResponseJson; + private cloudDetails?: CloudServiceResponseJson | null; constructor(options: CloudDetectorOptions = {}) { this.cloudServices = @@ -70,7 +70,7 @@ export class CloudDetector { } } - // explicitly undefined rather than null so that it can be ignored in JSON - return undefined; + // explicitly null to differentiate from not having populated the field yet + return null; } } From b09e418e518844d4aeb176273bf1726b06975b1f Mon Sep 17 00:00:00 2001 From: ymao1 Date: Thu, 15 Apr 2021 14:13:19 -0400 Subject: [PATCH 33/68] [Actions][Telemetry] Counting number of alert history connectors in use (#97063) * Counting number of alert history connectors in use * Telemetry for preconfigured alert history config enabled * Updating telemetry mappings * Updating tests * Adding descriptions to new telemetry fields Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/actions/server/plugin.ts | 1 + .../server/usage/actions_telemetry.test.ts | 67 +++++++++++++++++++ .../actions/server/usage/actions_telemetry.ts | 26 ++++++- .../usage/actions_usage_collector.test.ts | 5 ++ .../server/usage/actions_usage_collector.ts | 18 ++++- x-pack/plugins/actions/server/usage/task.ts | 1 + x-pack/plugins/actions/server/usage/types.ts | 2 + .../schema/xpack_plugins.json | 12 ++++ 8 files changed, 128 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/actions/server/plugin.ts b/x-pack/plugins/actions/server/plugin.ts index 3c754d90c4af5..1d941617789b7 100644 --- a/x-pack/plugins/actions/server/plugin.ts +++ b/x-pack/plugins/actions/server/plugin.ts @@ -224,6 +224,7 @@ export class ActionsPlugin implements Plugin taskManager) ); } diff --git a/x-pack/plugins/actions/server/usage/actions_telemetry.test.ts b/x-pack/plugins/actions/server/usage/actions_telemetry.test.ts index e4611857ca279..18510ba9aa864 100644 --- a/x-pack/plugins/actions/server/usage/actions_telemetry.test.ts +++ b/x-pack/plugins/actions/server/usage/actions_telemetry.test.ts @@ -158,12 +158,79 @@ Object { expect(telemetry).toMatchInlineSnapshot(` Object { + "countByAlertHistoryConnectorType": 0, "countByType": Object { "__server-log": 1, "__slack": 1, }, "countTotal": 2, } +`); + }); + + test('getInUseTotalCount should count preconfigured alert history connector usage', async () => { + const mockEsClient = elasticsearchClientMock.createClusterClient().asScoped().asInternalUser; + mockEsClient.search.mockReturnValue( + // @ts-expect-error not full search response + elasticsearchClientMock.createSuccessTransportRequestPromise({ + aggregations: { + refs: { + actionRefIds: { + value: { + connectorIds: { + '1': 'action_0', + '123': 'action_1', + 'preconfigured-alert-history-es-index': 'action_2', + }, + total: 3, + }, + }, + }, + hits: { + hits: [], + }, + }, + }) + ); + const actionsBulkGet = jest.fn(); + actionsBulkGet.mockReturnValue({ + saved_objects: [ + { + id: '1', + attributes: { + actionTypeId: '.server-log', + }, + }, + { + id: '123', + attributes: { + actionTypeId: '.slack', + }, + }, + { + id: 'preconfigured-alert-history-es-index', + error: { + statusCode: 404, + error: 'Not Found', + message: 'Saved object [action/preconfigured-alert-history-es-index] not found', + }, + }, + ], + }); + const telemetry = await getInUseTotalCount(mockEsClient, actionsBulkGet, 'test'); + + expect(mockEsClient.search).toHaveBeenCalledTimes(1); + expect(actionsBulkGet).toHaveBeenCalledTimes(1); + + expect(telemetry).toMatchInlineSnapshot(` +Object { + "countByAlertHistoryConnectorType": 1, + "countByType": Object { + "__server-log": 1, + "__slack": 1, + }, + "countTotal": 3, +} `); }); }); diff --git a/x-pack/plugins/actions/server/usage/actions_telemetry.ts b/x-pack/plugins/actions/server/usage/actions_telemetry.ts index 8d028b176a00a..71516cb4918e7 100644 --- a/x-pack/plugins/actions/server/usage/actions_telemetry.ts +++ b/x-pack/plugins/actions/server/usage/actions_telemetry.ts @@ -11,6 +11,7 @@ import { SavedObjectsBulkGetObject, SavedObjectsBulkResponse, } from 'kibana/server'; +import { AlertHistoryEsIndexConnectorId } from '../../common'; import { ActionResult } from '../types'; export async function getTotalCount(esClient: ElasticsearchClient, kibanaIndex: string) { @@ -79,7 +80,11 @@ export async function getInUseTotalCount( options?: SavedObjectsBaseOptions | undefined ) => Promise>>>, kibanaIndex: string -): Promise<{ countTotal: number; countByType: Record }> { +): Promise<{ + countTotal: number; + countByType: Record; + countByAlertHistoryConnectorType: number; +}> { const scriptedMetric = { scripted_metric: { init_script: 'state.connectorIds = new HashMap(); state.total = 0;', @@ -167,7 +172,13 @@ export async function getInUseTotalCount( fields: ['id', 'actionTypeId'], })); const actions = await actionsBulkGet(bulkFilter); - const countByType = actions.saved_objects.reduce( + + // filter out preconfigured connectors, which are not saved objects and return + // an error in the bulk response + const actionsWithActionTypeId = actions.saved_objects.filter( + (action) => action?.attributes?.actionTypeId != null + ); + const countByActionTypeId = actionsWithActionTypeId.reduce( (actionTypeCount: Record, action) => { const alertTypeId = replaceFirstAndLastDotSymbols(action.attributes.actionTypeId); const currentCount = @@ -177,7 +188,16 @@ export async function getInUseTotalCount( }, {} ); - return { countTotal: aggs.total, countByType }; + + const preconfiguredAlertHistoryConnector = actions.saved_objects.filter( + (action) => action.id === AlertHistoryEsIndexConnectorId + ); + + return { + countTotal: aggs.total, + countByType: countByActionTypeId, + countByAlertHistoryConnectorType: preconfiguredAlertHistoryConnector.length, + }; } function replaceFirstAndLastDotSymbols(strToReplace: string) { diff --git a/x-pack/plugins/actions/server/usage/actions_usage_collector.test.ts b/x-pack/plugins/actions/server/usage/actions_usage_collector.test.ts index cf76adddc5494..df43cbd084be8 100644 --- a/x-pack/plugins/actions/server/usage/actions_usage_collector.test.ts +++ b/x-pack/plugins/actions/server/usage/actions_usage_collector.test.ts @@ -7,6 +7,7 @@ import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { registerActionsUsageCollector } from './actions_usage_collector'; +import { configSchema, ActionsConfig } from '../config'; import { taskManagerMock } from '../../../task_manager/server/mocks'; const mockTaskManagerStart = taskManagerMock.createStart(); @@ -14,8 +15,10 @@ const mockTaskManagerStart = taskManagerMock.createStart(); beforeEach(() => jest.resetAllMocks()); describe('registerActionsUsageCollector', () => { + let config: ActionsConfig; let usageCollectionMock: jest.Mocked; beforeEach(() => { + config = configSchema.validate({}); usageCollectionMock = ({ makeUsageCollector: jest.fn(), registerCollector: jest.fn(), @@ -25,6 +28,7 @@ describe('registerActionsUsageCollector', () => { it('should call registerCollector', () => { registerActionsUsageCollector( usageCollectionMock as UsageCollectionSetup, + config, new Promise(() => mockTaskManagerStart) ); expect(usageCollectionMock.registerCollector).toHaveBeenCalledTimes(1); @@ -33,6 +37,7 @@ describe('registerActionsUsageCollector', () => { it('should call makeUsageCollector with type = actions', () => { registerActionsUsageCollector( usageCollectionMock as UsageCollectionSetup, + config, new Promise(() => mockTaskManagerStart) ); expect(usageCollectionMock.makeUsageCollector).toHaveBeenCalledTimes(1); diff --git a/x-pack/plugins/actions/server/usage/actions_usage_collector.ts b/x-pack/plugins/actions/server/usage/actions_usage_collector.ts index c338bbc998c49..06248e1fa95a8 100644 --- a/x-pack/plugins/actions/server/usage/actions_usage_collector.ts +++ b/x-pack/plugins/actions/server/usage/actions_usage_collector.ts @@ -9,6 +9,7 @@ import { MakeSchemaFrom, UsageCollectionSetup } from 'src/plugins/usage_collecti import { get } from 'lodash'; import { TaskManagerStartContract } from '../../../task_manager/server'; import { ActionsUsage } from './types'; +import { ActionsConfig } from '../config'; const byTypeSchema: MakeSchemaFrom['count_by_type'] = { // TODO: Find out an automated way to populate the keys or reformat these into an array (and change the Remote Telemetry indexer accordingly) @@ -28,6 +29,7 @@ const byTypeSchema: MakeSchemaFrom['count_by_type'] = { export function createActionsUsageCollector( usageCollection: UsageCollectionSetup, + config: ActionsConfig, taskManager: Promise ) { return usageCollection.makeUsageCollector({ @@ -37,8 +39,18 @@ export function createActionsUsageCollector( return true; }, schema: { + alert_history_connector_enabled: { + type: 'boolean', + _meta: { description: 'Indicates if preconfigured alert history connector is enabled.' }, + }, count_total: { type: 'long' }, count_active_total: { type: 'long' }, + count_active_alert_history_connectors: { + type: 'long', + _meta: { + description: 'The total number of preconfigured alert history connectors used by rules.', + }, + }, count_by_type: byTypeSchema, count_active_by_type: byTypeSchema, }, @@ -50,11 +62,14 @@ export function createActionsUsageCollector( return { ...state, + alert_history_connector_enabled: config.preconfiguredAlertHistoryEsIndex, }; } catch (err) { return { + alert_history_connector_enabled: false, count_total: 0, count_active_total: 0, + count_active_alert_history_connectors: 0, count_active_by_type: {}, count_by_type: {}, }; @@ -84,8 +99,9 @@ async function getLatestTaskState(taskManager: TaskManagerStartContract) { export function registerActionsUsageCollector( usageCollection: UsageCollectionSetup, + config: ActionsConfig, taskManager: Promise ) { - const collector = createActionsUsageCollector(usageCollection, taskManager); + const collector = createActionsUsageCollector(usageCollection, config, taskManager); usageCollection.registerCollector(collector); } diff --git a/x-pack/plugins/actions/server/usage/task.ts b/x-pack/plugins/actions/server/usage/task.ts index 03c49a31ed311..3ba40d92abd7a 100644 --- a/x-pack/plugins/actions/server/usage/task.ts +++ b/x-pack/plugins/actions/server/usage/task.ts @@ -101,6 +101,7 @@ export function telemetryTaskRunner(logger: Logger, core: CoreSetup, kibanaIndex count_by_type: totalAggegations.countByType, count_active_total: totalInUse.countTotal, count_active_by_type: totalInUse.countByType, + count_active_alert_history_connectors: totalInUse.countByAlertHistoryConnectorType, }, runAt: getNextMidnight(), }; diff --git a/x-pack/plugins/actions/server/usage/types.ts b/x-pack/plugins/actions/server/usage/types.ts index c192115bfb02a..9221ba8ea5688 100644 --- a/x-pack/plugins/actions/server/usage/types.ts +++ b/x-pack/plugins/actions/server/usage/types.ts @@ -6,8 +6,10 @@ */ export interface ActionsUsage { + alert_history_connector_enabled: boolean; count_total: number; count_active_total: number; + count_active_alert_history_connectors: number; count_by_type: Record; count_active_by_type: Record; // TODO: Implement executions count telemetry with eventLog, when it will write to index diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 3d302aa12832e..1d1cd8c0c7667 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -2,12 +2,24 @@ "properties": { "actions": { "properties": { + "alert_history_connector_enabled": { + "type": "boolean", + "_meta": { + "description": "Indicates if preconfigured alert history connector is enabled." + } + }, "count_total": { "type": "long" }, "count_active_total": { "type": "long" }, + "count_active_alert_history_connectors": { + "type": "long", + "_meta": { + "description": "The total number of preconfigured alert history connectors used by rules." + } + }, "count_by_type": { "properties": { "DYNAMIC_KEY": { From fdb7be3d1113f544e9c8fe45885c86e0a116dcaa Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 15 Apr 2021 12:26:25 -0600 Subject: [PATCH 34/68] Remove field type filtering from IndexPatternSelect (#97035) * Remove field type filtering from IndexPatternSelect * remove unused import * api doc updates * update jest snapshots * another fix for jest test * review feedback * tslint * update jest snapshot for changes Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- ...ins-data-public.indexpatternselectprops.md | 1 - src/plugins/data/public/public.api.md | 1 - .../index_pattern_select.tsx | 45 +++---------------- .../geo_index_pattern_select.test.tsx.snap | 29 ++++-------- .../geo_index_pattern_select.test.tsx | 2 +- .../components/geo_index_pattern_select.tsx | 41 ++++++++++------- .../public/components/single_field_select.tsx | 2 +- .../geo_index_pattern_select.tsx | 36 ++++++++++----- .../translations/translations/ja-JP.json | 2 - .../translations/translations/zh-CN.json | 2 - 10 files changed, 67 insertions(+), 94 deletions(-) diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselectprops.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselectprops.md index 5cfd5e1bc9929..e7d58f538c8ce 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselectprops.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselectprops.md @@ -10,7 +10,6 @@ export declare type IndexPatternSelectProps = Required, 'isLoading' | 'onSearchChange' | 'options' | 'selectedOptions' | 'onChange'>, 'placeholder'> & { onChange: (indexPatternId?: string) => void; indexPatternId: string; - fieldTypes?: string[]; onNoIndexPatterns?: () => void; }; ``` diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index c4e54c64af132..d99d754a3364d 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -1558,7 +1558,6 @@ export type IndexPatternsContract = PublicMethodsOf; export type IndexPatternSelectProps = Required, 'isLoading' | 'onSearchChange' | 'options' | 'selectedOptions' | 'onChange'>, 'placeholder'> & { onChange: (indexPatternId?: string) => void; indexPatternId: string; - fieldTypes?: string[]; onNoIndexPatterns?: () => void; }; diff --git a/src/plugins/data/public/ui/index_pattern_select/index_pattern_select.tsx b/src/plugins/data/public/ui/index_pattern_select/index_pattern_select.tsx index 04bdb7a690268..2b45d8efc4d92 100644 --- a/src/plugins/data/public/ui/index_pattern_select/index_pattern_select.tsx +++ b/src/plugins/data/public/ui/index_pattern_select/index_pattern_select.tsx @@ -23,7 +23,6 @@ export type IndexPatternSelectProps = Required< > & { onChange: (indexPatternId?: string) => void; indexPatternId: string; - fieldTypes?: string[]; onNoIndexPatterns?: () => void; }; @@ -102,49 +101,18 @@ export default class IndexPatternSelect extends Component { - const isCurrentSearch = () => { - return this.isMounted && searchValue === this.state.searchValue; - }; - const idsAndTitles = await this.props.indexPatternService.getIdsWithTitle(); - if (!isCurrentSearch()) { + if (!this.isMounted || searchValue !== this.state.searchValue) { return; } const options = []; for (let i = 0; i < idsAndTitles.length; i++) { - if (!idsAndTitles[i].title.toLowerCase().includes(searchValue.toLowerCase())) { - // index pattern excluded due to title not matching search - continue; - } - - if (this.props.fieldTypes) { - try { - const indexPattern = await this.props.indexPatternService.get(idsAndTitles[i].id); - if (!isCurrentSearch()) { - return; - } - const hasRequiredFieldTypes = indexPattern.fields.some((field) => { - return this.props.fieldTypes!.includes(field.type); - }); - if (!hasRequiredFieldTypes) { - continue; - } - } catch (err) { - // could not load index pattern, exclude it from list. - continue; - } - } - - options.push({ - label: idsAndTitles[i].title, - value: idsAndTitles[i].id, - }); - - // Loading each index pattern object requires a network call so just find small number of matching index patterns - // Users can use 'searchValue' to further refine the list and locate their index pattern. - if (options.length > 15) { - break; + if (idsAndTitles[i].title.toLowerCase().includes(searchValue.toLowerCase())) { + options.push({ + label: idsAndTitles[i].title, + value: idsAndTitles[i].id, + }); } } @@ -174,7 +142,6 @@ export default class IndexPatternSelect extends Component

-

@@ -79,22 +71,19 @@ exports[`should render no index pattern warning when there are no matching index { test('should render no index pattern warning when there are no matching index patterns', async () => { const component = shallow( {}} value={'indexPatternId'} />); - component.setState({ noGeoIndexPatternsExist: true }); + component.setState({ noIndexPatternsExist: true }); expect(component).toMatchSnapshot(); }); diff --git a/x-pack/plugins/maps/public/components/geo_index_pattern_select.tsx b/x-pack/plugins/maps/public/components/geo_index_pattern_select.tsx index 81e06e4ea9bbc..3db7dd322ae1c 100644 --- a/x-pack/plugins/maps/public/components/geo_index_pattern_select.tsx +++ b/x-pack/plugins/maps/public/components/geo_index_pattern_select.tsx @@ -24,14 +24,16 @@ interface Props { } interface State { - noGeoIndexPatternsExist: boolean; + doesIndexPatternHaveGeoField: boolean; + noIndexPatternsExist: boolean; } export class GeoIndexPatternSelect extends Component { private _isMounted: boolean = false; state = { - noGeoIndexPatternsExist: false, + doesIndexPatternHaveGeoField: false, + noIndexPatternsExist: false, }; componentWillUnmount() { @@ -57,16 +59,23 @@ export class GeoIndexPatternSelect extends Component { // method may be called again before 'get' returns // ignore response when fetched index pattern does not match active index pattern if (this._isMounted && indexPattern.id === indexPatternId) { + this.setState({ + doesIndexPatternHaveGeoField: indexPattern.fields.some((field) => { + return this.props?.isGeoPointsOnly + ? (ES_GEO_FIELD_TYPE.GEO_POINT as string) === field.type + : ES_GEO_FIELD_TYPES.includes(field.type); + }), + }); this.props.onChange(indexPattern); } }; _onNoIndexPatterns = () => { - this.setState({ noGeoIndexPatternsExist: true }); + this.setState({ noIndexPatternsExist: true }); }; _renderNoIndexPatternWarning() { - if (!this.state.noGeoIndexPatternsExist) { + if (!this.state.noIndexPatternsExist) { return null; } @@ -74,7 +83,7 @@ export class GeoIndexPatternSelect extends Component { <> @@ -86,18 +95,14 @@ export class GeoIndexPatternSelect extends Component { -

{ render() { const IndexPatternSelect = getIndexPatternSelectComponent(); + const isIndexPatternInvalid = !!this.props.value && !this.state.doesIndexPatternHaveGeoField; + const error = isIndexPatternInvalid + ? i18n.translate('xpack.maps.noGeoFieldInIndexPattern.message', { + defaultMessage: 'Index pattern does not contain any geospatial fields', + }) + : ''; return ( <> {this._renderNoIndexPatternWarning()} @@ -122,17 +133,17 @@ export class GeoIndexPatternSelect extends Component { label={i18n.translate('xpack.maps.indexPatternSelectLabel', { defaultMessage: 'Index pattern', })} + isInvalid={isIndexPatternInvalid} + error={error} > diff --git a/x-pack/plugins/maps/public/components/single_field_select.tsx b/x-pack/plugins/maps/public/components/single_field_select.tsx index 32f4f0e7115c0..6727de35b1be7 100644 --- a/x-pack/plugins/maps/public/components/single_field_select.tsx +++ b/x-pack/plugins/maps/public/components/single_field_select.tsx @@ -114,7 +114,7 @@ export function SingleFieldSelect({ options={fieldsToOptions(fields, isFieldDisabled)} selectedOptions={selectedOptions} onChange={onSelection} - isDisabled={!fields} + isDisabled={!fields || fields.length === 0} renderOption={renderOption} {...rest} /> diff --git a/x-pack/plugins/stack_alerts/public/alert_types/geo_containment/query_builder/util_components/geo_index_pattern_select.tsx b/x-pack/plugins/stack_alerts/public/alert_types/geo_containment/query_builder/util_components/geo_index_pattern_select.tsx index 8d7528d6810bd..9bb29b65e7454 100644 --- a/x-pack/plugins/stack_alerts/public/alert_types/geo_containment/query_builder/util_components/geo_index_pattern_select.tsx +++ b/x-pack/plugins/stack_alerts/public/alert_types/geo_containment/query_builder/util_components/geo_index_pattern_select.tsx @@ -23,14 +23,16 @@ interface Props { } interface State { - noGeoIndexPatternsExist: boolean; + doesIndexPatternHaveGeoField: boolean; + noIndexPatternsExist: boolean; } export class GeoIndexPatternSelect extends Component { private _isMounted: boolean = false; state = { - noGeoIndexPatternsExist: false, + doesIndexPatternHaveGeoField: false, + noIndexPatternsExist: false, }; componentWillUnmount() { @@ -56,16 +58,21 @@ export class GeoIndexPatternSelect extends Component { // method may be called again before 'get' returns // ignore response when fetched index pattern does not match active index pattern if (this._isMounted && indexPattern.id === indexPatternId) { + this.setState({ + doesIndexPatternHaveGeoField: indexPattern.fields.some((field) => { + return this.props.includedGeoTypes.includes(field.type); + }), + }); this.props.onChange(indexPattern); } }; _onNoIndexPatterns = () => { - this.setState({ noGeoIndexPatternsExist: true }); + this.setState({ noIndexPatternsExist: true }); }; _renderNoIndexPatternWarning() { - if (!this.state.noGeoIndexPatternsExist) { + if (!this.state.noIndexPatternsExist) { return null; } @@ -73,7 +80,7 @@ export class GeoIndexPatternSelect extends Component { <> @@ -87,18 +94,14 @@ export class GeoIndexPatternSelect extends Component { > -

{ render() { const IndexPatternSelectComponent = this.props.IndexPatternSelectComponent; + const isIndexPatternInvalid = !!this.props.value && !this.state.doesIndexPatternHaveGeoField; + const error = isIndexPatternInvalid + ? i18n.translate('xpack.stackAlerts.geoContainment.noGeoFieldInIndexPattern.message', { + defaultMessage: 'Index pattern does not contain any geospatial fields', + }) + : ''; return ( <> {this._renderNoIndexPatternWarning()} @@ -125,10 +134,13 @@ export class GeoIndexPatternSelect extends Component { label={i18n.translate('xpack.stackAlerts.geoContainment.indexPatternSelectLabel', { defaultMessage: 'Index pattern', })} + isInvalid={isIndexPatternInvalid} + error={error} > {IndexPatternSelectComponent ? ( Date: Thu, 15 Apr 2021 15:23:59 -0500 Subject: [PATCH 35/68] [Workplace Search] Add ErrorReasons fix from ent-search (#97299) Ports https://github.com/elastic/ent-search/pull/3393 to Kibana --- .../components/shared/source_row/source_row.test.tsx | 2 +- .../components/shared/source_row/source_row.tsx | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.test.tsx index f5c9858714cfd..7e06e0c4aa2f3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.test.tsx @@ -39,7 +39,7 @@ describe('SourceRow', () => { const source = { ...contentSources[0], status: 'error', - errorReason: 'credentials_invalid', + errorReason: 'OAuth access token could not be refreshed', }; const wrapper = shallow(); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.tsx index b6dcaa271d8d8..433e90d75ed64 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.tsx @@ -34,7 +34,9 @@ import { SourceIcon } from '../source_icon'; import './source_row.scss'; -const CREDENTIALS_INVALID_ERROR_REASON = 'credentials_invalid'; +// i18n is not needed here because this is only used to check against the server error, which +// is not translated by the Kibana team at this time. +const CREDENTIALS_REFRESH_NEEDED_PREFIX = 'OAuth access token could not be refreshed'; export interface ISourceRow { showDetails?: boolean; @@ -67,7 +69,10 @@ export const SourceRow: React.FC = ({ const isIndexing = status === statuses.INDEXING; const hasError = status === statuses.ERROR || status === statuses.DISCONNECTED; const showFix = - isOrganization && hasError && allowsReauth && errorReason === CREDENTIALS_INVALID_ERROR_REASON; + isOrganization && + hasError && + allowsReauth && + errorReason?.startsWith(CREDENTIALS_REFRESH_NEEDED_PREFIX); const rowClass = classNames({ 'source-row--error': hasError }); From ad25fb3f126911c091e4fdd814a911b7007e6c87 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 15 Apr 2021 22:34:01 +0200 Subject: [PATCH 36/68] Update dependency @elastic/charts to v28.2.0 (master) (#97005) * Update dependency @elastic/charts to v28.2.0 Co-authored-by: Renovate Bot Co-authored-by: nickofthyme Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Marco Vettorello --- package.json | 2 +- .../render_function.test.tsx | 11 ++++- .../pie_visualization/render_helpers.test.ts | 40 +++++++++++++++++-- yarn.lock | 8 ++-- 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index cc2532704114f..c81b63ff1cf98 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "dependencies": { "@elastic/apm-rum": "^5.6.1", "@elastic/apm-rum-react": "^1.2.5", - "@elastic/charts": "28.0.1", + "@elastic/charts": "28.2.0", "@elastic/datemath": "link:bazel-bin/packages/elastic-datemath/npm_module", "@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.4", "@elastic/ems-client": "7.12.0", diff --git a/x-pack/plugins/lens/public/pie_visualization/render_function.test.tsx b/x-pack/plugins/lens/public/pie_visualization/render_function.test.tsx index e18878ea064ef..4dcd9772b61b4 100644 --- a/x-pack/plugins/lens/public/pie_visualization/render_function.test.tsx +++ b/x-pack/plugins/lens/public/pie_visualization/render_function.test.tsx @@ -217,7 +217,16 @@ describe('PieVisualization component', () => { const component = shallow(); component.find(Settings).first().prop('onElementClick')!([ [ - [{ groupByRollup: 6, value: 6, depth: 1, path: [], sortIndex: 1 }], + [ + { + groupByRollup: 6, + value: 6, + depth: 1, + path: [], + sortIndex: 1, + smAccessorValue: '', + }, + ], {} as SeriesIdentifier, ], ]); diff --git a/x-pack/plugins/lens/public/pie_visualization/render_helpers.test.ts b/x-pack/plugins/lens/public/pie_visualization/render_helpers.test.ts index 6e40b07af6713..6ea8610384e47 100644 --- a/x-pack/plugins/lens/public/pie_visualization/render_helpers.test.ts +++ b/x-pack/plugins/lens/public/pie_visualization/render_helpers.test.ts @@ -66,7 +66,16 @@ describe('render helpers', () => { }; expect( getFilterContext( - [{ groupByRollup: 'Test', value: 100, depth: 1, path: [], sortIndex: 1 }], + [ + { + groupByRollup: 'Test', + value: 100, + depth: 1, + path: [], + sortIndex: 1, + smAccessorValue: '', + }, + ], ['a'], table ) @@ -98,7 +107,16 @@ describe('render helpers', () => { }; expect( getFilterContext( - [{ groupByRollup: 'Test', value: 100, depth: 1, path: [], sortIndex: 1 }], + [ + { + groupByRollup: 'Test', + value: 100, + depth: 1, + path: [], + sortIndex: 1, + smAccessorValue: '', + }, + ], ['a', 'b'], table ) @@ -131,8 +149,22 @@ describe('render helpers', () => { expect( getFilterContext( [ - { groupByRollup: 'Test', value: 100, depth: 1, path: [], sortIndex: 1 }, - { groupByRollup: 'Two', value: 5, depth: 1, path: [], sortIndex: 1 }, + { + groupByRollup: 'Test', + value: 100, + depth: 1, + path: [], + sortIndex: 1, + smAccessorValue: '', + }, + { + groupByRollup: 'Two', + value: 5, + depth: 1, + path: [], + sortIndex: 1, + smAccessorValue: '', + }, ], ['a', 'b'], table diff --git a/yarn.lock b/yarn.lock index c43641d668ae2..259f3eccd9a03 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1359,10 +1359,10 @@ dependencies: object-hash "^1.3.0" -"@elastic/charts@28.0.1": - version "28.0.1" - resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-28.0.1.tgz#615f393dc620304fb6cdbc3f6eaf2d6c53e39236" - integrity sha512-uuo7mWTYU4/rdg1a7hxRnNJz7Zjt/u18YwNV4D2SPvBqCDsNxtdRpiF+nLWFDIvBGoAFIGmHIv3cn88Y9dKqdg== +"@elastic/charts@28.2.0": + version "28.2.0" + resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-28.2.0.tgz#3de65668242ed680f3acd72e2befb01a530c01c2" + integrity sha512-18fhbqnb7/5OrpgcoWcnZAfG9O7isRBAkjt2c+ycZoaTsSmPpSRAIlMxAMt36ZXxA7yaSwUVeI28uuKqb1odZg== dependencies: "@popperjs/core" "^2.4.0" chroma-js "^2.1.0" From dcb69e12f0358506d24e6be9254504ccacf5281d Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 15 Apr 2021 21:57:35 +0100 Subject: [PATCH 37/68] chore(NA): upgrade lmdb-store to 1.2.4 (#97275) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 69 +++++++++++++++++++++------------------------------- 2 files changed, 29 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index c81b63ff1cf98..c6f33d263df84 100644 --- a/package.json +++ b/package.json @@ -770,7 +770,7 @@ "jsondiffpatch": "0.4.1", "license-checker": "^16.0.0", "listr": "^0.14.1", - "lmdb-store": "^0.9.0", + "lmdb-store": "^1.2.4", "load-grunt-config": "^3.0.1", "marge": "^1.0.1", "micromatch": "3.1.10", diff --git a/yarn.lock b/yarn.lock index 259f3eccd9a03..4d453cdb1dd27 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18792,28 +18792,17 @@ listr@0.14.3, listr@^0.14.1, listr@^0.14.3: p-map "^2.0.0" rxjs "^6.3.3" -lmdb-store-0.9@0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/lmdb-store-0.9/-/lmdb-store-0.9-0.7.3.tgz#c2cb27dfa916ab966cceed692c67e4236813104a" - integrity sha512-t8iCnN6T3NZPFelPmjYIjCg+nhGbOdc0xcHCG40v01AWRTN49OINSt2k/u+16/2/HrI+b6Ssb8WByXUhbyHz6w== - dependencies: - fs-extra "^9.0.1" - msgpackr "^0.5.3" - nan "^2.14.1" - node-gyp-build "^4.2.3" - weak-lru-cache "^0.3.9" - -lmdb-store@^0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/lmdb-store/-/lmdb-store-0.9.0.tgz#9a07735baaabcb8a46ee08c58ce1d578b69bdc12" - integrity sha512-5yxZ/s2J4w5mq3II5w2i4EiAAT+RvGZ3dtiWPYQDV/F8BpwqZOi7QmHdwawf15stvXv9P92Rm7t2WPbjOV9Xkg== +lmdb-store@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lmdb-store/-/lmdb-store-1.2.4.tgz#5ffe223fb7b899b870a9055468dc908544d072ba" + integrity sha512-KydyC34i7BxQFeEXeX2Ub73u8Iiyf1QxLmhHMxWWWWqNFr6tk8vUnLtf8HpJmubiOWg77QZjlwbsFRKIofEHdw== dependencies: - fs-extra "^9.0.1" - lmdb-store-0.9 "0.7.3" - msgpackr "^0.6.0" - nan "^2.14.1" + mkdirp "^1.0.4" + nan "^2.14.2" node-gyp-build "^4.2.3" - weak-lru-cache "^0.3.9" + weak-lru-cache "^0.4.1" + optionalDependencies: + msgpackr "^1.2.7" load-bmfont@^1.3.1, load-bmfont@^1.4.0: version "1.4.0" @@ -20314,27 +20303,20 @@ ms@^2.1.3: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -msgpackr-extract@^0.3.5, msgpackr-extract@^0.3.6: - version "0.3.6" - resolved "https://registry.yarnpkg.com/msgpackr-extract/-/msgpackr-extract-0.3.6.tgz#f20c0a278e44377471b1fa2a3a75a32c87693755" - integrity sha512-ASUrKn0MEFp2onn+xUBQhCNR6+RzzQAcs6p0RqKQ9sfqOZjzQ21a+ASyzgh+QAJrKcWBiZLN6L4+iXKPJV6pXg== +msgpackr-extract@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/msgpackr-extract/-/msgpackr-extract-1.0.6.tgz#65713a266de36d7dce8edcb766a7b4e5aa5f12ca" + integrity sha512-xDZjVWdBDQqohlB14/tbuhtFGsnQqZxE9/aJNz4iTxfGANtuajSCC6wJ72vYPR/k3hKtgLyL76E7xi6t2hcS+Q== dependencies: - nan "^2.14.1" + nan "^2.14.2" node-gyp-build "^4.2.3" -msgpackr@^0.5.3: - version "0.5.4" - resolved "https://registry.yarnpkg.com/msgpackr/-/msgpackr-0.5.4.tgz#c21c03d5e132d2e54d0b9ced02a75b1f48413380" - integrity sha512-ILEWtIWwd5ESWHKoVjJ4GP7JWkpuAUJ20qi2j2qEC6twecBmK4E6YG3QW847OpmvdAhMJGq2LoDJRn/kNERTeQ== - optionalDependencies: - msgpackr-extract "^0.3.5" - -msgpackr@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/msgpackr/-/msgpackr-0.6.0.tgz#57f75f80247ed3bcb937b7b5b0c7ef48123bee80" - integrity sha512-GF+hXvh1mn9f43ndEigmyTwomeJ/5OQWaxJTMeFrXouGTCYvzEtnF7Bd1DTCxOHXO85BeWFgUVA7Ev61R2KkVw== +msgpackr@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/msgpackr/-/msgpackr-1.2.7.tgz#374e17a294b52f2155bf3d54182a0888be286cad" + integrity sha512-U6Sef+XZjTRQoXZt9GPFf/2h4yhjsB2Kvb1Uq6N19wliryVvrq8onYPzgFnm9/byjDzpRWbJqXesp2AqX15Htg== optionalDependencies: - msgpackr-extract "^0.3.6" + msgpackr-extract "^1.0.6" multicast-dns-service-types@^1.1.0: version "1.1.0" @@ -20434,6 +20416,11 @@ nan@^2.13.2, nan@^2.14.0, nan@^2.14.1: resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01" integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw== +nan@^2.14.2: + version "2.14.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" + integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== + nano-css@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/nano-css/-/nano-css-5.2.1.tgz#73b8470fa40b028a134d3393ae36bbb34b9fa332" @@ -29549,10 +29536,10 @@ wcwidth@^1.0.1: dependencies: defaults "^1.0.3" -weak-lru-cache@^0.3.9: - version "0.3.9" - resolved "https://registry.yarnpkg.com/weak-lru-cache/-/weak-lru-cache-0.3.9.tgz#9e56920d4115e8542625d8ef8cc278cbd97f7624" - integrity sha512-WqAu3wzbHQvjSi/vgYhidZkf2p7L3Z8iDEIHnqvE31EQQa7Vh7PDOphrRJ1oxlW8JIjgr2HvMcRe9Q1GhW2NPw== +weak-lru-cache@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/weak-lru-cache/-/weak-lru-cache-0.4.1.tgz#d1a0600f00576e9cf836d069e4dc119b8234abde" + integrity sha512-NJS+edQXFd9zHuWuAWfieUDj0pAS6Qg6HX0NW548vhoU+aOSkRFZvcJC988PjVkrH/Q/p/E18bPctGoUE++Pdw== web-namespaces@^1.0.0: version "1.1.4" From f972174867b9b347302badeeaca04d7be43c5904 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 15 Apr 2021 15:14:18 -0600 Subject: [PATCH 38/68] [Maps][File upload] fix layer in preview mode shows different results after uploading geojson file when feature-count exceeds ES-search limit (#97157) * [Maps][File upload] fix layer in preview mode shows different results after uploading geojson file when feature-count exceeds ES-search limit * i18n clean up * review feedback Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../components/json_upload_and_parse.tsx | 37 ++++--- x-pack/plugins/file_upload/public/index.ts | 2 +- .../public/lazy_load_bundle/index.ts | 22 +++-- .../layer_template.test.tsx | 1 + .../layers/file_upload_wizard/config.tsx | 16 ++- .../layers/file_upload_wizard/wizard.tsx | 99 ++++++++++--------- .../classes/layers/layer_wizard_registry.ts | 1 + .../flyout_body/flyout_body.tsx | 1 + .../add_layer_panel/view.tsx | 3 + .../translations/translations/ja-JP.json | 2 - .../translations/translations/zh-CN.json | 2 - 11 files changed, 108 insertions(+), 78 deletions(-) diff --git a/x-pack/plugins/file_upload/public/components/json_upload_and_parse.tsx b/x-pack/plugins/file_upload/public/components/json_upload_and_parse.tsx index d73c6e9c5fb3a..5863b18d0cea0 100644 --- a/x-pack/plugins/file_upload/public/components/json_upload_and_parse.tsx +++ b/x-pack/plugins/file_upload/public/components/json_upload_and_parse.tsx @@ -12,7 +12,7 @@ import { getIndexPatternService } from '../kibana_services'; import { GeoJsonUploadForm, OnFileSelectParameters } from './geojson_upload_form'; import { ImportCompleteView } from './import_complete_view'; import { ES_FIELD_TYPES } from '../../../../../src/plugins/data/public'; -import { FileUploadComponentProps } from '../lazy_load_bundle'; +import type { FileUploadComponentProps, FileUploadGeoResults } from '../lazy_load_bundle'; import { ImportResults } from '../importer'; import { GeoJsonImporter } from '../importer/geojson_importer'; import { Settings } from '../../common'; @@ -93,7 +93,7 @@ export class JsonUploadAndParse extends Component + [ES_FIELD_TYPES.GEO_POINT as string, ES_FIELD_TYPES.GEO_SHAPE as string].includes( + field.type + ) + ); + if (!geoField) { + throw new Error('geo field not created in index pattern'); + } + results = { + indexPatternId: indexPattern.id, + geoFieldName: geoField.name, + geoFieldType: geoField.type as ES_FIELD_TYPES.GEO_POINT | ES_FIELD_TYPES.GEO_SHAPE, + docCount: importResults.docCount !== undefined ? importResults.docCount : 0, + }; } catch (error) { if (this._isMounted) { this.setState({ @@ -200,7 +218,7 @@ export class JsonUploadAndParse extends Component { this._geojsonImporter = importer; - this.props.onFileUpload( + this.props.onFileSelect( { type: 'FeatureCollection', features, @@ -245,7 +260,7 @@ export class JsonUploadAndParse extends Component { diff --git a/x-pack/plugins/file_upload/public/index.ts b/x-pack/plugins/file_upload/public/index.ts index 0c81779130d87..bb69a1b2efb05 100644 --- a/x-pack/plugins/file_upload/public/index.ts +++ b/x-pack/plugins/file_upload/public/index.ts @@ -16,4 +16,4 @@ export * from '../common'; export * from './importer/types'; export { FileUploadPluginStart } from './plugin'; -export { FileUploadComponentProps } from './lazy_load_bundle'; +export { FileUploadComponentProps, FileUploadGeoResults } from './lazy_load_bundle'; diff --git a/x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts b/x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts index 807d2fae52bf8..e1e00bee37159 100644 --- a/x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts +++ b/x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts @@ -7,21 +7,25 @@ import React from 'react'; import { FeatureCollection } from 'geojson'; -import { IndexPattern } from 'src/plugins/data/public'; import { HttpStart } from 'src/core/public'; -import { IImporter, ImportFactoryOptions, ImportResults } from '../importer'; +import { IImporter, ImportFactoryOptions } from '../importer'; import { getHttp } from '../kibana_services'; +import { ES_FIELD_TYPES } from '../../../../../src/plugins/data/public'; + +export interface FileUploadGeoResults { + indexPatternId: string; + geoFieldName: string; + geoFieldType: ES_FIELD_TYPES.GEO_POINT | ES_FIELD_TYPES.GEO_SHAPE; + docCount: number; +} export interface FileUploadComponentProps { isIndexingTriggered: boolean; - onFileUpload: (geojsonFile: FeatureCollection, name: string, previewCoverage: number) => void; - onFileRemove: () => void; + onFileSelect: (geojsonFile: FeatureCollection, name: string, previewCoverage: number) => void; + onFileClear: () => void; onIndexReady: (indexReady: boolean) => void; - onIndexingComplete: (results: { - indexDataResp: ImportResults; - indexPattern: IndexPattern; - }) => void; - onIndexingError: () => void; + onUploadComplete: (results: FileUploadGeoResults) => void; + onUploadError: () => void; } let loadModulesPromise: Promise; diff --git a/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.test.tsx b/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.test.tsx index 93896d50b2b99..6c352b4a39340 100644 --- a/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.test.tsx +++ b/x-pack/plugins/maps/public/classes/layers/choropleth_layer_wizard/layer_template.test.tsx @@ -31,6 +31,7 @@ const renderWizardArguments = { previewLayers: () => {}, mapColors: [], currentStepId: null, + isOnFinalStep: false, enableNextBtn: () => {}, disableNextBtn: () => {}, startStepLoading: () => {}, diff --git a/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/config.tsx b/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/config.tsx index 49f35c491ccf0..f914bf79d6a9f 100644 --- a/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/config.tsx +++ b/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/config.tsx @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { LayerWizard, RenderWizardArguments } from '../../layers/layer_wizard_registry'; -import { ClientFileCreateSourceEditor, INDEX_SETUP_STEP_ID, INDEXING_STEP_ID } from './wizard'; +import { ClientFileCreateSourceEditor, UPLOAD_STEPS } from './wizard'; import { getFileUpload } from '../../../kibana_services'; export const uploadLayerWizardConfig: LayerWizard = { @@ -30,17 +30,23 @@ export const uploadLayerWizardConfig: LayerWizard = { icon: 'importAction', prerequisiteSteps: [ { - id: INDEX_SETUP_STEP_ID, - label: i18n.translate('xpack.maps.fileUploadWizard.importFileSetupLabel', { + id: UPLOAD_STEPS.CONFIGURE_UPLOAD, + label: i18n.translate('xpack.maps.fileUploadWizard.configureUploadLabel', { defaultMessage: 'Import file', }), }, { - id: INDEXING_STEP_ID, - label: i18n.translate('xpack.maps.fileUploadWizard.indexingLabel', { + id: UPLOAD_STEPS.UPLOAD, + label: i18n.translate('xpack.maps.fileUploadWizard.uploadLabel', { defaultMessage: 'Importing file', }), }, + { + id: UPLOAD_STEPS.ADD_DOCUMENT_LAYER, + label: i18n.translate('xpack.maps.fileUploadWizard.configureDocumentLayerLabel', { + defaultMessage: 'Add as document layer', + }), + }, ], renderWizard: (renderWizardArguments: RenderWizardArguments) => { return ; diff --git a/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx b/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx index a6ff14d20f238..79902cf620511 100644 --- a/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx +++ b/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx @@ -5,25 +5,25 @@ * 2.0. */ +import _ from 'lodash'; import { i18n } from '@kbn/i18n'; import React, { Component } from 'react'; import { FeatureCollection } from 'geojson'; import { EuiPanel } from '@elastic/eui'; -import { IndexPattern, IFieldType } from 'src/plugins/data/public'; -import { - ES_GEO_FIELD_TYPE, - DEFAULT_MAX_RESULT_WINDOW, - SCALING_TYPES, -} from '../../../../common/constants'; +import { DEFAULT_MAX_RESULT_WINDOW, SCALING_TYPES } from '../../../../common/constants'; import { getFileUpload } from '../../../kibana_services'; import { GeoJsonFileSource } from '../../sources/geojson_file_source'; import { VectorLayer } from '../../layers/vector_layer'; import { createDefaultLayerDescriptor } from '../../sources/es_search_source'; import { RenderWizardArguments } from '../../layers/layer_wizard_registry'; -import { FileUploadComponentProps, ImportResults } from '../../../../../file_upload/public'; +import { FileUploadComponentProps, FileUploadGeoResults } from '../../../../../file_upload/public'; +import { ES_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; -export const INDEX_SETUP_STEP_ID = 'INDEX_SETUP_STEP_ID'; -export const INDEXING_STEP_ID = 'INDEXING_STEP_ID'; +export enum UPLOAD_STEPS { + CONFIGURE_UPLOAD = 'CONFIGURE_UPLOAD', + UPLOAD = 'UPLOAD', + ADD_DOCUMENT_LAYER = 'ADD_DOCUMENT_LAYER', +} enum INDEXING_STAGE { READY = 'READY', @@ -35,6 +35,7 @@ enum INDEXING_STAGE { interface State { indexingStage: INDEXING_STAGE | null; fileUploadComponent: React.ComponentType | null; + results?: FileUploadGeoResults; } export class ClientFileCreateSourceEditor extends Component { @@ -56,14 +57,40 @@ export class ClientFileCreateSourceEditor extends Component { + const esSearchSourceConfig = { + indexPatternId: results.indexPatternId, + geoField: results.geoFieldName, + // Only turn on bounds filter for large doc counts + filterByMapBounds: results.docCount > DEFAULT_MAX_RESULT_WINDOW, + scalingType: + results.geoFieldType === ES_FIELD_TYPES.GEO_POINT + ? SCALING_TYPES.CLUSTERS + : SCALING_TYPES.LIMIT, + }; + this.props.previewLayers([ + createDefaultLayerDescriptor(esSearchSourceConfig, this.props.mapColors), + ]); + this.props.advanceToNextStep(); + }); + async _loadFileUploadComponent() { const fileUploadComponent = await getFileUpload().getFileUploadComponent(); if (this._isMounted) { @@ -71,7 +98,7 @@ export class ClientFileCreateSourceEditor extends Component { + _onFileSelect = (geojsonFile: FeatureCollection, name: string, previewCoverage: number) => { if (!this._isMounted) { return; } @@ -103,41 +130,22 @@ export class ClientFileCreateSourceEditor extends Component { + _onFileClear = () => { + this.props.previewLayers([]); + }; + + _onUploadComplete = (results: FileUploadGeoResults) => { if (!this._isMounted) { return; } + this.setState({ results }); + this.setState({ indexingStage: INDEXING_STAGE.SUCCESS }); this.props.advanceToNextStep(); - - const geoField = results.indexPattern.fields.find((field: IFieldType) => - [ES_GEO_FIELD_TYPE.GEO_POINT as string, ES_GEO_FIELD_TYPE.GEO_SHAPE as string].includes( - field.type - ) - ); - if (!results.indexPattern.id || !geoField) { - this.setState({ indexingStage: INDEXING_STAGE.ERROR }); - this.props.previewLayers([]); - } else { - const esSearchSourceConfig = { - indexPatternId: results.indexPattern.id, - geoField: geoField.name, - // Only turn on bounds filter for large doc counts - // @ts-ignore - filterByMapBounds: results.indexDataResp.docCount > DEFAULT_MAX_RESULT_WINDOW, - scalingType: - geoField.type === ES_GEO_FIELD_TYPE.GEO_POINT - ? SCALING_TYPES.CLUSTERS - : SCALING_TYPES.LIMIT, - }; - this.setState({ indexingStage: INDEXING_STAGE.SUCCESS }); - this.props.previewLayers([ - createDefaultLayerDescriptor(esSearchSourceConfig, this.props.mapColors), - ]); - } + this.props.enableNextBtn(); }; - _onIndexingError = () => { + _onUploadError = () => { if (!this._isMounted) { return; } @@ -161,11 +169,6 @@ export class ClientFileCreateSourceEditor extends Component { - this.props.previewLayers([]); - }; - render() { if (!this.state.fileUploadComponent) { return null; @@ -176,11 +179,11 @@ export class ClientFileCreateSourceEditor extends Component ); diff --git a/x-pack/plugins/maps/public/classes/layers/layer_wizard_registry.ts b/x-pack/plugins/maps/public/classes/layers/layer_wizard_registry.ts index 2d30acf285d6f..824d9835380ec 100644 --- a/x-pack/plugins/maps/public/classes/layers/layer_wizard_registry.ts +++ b/x-pack/plugins/maps/public/classes/layers/layer_wizard_registry.ts @@ -16,6 +16,7 @@ export type RenderWizardArguments = { mapColors: string[]; // multi-step arguments for wizards that supply 'prerequisiteSteps' currentStepId: string | null; + isOnFinalStep: boolean; enableNextBtn: () => void; disableNextBtn: () => void; startStepLoading: () => void; diff --git a/x-pack/plugins/maps/public/connected_components/add_layer_panel/flyout_body/flyout_body.tsx b/x-pack/plugins/maps/public/connected_components/add_layer_panel/flyout_body/flyout_body.tsx index 4facfe72a6c6a..bcc7bbae8a9cc 100644 --- a/x-pack/plugins/maps/public/connected_components/add_layer_panel/flyout_body/flyout_body.tsx +++ b/x-pack/plugins/maps/public/connected_components/add_layer_panel/flyout_body/flyout_body.tsx @@ -28,6 +28,7 @@ export const FlyoutBody = (props: Props) => { previewLayers: props.previewLayers, mapColors: props.mapColors, currentStepId: props.currentStepId, + isOnFinalStep: props.isOnFinalStep, enableNextBtn: props.enableNextBtn, disableNextBtn: props.disableNextBtn, startStepLoading: props.startStepLoading, diff --git a/x-pack/plugins/maps/public/connected_components/add_layer_panel/view.tsx b/x-pack/plugins/maps/public/connected_components/add_layer_panel/view.tsx index 35672d7369404..0774798eab46d 100644 --- a/x-pack/plugins/maps/public/connected_components/add_layer_panel/view.tsx +++ b/x-pack/plugins/maps/public/connected_components/add_layer_panel/view.tsx @@ -168,6 +168,9 @@ export class AddLayerPanel extends Component { previewLayers={this._previewLayers} showBackButton={!this.state.isStepLoading} currentStepId={this.state.currentStep ? this.state.currentStep.id : null} + isOnFinalStep={ + this.state.currentStep ? this.state.currentStep.id === ADD_LAYER_STEP_ID : false + } enableNextBtn={this._enableNextBtn} disableNextBtn={this._disableNextBtn} startStepLoading={this._startStepLoading} diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 7868984702609..9ce17b052e3ab 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -12428,8 +12428,6 @@ "xpack.maps.featureRegistry.mapsFeatureName": "マップ", "xpack.maps.fields.percentileMedianLabek": "中間", "xpack.maps.fileUploadWizard.description": "Elasticsearch で GeoJSON データにインデックスします", - "xpack.maps.fileUploadWizard.importFileSetupLabel": "ファイルのインポート", - "xpack.maps.fileUploadWizard.indexingLabel": "ファイルをインポートしています", "xpack.maps.fileUploadWizard.title": "GeoJSONをアップロード", "xpack.maps.filterEditor.applyGlobalQueryCheckboxLabel": "レイヤーデータにグローバルフィルターを適用", "xpack.maps.filterEditor.applyGlobalTimeCheckboxLabel": "グローバル時刻をレイヤーデータに適用", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index af7013e52d76e..4a2f682ca2f4f 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -12595,8 +12595,6 @@ "xpack.maps.featureRegistry.mapsFeatureName": "Maps", "xpack.maps.fields.percentileMedianLabek": "中值", "xpack.maps.fileUploadWizard.description": "在 Elasticsearch 中索引 GeoJSON 数据", - "xpack.maps.fileUploadWizard.importFileSetupLabel": "导入文件", - "xpack.maps.fileUploadWizard.indexingLabel": "正在导入文件", "xpack.maps.fileUploadWizard.title": "上传 GeoJSON", "xpack.maps.filterEditor.applyGlobalQueryCheckboxLabel": "将全局筛选应用到图层数据", "xpack.maps.filterEditor.applyGlobalTimeCheckboxLabel": "将全局时间应用于图层数据", From 78937e3bb469ba5be25fe7785e629a3442da2125 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Thu, 15 Apr 2021 17:15:43 -0400 Subject: [PATCH 39/68] [Fleet] Remove fleet agent routes and related services (#97206) --- .../plugins/fleet/common/constants/routes.ts | 5 - .../common/openapi/paths/agents@enroll.yaml | 48 -- .../openapi/paths/agents@{agent_id}@acks.yaml | 32 -- .../paths/agents@{agent_id}@checkin.yaml | 60 --- .../full_agent_policy_kibana_config.test.ts | 40 -- .../full_agent_policy_kibana_config.ts | 27 -- x-pack/plugins/fleet/common/types/index.ts | 1 - .../fleet/common/types/models/settings.ts | 3 - .../fleet/mock/plugin_configuration.ts | 1 - .../plugins/fleet/scripts/dev_agent/index.js | 9 - .../plugins/fleet/scripts/dev_agent/script.ts | 143 ------ x-pack/plugins/fleet/scripts/readme.md | 8 - .../plugins/fleet/server/constants/index.ts | 1 - x-pack/plugins/fleet/server/index.ts | 36 +- x-pack/plugins/fleet/server/plugin.ts | 30 +- .../server/routes/agent/acks_handlers.test.ts | 104 ----- .../server/routes/agent/acks_handlers.ts | 59 --- .../server/routes/agent/actions_handlers.ts | 3 +- .../fleet/server/routes/agent/handlers.ts | 90 ---- .../fleet/server/routes/agent/index.ts | 159 +------ x-pack/plugins/fleet/server/routes/index.ts | 7 +- .../server/routes/install_script/index.ts | 60 --- .../server/routes/limited_concurrency.test.ts | 222 ---------- .../server/routes/limited_concurrency.ts | 90 ---- .../fleet/server/routes/setup/handlers.ts | 30 +- .../fleet/server/routes/setup/index.ts | 8 +- .../fleet/server/saved_objects/index.ts | 3 - .../security_solution/to_v7_13_0.test.ts | 23 - .../security_solution/to_v7_13_0.ts | 22 +- .../saved_objects/migrations/to_v7_10_0.ts | 1 + .../saved_objects/migrations/to_v7_13_0.ts | 5 + .../server/services/agent_policy.test.ts | 20 +- .../fleet/server/services/agent_policy.ts | 41 +- .../fleet/server/services/agents/acks.test.ts | 382 ---------------- .../fleet/server/services/agents/acks.ts | 216 --------- .../server/services/agents/actions.test.ts | 47 -- .../fleet/server/services/agents/actions.ts | 390 +++------------- .../server/services/agents/checkin/index.ts | 118 ----- .../agents/checkin/rxjs_utils.test.ts | 30 -- .../services/agents/checkin/rxjs_utils.ts | 83 ---- .../server/services/agents/checkin/state.ts | 59 --- .../agents/checkin/state_connected_agents.ts | 56 --- .../agents/checkin/state_new_actions.test.ts | 276 ------------ .../agents/checkin/state_new_actions.ts | 295 ------------- .../server/services/agents/enroll.test.ts | 57 --- .../fleet/server/services/agents/enroll.ts | 111 ----- .../fleet/server/services/agents/index.ts | 3 - .../fleet/server/services/agents/reassign.ts | 3 +- .../fleet/server/services/agents/setup.ts | 8 - .../fleet/server/services/agents/unenroll.ts | 3 +- .../fleet/server/services/agents/upgrade.ts | 3 +- .../fleet/server/services/api_keys/index.ts | 43 -- .../fleet/server/services/app_context.ts | 5 - .../fleet_server/saved_object_migrations.ts | 5 - .../server/services/preconfiguration.test.ts | 6 - .../plugins/fleet/server/services/settings.ts | 20 +- x-pack/plugins/fleet/server/services/setup.ts | 67 --- x-pack/plugins/fleet/server/types/index.tsx | 3 - .../fleet/server/types/rest_spec/settings.ts | 5 +- .../common/experimental_features.ts | 1 - .../security_solution/server/config.ts | 2 +- .../endpoint/lib/artifacts/manifest.test.ts | 47 -- .../server/endpoint/lib/artifacts/manifest.ts | 11 +- .../lib/artifacts/manifest_entry.test.ts | 4 +- .../endpoint/lib/artifacts/manifest_entry.ts | 14 +- .../migrate_artifacts_to_fleet.test.ts | 16 +- .../artifacts/migrate_artifacts_to_fleet.ts | 8 +- .../server/endpoint/lib/artifacts/mocks.ts | 10 +- .../artifacts/download_artifact.test.ts | 349 --------------- .../routes/artifacts/download_artifact.ts | 100 ----- .../server/endpoint/routes/artifacts/index.ts | 8 - .../routes/metadata/support/unenroll.ts | 5 +- .../manifest_manager/manifest_manager.ts | 38 +- .../security_solution/server/plugin.ts | 10 +- .../agent_policy_with_agents_setup.ts | 70 +-- .../fleet_api_integration/apis/agents/acks.ts | 250 ----------- .../apis/agents/checkin.ts | 114 ----- .../apis/agents/complete_flow.ts | 376 ---------------- .../apis/agents/enroll.ts | 225 ---------- .../apis/agents_setup.ts | 128 ------ .../test/fleet_api_integration/apis/index.js | 7 - .../apis/settings/update.ts | 38 +- .../endpoint/artifacts/api_feature/data.json | 218 --------- .../artifacts/fleet_artifacts/data.json | 109 ----- .../artifacts/fleet_artifacts/mappings.json | 64 --- .../apps/endpoint/policy_details.ts | 30 +- .../apis/artifacts/index.ts | 417 ------------------ .../apis/index.ts | 1 - 88 files changed, 189 insertions(+), 6166 deletions(-) delete mode 100644 x-pack/plugins/fleet/common/openapi/paths/agents@enroll.yaml delete mode 100644 x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@acks.yaml delete mode 100644 x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@checkin.yaml delete mode 100644 x-pack/plugins/fleet/common/services/full_agent_policy_kibana_config.test.ts delete mode 100644 x-pack/plugins/fleet/common/services/full_agent_policy_kibana_config.ts delete mode 100644 x-pack/plugins/fleet/scripts/dev_agent/index.js delete mode 100644 x-pack/plugins/fleet/scripts/dev_agent/script.ts delete mode 100644 x-pack/plugins/fleet/scripts/readme.md delete mode 100644 x-pack/plugins/fleet/server/routes/agent/acks_handlers.test.ts delete mode 100644 x-pack/plugins/fleet/server/routes/agent/acks_handlers.ts delete mode 100644 x-pack/plugins/fleet/server/routes/install_script/index.ts delete mode 100644 x-pack/plugins/fleet/server/routes/limited_concurrency.test.ts delete mode 100644 x-pack/plugins/fleet/server/routes/limited_concurrency.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/acks.test.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/acks.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/actions.test.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/checkin/index.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/checkin/rxjs_utils.test.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/checkin/rxjs_utils.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/checkin/state.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/checkin/state_connected_agents.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.test.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/enroll.test.ts delete mode 100644 x-pack/plugins/fleet/server/services/agents/enroll.ts delete mode 100644 x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.test.ts delete mode 100644 x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.ts delete mode 100644 x-pack/plugins/security_solution/server/endpoint/routes/artifacts/index.ts delete mode 100644 x-pack/test/fleet_api_integration/apis/agents/acks.ts delete mode 100644 x-pack/test/fleet_api_integration/apis/agents/checkin.ts delete mode 100644 x-pack/test/fleet_api_integration/apis/agents/complete_flow.ts delete mode 100644 x-pack/test/fleet_api_integration/apis/agents/enroll.ts delete mode 100644 x-pack/test/fleet_api_integration/apis/agents_setup.ts delete mode 100644 x-pack/test/functional/es_archives/endpoint/artifacts/api_feature/data.json delete mode 100644 x-pack/test/functional/es_archives/endpoint/artifacts/fleet_artifacts/data.json delete mode 100644 x-pack/test/functional/es_archives/endpoint/artifacts/fleet_artifacts/mappings.json delete mode 100644 x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts diff --git a/x-pack/plugins/fleet/common/constants/routes.ts b/x-pack/plugins/fleet/common/constants/routes.ts index 9c2947b836b9b..5aeba4bc3881d 100644 --- a/x-pack/plugins/fleet/common/constants/routes.ts +++ b/x-pack/plugins/fleet/common/constants/routes.ts @@ -97,11 +97,6 @@ export const AGENT_API_ROUTES = { UPGRADE_PATTERN: `${API_ROOT}/agents/{agentId}/upgrade`, BULK_UPGRADE_PATTERN: `${API_ROOT}/agents/bulk_upgrade`, }; -export const AGENT_API_ROUTES_7_9 = { - CHECKIN_PATTERN: `${FLEET_API_ROOT_7_9}/agents/{agentId}/checkin`, - ACKS_PATTERN: `${FLEET_API_ROOT_7_9}/agents/{agentId}/acks`, - ENROLL_PATTERN: `${FLEET_API_ROOT_7_9}/agents/enroll`, -}; export const ENROLLMENT_API_KEY_ROUTES = { CREATE_PATTERN: `${API_ROOT}/enrollment-api-keys`, diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@enroll.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@enroll.yaml deleted file mode 100644 index 1946a65e33fdc..0000000000000 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@enroll.yaml +++ /dev/null @@ -1,48 +0,0 @@ -post: - summary: Fleet - Agent - Enroll - tags: [] - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - action: - type: string - item: - $ref: ../components/schemas/agent.yaml - operationId: post-fleet-agents-enroll - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - requestBody: - content: - application/json: - schema: - type: object - properties: - type: - type: string - enum: - - PERMANENT - - EPHEMERAL - - TEMPORARY - shared_id: - type: string - deprecated: true - metadata: - type: object - required: - - local - - user_provided - properties: - local: - $ref: ../components/schemas/agent_metadata.yaml - user_provided: - $ref: ../components/schemas/agent_metadata.yaml - required: - - type - - metadata - security: - - Enrollment API Key: [] diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@acks.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@acks.yaml deleted file mode 100644 index 6728554bf542e..0000000000000 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@acks.yaml +++ /dev/null @@ -1,32 +0,0 @@ -parameters: - - schema: - type: string - name: agentId - in: path - required: true -post: - summary: Fleet - Agent - Acks - tags: [] - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - action: - type: string - enum: - - acks - required: - - action - operationId: post-fleet-agents-agentId-acks - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - requestBody: - content: - application/json: - schema: - type: object - properties: {} diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@checkin.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@checkin.yaml deleted file mode 100644 index cc797c7356603..0000000000000 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@checkin.yaml +++ /dev/null @@ -1,60 +0,0 @@ -parameters: - - schema: - type: string - name: agentId - in: path - required: true -post: - summary: Fleet - Agent - Check In - tags: [] - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - action: - type: string - enum: - - checkin - actions: - type: array - items: - type: object - properties: - agent_id: - type: string - data: - type: object - id: - type: string - created_at: - type: string - format: date-time - type: - type: string - required: - - agent_id - - data - - id - - created_at - - type - operationId: post-fleet-agents-agentId-checkin - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - security: - - Access API Key: [] - requestBody: - content: - application/json: - schema: - type: object - properties: - local_metadata: - $ref: ../components/schemas/agent_metadata.yaml - events: - type: array - items: - $ref: ../components/schemas/new_agent_event.yaml diff --git a/x-pack/plugins/fleet/common/services/full_agent_policy_kibana_config.test.ts b/x-pack/plugins/fleet/common/services/full_agent_policy_kibana_config.test.ts deleted file mode 100644 index 07e728b928c48..0000000000000 --- a/x-pack/plugins/fleet/common/services/full_agent_policy_kibana_config.test.ts +++ /dev/null @@ -1,40 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { getFullAgentPolicyKibanaConfig } from './full_agent_policy_kibana_config'; - -describe('Fleet - getFullAgentPolicyKibanaConfig', () => { - it('should return no path when there is no path', () => { - expect(getFullAgentPolicyKibanaConfig(['http://localhost:5601'])).toEqual({ - hosts: ['localhost:5601'], - protocol: 'http', - }); - }); - it('should return correct config when there is a path', () => { - expect(getFullAgentPolicyKibanaConfig(['http://localhost:5601/ssg'])).toEqual({ - hosts: ['localhost:5601'], - protocol: 'http', - path: '/ssg/', - }); - }); - it('should return correct config when there is a path that ends in a slash', () => { - expect(getFullAgentPolicyKibanaConfig(['http://localhost:5601/ssg/'])).toEqual({ - hosts: ['localhost:5601'], - protocol: 'http', - path: '/ssg/', - }); - }); - it('should return correct config when there are multiple hosts', () => { - expect( - getFullAgentPolicyKibanaConfig(['http://localhost:5601/ssg/', 'http://localhost:3333/ssg/']) - ).toEqual({ - hosts: ['localhost:5601', 'localhost:3333'], - protocol: 'http', - path: '/ssg/', - }); - }); -}); diff --git a/x-pack/plugins/fleet/common/services/full_agent_policy_kibana_config.ts b/x-pack/plugins/fleet/common/services/full_agent_policy_kibana_config.ts deleted file mode 100644 index 6b2709cc1961d..0000000000000 --- a/x-pack/plugins/fleet/common/services/full_agent_policy_kibana_config.ts +++ /dev/null @@ -1,27 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { FullAgentPolicyKibanaConfig } from '../types'; - -export function getFullAgentPolicyKibanaConfig(kibanaUrls: string[]): FullAgentPolicyKibanaConfig { - // paths and protocol are validated to be the same for all urls, so use the first to get them - const firstUrlParsed = new URL(kibanaUrls[0]); - const config: FullAgentPolicyKibanaConfig = { - // remove the : from http: - protocol: firstUrlParsed.protocol.replace(':', ''), - hosts: kibanaUrls.map((url) => new URL(url).host), - }; - - // add path if user provided one - if (firstUrlParsed.pathname !== '/') { - // make sure the path ends with / - config.path = firstUrlParsed.pathname.endsWith('/') - ? firstUrlParsed.pathname - : `${firstUrlParsed.pathname}/`; - } - return config; -} diff --git a/x-pack/plugins/fleet/common/types/index.ts b/x-pack/plugins/fleet/common/types/index.ts index cdea56448f3a2..03584a48ff17c 100644 --- a/x-pack/plugins/fleet/common/types/index.ts +++ b/x-pack/plugins/fleet/common/types/index.ts @@ -15,7 +15,6 @@ export interface FleetConfigType { registryProxyUrl?: string; agents: { enabled: boolean; - fleetServerEnabled: boolean; tlsCheckDisabled: boolean; pollingRequestTimeout: number; maxConcurrentConnections: number; diff --git a/x-pack/plugins/fleet/common/types/models/settings.ts b/x-pack/plugins/fleet/common/types/models/settings.ts index d6932f9a4d83f..2d7e90a3424d7 100644 --- a/x-pack/plugins/fleet/common/types/models/settings.ts +++ b/x-pack/plugins/fleet/common/types/models/settings.ts @@ -10,9 +10,6 @@ import type { SavedObjectAttributes } from 'src/core/public'; export interface BaseSettings { has_seen_add_data_notice?: boolean; fleet_server_hosts: string[]; - // TODO remove as part of https://github.com/elastic/kibana/issues/94303 - kibana_urls: string[]; - kibana_ca_sha256?: string; } export interface Settings extends BaseSettings { diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts b/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts index 81ef6a6703c34..5d53425607361 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts @@ -14,7 +14,6 @@ export const createConfigurationMock = (): FleetConfigType => { registryProxyUrl: '', agents: { enabled: true, - fleetServerEnabled: false, tlsCheckDisabled: true, pollingRequestTimeout: 1000, maxConcurrentConnections: 100, diff --git a/x-pack/plugins/fleet/scripts/dev_agent/index.js b/x-pack/plugins/fleet/scripts/dev_agent/index.js deleted file mode 100644 index 28004b679e59a..0000000000000 --- a/x-pack/plugins/fleet/scripts/dev_agent/index.js +++ /dev/null @@ -1,9 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -require('../../../../../src/setup_node_env'); -require('./script'); diff --git a/x-pack/plugins/fleet/scripts/dev_agent/script.ts b/x-pack/plugins/fleet/scripts/dev_agent/script.ts deleted file mode 100644 index b4bdea0c28996..0000000000000 --- a/x-pack/plugins/fleet/scripts/dev_agent/script.ts +++ /dev/null @@ -1,143 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import os from 'os'; - -import type { ToolingLog } from '@kbn/dev-utils'; -import { createFlagError, run } from '@kbn/dev-utils'; -import fetch from 'node-fetch'; - -import type { - Agent as _Agent, - PostAgentCheckinRequest, - PostAgentCheckinResponse, - PostAgentEnrollRequest, - PostAgentEnrollResponse, -} from '../../common/types'; -import * as kibanaPackage from '../../package.json'; - -// @ts-ignore -// Using the ts-ignore because we are importing directly from a json to a script file -const version = kibanaPackage.version; -const CHECKIN_INTERVAL = 3000; // 3 seconds - -type Agent = Pick<_Agent, 'id' | 'access_api_key'>; - -let closing = false; - -process.once('SIGINT', () => { - closing = true; -}); - -run( - async ({ flags, log }) => { - if (!flags.kibanaUrl || typeof flags.kibanaUrl !== 'string') { - throw createFlagError('please provide a single --path flag'); - } - - if (!flags.enrollmentApiKey || typeof flags.enrollmentApiKey !== 'string') { - throw createFlagError('please provide a single --enrollmentApiKey flag'); - } - const kibanaUrl = flags.kibanaUrl || 'http://localhost:5601'; - const agent = await enroll(kibanaUrl, flags.enrollmentApiKey, log); - - log.info('Enrolled with sucess', agent); - - while (!closing) { - await checkin(kibanaUrl, agent, log); - await new Promise((resolve, reject) => setTimeout(() => resolve(), CHECKIN_INTERVAL)); - } - }, - { - description: ` - Run a fleet development agent. - `, - flags: { - string: ['kibanaUrl', 'enrollmentApiKey'], - help: ` - --kibanaUrl kibanaURL to run the fleet agent - --enrollmentApiKey enrollment api key - `, - }, - } -); - -async function checkin(kibanaURL: string, agent: Agent, log: ToolingLog) { - const body: PostAgentCheckinRequest['body'] = { - events: [ - { - type: 'STATE', - subtype: 'RUNNING', - message: 'state changed from STOPPED to RUNNING', - timestamp: new Date().toISOString(), - payload: { - random: 'data', - state: 'RUNNING', - previous_state: 'STOPPED', - }, - agent_id: agent.id, - }, - ], - }; - const res = await fetch(`${kibanaURL}/api/fleet/agents/${agent.id}/checkin`, { - method: 'POST', - body: JSON.stringify(body), - headers: { - 'kbn-xsrf': 'xxx', - Authorization: `ApiKey ${agent.access_api_key}`, - 'Content-Type': 'application/json', - }, - }); - - if (res.status === 403) { - closing = true; - log.info('Unenrolling agent'); - return; - } - - const obj: PostAgentCheckinResponse = await res.json(); - log.info('checkin', obj); -} - -async function enroll(kibanaURL: string, apiKey: string, log: ToolingLog): Promise { - const body: PostAgentEnrollRequest['body'] = { - type: 'PERMANENT', - metadata: { - local: { - host: 'localhost', - ip: '127.0.0.1', - system: `${os.type()} ${os.release()}`, - memory: os.totalmem(), - elastic: { agent: { version } }, - }, - user_provided: { - dev_agent_version: '0.0.1', - region: 'us-east', - }, - }, - }; - const res = await fetch(`${kibanaURL}/api/fleet/agents/enroll`, { - method: 'POST', - body: JSON.stringify(body), - headers: { - 'kbn-xsrf': 'xxx', - Authorization: `ApiKey ${apiKey}`, - 'Content-Type': 'application/json', - }, - }); - const obj: PostAgentEnrollResponse = await res.json(); - - if (!res.ok) { - log.error(JSON.stringify(obj, null, 2)); - throw new Error('unable to enroll'); - } - - return { - id: obj.item.id, - access_api_key: obj.item.access_api_key, - }; -} diff --git a/x-pack/plugins/fleet/scripts/readme.md b/x-pack/plugins/fleet/scripts/readme.md deleted file mode 100644 index efec40b0aba1e..0000000000000 --- a/x-pack/plugins/fleet/scripts/readme.md +++ /dev/null @@ -1,8 +0,0 @@ -### Dev agents - -You can run a development fleet agent that is going to enroll and checkin every 3 seconds. -For this you can run the following command in the fleet pluging directory. - -``` -node scripts/dev_agent --enrollmentApiKey= --kibanaUrl=http://localhost:5603/qed -``` diff --git a/x-pack/plugins/fleet/server/constants/index.ts b/x-pack/plugins/fleet/server/constants/index.ts index b3b6bb5b4ea22..343fa756e79c3 100644 --- a/x-pack/plugins/fleet/server/constants/index.ts +++ b/x-pack/plugins/fleet/server/constants/index.ts @@ -24,7 +24,6 @@ export { DATA_STREAM_API_ROUTES, PACKAGE_POLICY_API_ROUTES, AGENT_API_ROUTES, - AGENT_API_ROUTES_7_9, AGENT_POLICY_API_ROUTES, AGENTS_SETUP_API_ROUTES, ENROLLMENT_API_KEY_ROUTES, diff --git a/x-pack/plugins/fleet/server/index.ts b/x-pack/plugins/fleet/server/index.ts index c66dd471690eb..c1baa43f4d588 100644 --- a/x-pack/plugins/fleet/server/index.ts +++ b/x-pack/plugins/fleet/server/index.ts @@ -9,12 +9,6 @@ import { schema } from '@kbn/config-schema'; import type { TypeOf } from '@kbn/config-schema'; import type { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server'; -import { - AGENT_POLICY_ROLLOUT_RATE_LIMIT_INTERVAL_MS, - AGENT_POLICY_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL, - AGENT_POLLING_REQUEST_TIMEOUT_MS, -} from '../common'; - import { PreconfiguredPackagesSchema, PreconfiguredAgentPoliciesSchema } from './types'; import { FleetPlugin } from './plugin'; @@ -40,6 +34,14 @@ export const config: PluginConfigDescriptor = { deprecations: ({ renameFromRoot, unused }) => [ renameFromRoot('xpack.ingestManager', 'xpack.fleet'), renameFromRoot('xpack.fleet.fleet', 'xpack.fleet.agents'), + unused('agents.kibana.ca_sha256'), + unused('agents.kibana.host'), + unused('agents.maxConcurrentConnections'), + unused('agents.agentPolicyRolloutRateLimitIntervalMs'), + unused('agents.agentPolicyRolloutRateLimitRequestPerInterval'), + unused('agents.pollingRequestTimeout'), + unused('agents.tlsCheckDisabled'), + unused('agents.fleetServerEnabled'), ], schema: schema.object({ enabled: schema.boolean({ defaultValue: true }), @@ -47,22 +49,6 @@ export const config: PluginConfigDescriptor = { registryProxyUrl: schema.maybe(schema.uri({ scheme: ['http', 'https'] })), agents: schema.object({ enabled: schema.boolean({ defaultValue: true }), - fleetServerEnabled: schema.boolean({ defaultValue: false }), - tlsCheckDisabled: schema.boolean({ defaultValue: false }), - pollingRequestTimeout: schema.number({ - defaultValue: AGENT_POLLING_REQUEST_TIMEOUT_MS, - min: 5000, - }), - maxConcurrentConnections: schema.number({ defaultValue: 0 }), - kibana: schema.object({ - host: schema.maybe( - schema.oneOf([ - schema.uri({ scheme: ['http', 'https'] }), - schema.arrayOf(schema.uri({ scheme: ['http', 'https'] }), { minSize: 1 }), - ]) - ), - ca_sha256: schema.maybe(schema.string()), - }), elasticsearch: schema.object({ host: schema.maybe(schema.string()), ca_sha256: schema.maybe(schema.string()), @@ -72,12 +58,6 @@ export const config: PluginConfigDescriptor = { hosts: schema.maybe(schema.arrayOf(schema.uri({ scheme: ['http', 'https'] }))), }) ), - agentPolicyRolloutRateLimitIntervalMs: schema.number({ - defaultValue: AGENT_POLICY_ROLLOUT_RATE_LIMIT_INTERVAL_MS, - }), - agentPolicyRolloutRateLimitRequestPerInterval: schema.number({ - defaultValue: AGENT_POLICY_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL, - }), }), packages: schema.maybe(PreconfiguredPackagesSchema), agentPolicies: schema.maybe(PreconfiguredAgentPoliciesSchema), diff --git a/x-pack/plugins/fleet/server/plugin.ts b/x-pack/plugins/fleet/server/plugin.ts index d25b1e13904db..704df5970b345 100644 --- a/x-pack/plugins/fleet/server/plugin.ts +++ b/x-pack/plugins/fleet/server/plugin.ts @@ -52,16 +52,13 @@ import { } from './constants'; import { registerSavedObjects, registerEncryptedSavedObjects } from './saved_objects'; import { - registerLimitedConcurrencyRoutes, registerEPMRoutes, registerPackagePolicyRoutes, registerDataStreamRoutes, registerAgentPolicyRoutes, registerSetupRoutes, registerAgentAPIRoutes, - registerElasticAgentRoutes, registerEnrollmentApiKeyRoutes, - registerInstallScriptRoutes, registerOutputRoutes, registerSettingsRoutes, registerAppRoutes, @@ -86,7 +83,6 @@ import { getAgentsByKuery, getAgentById, } from './services/agents'; -import { agentCheckinState } from './services/agents/checkin/state'; import { registerFleetUsageCollector } from './collectors/register'; import { getInstallation } from './services/epm/packages'; import { makeRouterEnforcingSuperuser } from './routes/security'; @@ -220,8 +216,6 @@ export class FleetPlugin const config = await this.config$.pipe(first()).toPromise(); - appContextService.fleetServerEnabled = config.agents.fleetServerEnabled; - registerSavedObjects(core.savedObjects, deps.encryptedSavedObjects); registerEncryptedSavedObjects(deps.encryptedSavedObjects); @@ -281,26 +275,8 @@ export class FleetPlugin // Conditional config routes if (config.agents.enabled) { - const isESOCanEncrypt = deps.encryptedSavedObjects.canEncrypt; - if (!isESOCanEncrypt) { - if (this.logger) { - this.logger.warn( - 'Fleet APIs are disabled because the Encrypted Saved Objects plugin is missing encryption key. Please set xpack.encryptedSavedObjects.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command.' - ); - } - } else { - // we currently only use this global interceptor if fleet is enabled - // since it would run this func on *every* req (other plugins, CSS, etc) - registerLimitedConcurrencyRoutes(core, config); - registerAgentAPIRoutes(routerSuperuserOnly, config); - registerEnrollmentApiKeyRoutes(routerSuperuserOnly); - registerInstallScriptRoutes({ - router: routerSuperuserOnly, - basePath: core.http.basePath, - }); - // Do not enforce superuser role for Elastic Agent routes - registerElasticAgentRoutes(router, config); - } + registerAgentAPIRoutes(routerSuperuserOnly, config); + registerEnrollmentApiKeyRoutes(routerSuperuserOnly); } } } @@ -322,7 +298,6 @@ export class FleetPlugin logger: this.logger, }); licenseService.start(this.licensing$); - agentCheckinState.start(); const fleetServerSetup = startFleetServerSetup(); @@ -366,6 +341,5 @@ export class FleetPlugin public async stop() { appContextService.stop(); licenseService.stop(); - agentCheckinState.stop(); } } diff --git a/x-pack/plugins/fleet/server/routes/agent/acks_handlers.test.ts b/x-pack/plugins/fleet/server/routes/agent/acks_handlers.test.ts deleted file mode 100644 index c4cd58226697c..0000000000000 --- a/x-pack/plugins/fleet/server/routes/agent/acks_handlers.test.ts +++ /dev/null @@ -1,104 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { - ElasticsearchClient, - KibanaResponseFactory, - RequestHandlerContext, - SavedObjectsClientContract, -} from 'kibana/server'; - -import { - elasticsearchServiceMock, - httpServerMock, - savedObjectsClientMock, -} from '../../../../../../src/core/server/mocks'; -import type { PostAgentAcksResponse } from '../../../common/types/rest_spec'; -import { AckEventSchema } from '../../types/models'; -import type { AcksService } from '../../services/agents'; - -import { postAgentAcksHandlerBuilder } from './acks_handlers'; - -describe('test acks schema', () => { - it('validate that ack event schema expect action id', async () => { - expect(() => - AckEventSchema.validate({ - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - agent_id: 'agent', - message: 'hello', - payload: 'payload', - }) - ).toThrow(Error); - - expect( - AckEventSchema.validate({ - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - agent_id: 'agent', - action_id: 'actionId', - message: 'hello', - payload: 'payload', - }) - ).toBeTruthy(); - }); -}); - -describe('test acks handlers', () => { - let mockResponse: jest.Mocked; - let mockSavedObjectsClient: jest.Mocked; - let mockElasticsearchClient: jest.Mocked; - - beforeEach(() => { - mockSavedObjectsClient = savedObjectsClientMock.create(); - mockElasticsearchClient = elasticsearchServiceMock.createClusterClient().asInternalUser; - mockResponse = httpServerMock.createResponseFactory(); - }); - - it('should succeed on valid agent event', async () => { - const mockRequest = httpServerMock.createKibanaRequest({ - headers: { - authorization: 'ApiKey TmVqTDBIQUJsRkw1em52R1ZIUF86NS1NaTItdHFUTHFHbThmQW1Fb0ljUQ==', - }, - body: { - events: [ - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: 'action1', - agent_id: 'agent', - message: 'message', - }, - ], - }, - }); - - const ackService: AcksService = { - acknowledgeAgentActions: jest.fn().mockReturnValueOnce([ - { - type: 'POLICY_CHANGE', - id: 'action1', - }, - ]), - authenticateAgentWithAccessToken: jest.fn().mockReturnValueOnce({ - id: 'agent', - }), - getSavedObjectsClientContract: jest.fn().mockReturnValueOnce(mockSavedObjectsClient), - getElasticsearchClientContract: jest.fn().mockReturnValueOnce(mockElasticsearchClient), - saveAgentEvents: jest.fn(), - } as jest.Mocked; - - const postAgentAcksHandler = postAgentAcksHandlerBuilder(ackService); - await postAgentAcksHandler(({} as unknown) as RequestHandlerContext, mockRequest, mockResponse); - expect(mockResponse.ok.mock.calls[0][0]?.body as PostAgentAcksResponse).toEqual({ - action: 'acks', - }); - }); -}); diff --git a/x-pack/plugins/fleet/server/routes/agent/acks_handlers.ts b/x-pack/plugins/fleet/server/routes/agent/acks_handlers.ts deleted file mode 100644 index d4c84d19546c9..0000000000000 --- a/x-pack/plugins/fleet/server/routes/agent/acks_handlers.ts +++ /dev/null @@ -1,59 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -// handlers that handle events from agents in response to actions received - -import type { RequestHandler } from 'kibana/server'; - -import type { AcksService } from '../../services/agents'; -import type { AgentEvent } from '../../../common/types/models'; -import type { PostAgentAcksRequest, PostAgentAcksResponse } from '../../../common/types/rest_spec'; -import { defaultIngestErrorHandler } from '../../errors'; - -export const postAgentAcksHandlerBuilder = function ( - ackService: AcksService -): RequestHandler { - return async (context, request, response) => { - try { - const soClient = ackService.getSavedObjectsClientContract(request); - const esClient = ackService.getElasticsearchClientContract(); - const agent = await ackService.authenticateAgentWithAccessToken(esClient, request); - const agentEvents = request.body.events as AgentEvent[]; - - // validate that all events are for the authorized agent obtained from the api key - const notAuthorizedAgentEvent = agentEvents.filter( - (agentEvent) => agentEvent.agent_id !== agent.id - ); - - if (notAuthorizedAgentEvent && notAuthorizedAgentEvent.length > 0) { - return response.badRequest({ - body: - 'agent events contains events with different agent id from currently authorized agent', - }); - } - - const agentActions = await ackService.acknowledgeAgentActions( - soClient, - esClient, - agent, - agentEvents - ); - - if (agentActions.length > 0) { - await ackService.saveAgentEvents(soClient, agentEvents); - } - - const body: PostAgentAcksResponse = { - action: 'acks', - }; - - return response.ok({ body }); - } catch (error) { - return defaultIngestErrorHandler({ error, response }); - } - }; -}; diff --git a/x-pack/plugins/fleet/server/routes/agent/actions_handlers.ts b/x-pack/plugins/fleet/server/routes/agent/actions_handlers.ts index f1e32f325dd0c..42769d4caf6cb 100644 --- a/x-pack/plugins/fleet/server/routes/agent/actions_handlers.ts +++ b/x-pack/plugins/fleet/server/routes/agent/actions_handlers.ts @@ -24,14 +24,13 @@ export const postNewAgentActionHandlerBuilder = function ( > { return async (context, request, response) => { try { - const soClient = context.core.savedObjects.client; const esClient = context.core.elasticsearch.client.asInternalUser; const agent = await actionsService.getAgent(esClient, request.params.agentId); const newAgentAction = request.body.action; - const savedAgentAction = await actionsService.createAgentAction(soClient, esClient, { + const savedAgentAction = await actionsService.createAgentAction(esClient, { created_at: new Date().toISOString(), ...newAgentAction, agent_id: agent.id, diff --git a/x-pack/plugins/fleet/server/routes/agent/handlers.ts b/x-pack/plugins/fleet/server/routes/agent/handlers.ts index 5ac264e29f079..c485cae4b3e37 100644 --- a/x-pack/plugins/fleet/server/routes/agent/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/agent/handlers.ts @@ -7,17 +7,13 @@ import type { RequestHandler } from 'src/core/server'; import type { TypeOf } from '@kbn/config-schema'; -import { AbortController } from 'abort-controller'; import type { GetAgentsResponse, GetOneAgentResponse, GetOneAgentEventsResponse, - PostAgentCheckinResponse, - PostAgentEnrollResponse, GetAgentStatusResponse, PutAgentReassignResponse, - PostAgentEnrollRequest, PostBulkAgentReassignResponse, } from '../../../common/types'; import type { @@ -30,12 +26,9 @@ import type { PutAgentReassignRequestSchema, PostBulkAgentReassignRequestSchema, } from '../../types'; -import type { PostAgentCheckinRequest } from '../../types'; import { defaultIngestErrorHandler } from '../../errors'; import { licenseService } from '../../services'; import * as AgentService from '../../services/agents'; -import * as APIKeyService from '../../services/api_keys'; -import { appContextService } from '../../services/app_context'; export const getAgentHandler: RequestHandler< TypeOf @@ -153,89 +146,6 @@ export const updateAgentHandler: RequestHandler< } }; -export const postAgentCheckinHandler: RequestHandler< - PostAgentCheckinRequest['params'], - undefined, - PostAgentCheckinRequest['body'] -> = async (context, request, response) => { - try { - const soClient = appContextService.getInternalUserSOClient(request); - const esClient = appContextService.getInternalUserESClient(); - const agent = await AgentService.authenticateAgentWithAccessToken(esClient, request); - const abortController = new AbortController(); - request.events.aborted$.subscribe(() => { - abortController.abort(); - }); - const signal = abortController.signal; - - const { actions } = await AgentService.agentCheckin( - soClient, - esClient, - agent, - { - events: request.body.events || [], - localMetadata: request.body.local_metadata, - status: request.body.status, - }, - { signal } - ); - const body: PostAgentCheckinResponse = { - action: 'checkin', - actions: actions.map((a) => ({ - agent_id: agent.id, - type: a.type, - data: a.data, - id: a.id, - created_at: a.created_at, - })), - }; - - return response.ok({ body }); - } catch (error) { - return defaultIngestErrorHandler({ error, response }); - } -}; - -export const postAgentEnrollHandler: RequestHandler< - undefined, - undefined, - PostAgentEnrollRequest['body'] -> = async (context, request, response) => { - try { - const soClient = appContextService.getInternalUserSOClient(request); - const esClient = context.core.elasticsearch.client.asInternalUser; - const { apiKeyId } = APIKeyService.parseApiKeyFromHeaders(request.headers); - const enrollmentAPIKey = await APIKeyService.getEnrollmentAPIKeyById(esClient, apiKeyId); - - if (!enrollmentAPIKey || !enrollmentAPIKey.active) { - return response.unauthorized({ - body: { message: 'Invalid Enrollment API Key' }, - }); - } - - const agent = await AgentService.enroll( - soClient, - request.body.type, - enrollmentAPIKey.policy_id as string, - { - userProvided: request.body.metadata.user_provided, - local: request.body.metadata.local, - } - ); - const body: PostAgentEnrollResponse = { - action: 'created', - item: { - ...agent, - status: AgentService.getAgentStatus(agent), - }, - }; - - return response.ok({ body }); - } catch (error) { - return defaultIngestErrorHandler({ error, response }); - } -}; - export const getAgentsHandler: RequestHandler< undefined, TypeOf diff --git a/x-pack/plugins/fleet/server/routes/agent/index.ts b/x-pack/plugins/fleet/server/routes/agent/index.ts index ec75768e816fe..9b33443d0dca3 100644 --- a/x-pack/plugins/fleet/server/routes/agent/index.ts +++ b/x-pack/plugins/fleet/server/routes/agent/index.ts @@ -5,38 +5,25 @@ * 2.0. */ -import type { IRouter, RouteValidationResultFactory } from 'src/core/server'; -import Ajv from 'ajv'; +import type { IRouter } from 'src/core/server'; -import { - PLUGIN_ID, - AGENT_API_ROUTES, - AGENT_API_ROUTES_7_9, - LIMITED_CONCURRENCY_ROUTE_TAG, - AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS, -} from '../../constants'; +import { PLUGIN_ID, AGENT_API_ROUTES } from '../../constants'; import { GetAgentsRequestSchema, GetOneAgentRequestSchema, GetOneAgentEventsRequestSchema, UpdateAgentRequestSchema, DeleteAgentRequestSchema, - PostAgentCheckinRequestBodyJSONSchema, - PostAgentCheckinRequestParamsJSONSchema, - PostAgentAcksRequestParamsJSONSchema, - PostAgentAcksRequestBodyJSONSchema, PostAgentUnenrollRequestSchema, PostBulkAgentUnenrollRequestSchema, GetAgentStatusRequestSchema, PostNewAgentActionRequestSchema, PutAgentReassignRequestSchema, PostBulkAgentReassignRequestSchema, - PostAgentEnrollRequestBodyJSONSchema, PostAgentUpgradeRequestSchema, PostBulkAgentUpgradeRequestSchema, } from '../../types'; import * as AgentService from '../../services/agents'; -import { appContextService } from '../../services'; import type { FleetConfigType } from '../..'; import { @@ -45,40 +32,14 @@ import { updateAgentHandler, deleteAgentHandler, getAgentEventsHandler, - postAgentCheckinHandler, - postAgentEnrollHandler, getAgentStatusForAgentPolicyHandler, putAgentsReassignHandler, postBulkAgentsReassignHandler, } from './handlers'; -import { postAgentAcksHandlerBuilder } from './acks_handlers'; import { postNewAgentActionHandlerBuilder } from './actions_handlers'; import { postAgentUnenrollHandler, postBulkAgentsUnenrollHandler } from './unenroll_handler'; import { postAgentUpgradeHandler, postBulkAgentsUpgradeHandler } from './upgrade_handler'; -const ajv = new Ajv({ - coerceTypes: true, - useDefaults: true, - removeAdditional: true, - allErrors: false, - nullable: true, -}); - -function schemaErrorsText(errors: Ajv.ErrorObject[], dataVar: any) { - return errors.map((e) => `${dataVar + (e.dataPath || '')} ${e.message}`).join(', '); -} - -function makeValidator(jsonSchema: any) { - const validator = ajv.compile(jsonSchema); - return function validateWithAJV(data: any, r: RouteValidationResultFactory) { - if (validator(data)) { - return r.ok(data); - } - - return r.badRequest(schemaErrorsText(validator.errors || [], data)); - }; -} - export const registerAPIRoutes = (router: IRouter, config: FleetConfigType) => { // Get one router.get( @@ -205,119 +166,3 @@ export const registerAPIRoutes = (router: IRouter, config: FleetConfigType) => { postBulkAgentsUnenrollHandler ); }; - -export const registerElasticAgentRoutes = (router: IRouter, config: FleetConfigType) => { - const pollingRequestTimeout = config.agents.pollingRequestTimeout; - // Agent checkin - router.post( - { - path: AGENT_API_ROUTES.CHECKIN_PATTERN, - validate: { - params: makeValidator(PostAgentCheckinRequestParamsJSONSchema), - body: makeValidator(PostAgentCheckinRequestBodyJSONSchema), - }, - options: { - tags: [], - // If the timeout is too short, do not set socket idle timeout and rely on Kibana global socket timeout - ...(pollingRequestTimeout && pollingRequestTimeout > AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS - ? { - timeout: { - idleSocket: pollingRequestTimeout, - }, - } - : {}), - }, - }, - postAgentCheckinHandler - ); - // BWC for agent <= 7.9 - router.post( - { - path: AGENT_API_ROUTES_7_9.CHECKIN_PATTERN, - validate: { - params: makeValidator(PostAgentCheckinRequestParamsJSONSchema), - body: makeValidator(PostAgentCheckinRequestBodyJSONSchema), - }, - options: { - tags: [], - // If the timeout is too short, do not set socket idle timeout and rely on Kibana global socket timeout - ...(pollingRequestTimeout && pollingRequestTimeout > AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS - ? { - timeout: { - idleSocket: pollingRequestTimeout, - }, - } - : {}), - }, - }, - postAgentCheckinHandler - ); - - // Agent enrollment - router.post( - { - path: AGENT_API_ROUTES.ENROLL_PATTERN, - validate: { - body: makeValidator(PostAgentEnrollRequestBodyJSONSchema), - }, - options: { tags: [LIMITED_CONCURRENCY_ROUTE_TAG] }, - }, - postAgentEnrollHandler - ); - // BWC for agent <= 7.9 - router.post( - { - path: AGENT_API_ROUTES_7_9.ENROLL_PATTERN, - validate: { - body: makeValidator(PostAgentEnrollRequestBodyJSONSchema), - }, - options: { tags: [LIMITED_CONCURRENCY_ROUTE_TAG] }, - }, - postAgentEnrollHandler - ); - - // Agent acks - router.post( - { - path: AGENT_API_ROUTES.ACKS_PATTERN, - validate: { - params: makeValidator(PostAgentAcksRequestParamsJSONSchema), - body: makeValidator(PostAgentAcksRequestBodyJSONSchema), - }, - options: { tags: [LIMITED_CONCURRENCY_ROUTE_TAG] }, - }, - postAgentAcksHandlerBuilder({ - acknowledgeAgentActions: AgentService.acknowledgeAgentActions, - authenticateAgentWithAccessToken: AgentService.authenticateAgentWithAccessToken, - getSavedObjectsClientContract: appContextService.getInternalUserSOClient.bind( - appContextService - ), - getElasticsearchClientContract: appContextService.getInternalUserESClient.bind( - appContextService - ), - saveAgentEvents: AgentService.saveAgentEvents, - }) - ); - // BWC for agent <= 7.9 - router.post( - { - path: AGENT_API_ROUTES_7_9.ACKS_PATTERN, - validate: { - params: makeValidator(PostAgentAcksRequestParamsJSONSchema), - body: makeValidator(PostAgentAcksRequestBodyJSONSchema), - }, - options: { tags: [LIMITED_CONCURRENCY_ROUTE_TAG] }, - }, - postAgentAcksHandlerBuilder({ - acknowledgeAgentActions: AgentService.acknowledgeAgentActions, - authenticateAgentWithAccessToken: AgentService.authenticateAgentWithAccessToken, - getSavedObjectsClientContract: appContextService.getInternalUserSOClient.bind( - appContextService - ), - getElasticsearchClientContract: appContextService.getInternalUserESClient.bind( - appContextService - ), - saveAgentEvents: AgentService.saveAgentEvents, - }) - ); -}; diff --git a/x-pack/plugins/fleet/server/routes/index.ts b/x-pack/plugins/fleet/server/routes/index.ts index 4d5a4b1e64dc0..bcdc2db54ae0c 100644 --- a/x-pack/plugins/fleet/server/routes/index.ts +++ b/x-pack/plugins/fleet/server/routes/index.ts @@ -10,14 +10,9 @@ export { registerRoutes as registerPackagePolicyRoutes } from './package_policy' export { registerRoutes as registerDataStreamRoutes } from './data_streams'; export { registerRoutes as registerEPMRoutes } from './epm'; export { registerRoutes as registerSetupRoutes } from './setup'; -export { - registerAPIRoutes as registerAgentAPIRoutes, - registerElasticAgentRoutes as registerElasticAgentRoutes, -} from './agent'; +export { registerAPIRoutes as registerAgentAPIRoutes } from './agent'; export { registerRoutes as registerEnrollmentApiKeyRoutes } from './enrollment_api_key'; -export { registerRoutes as registerInstallScriptRoutes } from './install_script'; export { registerRoutes as registerOutputRoutes } from './output'; export { registerRoutes as registerSettingsRoutes } from './settings'; export { registerRoutes as registerAppRoutes } from './app'; -export { registerLimitedConcurrencyRoutes } from './limited_concurrency'; export { registerRoutes as registerPreconfigurationRoutes } from './preconfiguration'; diff --git a/x-pack/plugins/fleet/server/routes/install_script/index.ts b/x-pack/plugins/fleet/server/routes/install_script/index.ts deleted file mode 100644 index 673fe237700cf..0000000000000 --- a/x-pack/plugins/fleet/server/routes/install_script/index.ts +++ /dev/null @@ -1,60 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import url from 'url'; - -import type { BasePath, KibanaRequest } from 'src/core/server'; -import type { IRouter } from 'src/core/server'; - -import { INSTALL_SCRIPT_API_ROUTES } from '../../constants'; -import { getScript } from '../../services/install_script'; -import { InstallScriptRequestSchema } from '../../types'; -import { appContextService, settingsService } from '../../services'; - -function getInternalUserSOClient(request: KibanaRequest) { - // soClient as kibana internal users, be carefull on how you use it, security is not enabled - return appContextService.getSavedObjects().getScopedClient(request, { - excludedWrappers: ['security'], - }); -} - -export const registerRoutes = ({ - router, -}: { - router: IRouter; - basePath: Pick; -}) => { - router.get( - { - path: INSTALL_SCRIPT_API_ROUTES, - validate: InstallScriptRequestSchema, - options: { tags: [], authRequired: false }, - }, - async function getInstallScriptHandler( - context, - request: KibanaRequest<{ osType: 'macos' }>, - response - ) { - const soClient = getInternalUserSOClient(request); - const http = appContextService.getHttpSetup(); - const serverInfo = http.getServerInfo(); - const basePath = http.basePath; - const kibanaUrls = (await settingsService.getSettings(soClient)).kibana_urls || [ - url.format({ - protocol: serverInfo.protocol, - hostname: serverInfo.hostname, - port: serverInfo.port, - pathname: basePath.serverBasePath, - }), - ]; - - const script = getScript(request.params.osType, kibanaUrls[0]); - - return response.ok({ body: script }); - } - ); -}; diff --git a/x-pack/plugins/fleet/server/routes/limited_concurrency.test.ts b/x-pack/plugins/fleet/server/routes/limited_concurrency.test.ts deleted file mode 100644 index c645d8fceaab8..0000000000000 --- a/x-pack/plugins/fleet/server/routes/limited_concurrency.test.ts +++ /dev/null @@ -1,222 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { coreMock, httpServerMock, httpServiceMock } from 'src/core/server/mocks'; - -import type { FleetConfigType } from '../index'; - -import { - createLimitedPreAuthHandler, - isLimitedRoute, - registerLimitedConcurrencyRoutes, -} from './limited_concurrency'; - -describe('registerLimitedConcurrencyRoutes', () => { - test(`doesn't call registerOnPreAuth if maxConcurrentConnections is 0`, async () => { - const mockSetup = coreMock.createSetup(); - const mockConfig = { agents: { maxConcurrentConnections: 0 } } as FleetConfigType; - registerLimitedConcurrencyRoutes(mockSetup, mockConfig); - - expect(mockSetup.http.registerOnPreAuth).not.toHaveBeenCalled(); - }); - - test(`calls registerOnPreAuth once if maxConcurrentConnections is 1`, async () => { - const mockSetup = coreMock.createSetup(); - const mockConfig = { agents: { maxConcurrentConnections: 1 } } as FleetConfigType; - registerLimitedConcurrencyRoutes(mockSetup, mockConfig); - - expect(mockSetup.http.registerOnPreAuth).toHaveBeenCalledTimes(1); - }); - - test(`calls registerOnPreAuth once if maxConcurrentConnections is 1000`, async () => { - const mockSetup = coreMock.createSetup(); - const mockConfig = { agents: { maxConcurrentConnections: 1000 } } as FleetConfigType; - registerLimitedConcurrencyRoutes(mockSetup, mockConfig); - - expect(mockSetup.http.registerOnPreAuth).toHaveBeenCalledTimes(1); - }); -}); - -// assertions for calls to .decrease are commented out because it's called on the -// "req.events.completed$ observable (which) will never emit from a mocked request in a jest unit test environment" -// https://github.com/elastic/kibana/pull/72338#issuecomment-661908791 -describe('preAuthHandler', () => { - test(`ignores routes when !isMatch`, async () => { - const mockMaxCounter = { - increase: jest.fn(), - decrease: jest.fn(), - lessThanMax: jest.fn(), - }; - const preAuthHandler = createLimitedPreAuthHandler({ - isMatch: jest.fn().mockImplementation(() => false), - maxCounter: mockMaxCounter, - }); - - const mockRequest = httpServerMock.createKibanaRequest({ - path: '/no/match', - }); - const mockResponse = httpServerMock.createResponseFactory(); - const mockPreAuthToolkit = httpServiceMock.createOnPreAuthToolkit(); - - await preAuthHandler(mockRequest, mockResponse, mockPreAuthToolkit); - - expect(mockMaxCounter.increase).not.toHaveBeenCalled(); - expect(mockMaxCounter.decrease).not.toHaveBeenCalled(); - expect(mockMaxCounter.lessThanMax).not.toHaveBeenCalled(); - expect(mockPreAuthToolkit.next).toHaveBeenCalledTimes(1); - }); - - test(`ignores routes which don't have the correct tag`, async () => { - const mockMaxCounter = { - increase: jest.fn(), - decrease: jest.fn(), - lessThanMax: jest.fn(), - }; - const preAuthHandler = createLimitedPreAuthHandler({ - isMatch: isLimitedRoute, - maxCounter: mockMaxCounter, - }); - - const mockRequest = httpServerMock.createKibanaRequest({ - path: '/no/match', - }); - const mockResponse = httpServerMock.createResponseFactory(); - const mockPreAuthToolkit = httpServiceMock.createOnPreAuthToolkit(); - - await preAuthHandler(mockRequest, mockResponse, mockPreAuthToolkit); - - expect(mockMaxCounter.increase).not.toHaveBeenCalled(); - expect(mockMaxCounter.decrease).not.toHaveBeenCalled(); - expect(mockMaxCounter.lessThanMax).not.toHaveBeenCalled(); - expect(mockPreAuthToolkit.next).toHaveBeenCalledTimes(1); - }); - - test(`processes routes which have the correct tag`, async () => { - const mockMaxCounter = { - increase: jest.fn(), - decrease: jest.fn(), - lessThanMax: jest.fn().mockImplementation(() => true), - }; - const preAuthHandler = createLimitedPreAuthHandler({ - isMatch: isLimitedRoute, - maxCounter: mockMaxCounter, - }); - - const mockRequest = httpServerMock.createKibanaRequest({ - path: '/should/match', - routeTags: ['ingest:limited-concurrency'], - }); - const mockResponse = httpServerMock.createResponseFactory(); - const mockPreAuthToolkit = httpServiceMock.createOnPreAuthToolkit(); - - await preAuthHandler(mockRequest, mockResponse, mockPreAuthToolkit); - - // will call lessThanMax because isMatch succeeds - expect(mockMaxCounter.lessThanMax).toHaveBeenCalledTimes(1); - // will not error because lessThanMax is true - expect(mockResponse.customError).not.toHaveBeenCalled(); - expect(mockPreAuthToolkit.next).toHaveBeenCalledTimes(1); - }); - - test(`updates the counter when isMatch & lessThanMax`, async () => { - const mockMaxCounter = { - increase: jest.fn(), - decrease: jest.fn(), - lessThanMax: jest.fn().mockImplementation(() => true), - }; - const preAuthHandler = createLimitedPreAuthHandler({ - isMatch: jest.fn().mockImplementation(() => true), - maxCounter: mockMaxCounter, - }); - - const mockRequest = httpServerMock.createKibanaRequest(); - const mockResponse = httpServerMock.createResponseFactory(); - const mockPreAuthToolkit = httpServiceMock.createOnPreAuthToolkit(); - - await preAuthHandler(mockRequest, mockResponse, mockPreAuthToolkit); - - expect(mockMaxCounter.increase).toHaveBeenCalled(); - // expect(mockMaxCounter.decrease).toHaveBeenCalled(); - expect(mockPreAuthToolkit.next).toHaveBeenCalledTimes(1); - }); - - test(`lessThanMax ? next : error`, async () => { - const mockMaxCounter = { - increase: jest.fn(), - decrease: jest.fn(), - lessThanMax: jest - .fn() - // call 1 - .mockImplementationOnce(() => true) - // calls 2, 3, 4 - .mockImplementationOnce(() => false) - .mockImplementationOnce(() => false) - .mockImplementationOnce(() => false) - // calls 5+ - .mockImplementationOnce(() => true) - .mockImplementation(() => true), - }; - - const preAuthHandler = createLimitedPreAuthHandler({ - isMatch: isLimitedRoute, - maxCounter: mockMaxCounter, - }); - - function makeRequestExpectNext() { - const request = httpServerMock.createKibanaRequest({ - path: '/should/match/', - routeTags: ['ingest:limited-concurrency'], - }); - const response = httpServerMock.createResponseFactory(); - const toolkit = httpServiceMock.createOnPreAuthToolkit(); - - preAuthHandler(request, response, toolkit); - expect(toolkit.next).toHaveBeenCalledTimes(1); - expect(response.customError).not.toHaveBeenCalled(); - } - - function makeRequestExpectError() { - const request = httpServerMock.createKibanaRequest({ - path: '/should/match/', - routeTags: ['ingest:limited-concurrency'], - }); - const response = httpServerMock.createResponseFactory(); - const toolkit = httpServiceMock.createOnPreAuthToolkit(); - - preAuthHandler(request, response, toolkit); - expect(toolkit.next).not.toHaveBeenCalled(); - expect(response.customError).toHaveBeenCalledTimes(1); - expect(response.customError).toHaveBeenCalledWith({ - statusCode: 429, - body: 'Too Many Requests', - }); - } - - // request 1 succeeds - makeRequestExpectNext(); - expect(mockMaxCounter.increase).toHaveBeenCalledTimes(1); - // expect(mockMaxCounter.decrease).toHaveBeenCalledTimes(1); - - // requests 2, 3, 4 fail - makeRequestExpectError(); - makeRequestExpectError(); - makeRequestExpectError(); - - // requests 5+ succeed - makeRequestExpectNext(); - expect(mockMaxCounter.increase).toHaveBeenCalledTimes(2); - // expect(mockMaxCounter.decrease).toHaveBeenCalledTimes(2); - - makeRequestExpectNext(); - expect(mockMaxCounter.increase).toHaveBeenCalledTimes(3); - // expect(mockMaxCounter.decrease).toHaveBeenCalledTimes(3); - - makeRequestExpectNext(); - expect(mockMaxCounter.increase).toHaveBeenCalledTimes(4); - // expect(mockMaxCounter.decrease).toHaveBeenCalledTimes(4); - }); -}); diff --git a/x-pack/plugins/fleet/server/routes/limited_concurrency.ts b/x-pack/plugins/fleet/server/routes/limited_concurrency.ts deleted file mode 100644 index 6f9a2bc95ea20..0000000000000 --- a/x-pack/plugins/fleet/server/routes/limited_concurrency.ts +++ /dev/null @@ -1,90 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { KibanaRequest } from 'kibana/server'; -import type { - CoreSetup, - LifecycleResponseFactory, - OnPreAuthToolkit, - OnPreAuthHandler, -} from 'kibana/server'; - -import { LIMITED_CONCURRENCY_ROUTE_TAG } from '../../common'; -import type { FleetConfigType } from '../index'; - -export class MaxCounter { - constructor(private readonly max: number = 1) {} - private counter = 0; - valueOf() { - return this.counter; - } - increase() { - if (this.counter < this.max) { - this.counter += 1; - } - } - decrease() { - if (this.counter > 0) { - this.counter -= 1; - } - } - lessThanMax() { - return this.counter < this.max; - } -} - -export type IMaxCounter = Pick; - -export function isLimitedRoute(request: KibanaRequest) { - const tags = request.route.options.tags; - return !!tags.includes(LIMITED_CONCURRENCY_ROUTE_TAG); -} - -export function createLimitedPreAuthHandler({ - isMatch, - maxCounter, -}: { - isMatch: (request: KibanaRequest) => boolean; - maxCounter: IMaxCounter; -}): OnPreAuthHandler { - return function preAuthHandler( - request: KibanaRequest, - response: LifecycleResponseFactory, - toolkit: OnPreAuthToolkit - ) { - if (!isMatch(request)) { - return toolkit.next(); - } - - if (!maxCounter.lessThanMax()) { - return response.customError({ - body: 'Too Many Requests', - statusCode: 429, - }); - } - - maxCounter.increase(); - - request.events.completed$.toPromise().then(() => { - maxCounter.decrease(); - }); - - return toolkit.next(); - }; -} - -export function registerLimitedConcurrencyRoutes(core: CoreSetup, config: FleetConfigType) { - const max = config.agents.maxConcurrentConnections; - if (!max) return; - - core.http.registerOnPreAuth( - createLimitedPreAuthHandler({ - isMatch: isLimitedRoute, - maxCounter: new MaxCounter(max), - }) - ); -} diff --git a/x-pack/plugins/fleet/server/routes/setup/handlers.ts b/x-pack/plugins/fleet/server/routes/setup/handlers.ts index 41efb7b83d3be..b6aa9e29de9ee 100644 --- a/x-pack/plugins/fleet/server/routes/setup/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/setup/handlers.ts @@ -6,14 +6,12 @@ */ import type { RequestHandler } from 'src/core/server'; -import type { TypeOf } from '@kbn/config-schema'; import { appContextService } from '../../services'; import type { GetFleetStatusResponse, PostIngestSetupResponse } from '../../../common'; -import { setupFleet, setupIngestManager } from '../../services/setup'; +import { setupIngestManager } from '../../services/setup'; import { hasFleetServers } from '../../services/fleet_server'; import { defaultIngestErrorHandler } from '../../errors'; -import type { PostFleetSetupRequestSchema } from '../../types'; export const getFleetStatusHandler: RequestHandler = async (context, request, response) => { try { @@ -21,15 +19,12 @@ export const getFleetStatusHandler: RequestHandler = async (context, request, re .getSecurity() .authc.apiKeys.areAPIKeysEnabled(); const isFleetServerSetup = await hasFleetServers(appContextService.getInternalUserESClient()); - const canEncrypt = appContextService.getEncryptedSavedObjectsSetup()?.canEncrypt === true; const missingRequirements: GetFleetStatusResponse['missing_requirements'] = []; if (!isApiKeysEnabled) { missingRequirements.push('api_keys'); } - if (!canEncrypt) { - missingRequirements.push('encrypted_saved_object_encryption_key_required'); - } + if (!isFleetServerSetup) { missingRequirements.push('fleet_server'); } @@ -61,24 +56,3 @@ export const fleetSetupHandler: RequestHandler = async (context, request, respon return defaultIngestErrorHandler({ error, response }); } }; - -// TODO should be removed as part https://github.com/elastic/kibana/issues/94303 -export const fleetAgentSetupHandler: RequestHandler< - undefined, - undefined, - TypeOf -> = async (context, request, response) => { - try { - const soClient = context.core.savedObjects.client; - const esClient = context.core.elasticsearch.client.asCurrentUser; - const body: PostIngestSetupResponse = { isInitialized: true }; - await setupIngestManager(soClient, esClient); - await setupFleet(soClient, esClient, { forceRecreate: request.body?.forceRecreate === true }); - - return response.ok({ - body, - }); - } catch (error) { - return defaultIngestErrorHandler({ error, response }); - } -}; diff --git a/x-pack/plugins/fleet/server/routes/setup/index.ts b/x-pack/plugins/fleet/server/routes/setup/index.ts index a40e7138e0f95..d64c9f24f2610 100644 --- a/x-pack/plugins/fleet/server/routes/setup/index.ts +++ b/x-pack/plugins/fleet/server/routes/setup/index.ts @@ -9,9 +9,8 @@ import type { IRouter } from 'src/core/server'; import { PLUGIN_ID, AGENTS_SETUP_API_ROUTES, SETUP_API_ROUTE } from '../../constants'; import type { FleetConfigType } from '../../../common'; -import { PostFleetSetupRequestSchema } from '../../types'; -import { getFleetStatusHandler, fleetSetupHandler, fleetAgentSetupHandler } from './handlers'; +import { getFleetStatusHandler, fleetSetupHandler } from './handlers'; export const registerFleetSetupRoute = (router: IRouter) => { router.post( @@ -26,14 +25,15 @@ export const registerFleetSetupRoute = (router: IRouter) => { ); }; +// That route is used by agent to setup Fleet export const registerCreateFleetSetupRoute = (router: IRouter) => { router.post( { path: AGENTS_SETUP_API_ROUTES.CREATE_PATTERN, - validate: PostFleetSetupRequestSchema, + validate: false, options: { tags: [`access:${PLUGIN_ID}-all`] }, }, - fleetAgentSetupHandler + fleetSetupHandler ); }; diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index 58ec3972ca517..27725bfc637ee 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -61,9 +61,6 @@ const getSavedObjectTypes = ( properties: { fleet_server_hosts: { type: 'keyword' }, has_seen_add_data_notice: { type: 'boolean', index: false }, - // TODO remove as part of https://github.com/elastic/kibana/issues/94303 - kibana_urls: { type: 'keyword' }, - kibana_ca_sha256: { type: 'keyword' }, }, }, migrations: { diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.test.ts index 6897efbe94110..75e2922bd5149 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.test.ts @@ -12,8 +12,6 @@ import type { PackagePolicy } from '../../../../common'; import { migrationMocks } from '../../../../../../../src/core/server/mocks'; -import { appContextService } from '../../../services'; - import { migrateEndpointPackagePolicyToV7130 } from './to_v7_13_0'; describe('7.13.0 Endpoint Package Policy migration', () => { @@ -128,16 +126,6 @@ describe('7.13.0 Endpoint Package Policy migration', () => { const migrationContext = migrationMocks.createContext(); - beforeEach(() => { - // set `fleetServerEnabled` flag to true - appContextService.fleetServerEnabled = true; - }); - - afterEach(() => { - // set `fleetServerEnabled` flag back to false - appContextService.fleetServerEnabled = false; - }); - it('should adjust the relative url for all artifact manifests', () => { expect( migrateEndpointPackagePolicyToV7130(createOldPackagePolicySO(), migrationContext) @@ -154,15 +142,4 @@ describe('7.13.0 Endpoint Package Policy migration', () => { unchangedPackagePolicySo ); }); - - it('should NOT migrate artifact relative_url if fleetServerEnabled is false', () => { - const packagePolicySo = createOldPackagePolicySO(); - const unchangedPackagePolicySo = cloneDeep(packagePolicySo); - - appContextService.fleetServerEnabled = false; - - expect(migrateEndpointPackagePolicyToV7130(packagePolicySo, migrationContext)).toEqual( - unchangedPackagePolicySo - ); - }); }); diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.ts index 5eb0c7a6e3141..655ce37b4faaf 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.ts @@ -10,7 +10,6 @@ import type { SavedObjectMigrationFn } from 'kibana/server'; import type { PackagePolicy } from '../../../../common'; import { relativeDownloadUrlFromArtifact } from '../../../services/artifacts/mappings'; import type { ArtifactElasticsearchProperties } from '../../../services'; -import { appContextService } from '../../../services'; type ArtifactManifestList = Record< string, @@ -22,19 +21,16 @@ export const migrateEndpointPackagePolicyToV7130: SavedObjectMigrationFn< PackagePolicy > = (packagePolicyDoc) => { if (packagePolicyDoc.attributes.package?.name === 'endpoint') { - // Feature condition check here is temporary until v7.13 ships - if (appContextService.fleetServerEnabled) { - // Adjust all artifact URLs so that they point at fleet-server - const artifactList: ArtifactManifestList = - packagePolicyDoc.attributes?.inputs[0]?.config?.artifact_manifest.value.artifacts; + // Adjust all artifact URLs so that they point at fleet-server + const artifactList: ArtifactManifestList = + packagePolicyDoc.attributes?.inputs[0]?.config?.artifact_manifest.value.artifacts; - if (artifactList) { - for (const [identifier, artifactManifest] of Object.entries(artifactList)) { - artifactManifest.relative_url = relativeDownloadUrlFromArtifact({ - identifier, - decodedSha256: artifactManifest.decoded_sha256, - }); - } + if (artifactList) { + for (const [identifier, artifactManifest] of Object.entries(artifactList)) { + artifactManifest.relative_url = relativeDownloadUrlFromArtifact({ + identifier, + decodedSha256: artifactManifest.decoded_sha256, + }); } } } diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_10_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_10_0.ts index 97a5dd6e13eda..f3f6050a8cde2 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_10_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_10_0.ts @@ -91,6 +91,7 @@ export const migrateSettingsToV7100: SavedObjectMigrationFn< }, Settings > = (settingsDoc) => { + // @ts-expect-error settingsDoc.attributes.kibana_urls = [settingsDoc.attributes.kibana_url]; // @ts-expect-error delete settingsDoc.attributes.kibana_url; diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_13_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_13_0.ts index e4ba7ce56e847..8773bfd733420 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_13_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_13_0.ts @@ -17,6 +17,7 @@ export const migrateSettingsToV7130: SavedObjectMigrationFn< Settings & { package_auto_upgrade: string; agent_auto_upgrade: string; + kibana_urls: string; }, Settings > = (settingsDoc) => { @@ -24,6 +25,10 @@ export const migrateSettingsToV7130: SavedObjectMigrationFn< delete settingsDoc.attributes.package_auto_upgrade; // @ts-expect-error delete settingsDoc.attributes.agent_auto_upgrade; + // @ts-expect-error + delete settingsDoc.attributes.kibana_urls; + // @ts-expect-error + delete settingsDoc.attributes.kibana_ca_sha256; return settingsDoc; }; diff --git a/x-pack/plugins/fleet/server/services/agent_policy.test.ts b/x-pack/plugins/fleet/server/services/agent_policy.test.ts index 56e76130538cf..68bd9e721d714 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.test.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.test.ts @@ -28,7 +28,7 @@ function getSavedObjectMock(agentPolicyAttributes: any) { { id: '93f74c0-e876-11ea-b7d3-8b2acec6f75c', attributes: { - kibana_urls: ['http://localhost:5603'], + fleet_server_hosts: ['http://fleetserver:8220'], }, type: 'ingest_manager_settings', score: 1, @@ -171,11 +171,7 @@ describe('agent policy', () => { inputs: [], revision: 1, fleet: { - hosts: ['http://localhost:5603'], - kibana: { - hosts: ['localhost:5603'], - protocol: 'http', - }, + hosts: ['http://fleetserver:8220'], }, agent: { monitoring: { @@ -207,11 +203,7 @@ describe('agent policy', () => { inputs: [], revision: 1, fleet: { - hosts: ['http://localhost:5603'], - kibana: { - hosts: ['localhost:5603'], - protocol: 'http', - }, + hosts: ['http://fleetserver:8220'], }, agent: { monitoring: { @@ -244,11 +236,7 @@ describe('agent policy', () => { inputs: [], revision: 1, fleet: { - hosts: ['http://localhost:5603'], - kibana: { - hosts: ['localhost:5603'], - protocol: 'http', - }, + hosts: ['http://fleetserver:8220'], }, agent: { monitoring: { diff --git a/x-pack/plugins/fleet/server/services/agent_policy.ts b/x-pack/plugins/fleet/server/services/agent_policy.ts index 432e64280b74b..e398eb4527f52 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.ts @@ -51,10 +51,9 @@ import { AgentPolicyDeletionError, IngestManagerError, } from '../errors'; -import { getFullAgentPolicyKibanaConfig } from '../../common/services/full_agent_policy_kibana_config'; import { getPackageInfo } from './epm/packages'; -import { createAgentPolicyAction, getAgentsByKuery } from './agents'; +import { getAgentsByKuery } from './agents'; import { packagePolicyService } from './package_policy'; import { outputService } from './output'; import { agentPolicyUpdateEventHandler } from './agent_policy_update'; @@ -609,35 +608,6 @@ class AgentPolicyService { } await this.createFleetPolicyChangeFleetServer(soClient, esClient, agentPolicyId); - - return this.createFleetPolicyChangeActionSO(soClient, esClient, agentPolicyId); - } - - public async createFleetPolicyChangeActionSO( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - agentPolicyId: string - ) { - const policy = await agentPolicyService.getFullAgentPolicy(soClient, agentPolicyId); - if (!policy || !policy.revision) { - return; - } - const packages = policy.inputs.reduce((acc, input) => { - const packageName = input.meta?.package?.name; - if (packageName && acc.indexOf(packageName) < 0) { - acc.push(packageName); - } - return acc; - }, []); - - await createAgentPolicyAction(soClient, esClient, { - type: 'POLICY_CHANGE', - data: { policy }, - ack_data: { packages }, - created_at: new Date().toISOString(), - policy_id: policy.id, - policy_revision: policy.revision, - }); } public async createFleetPolicyChangeFleetServer( @@ -796,15 +766,6 @@ class AgentPolicyService { fullAgentPolicy.fleet = { hosts: settings.fleet_server_hosts, }; - } // TODO remove as part of https://github.com/elastic/kibana/issues/94303 - else { - if (!settings.kibana_urls || !settings.kibana_urls.length) - throw new Error('kibana_urls is missing'); - - fullAgentPolicy.fleet = { - hosts: settings.kibana_urls, - kibana: getFullAgentPolicyKibanaConfig(settings.kibana_urls), - }; } } return fullAgentPolicy; diff --git a/x-pack/plugins/fleet/server/services/agents/acks.test.ts b/x-pack/plugins/fleet/server/services/agents/acks.test.ts deleted file mode 100644 index 7342bbfe51e20..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/acks.test.ts +++ /dev/null @@ -1,382 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import Boom from '@hapi/boom'; -import type { SavedObjectsBulkResponse } from 'kibana/server'; -import { elasticsearchServiceMock, savedObjectsClientMock } from 'src/core/server/mocks'; - -import type { - Agent, - AgentActionSOAttributes, - BaseAgentActionSOAttributes, - AgentEvent, -} from '../../../common/types/models'; -import { AGENT_TYPE_PERMANENT, AGENT_ACTION_SAVED_OBJECT_TYPE } from '../../../common/constants'; - -import { acknowledgeAgentActions } from './acks'; - -describe('test agent acks services', () => { - it('should succeed on valid and matched actions', async () => { - const mockSavedObjectsClient = savedObjectsClientMock.create(); - const mockElasticsearchClient = elasticsearchServiceMock.createClusterClient().asInternalUser; - - mockSavedObjectsClient.bulkGet.mockReturnValue( - Promise.resolve({ - saved_objects: [ - { - id: 'action1', - references: [], - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - attributes: { - type: 'POLICY_CHANGE', - agent_id: 'id', - sent_at: '2020-03-14T19:45:02.620Z', - timestamp: '2019-01-04T14:32:03.36764-05:00', - created_at: '2020-03-14T19:45:02.620Z', - }, - }, - ], - } as SavedObjectsBulkResponse) - ); - - await acknowledgeAgentActions( - mockSavedObjectsClient, - mockElasticsearchClient, - ({ - id: 'id', - type: AGENT_TYPE_PERMANENT, - } as unknown) as Agent, - [ - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: 'action1', - agent_id: 'id', - } as AgentEvent, - ] - ); - }); - - it('should update config field on the agent if a policy change is acknowledged with an agent without policy', async () => { - const mockSavedObjectsClient = savedObjectsClientMock.create(); - const mockElasticsearchClient = elasticsearchServiceMock.createClusterClient().asInternalUser; - - const actionAttributes = { - type: 'POLICY_CHANGE', - policy_id: 'policy1', - policy_revision: 4, - sent_at: '2020-03-14T19:45:02.620Z', - timestamp: '2019-01-04T14:32:03.36764-05:00', - created_at: '2020-03-14T19:45:02.620Z', - ack_data: JSON.stringify({ packages: ['system'] }), - }; - - mockSavedObjectsClient.bulkGet.mockReturnValue( - Promise.resolve({ - saved_objects: [ - { - id: 'action2', - references: [], - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - attributes: actionAttributes, - }, - ], - } as SavedObjectsBulkResponse) - ); - - await acknowledgeAgentActions( - mockSavedObjectsClient, - mockElasticsearchClient, - ({ - id: 'id', - type: AGENT_TYPE_PERMANENT, - policy_id: 'policy1', - } as unknown) as Agent, - [ - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: 'action2', - agent_id: 'id', - } as AgentEvent, - ] - ); - expect(mockSavedObjectsClient.bulkUpdate).not.toBeCalled(); - expect(mockElasticsearchClient.update).toBeCalled(); - expect(mockElasticsearchClient.update.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "body": Object { - "doc": Object { - "packages": Array [ - "system", - ], - "policy_revision_idx": 4, - }, - }, - "id": "id", - "index": ".fleet-agents", - "refresh": "wait_for", - }, - ] - `); - }); - - it('should update config field on the agent if a policy change is acknowledged with a higher revision than the agent one', async () => { - const mockSavedObjectsClient = savedObjectsClientMock.create(); - const mockElasticsearchClient = elasticsearchServiceMock.createClusterClient().asInternalUser; - - const actionAttributes = { - type: 'POLICY_CHANGE', - policy_id: 'policy1', - policy_revision: 4, - sent_at: '2020-03-14T19:45:02.620Z', - timestamp: '2019-01-04T14:32:03.36764-05:00', - created_at: '2020-03-14T19:45:02.620Z', - ack_data: JSON.stringify({ packages: ['system'] }), - }; - - mockSavedObjectsClient.bulkGet.mockReturnValue( - Promise.resolve({ - saved_objects: [ - { - id: 'action2', - references: [], - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - attributes: actionAttributes, - }, - ], - } as SavedObjectsBulkResponse) - ); - - await acknowledgeAgentActions( - mockSavedObjectsClient, - mockElasticsearchClient, - ({ - id: 'id', - type: AGENT_TYPE_PERMANENT, - policy_id: 'policy1', - policy_revision: 3, - } as unknown) as Agent, - [ - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: 'action2', - agent_id: 'id', - } as AgentEvent, - ] - ); - expect(mockSavedObjectsClient.bulkUpdate).not.toBeCalled(); - expect(mockElasticsearchClient.update).toBeCalled(); - expect(mockElasticsearchClient.update.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "body": Object { - "doc": Object { - "packages": Array [ - "system", - ], - "policy_revision_idx": 4, - }, - }, - "id": "id", - "index": ".fleet-agents", - "refresh": "wait_for", - }, - ] - `); - }); - - it('should not update config field on the agent if a policy change is acknowledged with a lower revision than the agent one', async () => { - const mockSavedObjectsClient = savedObjectsClientMock.create(); - const mockElasticsearchClient = elasticsearchServiceMock.createClusterClient().asInternalUser; - - const actionAttributes = { - type: 'POLICY_CHANGE', - policy_id: 'policy1', - policy_revision: 4, - sent_at: '2020-03-14T19:45:02.620Z', - timestamp: '2019-01-04T14:32:03.36764-05:00', - created_at: '2020-03-14T19:45:02.620Z', - ack_data: JSON.stringify({ packages: ['system'] }), - }; - - mockSavedObjectsClient.bulkGet.mockReturnValue( - Promise.resolve({ - saved_objects: [ - { - id: 'action2', - references: [], - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - attributes: actionAttributes, - }, - ], - } as SavedObjectsBulkResponse) - ); - - await acknowledgeAgentActions( - mockSavedObjectsClient, - mockElasticsearchClient, - ({ - id: 'id', - type: AGENT_TYPE_PERMANENT, - policy_id: 'policy1', - policy_revision: 5, - } as unknown) as Agent, - [ - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: 'action2', - agent_id: 'id', - } as AgentEvent, - ] - ); - expect(mockSavedObjectsClient.bulkUpdate).not.toBeCalled(); - expect(mockSavedObjectsClient.update).not.toBeCalled(); - }); - - it('should not update config field on the agent if a policy change for an old revision is acknowledged', async () => { - const mockSavedObjectsClient = savedObjectsClientMock.create(); - const mockElasticsearchClient = elasticsearchServiceMock.createClusterClient().asInternalUser; - - mockSavedObjectsClient.bulkGet.mockReturnValue( - Promise.resolve({ - saved_objects: [ - { - id: 'action3', - references: [], - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - attributes: { - type: 'POLICY_CHANGE', - sent_at: '2020-03-14T19:45:02.620Z', - timestamp: '2019-01-04T14:32:03.36764-05:00', - created_at: '2020-03-14T19:45:02.620Z', - policy_id: 'policy1', - policy_revision: 99, - }, - }, - ], - } as SavedObjectsBulkResponse) - ); - - await acknowledgeAgentActions( - mockSavedObjectsClient, - mockElasticsearchClient, - ({ - id: 'id', - type: AGENT_TYPE_PERMANENT, - policy_id: 'policy1', - policy_revision: 100, - } as unknown) as Agent, - [ - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: 'action3', - agent_id: 'id', - } as AgentEvent, - ] - ); - expect(mockSavedObjectsClient.bulkUpdate).not.toBeCalled(); - expect(mockSavedObjectsClient.update).not.toBeCalled(); - }); - - it('should fail for actions that cannot be found on agent actions list', async () => { - const mockSavedObjectsClient = savedObjectsClientMock.create(); - const mockElasticsearchClient = elasticsearchServiceMock.createClusterClient().asInternalUser; - mockSavedObjectsClient.bulkGet.mockReturnValue( - Promise.resolve({ - saved_objects: [ - { - id: 'action4', - error: { - message: 'Not found', - statusCode: 404, - }, - }, - ], - } as SavedObjectsBulkResponse) - ); - - try { - await acknowledgeAgentActions( - mockSavedObjectsClient, - mockElasticsearchClient, - ({ - id: 'id', - type: AGENT_TYPE_PERMANENT, - } as unknown) as Agent, - [ - ({ - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: 'action4', - agent_id: 'id', - } as unknown) as AgentEvent, - ] - ); - expect(true).toBeFalsy(); - } catch (e) { - expect(Boom.isBoom(e)).toBeTruthy(); - } - }); - - it('should fail for events that have types not in the allowed acknowledgement type list', async () => { - const mockSavedObjectsClient = savedObjectsClientMock.create(); - const mockElasticsearchClient = elasticsearchServiceMock.createClusterClient().asInternalUser; - - mockSavedObjectsClient.bulkGet.mockReturnValue( - Promise.resolve({ - saved_objects: [ - { - id: 'action5', - references: [], - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - attributes: { - type: 'POLICY_CHANGE', - agent_id: 'id', - sent_at: '2020-03-14T19:45:02.620Z', - timestamp: '2019-01-04T14:32:03.36764-05:00', - created_at: '2020-03-14T19:45:02.620Z', - }, - }, - ], - } as SavedObjectsBulkResponse) - ); - - try { - await acknowledgeAgentActions( - mockSavedObjectsClient, - mockElasticsearchClient, - ({ - id: 'id', - type: AGENT_TYPE_PERMANENT, - } as unknown) as Agent, - [ - ({ - type: 'ACTION', - subtype: 'FAILED', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: 'action5', - agent_id: 'id', - } as unknown) as AgentEvent, - ] - ); - expect(true).toBeFalsy(); - } catch (e) { - expect(Boom.isBoom(e)).toBeTruthy(); - } - }); -}); diff --git a/x-pack/plugins/fleet/server/services/agents/acks.ts b/x-pack/plugins/fleet/server/services/agents/acks.ts deleted file mode 100644 index 3acdfc2708eab..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/acks.ts +++ /dev/null @@ -1,216 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { KibanaRequest } from 'src/core/server'; -import type { - ElasticsearchClient, - SavedObjectsBulkCreateObject, - SavedObjectsBulkResponse, - SavedObjectsClientContract, -} from 'src/core/server'; -import Boom from '@hapi/boom'; -import LRU from 'lru-cache'; - -import type { - Agent, - AgentAction, - AgentPolicyAction, - AgentPolicyActionV7_9, - AgentEvent, - AgentEventSOAttributes, - AgentSOAttributes, - AgentActionSOAttributes, -} from '../../types'; -import { AGENT_EVENT_SAVED_OBJECT_TYPE, AGENT_ACTION_SAVED_OBJECT_TYPE } from '../../constants'; - -import { getAgentActionByIds } from './actions'; -import { forceUnenrollAgent } from './unenroll'; -import { ackAgentUpgraded } from './upgrade'; -import { updateAgent } from './crud'; - -const ALLOWED_ACKNOWLEDGEMENT_TYPE: string[] = ['ACTION_RESULT']; - -const actionCache = new LRU({ - max: 20, - maxAge: 10 * 60 * 1000, // 10 minutes -}); - -export async function acknowledgeAgentActions( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - agent: Agent, - agentEvents: AgentEvent[] -): Promise { - if (agentEvents.length === 0) { - return []; - } - - for (const agentEvent of agentEvents) { - if (!isAllowedType(agentEvent.type)) { - throw Boom.badRequest(`${agentEvent.type} not allowed for acknowledgment only ACTION_RESULT`); - } - } - - const actionIds = agentEvents - .map((event) => event.action_id) - .filter((actionId) => actionId !== undefined) as string[]; - - let actions: AgentAction[]; - try { - actions = await fetchActionsUsingCache(soClient, actionIds); - } catch (error) { - if (Boom.isBoom(error) && error.output.statusCode === 404) { - throw Boom.badRequest(`One or more actions cannot be found`); - } - throw error; - } - - const agentActionsIds: string[] = []; - for (const action of actions) { - if (action.agent_id) { - agentActionsIds.push(action.id); - } - if (action.agent_id && action.agent_id !== agent.id) { - throw Boom.badRequest(`${action.id} not found`); - } - } - - const isAgentUnenrolled = actions.some((action) => action.type === 'UNENROLL'); - if (isAgentUnenrolled) { - await forceUnenrollAgent(soClient, esClient, agent); - } - - const upgradeAction = actions.find((action) => action.type === 'UPGRADE'); - if (upgradeAction) { - await ackAgentUpgraded(soClient, esClient, upgradeAction); - } - - const configChangeAction = getLatestConfigChangePolicyActionIfUpdated(agent, actions); - - if (configChangeAction) { - await updateAgent(esClient, agent.id, { - policy_revision: configChangeAction.policy_revision, - packages: configChangeAction?.ack_data?.packages, - }); - } - - if (agentActionsIds.length > 0) { - await soClient.bulkUpdate([ - ...buildUpdateAgentActionSentAt(agentActionsIds), - ]); - } - - return actions; -} - -async function fetchActionsUsingCache( - soClient: SavedObjectsClientContract, - actionIds: string[] -): Promise { - const missingActionIds: string[] = []; - const actions = actionIds - .map((actionId) => { - const action = actionCache.get(actionId); - if (!action) { - missingActionIds.push(actionId); - } - return action; - }) - .filter((action): action is AgentAction => action !== undefined); - - if (missingActionIds.length === 0) { - return actions; - } - - const freshActions = await getAgentActionByIds(soClient, actionIds, false); - freshActions.forEach((action) => actionCache.set(action.id, action)); - - return [...freshActions, ...actions]; -} - -function isAgentPolicyAction( - action: AgentAction | AgentPolicyAction | AgentPolicyActionV7_9 -): action is AgentPolicyAction | AgentPolicyActionV7_9 { - return (action as AgentPolicyAction).policy_id !== undefined; -} - -function getLatestConfigChangePolicyActionIfUpdated( - agent: Agent, - actions: Array -): AgentPolicyAction | AgentPolicyActionV7_9 | null { - return actions.reduce((acc, action) => { - if ( - !isAgentPolicyAction(action) || - (action.type !== 'POLICY_CHANGE' && action.type !== 'CONFIG_CHANGE') || - action.policy_id !== agent.policy_id || - (action?.policy_revision ?? 0) < (agent.policy_revision || 0) - ) { - return acc; - } - - return action; - }, null); -} - -function buildUpdateAgentActionSentAt( - actionsIds: string[], - sentAt: string = new Date().toISOString() -) { - return actionsIds.map((actionId) => ({ - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - id: actionId, - attributes: { - sent_at: sentAt, - }, - })); -} - -function isAllowedType(eventType: string): boolean { - return ALLOWED_ACKNOWLEDGEMENT_TYPE.indexOf(eventType) >= 0; -} - -export async function saveAgentEvents( - soClient: SavedObjectsClientContract, - events: AgentEvent[] -): Promise> { - const objects: Array> = events.map( - (eventData) => { - return { - attributes: { - ...eventData, - payload: eventData.payload ? JSON.stringify(eventData.payload) : undefined, - }, - type: AGENT_EVENT_SAVED_OBJECT_TYPE, - }; - } - ); - - return await soClient.bulkCreate(objects); -} - -export interface AcksService { - acknowledgeAgentActions: ( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - agent: Agent, - actionIds: AgentEvent[] - ) => Promise; - - authenticateAgentWithAccessToken: ( - esClient: ElasticsearchClient, - request: KibanaRequest - ) => Promise; - - getSavedObjectsClientContract: (kibanaRequest: KibanaRequest) => SavedObjectsClientContract; - - getElasticsearchClientContract: () => ElasticsearchClient; - - saveAgentEvents: ( - soClient: SavedObjectsClientContract, - events: AgentEvent[] - ) => Promise>; -} diff --git a/x-pack/plugins/fleet/server/services/agents/actions.test.ts b/x-pack/plugins/fleet/server/services/agents/actions.test.ts deleted file mode 100644 index 1af6173f938d6..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/actions.test.ts +++ /dev/null @@ -1,47 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { SavedObject } from 'kibana/server'; - -import { savedObjectsClientMock, elasticsearchServiceMock } from 'src/core/server/mocks'; - -import type { AgentAction } from '../../../common/types/models'; - -import { createAgentAction } from './actions'; - -describe('test agent actions services', () => { - it('should create a new action', async () => { - const mockSavedObjectsClient = savedObjectsClientMock.create(); - const mockedEsClient = elasticsearchServiceMock.createInternalClient(); - const newAgentAction: Omit = { - agent_id: 'agentid', - type: 'POLICY_CHANGE', - data: { content: 'data' }, - sent_at: '2020-03-14T19:45:02.620Z', - created_at: '2020-03-14T19:45:02.620Z', - }; - mockSavedObjectsClient.create.mockReturnValue( - Promise.resolve({ - attributes: { - agent_id: 'agentid', - type: 'POLICY_CHANGE', - data: JSON.stringify({ content: 'data' }), - sent_at: '2020-03-14T19:45:02.620Z', - created_at: '2020-03-14T19:45:02.620Z', - }, - } as SavedObject) - ); - await createAgentAction(mockSavedObjectsClient, mockedEsClient, newAgentAction); - - const createdAction = (mockSavedObjectsClient.create.mock - .calls[0][1] as unknown) as AgentAction; - expect(createdAction).toBeDefined(); - expect(createdAction?.type).toEqual(newAgentAction.type); - expect(createdAction?.data).toEqual(JSON.stringify(newAgentAction.data)); - expect(createdAction?.sent_at).toEqual(newAgentAction.sent_at); - }); -}); diff --git a/x-pack/plugins/fleet/server/services/agents/actions.ts b/x-pack/plugins/fleet/server/services/agents/actions.ts index bcece7283270b..dbd7105fd5607 100644 --- a/x-pack/plugins/fleet/server/services/agents/actions.ts +++ b/x-pack/plugins/fleet/server/services/agents/actions.ts @@ -5,373 +5,87 @@ * 2.0. */ -import type { ElasticsearchClient, SavedObjectsClientContract } from 'kibana/server'; +import uuid from 'uuid'; +import type { ElasticsearchClient } from 'kibana/server'; -import type { - Agent, - AgentAction, - AgentPolicyAction, - BaseAgentActionSOAttributes, - AgentActionSOAttributes, - AgentPolicyActionSOAttributes, - FleetServerAgentAction, -} from '../../../common/types/models'; -import { AGENT_ACTION_SAVED_OBJECT_TYPE, AGENT_ACTIONS_INDEX } from '../../../common/constants'; -import { appContextService } from '../app_context'; -import { nodeTypes } from '../../../../../../src/plugins/data/common'; - -import { - isAgentActionSavedObject, - isPolicyActionSavedObject, - savedObjectToAgentAction, -} from './saved_objects'; +import type { Agent, AgentAction, FleetServerAgentAction } from '../../../common/types/models'; +import { AGENT_ACTIONS_INDEX } from '../../../common/constants'; const ONE_MONTH_IN_MS = 2592000000; export async function createAgentAction( - soClient: SavedObjectsClientContract, esClient: ElasticsearchClient, newAgentAction: Omit ): Promise { - return createAction(soClient, esClient, newAgentAction); + const id = uuid.v4(); + const body: FleetServerAgentAction = { + '@timestamp': new Date().toISOString(), + expiration: new Date(Date.now() + ONE_MONTH_IN_MS).toISOString(), + agents: [newAgentAction.agent_id], + action_id: id, + data: newAgentAction.data, + type: newAgentAction.type, + }; + + await esClient.create({ + index: AGENT_ACTIONS_INDEX, + id, + body, + refresh: 'wait_for', + }); + + return { + id, + ...newAgentAction, + }; } export async function bulkCreateAgentActions( - soClient: SavedObjectsClientContract, esClient: ElasticsearchClient, newAgentActions: Array> ): Promise { - return bulkCreateActions(soClient, esClient, newAgentActions); -} - -export function createAgentPolicyAction( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - newAgentAction: Omit -): Promise { - return createAction(soClient, esClient, newAgentAction); -} - -async function createAction( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - newAgentAction: Omit -): Promise; -async function createAction( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - newAgentAction: Omit -): Promise; -async function createAction( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - newAgentAction: Omit | Omit -): Promise { - const actionSO = await soClient.create( - AGENT_ACTION_SAVED_OBJECT_TYPE, - { + const actions = newAgentActions.map((newAgentAction) => { + const id = uuid.v4(); + return { + id, ...newAgentAction, - data: newAgentAction.data ? JSON.stringify(newAgentAction.data) : undefined, - ack_data: newAgentAction.ack_data ? JSON.stringify(newAgentAction.ack_data) : undefined, - } - ); - - if (isAgentActionSavedObject(actionSO)) { - const body: FleetServerAgentAction = { - '@timestamp': new Date().toISOString(), - expiration: new Date(Date.now() + ONE_MONTH_IN_MS).toISOString(), - agents: [actionSO.attributes.agent_id], - action_id: actionSO.id, - data: newAgentAction.data, - type: newAgentAction.type, }; - - await esClient.create({ - index: AGENT_ACTIONS_INDEX, - id: actionSO.id, - body, - refresh: 'wait_for', - }); - } - - if (isAgentActionSavedObject(actionSO)) { - const agentAction = savedObjectToAgentAction(actionSO); - // Action `data` is encrypted, so is not returned from the saved object - // so we add back the original value from the request to form the expected - // response shape for POST create agent action endpoint - agentAction.data = newAgentAction.data; - - return agentAction; - } else if (isPolicyActionSavedObject(actionSO)) { - const agentAction = savedObjectToAgentAction(actionSO); - agentAction.data = newAgentAction.data; - - return agentAction; - } - throw new Error('Invalid action'); -} - -async function bulkCreateActions( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - newAgentActions: Array> -): Promise; -async function bulkCreateActions( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - newAgentActions: Array> -): Promise; -async function bulkCreateActions( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - newAgentActions: Array | Omit> -): Promise> { - const { saved_objects: actionSOs } = await soClient.bulkCreate( - newAgentActions.map((newAgentAction) => ({ - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - attributes: { - ...newAgentAction, - data: newAgentAction.data ? JSON.stringify(newAgentAction.data) : undefined, - ack_data: newAgentAction.ack_data ? JSON.stringify(newAgentAction.ack_data) : undefined, - }, - })) - ); - - if (actionSOs.length > 0) { - await esClient.bulk({ - index: AGENT_ACTIONS_INDEX, - body: actionSOs.flatMap((actionSO) => { - if (!isAgentActionSavedObject(actionSO)) { - return []; - } - const body: FleetServerAgentAction = { - '@timestamp': new Date().toISOString(), - expiration: new Date(Date.now() + ONE_MONTH_IN_MS).toISOString(), - agents: [actionSO.attributes.agent_id], - action_id: actionSO.id, - data: actionSO.attributes.data ? JSON.parse(actionSO.attributes.data) : undefined, - type: actionSO.type, - }; - - return [ - { - create: { - _id: actionSO.id, - }, - }, - body, - ]; - }), - }); - } - - return actionSOs.map((actionSO) => { - if (isAgentActionSavedObject(actionSO)) { - const agentAction = savedObjectToAgentAction(actionSO); - // Compared to single create (createAction()), we don't add back the - // original value of `agentAction.data` as this method isn't exposed - // via an HTTP endpoint - return agentAction; - } else if (isPolicyActionSavedObject(actionSO)) { - const agentAction = savedObjectToAgentAction(actionSO); - return agentAction; - } - throw new Error('Invalid action'); - }); -} - -export async function getAgentActionsForCheckin( - soClient: SavedObjectsClientContract, - agentId: string -): Promise { - const filter = nodeTypes.function.buildNode('and', [ - nodeTypes.function.buildNode( - 'not', - nodeTypes.function.buildNodeWithArgumentNodes('is', [ - nodeTypes.literal.buildNode(`${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.sent_at`), - nodeTypes.wildcard.buildNode(nodeTypes.wildcard.wildcardSymbol), - nodeTypes.literal.buildNode(false), - ]) - ), - nodeTypes.function.buildNode( - 'not', - nodeTypes.function.buildNodeWithArgumentNodes('is', [ - nodeTypes.literal.buildNode(`${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.type`), - nodeTypes.literal.buildNode('INTERNAL_POLICY_REASSIGN'), - nodeTypes.literal.buildNode(false), - ]) - ), - nodeTypes.function.buildNodeWithArgumentNodes('is', [ - nodeTypes.literal.buildNode(`${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.agent_id`), - nodeTypes.literal.buildNode(agentId), - nodeTypes.literal.buildNode(false), - ]), - ]); - - const res = await soClient.find({ - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - filter, }); - return Promise.all( - res.saved_objects.map(async (so) => { - // Get decrypted actions - return savedObjectToAgentAction( - await appContextService - .getEncryptedSavedObjects() - .getDecryptedAsInternalUser( - AGENT_ACTION_SAVED_OBJECT_TYPE, - so.id - ) - ); - }) - ); -} - -export async function getAgentActionByIds( - soClient: SavedObjectsClientContract, - actionIds: string[], - decryptData: boolean = true -) { - const actions = ( - await soClient.bulkGet( - actionIds.map((actionId) => ({ - id: actionId, - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - })) - ) - ).saved_objects.map((action) => savedObjectToAgentAction(action)); - - if (!decryptData) { + if (actions.length === 0) { return actions; } - return Promise.all( - actions.map(async (action) => { - // Get decrypted actions - return savedObjectToAgentAction( - await appContextService - .getEncryptedSavedObjects() - .getDecryptedAsInternalUser( - AGENT_ACTION_SAVED_OBJECT_TYPE, - action.id - ) - ); - }) - ); -} - -export async function getAgentPolicyActionByIds( - soClient: SavedObjectsClientContract, - actionIds: string[], - decryptData: boolean = true -) { - const actions = ( - await soClient.bulkGet( - actionIds.map((actionId) => ({ - id: actionId, - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - })) - ) - ).saved_objects.map((action) => savedObjectToAgentAction(action)); - - if (!decryptData) { - return actions; - } - - return Promise.all( - actions.map(async (action) => { - // Get decrypted actions - return savedObjectToAgentAction( - await appContextService - .getEncryptedSavedObjects() - .getDecryptedAsInternalUser( - AGENT_ACTION_SAVED_OBJECT_TYPE, - action.id - ) - ); - }) - ); -} - -export async function getNewActionsSince( - soClient: SavedObjectsClientContract, - timestamp: string, - decryptData: boolean = true -) { - const filter = nodeTypes.function.buildNode('and', [ - nodeTypes.function.buildNode( - 'not', - nodeTypes.function.buildNodeWithArgumentNodes('is', [ - nodeTypes.literal.buildNode(`${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.sent_at`), - nodeTypes.wildcard.buildNode(nodeTypes.wildcard.wildcardSymbol), - nodeTypes.literal.buildNode(false), - ]) - ), - nodeTypes.function.buildNodeWithArgumentNodes('is', [ - nodeTypes.literal.buildNode(`${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.agent_id`), - nodeTypes.wildcard.buildNode(nodeTypes.wildcard.wildcardSymbol), - nodeTypes.literal.buildNode(false), - ]), - nodeTypes.function.buildNode( - 'range', - `${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.created_at`, - { - gt: timestamp, - } - ), - ]); - - const actions = ( - await soClient.find({ - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - filter, - }) - ).saved_objects - .filter(isAgentActionSavedObject) - .map((so) => savedObjectToAgentAction(so)); - - if (!decryptData) { - return actions; - } - - return await Promise.all( - actions.map(async (action) => { - // Get decrypted actions - return savedObjectToAgentAction( - await appContextService - .getEncryptedSavedObjects() - .getDecryptedAsInternalUser( - AGENT_ACTION_SAVED_OBJECT_TYPE, - action.id - ) - ); - }) - ); -} - -export async function getLatestConfigChangeAction( - soClient: SavedObjectsClientContract, - policyId: string -) { - const res = await soClient.find({ - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - search: policyId, - searchFields: ['policy_id'], - sortField: 'created_at', - sortOrder: 'desc', + await esClient.bulk({ + index: AGENT_ACTIONS_INDEX, + body: actions.flatMap((action) => { + const body: FleetServerAgentAction = { + '@timestamp': new Date().toISOString(), + expiration: new Date(Date.now() + ONE_MONTH_IN_MS).toISOString(), + agents: [action.agent_id], + action_id: action.id, + data: action.data, + type: action.type, + }; + + return [ + { + create: { + _id: action.id, + }, + }, + body, + ]; + }), }); - if (res.saved_objects[0]) { - return savedObjectToAgentAction(res.saved_objects[0]); - } + return actions; } export interface ActionsService { getAgent: (esClient: ElasticsearchClient, agentId: string) => Promise; createAgentAction: ( - soClient: SavedObjectsClientContract, esClient: ElasticsearchClient, newAgentAction: Omit ) => Promise; diff --git a/x-pack/plugins/fleet/server/services/agents/checkin/index.ts b/x-pack/plugins/fleet/server/services/agents/checkin/index.ts deleted file mode 100644 index ce81d6b366e9a..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/checkin/index.ts +++ /dev/null @@ -1,118 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import deepEqual from 'fast-deep-equal'; -import type { - ElasticsearchClient, - SavedObjectsClientContract, - SavedObjectsBulkCreateObject, -} from 'src/core/server'; - -import type { - Agent, - NewAgentEvent, - AgentEvent, - AgentSOAttributes, - AgentEventSOAttributes, -} from '../../../types'; -import { AGENT_EVENT_SAVED_OBJECT_TYPE } from '../../../constants'; -import { getAgentActionsForCheckin } from '../actions'; -import { updateAgent } from '../crud'; - -import { agentCheckinState } from './state'; - -export async function agentCheckin( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - agent: Agent, - data: { - events: NewAgentEvent[]; - localMetadata?: any; - status?: 'online' | 'error' | 'degraded'; - }, - options?: { signal: AbortSignal } -) { - const updateData: Partial = {}; - await processEventsForCheckin(soClient, agent, data.events); - if (data.localMetadata && !deepEqual(data.localMetadata, agent.local_metadata)) { - updateData.local_metadata = data.localMetadata; - } - if (data.status !== agent.last_checkin_status) { - updateData.last_checkin_status = data.status; - } - // Update agent only if something changed - if (Object.keys(updateData).length > 0) { - await updateAgent(esClient, agent.id, updateData); - } - // Check if some actions are not acknowledged - let actions = await getAgentActionsForCheckin(soClient, agent.id); - if (actions.length > 0) { - return { actions }; - } - - // Wait for new actions - actions = await agentCheckinState.subscribeToNewActions(soClient, esClient, agent, options); - - return { actions }; -} - -async function processEventsForCheckin( - soClient: SavedObjectsClientContract, - agent: Agent, - events: NewAgentEvent[] -) { - const updatedErrorEvents: Array = [...agent.current_error_events]; - for (const event of events) { - // @ts-ignore - event.policy_id = agent.policy_id; - - if (isErrorOrState(event)) { - // Remove any global or specific to a stream event - const existingEventIndex = updatedErrorEvents.findIndex( - (e) => e.stream_id === event.stream_id - ); - if (existingEventIndex >= 0) { - updatedErrorEvents.splice(existingEventIndex, 1); - } - if (event.type === 'ERROR') { - updatedErrorEvents.push(event); - } - } - } - - if (events.length > 0) { - await createEventsForAgent(soClient, agent.id, events); - } - - return { - updatedErrorEvents, - }; -} - -async function createEventsForAgent( - soClient: SavedObjectsClientContract, - agentId: string, - events: NewAgentEvent[] -) { - const objects: Array> = events.map( - (eventData) => { - return { - attributes: { - ...eventData, - payload: eventData.payload ? JSON.stringify(eventData.payload) : undefined, - }, - type: AGENT_EVENT_SAVED_OBJECT_TYPE, - }; - } - ); - - return soClient.bulkCreate(objects); -} - -function isErrorOrState(event: AgentEvent | NewAgentEvent) { - return event.type === 'STATE' || event.type === 'ERROR'; -} diff --git a/x-pack/plugins/fleet/server/services/agents/checkin/rxjs_utils.test.ts b/x-pack/plugins/fleet/server/services/agents/checkin/rxjs_utils.test.ts deleted file mode 100644 index 18f788b087250..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/checkin/rxjs_utils.test.ts +++ /dev/null @@ -1,30 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { TestScheduler } from 'rxjs/testing'; - -import { createRateLimiter } from './rxjs_utils'; - -describe('createRateLimiter', () => { - it('should rate limit correctly with 1 request per 10ms', async () => { - const scheduler = new TestScheduler((actual, expected) => { - expect(actual).toEqual(expected); - }); - - scheduler.run(({ expectObservable, cold }) => { - const source = cold('a-b-c-d-e-f|'); - const intervalMs = 10; - const perInterval = 1; - const maxDelayMs = 50; - const rateLimiter = createRateLimiter(intervalMs, perInterval, maxDelayMs, scheduler); - const obs = source.pipe(rateLimiter()); - // f should be dropped because of maxDelay - const results = 'a 9ms b 9ms c 9ms d 9ms (e|)'; - expectObservable(obs).toBe(results); - }); - }); -}); diff --git a/x-pack/plugins/fleet/server/services/agents/checkin/rxjs_utils.ts b/x-pack/plugins/fleet/server/services/agents/checkin/rxjs_utils.ts deleted file mode 100644 index aec67cf8908dd..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/checkin/rxjs_utils.ts +++ /dev/null @@ -1,83 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import * as Rx from 'rxjs'; -import { concatMap, delay } from 'rxjs/operators'; - -export class AbortError extends Error {} - -export const toPromiseAbortable = ( - observable: Rx.Observable, - signal?: AbortSignal -): Promise => - new Promise((resolve, reject) => { - if (signal && signal.aborted) { - reject(new AbortError('Aborted')); - return; - } - - const listener = () => { - subscription.unsubscribe(); - reject(new AbortError('Aborted')); - }; - const cleanup = () => { - if (signal) { - signal.removeEventListener('abort', listener); - } - }; - const subscription = observable.subscribe( - (data) => { - cleanup(); - resolve(data); - }, - (err) => { - cleanup(); - reject(err); - } - ); - - if (signal) { - signal.addEventListener('abort', listener, { once: true }); - } - }); - -export function createRateLimiter( - ratelimitIntervalMs: number, - ratelimitRequestPerInterval: number, - maxDelay: number, - scheduler = Rx.asyncScheduler -) { - let intervalEnd = 0; - let countInCurrentInterval = 0; - - function createRateLimitOperator(): Rx.OperatorFunction { - const maxIntervalEnd = scheduler.now() + maxDelay; - - return Rx.pipe( - concatMap(function rateLimit(value: T) { - const now = scheduler.now(); - if (intervalEnd <= now) { - countInCurrentInterval = 1; - intervalEnd = now + ratelimitIntervalMs; - return Rx.of(value); - } else if (intervalEnd >= maxIntervalEnd) { - // drop the value as it's never going to success as long polling timeout is going to happen before we can send the policy - return Rx.EMPTY; - } else { - if (++countInCurrentInterval > ratelimitRequestPerInterval) { - countInCurrentInterval = 1; - intervalEnd += ratelimitIntervalMs; - } - - const wait = intervalEnd - ratelimitIntervalMs - now; - return wait > 0 ? Rx.of(value).pipe(delay(wait, scheduler)) : Rx.of(value); - } - }) - ); - } - return createRateLimitOperator; -} diff --git a/x-pack/plugins/fleet/server/services/agents/checkin/state.ts b/x-pack/plugins/fleet/server/services/agents/checkin/state.ts deleted file mode 100644 index c48e0380da2c4..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/checkin/state.ts +++ /dev/null @@ -1,59 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/server'; - -import type { Agent } from '../../../types'; -import { appContextService } from '../../app_context'; -import { AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS } from '../../../constants'; - -import { agentCheckinStateConnectedAgentsFactory } from './state_connected_agents'; -import { agentCheckinStateNewActionsFactory } from './state_new_actions'; - -function agentCheckinStateFactory() { - const agentConnected = agentCheckinStateConnectedAgentsFactory(); - let newActions: ReturnType; - let interval: NodeJS.Timeout; - - function start() { - newActions = agentCheckinStateNewActionsFactory(); - interval = setInterval(async () => { - try { - await agentConnected.updateLastCheckinAt(); - } catch (err) { - appContextService.getLogger().error(err); - } - }, AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS); - } - - function stop() { - if (interval) { - clearInterval(interval); - } - } - return { - subscribeToNewActions: async ( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - agent: Agent, - options?: { signal: AbortSignal } - ) => { - if (!newActions) { - throw new Error('Agent checkin state not initialized'); - } - - return agentConnected.wrapPromise( - agent.id, - newActions.subscribeToNewActions(soClient, esClient, agent, options) - ); - }, - start, - stop, - }; -} - -export const agentCheckinState = agentCheckinStateFactory(); diff --git a/x-pack/plugins/fleet/server/services/agents/checkin/state_connected_agents.ts b/x-pack/plugins/fleet/server/services/agents/checkin/state_connected_agents.ts deleted file mode 100644 index f8ef33acb30f1..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/checkin/state_connected_agents.ts +++ /dev/null @@ -1,56 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { appContextService } from '../../app_context'; -import { bulkUpdateAgents } from '../crud'; - -export function agentCheckinStateConnectedAgentsFactory() { - const connectedAgentsIds = new Set(); - let agentToUpdate = new Set(); - - function addAgent(agentId: string) { - connectedAgentsIds.add(agentId); - agentToUpdate.add(agentId); - } - - function removeAgent(agentId: string) { - connectedAgentsIds.delete(agentId); - } - - async function wrapPromise(agentId: string, p: Promise): Promise { - try { - addAgent(agentId); - const res = await p; - removeAgent(agentId); - return res; - } catch (err) { - removeAgent(agentId); - throw err; - } - } - - async function updateLastCheckinAt() { - if (agentToUpdate.size === 0) { - return; - } - const esClient = appContextService.getInternalUserESClient(); - const now = new Date().toISOString(); - const updates = [...agentToUpdate.values()].map((agentId) => ({ - agentId, - data: { - last_checkin: now, - }, - })); - agentToUpdate = new Set([...connectedAgentsIds.values()]); - await bulkUpdateAgents(esClient, updates); - } - - return { - wrapPromise, - updateLastCheckinAt, - }; -} diff --git a/x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.test.ts b/x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.test.ts deleted file mode 100644 index 12205f3110614..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.test.ts +++ /dev/null @@ -1,276 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { ElasticsearchClient } from 'kibana/server'; -import { savedObjectsClientMock } from 'src/core/server/mocks'; -import { take } from 'rxjs/operators'; - -import { getNewActionsSince } from '../actions'; -import type { Agent, AgentAction, AgentPolicyAction } from '../../../types'; -import { outputType } from '../../../../common/constants'; - -import { - createAgentActionFromPolicyAction, - createNewActionsSharedObservable, -} from './state_new_actions'; - -jest.mock('../../app_context', () => ({ - appContextService: { - getConfig: () => ({}), - getInternalUserSOClient: () => { - return {}; - }, - getEncryptedSavedObjects: () => ({ - getDecryptedAsInternalUser: () => ({ - attributes: { - default_api_key: 'MOCK_API_KEY', - }, - }), - }), - }, -})); - -jest.mock('../actions'); - -jest.useFakeTimers(); - -function waitForPromiseResolved() { - return new Promise((resolve) => setImmediate(resolve)); -} - -function getMockedNewActionSince() { - return getNewActionsSince as jest.MockedFunction; -} - -const mockedEsClient = {} as ElasticsearchClient; - -describe('test agent checkin new action services', () => { - describe('newAgetActionObservable', () => { - beforeEach(() => { - (getNewActionsSince as jest.MockedFunction).mockReset(); - }); - it('should work, call get actions until there is new action', async () => { - const observable = createNewActionsSharedObservable(); - - getMockedNewActionSince() - .mockResolvedValueOnce([]) - .mockResolvedValueOnce([ - ({ id: 'action1', created_at: new Date().toISOString() } as unknown) as AgentAction, - ]) - .mockResolvedValueOnce([ - ({ id: 'action2', created_at: new Date().toISOString() } as unknown) as AgentAction, - ]); - // First call - const promise = observable.pipe(take(1)).toPromise(); - - jest.advanceTimersByTime(5000); - await waitForPromiseResolved(); - jest.advanceTimersByTime(5000); - await waitForPromiseResolved(); - - const res = await promise; - expect(getNewActionsSince).toBeCalledTimes(2); - expect(res).toHaveLength(1); - expect(res[0].id).toBe('action1'); - // Second call - const secondSubscription = observable.pipe(take(1)).toPromise(); - - jest.advanceTimersByTime(5000); - await waitForPromiseResolved(); - - const secondRes = await secondSubscription; - expect(secondRes).toHaveLength(1); - expect(secondRes[0].id).toBe('action2'); - expect(getNewActionsSince).toBeCalledTimes(3); - // It should call getNewActionsSince with the last action returned - expect(getMockedNewActionSince().mock.calls[2][1]).toBe(res[0].created_at); - }); - - it('should not fetch actions concurrently', async () => { - const observable = createNewActionsSharedObservable(); - - const resolves: Array<(value?: any) => void> = []; - getMockedNewActionSince().mockImplementation(() => { - return new Promise((resolve) => { - resolves.push(resolve); - }); - }); - - observable.pipe(take(1)).toPromise(); - - jest.advanceTimersByTime(5000); - await waitForPromiseResolved(); - jest.advanceTimersByTime(5000); - await waitForPromiseResolved(); - jest.advanceTimersByTime(5000); - await waitForPromiseResolved(); - - expect(getNewActionsSince).toBeCalledTimes(1); - }); - }); - - describe('createAgentActionFromPolicyAction()', () => { - const mockSavedObjectsClient = savedObjectsClientMock.create(); - const mockAgent: Agent = { - id: 'agent1', - active: true, - type: 'PERMANENT', - local_metadata: { elastic: { agent: { version: '7.10.0' } } }, - user_provided_metadata: {}, - current_error_events: [], - packages: [], - enrolled_at: '2020-03-14T19:45:02.620Z', - default_api_key: 'MOCK_API_KEY', - }; - const mockPolicyAction: AgentPolicyAction = { - id: 'action1', - type: 'POLICY_CHANGE', - policy_id: 'policy1', - policy_revision: 1, - sent_at: '2020-03-14T19:45:02.620Z', - created_at: '2020-03-14T19:45:02.620Z', - data: { - policy: { - id: 'policy1', - outputs: { - default: { - type: outputType.Elasticsearch, - hosts: [], - ca_sha256: undefined, - api_key: undefined, - }, - }, - output_permissions: { - default: { _fallback: { cluster: [], indices: [] } }, - }, - inputs: [], - }, - }, - }; - - it('should return POLICY_CHANGE and data.policy for agent version >= 7.10', async () => { - const expectedResult = [ - { - agent_id: 'agent1', - created_at: '2020-03-14T19:45:02.620Z', - data: { - policy: { - id: 'policy1', - inputs: [], - outputs: { default: { api_key: 'MOCK_API_KEY', hosts: [], type: 'elasticsearch' } }, - output_permissions: { default: { _fallback: { cluster: [], indices: [] } } }, - }, - }, - id: 'action1', - sent_at: '2020-03-14T19:45:02.620Z', - type: 'POLICY_CHANGE', - }, - ]; - - expect( - await createAgentActionFromPolicyAction( - mockSavedObjectsClient, - mockedEsClient, - mockAgent, - mockPolicyAction - ) - ).toEqual(expectedResult); - - expect( - await createAgentActionFromPolicyAction( - mockSavedObjectsClient, - mockedEsClient, - { ...mockAgent, local_metadata: { elastic: { agent: { version: '7.10.0-SNAPSHOT' } } } }, - mockPolicyAction - ) - ).toEqual(expectedResult); - - expect( - await createAgentActionFromPolicyAction( - mockSavedObjectsClient, - mockedEsClient, - { ...mockAgent, local_metadata: { elastic: { agent: { version: '7.10.2' } } } }, - mockPolicyAction - ) - ).toEqual(expectedResult); - - expect( - await createAgentActionFromPolicyAction( - mockSavedObjectsClient, - mockedEsClient, - { ...mockAgent, local_metadata: { elastic: { agent: { version: '8.0.0' } } } }, - mockPolicyAction - ) - ).toEqual(expectedResult); - - expect( - await createAgentActionFromPolicyAction( - mockSavedObjectsClient, - mockedEsClient, - { ...mockAgent, local_metadata: { elastic: { agent: { version: '8.0.0-SNAPSHOT' } } } }, - mockPolicyAction - ) - ).toEqual(expectedResult); - }); - - it('should return CONFIG_CHANGE and data.config for agent version <= 7.9', async () => { - const expectedResult = [ - { - agent_id: 'agent1', - created_at: '2020-03-14T19:45:02.620Z', - data: { - config: { - id: 'policy1', - inputs: [], - outputs: { default: { api_key: 'MOCK_API_KEY', hosts: [], type: 'elasticsearch' } }, - output_permissions: { default: { _fallback: { cluster: [], indices: [] } } }, - }, - }, - id: 'action1', - sent_at: '2020-03-14T19:45:02.620Z', - type: 'CONFIG_CHANGE', - }, - ]; - - expect( - await createAgentActionFromPolicyAction( - mockSavedObjectsClient, - mockedEsClient, - { ...mockAgent, local_metadata: { elastic: { agent: { version: '7.9.0' } } } }, - mockPolicyAction - ) - ).toEqual(expectedResult); - - expect( - await createAgentActionFromPolicyAction( - mockSavedObjectsClient, - mockedEsClient, - { ...mockAgent, local_metadata: { elastic: { agent: { version: '7.9.3' } } } }, - mockPolicyAction - ) - ).toEqual(expectedResult); - - expect( - await createAgentActionFromPolicyAction( - mockSavedObjectsClient, - mockedEsClient, - { ...mockAgent, local_metadata: { elastic: { agent: { version: '7.9.1-SNAPSHOT' } } } }, - mockPolicyAction - ) - ).toEqual(expectedResult); - - expect( - await createAgentActionFromPolicyAction( - mockSavedObjectsClient, - mockedEsClient, - { ...mockAgent, local_metadata: { elastic: { agent: { version: '7.8.2' } } } }, - mockPolicyAction - ) - ).toEqual(expectedResult); - }); - }); -}); diff --git a/x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.ts b/x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.ts deleted file mode 100644 index 8f0000413471f..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.ts +++ /dev/null @@ -1,295 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import semverParse from 'semver/functions/parse'; -import semverLt from 'semver/functions/lt'; -import type { Observable } from 'rxjs'; -import { timer, from, TimeoutError, of, EMPTY } from 'rxjs'; -import { omit } from 'lodash'; -import { - shareReplay, - share, - distinctUntilKeyChanged, - switchMap, - exhaustMap, - concatMap, - merge, - filter, - timeout, - take, -} from 'rxjs/operators'; -import type { KibanaRequest } from 'src/core/server'; -import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/server'; - -import type { Agent, AgentAction, AgentPolicyAction, AgentPolicyActionV7_9 } from '../../../types'; -import * as APIKeysService from '../../api_keys'; -import { - AGENT_UPDATE_ACTIONS_INTERVAL_MS, - AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS, - AGENT_POLICY_ROLLOUT_RATE_LIMIT_INTERVAL_MS, - AGENT_POLICY_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL, -} from '../../../constants'; -import { - getNewActionsSince, - getLatestConfigChangeAction, - getAgentPolicyActionByIds, -} from '../actions'; -import { appContextService } from '../../app_context'; -import { updateAgent } from '../crud'; -import type { FullAgentPolicy, FullAgentPolicyOutputPermissions } from '../../../../common'; - -import { toPromiseAbortable, AbortError, createRateLimiter } from './rxjs_utils'; - -function getInternalUserSOClient() { - const fakeRequest = ({ - headers: {}, - getBasePath: () => '', - path: '/', - route: { settings: {} }, - url: { - href: '/', - }, - raw: { - req: { - url: '/', - }, - }, - } as unknown) as KibanaRequest; - - return appContextService.getInternalUserSOClient(fakeRequest); -} - -export function createNewActionsSharedObservable(): Observable { - let lastTimestamp = new Date().toISOString(); - - return timer(0, AGENT_UPDATE_ACTIONS_INTERVAL_MS).pipe( - exhaustMap(() => { - const internalSOClient = getInternalUserSOClient(); - - return from( - getNewActionsSince(internalSOClient, lastTimestamp).then((data) => { - if (data.length > 0) { - lastTimestamp = data.reduce((acc, action) => { - return acc >= action.created_at ? acc : action.created_at; - }, lastTimestamp); - } - - return data; - }) - ); - }), - filter((data) => { - return data.length > 0; - }), - share() - ); -} - -function createAgentPolicyActionSharedObservable(agentPolicyId: string) { - const internalSOClient = getInternalUserSOClient(); - - return timer(0, AGENT_UPDATE_ACTIONS_INTERVAL_MS).pipe( - switchMap(() => from(getLatestConfigChangeAction(internalSOClient, agentPolicyId))), - filter((data): data is AgentPolicyAction => data !== undefined), - distinctUntilKeyChanged('id'), - switchMap((data) => - from(getAgentPolicyActionByIds(internalSOClient, [data.id]).then((r) => r[0])) - ), - shareReplay({ refCount: true, bufferSize: 1 }) - ); -} - -async function getAgentDefaultOutputAPIKey( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - agent: Agent -) { - return agent.default_api_key; -} - -async function getOrCreateAgentDefaultOutputAPIKey( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - agent: Agent, - permissions: FullAgentPolicyOutputPermissions -): Promise { - const defaultAPIKey = await getAgentDefaultOutputAPIKey(soClient, esClient, agent); - if (defaultAPIKey) { - return defaultAPIKey; - } - - const outputAPIKey = await APIKeysService.generateOutputApiKey( - soClient, - 'default', - agent.id, - permissions - ); - await updateAgent(esClient, agent.id, { - default_api_key: outputAPIKey.key, - default_api_key_id: outputAPIKey.id, - }); - return outputAPIKey.key; -} - -export async function createAgentActionFromPolicyAction( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - agent: Agent, - policyAction: AgentPolicyAction -) { - // Transform the policy action for agent version <= 7.9.x for BWC - const agentVersion = semverParse((agent.local_metadata?.elastic as any)?.agent?.version); - const agentPolicyAction: AgentPolicyAction | AgentPolicyActionV7_9 = - agentVersion && - semverLt( - agentVersion, - // A prerelease tag is added here so that agent versions with prerelease tags can be compared - // correctly using `semvar` - '7.10.0-SNAPSHOT', - { includePrerelease: true } - ) - ? { - ...policyAction, - type: 'CONFIG_CHANGE', - data: { - config: policyAction.data.policy, - }, - } - : policyAction; - - // Create agent action - const newAgentAction: AgentAction = Object.assign( - omit( - // Faster than clone - JSON.parse(JSON.stringify(agentPolicyAction)) as AgentPolicyAction, - 'policy_id', - 'policy_revision' - ), - { - agent_id: agent.id, - } - ); - - // agent <= 7.9 uses `data.config` instead of `data.policy` - const policyProp = 'policy' in newAgentAction.data ? 'policy' : 'config'; - - // TODO: The null assertion `!` is strictly correct for the current use case - // where the only output is `elasticsearch`, but this might change in the future. - const permissions = (newAgentAction.data[policyProp] as FullAgentPolicy).output_permissions! - .default; - - // Mutate the policy to set the api token for this agent - const apiKey = await getOrCreateAgentDefaultOutputAPIKey(soClient, esClient, agent, permissions); - - newAgentAction.data[policyProp].outputs.default.api_key = apiKey; - - return [newAgentAction]; -} - -function getPollingTimeoutMs() { - const pollingTimeoutMs = appContextService.getConfig()?.agents.pollingRequestTimeout ?? 0; - - // If polling timeout is too short do not use margin - if (pollingTimeoutMs <= AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS) { - return pollingTimeoutMs; - } - // Set a timeout 20s before the real timeout to have a chance to respond an empty response before socket timeout - return Math.max( - pollingTimeoutMs - AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS, - AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS - ); -} - -export function agentCheckinStateNewActionsFactory() { - // Shared Observables - const agentPolicies$ = new Map>(); - const newActions$ = createNewActionsSharedObservable(); - // Rx operators - const pollingTimeoutMs = getPollingTimeoutMs(); - - const rateLimiterIntervalMs = - appContextService.getConfig()?.agents.agentPolicyRolloutRateLimitIntervalMs ?? - AGENT_POLICY_ROLLOUT_RATE_LIMIT_INTERVAL_MS; - const rateLimiterRequestPerInterval = - appContextService.getConfig()?.agents.agentPolicyRolloutRateLimitRequestPerInterval ?? - AGENT_POLICY_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL; - const rateLimiterMaxDelay = pollingTimeoutMs; - - const rateLimiter = createRateLimiter( - rateLimiterIntervalMs, - rateLimiterRequestPerInterval, - rateLimiterMaxDelay - ); - - function getOrCreateAgentPolicyObservable(agentPolicyId: string) { - if (!agentPolicies$.has(agentPolicyId)) { - agentPolicies$.set(agentPolicyId, createAgentPolicyActionSharedObservable(agentPolicyId)); - } - const agentPolicy$ = agentPolicies$.get(agentPolicyId); - if (!agentPolicy$) { - throw new Error(`Invalid state, no observable for policy ${agentPolicyId}`); - } - - return agentPolicy$; - } - - async function subscribeToNewActions( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - agent: Agent, - options?: { signal: AbortSignal } - ): Promise { - if (!agent.policy_id) { - throw new Error('Agent does not have a policy'); - } - const agentPolicy$ = getOrCreateAgentPolicyObservable(agent.policy_id); - - const stream$ = agentPolicy$.pipe( - timeout(pollingTimeoutMs), - filter( - (action) => - agent.policy_id !== undefined && - action.policy_revision !== undefined && - action.policy_id !== undefined && - action.policy_id === agent.policy_id && - (!agent.policy_revision || action.policy_revision > agent.policy_revision) - ), - rateLimiter(), - concatMap((policyAction) => - createAgentActionFromPolicyAction(soClient, esClient, agent, policyAction) - ), - merge(newActions$), - concatMap((data: AgentAction[] | undefined) => { - if (data === undefined) { - return EMPTY; - } - const newActions = data.filter((action) => action.agent_id === agent.id); - if (newActions.length === 0) { - return EMPTY; - } - - return of(newActions); - }), - filter((data) => data !== undefined), - take(1) - ); - try { - const data = await toPromiseAbortable(stream$, options?.signal); - return data || []; - } catch (err) { - if (err instanceof TimeoutError || err instanceof AbortError) { - return []; - } - - throw err; - } - } - - return { - subscribeToNewActions, - }; -} diff --git a/x-pack/plugins/fleet/server/services/agents/enroll.test.ts b/x-pack/plugins/fleet/server/services/agents/enroll.test.ts deleted file mode 100644 index 676e5a155aef2..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/enroll.test.ts +++ /dev/null @@ -1,57 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { validateAgentVersion } from './enroll'; - -describe('validateAgentVersion', () => { - it('should throw with agent > kibana version', () => { - expect(() => validateAgentVersion('8.8.0', '8.0.0')).toThrowError('not compatible'); - }); - it('should work with agent < kibana version', () => { - validateAgentVersion('7.8.0', '8.0.0'); - }); - - it('should work with agent = kibana version', () => { - validateAgentVersion('8.0.0', '8.0.0'); - }); - - it('should work with SNAPSHOT version', () => { - validateAgentVersion('8.0.0-SNAPSHOT', '8.0.0-SNAPSHOT'); - }); - - it('should work with a agent using SNAPSHOT version', () => { - validateAgentVersion('7.8.0-SNAPSHOT', '7.8.0'); - }); - - it('should work with a kibana using SNAPSHOT version', () => { - validateAgentVersion('7.8.0', '7.8.0-SNAPSHOT'); - }); - - it('very close versions, e.g. patch/prerelease - all combos should work', () => { - validateAgentVersion('7.9.1', '7.9.2'); - validateAgentVersion('7.8.1', '7.8.2'); - validateAgentVersion('7.6.99', '7.6.2'); - validateAgentVersion('7.6.2', '7.6.99'); - validateAgentVersion('5.94.3', '5.94.1234-SNAPSHOT'); - validateAgentVersion('5.94.3-SNAPSHOT', '5.94.1'); - }); - - it('somewhat close versions, minor release is 1 or 2 versions back and is older than the stack', () => { - validateAgentVersion('7.9.1', '7.10.2'); - validateAgentVersion('7.9.9', '7.11.1'); - validateAgentVersion('7.6.99', '7.6.2'); - validateAgentVersion('7.6.2', '7.6.99'); - expect(() => validateAgentVersion('5.94.3-SNAPSHOT', '5.93.1')).toThrowError('not compatible'); - expect(() => validateAgentVersion('5.94.3', '5.92.99-SNAPSHOT')).toThrowError('not compatible'); - }); - - it('versions where Agent is a minor version or major version greater (newer) than the stack should not work', () => { - expect(() => validateAgentVersion('7.10.1', '7.9.99')).toThrowError('not compatible'); - expect(() => validateAgentVersion('7.9.9', '6.11.1')).toThrowError('not compatible'); - expect(() => validateAgentVersion('5.94.3', '5.92.99-SNAPSHOT')).toThrowError('not compatible'); - }); -}); diff --git a/x-pack/plugins/fleet/server/services/agents/enroll.ts b/x-pack/plugins/fleet/server/services/agents/enroll.ts deleted file mode 100644 index c9148f6249fa5..0000000000000 --- a/x-pack/plugins/fleet/server/services/agents/enroll.ts +++ /dev/null @@ -1,111 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import Boom from '@hapi/boom'; -import uuid from 'uuid/v4'; -import semverParse from 'semver/functions/parse'; -import semverDiff from 'semver/functions/diff'; -import semverLte from 'semver/functions/lte'; -import type { SavedObjectsClientContract } from 'src/core/server'; - -import type { AgentType, Agent, FleetServerAgent } from '../../types'; -import { AGENTS_INDEX } from '../../constants'; -import { IngestManagerError } from '../../errors'; -import * as APIKeyService from '../api_keys'; -import { agentPolicyService } from '../../services'; -import { appContextService } from '../app_context'; - -export async function enroll( - soClient: SavedObjectsClientContract, - type: AgentType, - agentPolicyId: string, - metadata?: { local: any; userProvided: any } -): Promise { - const agentVersion = metadata?.local?.elastic?.agent?.version; - validateAgentVersion(agentVersion); - - const agentPolicy = await agentPolicyService.get(soClient, agentPolicyId, false); - if (agentPolicy?.is_managed) { - throw new IngestManagerError(`Cannot enroll in managed policy ${agentPolicyId}`); - } - - const esClient = appContextService.getInternalUserESClient(); - - const agentId = uuid(); - const accessAPIKey = await APIKeyService.generateAccessApiKey(soClient, agentId); - const fleetServerAgent: FleetServerAgent = { - active: true, - policy_id: agentPolicyId, - type, - enrolled_at: new Date().toISOString(), - user_provided_metadata: metadata?.userProvided ?? {}, - local_metadata: metadata?.local ?? {}, - access_api_key_id: accessAPIKey.id, - }; - await esClient.create({ - index: AGENTS_INDEX, - body: fleetServerAgent, - id: agentId, - refresh: 'wait_for', - }); - - return { - id: agentId, - current_error_events: [], - packages: [], - ...fleetServerAgent, - access_api_key: accessAPIKey.key, - } as Agent; -} - -export function validateAgentVersion( - agentVersion: string, - kibanaVersion = appContextService.getKibanaVersion() -) { - const agentVersionParsed = semverParse(agentVersion); - if (!agentVersionParsed) { - throw Boom.badRequest('Agent version not provided'); - } - - const kibanaVersionParsed = semverParse(kibanaVersion); - if (!kibanaVersionParsed) { - throw Boom.badRequest('Kibana version is not set or provided'); - } - - const diff = semverDiff(agentVersion, kibanaVersion); - switch (diff) { - // section 1) very close versions, only patch release differences - all combos should work - // Agent a.b.1 < Kibana a.b.2 - // Agent a.b.2 > Kibana a.b.1 - case null: - case 'prerelease': - case 'prepatch': - case 'patch': - return; // OK - - // section 2) somewhat close versions, Agent minor release is 1 or 2 versions back and is older than the stack: - // Agent a.9.x < Kibana a.10.x - // Agent a.9.x < Kibana a.11.x - case 'preminor': - case 'minor': - if ( - agentVersionParsed.minor < kibanaVersionParsed.minor && - kibanaVersionParsed.minor - agentVersionParsed.minor <= 2 - ) - return; - - // section 3) versions where Agent is a minor version or major version greater (newer) than the stack should not work: - // Agent 7.10.x > Kibana 7.9.x - // Agent 8.0.x > Kibana 7.9.x - default: - if (semverLte(agentVersionParsed, kibanaVersionParsed)) return; - else - throw Boom.badRequest( - `Agent version ${agentVersion} is not compatible with Kibana version ${kibanaVersion}` - ); - } -} diff --git a/x-pack/plugins/fleet/server/services/agents/index.ts b/x-pack/plugins/fleet/server/services/agents/index.ts index 0b28b5050572a..66303514c4fe7 100644 --- a/x-pack/plugins/fleet/server/services/agents/index.ts +++ b/x-pack/plugins/fleet/server/services/agents/index.ts @@ -5,10 +5,7 @@ * 2.0. */ -export * from './acks'; export * from './events'; -export * from './checkin'; -export * from './enroll'; export * from './unenroll'; export * from './upgrade'; export * from './status'; diff --git a/x-pack/plugins/fleet/server/services/agents/reassign.ts b/x-pack/plugins/fleet/server/services/agents/reassign.ts index 81b00663d7a8a..2d94e8b9e9247 100644 --- a/x-pack/plugins/fleet/server/services/agents/reassign.ts +++ b/x-pack/plugins/fleet/server/services/agents/reassign.ts @@ -41,7 +41,7 @@ export async function reassignAgent( policy_revision: null, }); - await createAgentAction(soClient, esClient, { + await createAgentAction(esClient, { agent_id: agentId, created_at: new Date().toISOString(), type: 'POLICY_REASSIGN', @@ -159,7 +159,6 @@ export async function reassignAgents( const now = new Date().toISOString(); await bulkCreateAgentActions( - soClient, esClient, agentsToUpdate.map((agent) => ({ agent_id: agent.id, diff --git a/x-pack/plugins/fleet/server/services/agents/setup.ts b/x-pack/plugins/fleet/server/services/agents/setup.ts index 67c1715ca8be4..81ae6b177783d 100644 --- a/x-pack/plugins/fleet/server/services/agents/setup.ts +++ b/x-pack/plugins/fleet/server/services/agents/setup.ts @@ -9,14 +9,6 @@ import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/s import { SO_SEARCH_LIMIT } from '../../constants'; import { agentPolicyService } from '../agent_policy'; -import { outputService } from '../output'; - -export async function isAgentsSetup(soClient: SavedObjectsClientContract): Promise { - const adminUser = await outputService.getAdminUser(soClient, false); - const outputId = await outputService.getDefaultOutputId(soClient); - // If admin user (fleet_enroll) and output id exist Agents are correctly setup - return adminUser && outputId ? true : false; -} /** * During the migration from 7.9 to 7.10 we introduce a new agent action POLICY_CHANGE per policy diff --git a/x-pack/plugins/fleet/server/services/agents/unenroll.ts b/x-pack/plugins/fleet/server/services/agents/unenroll.ts index 85bc5eecd78b9..c97dc128de591 100644 --- a/x-pack/plugins/fleet/server/services/agents/unenroll.ts +++ b/x-pack/plugins/fleet/server/services/agents/unenroll.ts @@ -52,7 +52,7 @@ export async function unenrollAgent( return forceUnenrollAgent(soClient, esClient, agentId); } const now = new Date().toISOString(); - await createAgentAction(soClient, esClient, { + await createAgentAction(esClient, { agent_id: agentId, created_at: now, type: 'UNENROLL', @@ -106,7 +106,6 @@ export async function unenrollAgents( } else { // Create unenroll action for each agent await bulkCreateAgentActions( - soClient, esClient, agentsToUpdate.map((agent) => ({ agent_id: agent.id, diff --git a/x-pack/plugins/fleet/server/services/agents/upgrade.ts b/x-pack/plugins/fleet/server/services/agents/upgrade.ts index d8dd1167d3653..c791a5b7c10ce 100644 --- a/x-pack/plugins/fleet/server/services/agents/upgrade.ts +++ b/x-pack/plugins/fleet/server/services/agents/upgrade.ts @@ -51,7 +51,7 @@ export async function sendUpgradeAgentAction({ ); } - await createAgentAction(soClient, esClient, { + await createAgentAction(esClient, { agent_id: agentId, created_at: now, data, @@ -167,7 +167,6 @@ export async function sendUpgradeAgentsActions( }; await bulkCreateAgentActions( - soClient, esClient, agentsToUpdate.map((agent) => ({ agent_id: agent.id, diff --git a/x-pack/plugins/fleet/server/services/api_keys/index.ts b/x-pack/plugins/fleet/server/services/api_keys/index.ts index 1f9e77821360c..c781b2d01943f 100644 --- a/x-pack/plugins/fleet/server/services/api_keys/index.ts +++ b/x-pack/plugins/fleet/server/services/api_keys/index.ts @@ -6,53 +6,10 @@ */ import type { KibanaRequest } from 'src/core/server'; -import type { SavedObjectsClientContract } from 'src/core/server'; - -import type { FullAgentPolicyOutputPermissions } from '../../../common'; - -import { createAPIKey } from './security'; export { invalidateAPIKeys } from './security'; export * from './enrollment_api_key'; -export async function generateOutputApiKey( - soClient: SavedObjectsClientContract, - outputId: string, - agentId: string, - permissions: FullAgentPolicyOutputPermissions -): Promise<{ key: string; id: string }> { - const name = `${agentId}:${outputId}`; - const key = await createAPIKey(soClient, name, permissions); - - if (!key) { - throw new Error('Unable to create an output api key'); - } - - return { key: `${key.id}:${key.api_key}`, id: key.id }; -} - -export async function generateAccessApiKey(soClient: SavedObjectsClientContract, agentId: string) { - const key = await createAPIKey(soClient, agentId, { - // Useless role to avoid to have the privilege of the user that created the key - 'fleet-apikey-access': { - cluster: [], - applications: [ - { - application: '.fleet', - privileges: ['no-privileges'], - resources: ['*'], - }, - ], - }, - }); - - if (!key) { - throw new Error('Unable to create an access api key'); - } - - return { id: key.id, key: Buffer.from(`${key.id}:${key.api_key}`).toString('base64') }; -} - export function parseApiKeyFromHeaders(headers: KibanaRequest['headers']) { const authorizationHeader = headers.authorization; diff --git a/x-pack/plugins/fleet/server/services/app_context.ts b/x-pack/plugins/fleet/server/services/app_context.ts index c49e536435027..954308a980861 100644 --- a/x-pack/plugins/fleet/server/services/app_context.ts +++ b/x-pack/plugins/fleet/server/services/app_context.ts @@ -44,11 +44,6 @@ class AppContextService { private httpSetup?: HttpServiceSetup; private externalCallbacks: ExternalCallbacksStorage = new Map(); - /** - * Temporary flag until v7.13 ships - */ - public fleetServerEnabled: boolean = false; - public async start(appContext: FleetAppContext) { this.data = appContext.data; this.esClient = appContext.elasticsearch.client.asInternalUser; diff --git a/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts b/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts index df8aa7cb01286..7ccee39aa815c 100644 --- a/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts +++ b/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts @@ -23,15 +23,10 @@ import type { } from '../../../common'; import { listEnrollmentApiKeys, getEnrollmentAPIKey } from '../api_keys/enrollment_api_key_so'; import { appContextService } from '../app_context'; -import { isAgentsSetup } from '../agents'; import { agentPolicyService } from '../agent_policy'; import { invalidateAPIKeys } from '../api_keys'; export async function runFleetServerMigration() { - // If Agents are not setup skip as there is nothing to migrate - if (!(await isAgentsSetup(getInternalUserSOClient()))) { - return; - } await Promise.all([migrateEnrollmentApiKeys(), migrateAgentPolicies(), migrateAgents()]); } diff --git a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts index 4bdd473e077f4..d60b8fde2aa8d 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts @@ -117,12 +117,6 @@ jest.mock('./package_policy', () => ({ }, })); -jest.mock('./agents/setup', () => ({ - isAgentsSetup() { - return false; - }, -})); - describe('policy preconfiguration', () => { beforeEach(() => { mockInstalledPackages.clear(); diff --git a/x-pack/plugins/fleet/server/services/settings.ts b/x-pack/plugins/fleet/server/services/settings.ts index 7658a8d71839e..e0723a8e16306 100644 --- a/x-pack/plugins/fleet/server/services/settings.ts +++ b/x-pack/plugins/fleet/server/services/settings.ts @@ -5,12 +5,10 @@ * 2.0. */ -import url from 'url'; - import Boom from '@hapi/boom'; import type { SavedObjectsClientContract } from 'kibana/server'; -import { GLOBAL_SETTINGS_SAVED_OBJECT_TYPE, decodeCloudId } from '../../common'; +import { GLOBAL_SETTINGS_SAVED_OBJECT_TYPE } from '../../common'; import type { SettingsSOAttributes, Settings, BaseSettings } from '../../common'; import { appContextService } from './app_context'; @@ -67,25 +65,9 @@ export async function saveSettings( } export function createDefaultSettings(): BaseSettings { - const http = appContextService.getHttpSetup(); - const serverInfo = http.getServerInfo(); - const basePath = http.basePath; - - const cloud = appContextService.getCloud(); - const cloudId = cloud?.isCloudEnabled && cloud.cloudId; - const cloudUrl = cloudId && decodeCloudId(cloudId)?.kibanaUrl; - const flagsUrl = appContextService.getConfig()?.agents?.kibana?.host; - const defaultUrl = url.format({ - protocol: serverInfo.protocol, - hostname: serverInfo.hostname, - port: serverInfo.port, - pathname: basePath.serverBasePath, - }); - const fleetServerHosts = appContextService.getConfig()?.agents?.fleet_server?.hosts ?? []; return { - kibana_urls: [cloudUrl || flagsUrl || defaultUrl].flat(), fleet_server_hosts: fleetServerHosts, }; } diff --git a/x-pack/plugins/fleet/server/services/setup.ts b/x-pack/plugins/fleet/server/services/setup.ts index de551a584f49f..c906dc73e6df2 100644 --- a/x-pack/plugins/fleet/server/services/setup.ts +++ b/x-pack/plugins/fleet/server/services/setup.ts @@ -5,7 +5,6 @@ * 2.0. */ -import uuid from 'uuid'; import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/server'; import { i18n } from '@kbn/i18n'; @@ -31,9 +30,6 @@ import { createDefaultSettings } from './settings'; import { ensureAgentActionPolicyChangeExists } from './agents'; import { awaitIfFleetServerSetupPending } from './fleet_server'; -const FLEET_ENROLL_USERNAME = 'fleet_enroll'; -const FLEET_ENROLL_ROLE = 'fleet_enroll'; - export interface SetupStatus { isInitialized: boolean; preconfigurationError: { name: string; message: string } | undefined; @@ -213,66 +209,3 @@ export async function ensureDefaultEnrollmentAPIKeysExists( }) ); } - -async function putFleetRole(esClient: ElasticsearchClient) { - return await esClient.security.putRole({ - name: FLEET_ENROLL_ROLE, - body: { - cluster: ['monitor', 'manage_api_key'], - indices: [ - { - names: ['logs-*', 'metrics-*', 'traces-*', '.logs-endpoint.diagnostic.collection-*'], - privileges: ['auto_configure', 'create_doc'], - }, - ], - }, - }); -} - -// TODO Deprecated should be removed as part of https://github.com/elastic/kibana/issues/94303 -export async function setupFleet( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - options?: { forceRecreate?: boolean } -) { - // Create fleet_enroll role - // This should be done directly in ES at some point - const { body: res } = await putFleetRole(esClient); - - // If the role is already created skip the rest unless you have forceRecreate set to true - if (options?.forceRecreate !== true && res.role.created === false) { - return; - } - const password = generateRandomPassword(); - // Create fleet enroll user - await esClient.security.putUser({ - username: FLEET_ENROLL_USERNAME, - body: { - password, - roles: [FLEET_ENROLL_ROLE], - metadata: { - updated_at: new Date().toISOString(), - }, - }, - }); - - // save fleet admin user - const defaultOutputId = await outputService.getDefaultOutputId(soClient); - if (!defaultOutputId) { - throw new Error( - i18n.translate('xpack.fleet.setup.defaultOutputError', { - defaultMessage: 'Default output does not exist', - }) - ); - } - await outputService.updateOutput(soClient, defaultOutputId, { - fleet_enroll_username: FLEET_ENROLL_USERNAME, - fleet_enroll_password: password, - }); - - outputService.invalidateCache(); -} - -function generateRandomPassword() { - return Buffer.from(uuid.v4()).toString('base64'); -} diff --git a/x-pack/plugins/fleet/server/types/index.tsx b/x-pack/plugins/fleet/server/types/index.tsx index 581a8241f09bf..87808e03fe70b 100644 --- a/x-pack/plugins/fleet/server/types/index.tsx +++ b/x-pack/plugins/fleet/server/types/index.tsx @@ -74,9 +74,6 @@ export { InstallType, InstallSource, InstallResult, - // Agent Request types - PostAgentEnrollRequest, - PostAgentCheckinRequest, DataType, dataTypes, // Fleet Server types diff --git a/x-pack/plugins/fleet/server/types/rest_spec/settings.ts b/x-pack/plugins/fleet/server/types/rest_spec/settings.ts index 9051d7a06efff..551cc37551da2 100644 --- a/x-pack/plugins/fleet/server/types/rest_spec/settings.ts +++ b/x-pack/plugins/fleet/server/types/rest_spec/settings.ts @@ -22,6 +22,9 @@ export const PutSettingsRequestSchema = { }, }) ), + has_seen_add_data_notice: schema.maybe(schema.boolean()), + additional_yaml_config: schema.maybe(schema.string()), + // Deprecated not used kibana_urls: schema.maybe( schema.arrayOf(schema.uri({ scheme: ['http', 'https'] }), { validate: (value) => { @@ -32,7 +35,5 @@ export const PutSettingsRequestSchema = { }) ), kibana_ca_sha256: schema.maybe(schema.string()), - has_seen_add_data_notice: schema.maybe(schema.boolean()), - additional_yaml_config: schema.maybe(schema.string()), }), }; diff --git a/x-pack/plugins/security_solution/common/experimental_features.ts b/x-pack/plugins/security_solution/common/experimental_features.ts index 39551e3ee6f1c..8cce97ea07cb1 100644 --- a/x-pack/plugins/security_solution/common/experimental_features.ts +++ b/x-pack/plugins/security_solution/common/experimental_features.ts @@ -12,7 +12,6 @@ export type ExperimentalFeatures = typeof allowedExperimentalValues; * This object is then used to validate and parse the value entered. */ const allowedExperimentalValues = Object.freeze({ - fleetServerEnabled: false, trustedAppsByPolicyEnabled: false, eventFilteringEnabled: false, }); diff --git a/x-pack/plugins/security_solution/server/config.ts b/x-pack/plugins/security_solution/server/config.ts index 88d57a47b6c42..8dfe56a1a54f4 100644 --- a/x-pack/plugins/security_solution/server/config.ts +++ b/x-pack/plugins/security_solution/server/config.ts @@ -32,7 +32,7 @@ export const configSchema = schema.object({ * * @example * xpack.securitySolution.enableExperimental: - * - fleetServerEnabled + * - someCrazyFeature * - trustedAppsByPolicyEnabled */ enableExperimental: schema.arrayOf(schema.string(), { diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.test.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.test.ts index cc1dda05f6738..beaf0c06299fa 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.test.ts @@ -10,7 +10,6 @@ import { InternalArtifactCompleteSchema } from '../../schemas'; import { getArtifactId } from './common'; import { isEmptyManifestDiff, Manifest } from './manifest'; import { getMockArtifacts, toArtifactRecords } from './mocks'; -import { cloneDeepWith, CloneDeepWithCustomizer } from 'lodash'; describe('manifest', () => { const TEST_POLICY_ID_1 = 'c6d16e42-c32d-4dce-8a88-113cfe276ad1'; @@ -695,50 +694,4 @@ describe('manifest', () => { expect(isEmptyManifestDiff(diff)).toBe(false); }); }); - - describe('and Fleet Server is enabled', () => { - const convertToFleetServerRelativeUrl: CloneDeepWithCustomizer = (value, key) => { - if (key === 'relative_url') { - return value.replace('/api/endpoint/artifacts/download/', '/api/fleet/artifacts/'); - } - }; - let manifest: Manifest; - - beforeEach(() => { - manifest = new Manifest({ schemaVersion: 'v1', semanticVersion: '1.0.0' }, true); - - manifest.addEntry(ARTIFACT_EXCEPTIONS_MACOS); - manifest.addEntry(ARTIFACT_EXCEPTIONS_WINDOWS); - manifest.addEntry(ARTIFACT_EXCEPTIONS_WINDOWS, TEST_POLICY_ID_1); - manifest.addEntry(ARTIFACT_TRUSTED_APPS_MACOS, TEST_POLICY_ID_1); - }); - - test('should write manifest for global artifacts with fleet-server relative url', () => { - expect(manifest.toPackagePolicyManifest()).toStrictEqual({ - schema_version: 'v1', - manifest_version: '1.0.0', - artifacts: cloneDeepWith( - toArtifactRecords({ - 'endpoint-exceptionlist-windows-v1': ARTIFACT_EXCEPTIONS_WINDOWS, - 'endpoint-exceptionlist-macos-v1': ARTIFACT_EXCEPTIONS_MACOS, - }), - convertToFleetServerRelativeUrl - ), - }); - }); - - test('should write policy specific manifest with fleet-server relative url', () => { - expect(manifest.toPackagePolicyManifest(TEST_POLICY_ID_1)).toStrictEqual({ - schema_version: 'v1', - manifest_version: '1.0.0', - artifacts: cloneDeepWith( - toArtifactRecords({ - 'endpoint-exceptionlist-windows-v1': ARTIFACT_EXCEPTIONS_WINDOWS, - 'endpoint-trustlist-macos-v1': ARTIFACT_TRUSTED_APPS_MACOS, - }), - convertToFleetServerRelativeUrl - ), - }); - }); - }); }); diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.ts index aefda4cf1f88d..7e1accac37cf0 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.ts @@ -56,10 +56,7 @@ export class Manifest { private readonly policySpecificEntries: Map>; private version: ManifestVersion; - constructor( - version?: Partial, - private readonly isFleetServerEnabled: boolean = false - ) { + constructor(version?: Partial) { this.allEntries = new Map(); this.defaultEntries = new Map(); this.policySpecificEntries = new Map(); @@ -78,8 +75,8 @@ export class Manifest { this.version = validated; } - public static getDefault(schemaVersion?: ManifestSchemaVersion, isFleetServerEnabled?: boolean) { - return new Manifest({ schemaVersion, semanticVersion: '1.0.0' }, isFleetServerEnabled); + public static getDefault(schemaVersion?: ManifestSchemaVersion) { + return new Manifest({ schemaVersion, semanticVersion: '1.0.0' }); } public bumpSemanticVersion() { @@ -107,7 +104,7 @@ export class Manifest { const descriptor = { isDefaultEntry: existingDescriptor?.isDefaultEntry || policyId === undefined, specificTargetPolicies: addValueToSet(existingDescriptor?.specificTargetPolicies, policyId), - entry: existingDescriptor?.entry || new ManifestEntry(artifact, this.isFleetServerEnabled), + entry: existingDescriptor?.entry || new ManifestEntry(artifact), }; this.allEntries.set(descriptor.entry.getDocId(), descriptor); diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest_entry.test.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest_entry.test.ts index 1f07818d2d44f..99f08103ece06 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest_entry.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest_entry.test.ts @@ -49,7 +49,7 @@ describe('manifest_entry', () => { test('Correct url is returned', () => { expect(manifestEntry.getUrl()).toEqual( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3' + '/api/fleet/artifacts/endpoint-exceptionlist-windows-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3' ); }); @@ -66,7 +66,7 @@ describe('manifest_entry', () => { decoded_size: 432, encoded_size: 147, relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', + '/api/fleet/artifacts/endpoint-exceptionlist-windows-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', }); }); }); diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest_entry.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest_entry.ts index 4dcdfa23e0d63..5f1fe72b7c0f9 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest_entry.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest_entry.ts @@ -14,7 +14,7 @@ import { relativeDownloadUrlFromArtifact } from '../../../../../fleet/server'; export class ManifestEntry { private artifact: InternalArtifactSchema; - constructor(artifact: InternalArtifactSchema, private isFleetServerEnabled: boolean = false) { + constructor(artifact: InternalArtifactSchema) { this.artifact = artifact; } @@ -47,14 +47,10 @@ export class ManifestEntry { } public getUrl(): string { - if (this.isFleetServerEnabled) { - return relativeDownloadUrlFromArtifact({ - identifier: this.getIdentifier(), - decodedSha256: this.getDecodedSha256(), - }); - } - - return `/api/endpoint/artifacts/download/${this.getIdentifier()}/${this.getDecodedSha256()}`; + return relativeDownloadUrlFromArtifact({ + identifier: this.getIdentifier(), + decodedSha256: this.getDecodedSha256(), + }); } public getArtifact(): InternalArtifactSchema { diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/migrate_artifacts_to_fleet.test.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/migrate_artifacts_to_fleet.test.ts index cf1f178a80e78..b74492103dbdc 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/migrate_artifacts_to_fleet.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/migrate_artifacts_to_fleet.test.ts @@ -58,22 +58,14 @@ describe('When migrating artifacts to fleet', () => { it('should do nothing if there are no artifacts', async () => { soClient.find.mockReset(); soClient.find.mockResolvedValue(createSoFindResult([], 0)); - await migrateArtifactsToFleet(soClient, artifactClient, logger, true); + await migrateArtifactsToFleet(soClient, artifactClient, logger); expect(soClient.find).toHaveBeenCalled(); expect(artifactClient.createArtifact).not.toHaveBeenCalled(); expect(soClient.delete).not.toHaveBeenCalled(); }); - it('should do nothing if `fleetServerEnabled` flag is false', async () => { - await migrateArtifactsToFleet(soClient, artifactClient, logger, false); - expect(logger.debug).toHaveBeenCalledWith( - 'Skipping Artifacts migration. [fleetServerEnabled] flag is off' - ); - expect(soClient.find).not.toHaveBeenCalled(); - }); - it('should create new artifact via fleet client and delete prior SO one', async () => { - await migrateArtifactsToFleet(soClient, artifactClient, logger, true); + await migrateArtifactsToFleet(soClient, artifactClient, logger); expect(artifactClient.createArtifact).toHaveBeenCalled(); expect(soClient.delete).toHaveBeenCalled(); }); @@ -82,7 +74,7 @@ describe('When migrating artifacts to fleet', () => { const notFoundError: Error & { output?: { statusCode: number } } = new Error('not found'); notFoundError.output = { statusCode: 404 }; soClient.delete.mockRejectedValue(notFoundError); - await expect(migrateArtifactsToFleet(soClient, artifactClient, logger, true)).resolves.toEqual( + await expect(migrateArtifactsToFleet(soClient, artifactClient, logger)).resolves.toEqual( undefined ); expect(logger.debug).toHaveBeenCalledWith( @@ -93,7 +85,7 @@ describe('When migrating artifacts to fleet', () => { it('should Throw() and log error if migration fails', async () => { const error = new Error('test: delete failed'); soClient.delete.mockRejectedValue(error); - await expect(migrateArtifactsToFleet(soClient, artifactClient, logger, true)).rejects.toThrow( + await expect(migrateArtifactsToFleet(soClient, artifactClient, logger)).rejects.toThrow( 'Artifact SO migration failed' ); }); diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/migrate_artifacts_to_fleet.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/migrate_artifacts_to_fleet.ts index ba3c15cecf217..4518e23bb7fea 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/migrate_artifacts_to_fleet.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/migrate_artifacts_to_fleet.ts @@ -23,14 +23,8 @@ class ArtifactMigrationError extends Error { export const migrateArtifactsToFleet = async ( soClient: SavedObjectsClient, endpointArtifactClient: EndpointArtifactClientInterface, - logger: Logger, - isFleetServerEnabled: boolean + logger: Logger ): Promise => { - if (!isFleetServerEnabled) { - logger.debug('Skipping Artifacts migration. [fleetServerEnabled] flag is off'); - return; - } - let totalArtifactsMigrated = -1; let hasMore = true; diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/mocks.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/mocks.ts index 1a582a51c52c1..85857301d5f39 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/mocks.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/mocks.ts @@ -71,7 +71,7 @@ const toArtifactRecord = (artifactName: string, artifact: InternalArtifactComple encoded_sha256: artifact.encodedSha256, encoded_size: artifact.encodedSize, encryption_algorithm: artifact.encryptionAlgorithm, - relative_url: `/api/endpoint/artifacts/download/${artifactName}/${artifact.decodedSha256}`, + relative_url: `/api/fleet/artifacts/${artifactName}/${artifact.decodedSha256}`, }); export const toArtifactRecords = (artifacts: Record) => @@ -100,7 +100,7 @@ export const createPackagePolicyWithInitialManifestMock = (): PackagePolicy => { decoded_size: 14, encoded_size: 22, relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-exceptionlist-windows-v1': { compression_algorithm: 'zlib', @@ -110,7 +110,7 @@ export const createPackagePolicyWithInitialManifestMock = (): PackagePolicy => { decoded_size: 14, encoded_size: 22, relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, }, manifest_version: '1.0.0', @@ -135,7 +135,7 @@ export const createPackagePolicyWithManifestMock = (): PackagePolicy => { decoded_size: 432, encoded_size: 147, relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', + '/api/fleet/artifacts/endpoint-exceptionlist-macos-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', }, 'endpoint-exceptionlist-windows-v1': { compression_algorithm: 'zlib', @@ -145,7 +145,7 @@ export const createPackagePolicyWithManifestMock = (): PackagePolicy => { decoded_size: 432, encoded_size: 147, relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', + '/api/fleet/artifacts/endpoint-exceptionlist-windows-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', }, }, manifest_version: '1.0.1', diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.test.ts deleted file mode 100644 index c70dd39e17e9e..0000000000000 --- a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.test.ts +++ /dev/null @@ -1,349 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { deflateSync, inflateSync } from 'zlib'; -import LRU from 'lru-cache'; -import type { - ILegacyClusterClient, - IRouter, - SavedObjectsClientContract, - ILegacyScopedClusterClient, - RouteConfig, - RequestHandler, - KibanaResponseFactory, - SavedObject, -} from 'kibana/server'; -import { - elasticsearchServiceMock, - savedObjectsClientMock, - httpServiceMock, - httpServerMock, - loggingSystemMock, -} from 'src/core/server/mocks'; -import { parseExperimentalConfigValue } from '../../../../common/experimental_features'; -import { ArtifactConstants } from '../../lib/artifacts'; -import { registerDownloadArtifactRoute } from './download_artifact'; -import { EndpointAppContextService } from '../../endpoint_app_context_services'; -import { createMockEndpointAppContextServiceStartContract } from '../../mocks'; -import { createMockConfig } from '../../../lib/detection_engine/routes/__mocks__'; -import { WrappedTranslatedExceptionList } from '../../schemas/artifacts/lists'; -import type { SecuritySolutionRequestHandlerContext } from '../../../types'; - -const mockArtifactName = `${ArtifactConstants.GLOBAL_ALLOWLIST_NAME}-windows-v1`; -const expectedEndpointExceptions: WrappedTranslatedExceptionList = { - entries: [ - { - type: 'simple', - entries: [ - { - entries: [ - { - field: 'some.not.nested.field', - operator: 'included', - type: 'exact_cased', - value: 'some value', - }, - ], - field: 'some.field', - type: 'nested', - }, - { - field: 'some.not.nested.field', - operator: 'included', - type: 'exact_cased', - value: 'some value', - }, - ], - }, - { - type: 'simple', - entries: [ - { - field: 'some.other.not.nested.field', - operator: 'included', - type: 'exact_cased', - value: 'some other value', - }, - ], - }, - ], -}; -const mockFleetESResponse = { - body: { - hits: { - hits: [ - { - _id: 'agent1', - _source: { - active: true, - access_api_key_id: 'pedTuHIBTEDt93wW0Fhr', - }, - }, - ], - }, - }, -}; - -const AuthHeader = 'ApiKey cGVkVHVISUJURUR0OTN3VzBGaHI6TnU1U0JtbHJSeC12Rm9qQWpoSHlUZw=='; - -describe('test alerts route', () => { - let routerMock: jest.Mocked; - let mockClusterClient: jest.Mocked; - let mockScopedClient: jest.Mocked; - let mockSavedObjectClient: jest.Mocked; - let mockResponse: jest.Mocked; - let routeConfig: RouteConfig; - let routeHandler: RequestHandler; - let endpointAppContextService: EndpointAppContextService; - let cache: LRU; - let ingestSavedObjectClient: jest.Mocked; - let esClientMock: ReturnType; - - beforeEach(() => { - mockClusterClient = elasticsearchServiceMock.createLegacyClusterClient(); - mockScopedClient = elasticsearchServiceMock.createLegacyScopedClusterClient(); - mockSavedObjectClient = savedObjectsClientMock.create(); - mockResponse = httpServerMock.createResponseFactory(); - mockClusterClient.asScoped.mockReturnValue(mockScopedClient); - routerMock = httpServiceMock.createRouter(); - endpointAppContextService = new EndpointAppContextService(); - cache = new LRU({ max: 10, maxAge: 1000 * 60 * 60 }); - const startContract = createMockEndpointAppContextServiceStartContract(); - - // // The authentication with the Fleet Plugin needs a separate scoped ES CLient - esClientMock = elasticsearchServiceMock.createInternalClient(); - // @ts-expect-error - esClientMock.search.mockResolvedValue(mockFleetESResponse); - - ingestSavedObjectClient = savedObjectsClientMock.create(); - (startContract.savedObjectsStart.getScopedClient as jest.Mock).mockReturnValue( - ingestSavedObjectClient - ); - endpointAppContextService.start(startContract); - - registerDownloadArtifactRoute( - routerMock, - { - logFactory: loggingSystemMock.create(), - service: endpointAppContextService, - config: () => Promise.resolve(createMockConfig()), - experimentalFeatures: parseExperimentalConfigValue(createMockConfig().enableExperimental), - }, - cache - ); - }); - - it('should serve the artifact to download', async () => { - const mockRequest = httpServerMock.createKibanaRequest({ - path: `/api/endpoint/artifacts/download/${mockArtifactName}/123456`, - method: 'get', - params: { sha256: '123456' }, - headers: { - authorization: AuthHeader, - }, - }); - - // Mock the SavedObjectsClient get response for fetching the artifact - const mockArtifact = { - id: '2468', - type: 'test', - references: [], - attributes: { - identifier: mockArtifactName, - schemaVersion: 'v1', - sha256: '123456', - encoding: 'application/json', - created: Date.now(), - body: deflateSync(JSON.stringify(expectedEndpointExceptions)).toString('base64'), - size: 100, - }, - }; - const soFindResp: SavedObject = { - ...mockArtifact, - }; - ingestSavedObjectClient.get.mockImplementationOnce(() => Promise.resolve(soFindResp)); - - // This workaround is only temporary. The endpoint `ArtifactClient` will be removed soon - // and this entire test file refactored to start using fleet's exposed FleetArtifactClient class. - endpointAppContextService! - .getManifestManager()! - .getArtifactsClient().getArtifact = jest.fn().mockResolvedValue(soFindResp.attributes); - - [routeConfig, routeHandler] = routerMock.get.mock.calls.find(([{ path }]) => - path.startsWith('/api/endpoint/artifacts/download') - )!; - - expect(routeConfig.options).toEqual({ tags: ['endpoint:limited-concurrency'] }); - - await routeHandler( - ({ - core: { - savedObjects: { - client: mockSavedObjectClient, - }, - elasticsearch: { - client: { asInternalUser: esClientMock }, - }, - }, - } as unknown) as SecuritySolutionRequestHandlerContext, - mockRequest, - mockResponse - ); - - const expectedHeaders = { - 'content-encoding': 'identity', - 'content-disposition': `attachment; filename=${mockArtifactName}.zz`, - }; - - expect(mockResponse.ok).toBeCalled(); - expect(mockResponse.ok.mock.calls[0][0]?.headers).toEqual(expectedHeaders); - const artifact = inflateSync(mockResponse.ok.mock.calls[0][0]?.body as Buffer).toString(); - expect(artifact).toEqual( - inflateSync(Buffer.from(mockArtifact.attributes.body, 'base64')).toString() - ); - }); - - it('should handle fetching a non-existent artifact', async () => { - const mockRequest = httpServerMock.createKibanaRequest({ - path: `/api/endpoint/artifacts/download/${mockArtifactName}/123456`, - method: 'get', - params: { sha256: '789' }, - headers: { - authorization: AuthHeader, - }, - }); - - ingestSavedObjectClient.get.mockImplementationOnce(() => - // eslint-disable-next-line prefer-promise-reject-errors - Promise.reject({ output: { statusCode: 404 } }) - ); - - [routeConfig, routeHandler] = routerMock.get.mock.calls.find(([{ path }]) => - path.startsWith('/api/endpoint/artifacts/download') - )!; - - await routeHandler( - ({ - core: { - savedObjects: { - client: mockSavedObjectClient, - }, - elasticsearch: { - client: { asInternalUser: esClientMock }, - }, - }, - } as unknown) as SecuritySolutionRequestHandlerContext, - mockRequest, - mockResponse - ); - expect(mockResponse.notFound).toBeCalled(); - }); - - it('should utilize the cache', async () => { - const mockSha = '123456789'; - const mockRequest = httpServerMock.createKibanaRequest({ - path: `/api/endpoint/artifacts/download/${mockArtifactName}/${mockSha}`, - method: 'get', - params: { sha256: mockSha, identifier: mockArtifactName }, - headers: { - authorization: AuthHeader, - }, - }); - - // Add to the download cache - const mockArtifact = expectedEndpointExceptions; - const cacheKey = `${mockArtifactName}-${mockSha}`; - cache.set(cacheKey, Buffer.from(JSON.stringify(mockArtifact))); // TODO: add compression here - - [routeConfig, routeHandler] = routerMock.get.mock.calls.find(([{ path }]) => - path.startsWith('/api/endpoint/artifacts/download') - )!; - - await routeHandler( - ({ - core: { - savedObjects: { - client: mockSavedObjectClient, - }, - elasticsearch: { - client: { asInternalUser: esClientMock }, - }, - }, - } as unknown) as SecuritySolutionRequestHandlerContext, - mockRequest, - mockResponse - ); - expect(mockResponse.ok).toBeCalled(); - // The saved objects client should be bypassed as the cache will contain the download - expect(ingestSavedObjectClient.get.mock.calls.length).toEqual(0); - }); - - it('should respond with a 401 if a valid API Token is not supplied', async () => { - const mockSha = '123456789'; - const mockRequest = httpServerMock.createKibanaRequest({ - path: `/api/endpoint/artifacts/download/${mockArtifactName}/${mockSha}`, - method: 'get', - params: { sha256: mockSha, identifier: mockArtifactName }, - }); - - [routeConfig, routeHandler] = routerMock.get.mock.calls.find(([{ path }]) => - path.startsWith('/api/endpoint/artifacts/download') - )!; - - await routeHandler( - ({ - core: { - savedObjects: { - client: mockSavedObjectClient, - }, - elasticsearch: { - client: { asInternalUser: esClientMock }, - }, - }, - } as unknown) as SecuritySolutionRequestHandlerContext, - mockRequest, - mockResponse - ); - expect(mockResponse.unauthorized).toBeCalled(); - }); - - it('should respond with a 404 if an agent cannot be linked to the API token', async () => { - const mockSha = '123456789'; - const mockRequest = httpServerMock.createKibanaRequest({ - path: `/api/endpoint/artifacts/download/${mockArtifactName}/${mockSha}`, - method: 'get', - params: { sha256: mockSha, identifier: mockArtifactName }, - headers: { - authorization: AuthHeader, - }, - }); - - // Mock the SavedObjectsClient find response for verifying the API token with no results - // @ts-expect-error - esClientMock.search.mockResolvedValue({ body: { hits: { hits: [] } } }); - - [routeConfig, routeHandler] = routerMock.get.mock.calls.find(([{ path }]) => - path.startsWith('/api/endpoint/artifacts/download') - )!; - - await routeHandler( - ({ - core: { - savedObjects: { - client: mockSavedObjectClient, - }, - elasticsearch: { - client: { asInternalUser: esClientMock }, - }, - }, - } as unknown) as SecuritySolutionRequestHandlerContext, - mockRequest, - mockResponse - ); - expect(mockResponse.notFound).toBeCalled(); - }); -}); diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.ts b/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.ts deleted file mode 100644 index 948cd035243bd..0000000000000 --- a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.ts +++ /dev/null @@ -1,100 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { IRouter, HttpResponseOptions, IKibanaResponse } from 'src/core/server'; -import LRU from 'lru-cache'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { authenticateAgentWithAccessToken } from '../../../../../fleet/server/services/agents/authenticate'; -import { LIMITED_CONCURRENCY_ENDPOINT_ROUTE_TAG } from '../../../../common/endpoint/constants'; -import { buildRouteValidation } from '../../../utils/build_validation/route_validation'; -import { - DownloadArtifactRequestParamsSchema, - downloadArtifactRequestParamsSchema, - downloadArtifactResponseSchema, -} from '../../schemas/artifacts'; -import { EndpointAppContext } from '../../types'; - -const allowlistBaseRoute: string = '/api/endpoint/artifacts'; - -/** - * Registers the artifact download route to enable sensors to download an allowlist artifact - */ -export function registerDownloadArtifactRoute( - router: IRouter, - endpointContext: EndpointAppContext, - cache: LRU -) { - router.get( - { - path: `${allowlistBaseRoute}/download/{identifier}/{sha256}`, - validate: { - params: buildRouteValidation< - typeof downloadArtifactRequestParamsSchema, - DownloadArtifactRequestParamsSchema - >(downloadArtifactRequestParamsSchema), - }, - options: { tags: [LIMITED_CONCURRENCY_ENDPOINT_ROUTE_TAG] }, - }, - async (context, req, res) => { - const logger = endpointContext.logFactory.get('download_artifact'); - - // The ApiKey must be associated with an enrolled Fleet agent - try { - await authenticateAgentWithAccessToken( - context.core.elasticsearch.client.asInternalUser, - req - ); - } catch (err) { - if ((err.isBoom ? err.output.statusCode : err.statusCode) === 401) { - return res.unauthorized(); - } else { - return res.notFound(); - } - } - - const validateDownload = (await endpointContext.config()).validateArtifactDownloads; - const buildAndValidateResponse = (artName: string, body: Buffer): IKibanaResponse => { - const artifact: HttpResponseOptions = { - body, - headers: { - 'content-encoding': 'identity', - 'content-disposition': `attachment; filename=${artName}.zz`, - }, - }; - - if (validateDownload && !downloadArtifactResponseSchema.is(artifact)) { - throw new Error('Artifact failed to validate.'); - } else { - return res.ok(artifact); - } - }; - - const id = `${req.params.identifier}-${req.params.sha256}`; - const cacheResp = cache.get(id); - - if (cacheResp) { - logger.debug(`Cache HIT artifact ${id}`); - return buildAndValidateResponse(req.params.identifier, cacheResp); - } else { - logger.debug(`Cache MISS artifact ${id}`); - - const artifact = await endpointContext.service - .getManifestManager() - ?.getArtifactsClient() - .getArtifact(id); - - if (!artifact) { - return res.notFound({ body: `No artifact found for ${id}` }); - } - - const bodyBuffer = Buffer.from(artifact.body, 'base64'); - cache.set(id, bodyBuffer); - return buildAndValidateResponse(artifact.identifier, bodyBuffer); - } - } - ); -} diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/index.ts b/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/index.ts deleted file mode 100644 index a651f93cab09d..0000000000000 --- a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/index.ts +++ /dev/null @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export * from './download_artifact'; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.ts index 7dfa463f4a4f8..929f2598c0a34 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.ts @@ -20,7 +20,10 @@ export async function findAllUnenrolledAgentIds( page: pageNum, perPage: pageSize, showInactive: true, - kuery: '(active : false) OR (NOT packages : "endpoint" AND active : true)', + // FIXME: remove temporary work-around after https://github.com/elastic/beats/pull/25070 is implemented + // makes it into a snapshot build. + // kuery: '(active : false) OR (NOT packages : "endpoint" AND active : true)', + kuery: '(active : false)', }; }; diff --git a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts index b3d8b63687d31..fe4aba165d2bd 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts @@ -317,14 +317,11 @@ export class ManifestManager { throw new Error('No version returned for manifest.'); } - const manifest = new Manifest( - { - schemaVersion: this.schemaVersion, - semanticVersion: manifestSo.attributes.semanticVersion, - soVersion: manifestSo.version, - }, - this.experimentalFeatures.fleetServerEnabled - ); + const manifest = new Manifest({ + schemaVersion: this.schemaVersion, + semanticVersion: manifestSo.attributes.semanticVersion, + soVersion: manifestSo.version, + }); for (const entry of manifestSo.attributes.artifacts) { const artifact = await this.artifactClient.getArtifact(entry.artifactId); @@ -348,11 +345,8 @@ export class ManifestManager { /** * creates a new default Manifest */ - public static createDefaultManifest( - schemaVersion?: ManifestSchemaVersion, - isFleetServerEnabled?: boolean - ): Manifest { - return Manifest.getDefault(schemaVersion, isFleetServerEnabled); + public static createDefaultManifest(schemaVersion?: ManifestSchemaVersion): Manifest { + return Manifest.getDefault(schemaVersion); } /** @@ -362,10 +356,7 @@ export class ManifestManager { * @returns {Promise} A new Manifest object reprenting the current exception list. */ public async buildNewManifest( - baselineManifest: Manifest = ManifestManager.createDefaultManifest( - this.schemaVersion, - this.experimentalFeatures.fleetServerEnabled - ) + baselineManifest: Manifest = ManifestManager.createDefaultManifest(this.schemaVersion) ): Promise { const results = await Promise.all([ this.buildExceptionListArtifacts(), @@ -376,14 +367,11 @@ export class ManifestManager { : []), ]); - const manifest = new Manifest( - { - schemaVersion: this.schemaVersion, - semanticVersion: baselineManifest.getSemanticVersion(), - soVersion: baselineManifest.getSavedObjectVersion(), - }, - this.experimentalFeatures.fleetServerEnabled - ); + const manifest = new Manifest({ + schemaVersion: this.schemaVersion, + semanticVersion: baselineManifest.getSemanticVersion(), + soVersion: baselineManifest.getSavedObjectVersion(), + }); for (const result of results) { await iterateArtifactsBuildResult(result, async (artifact, policyId) => { diff --git a/x-pack/plugins/security_solution/server/plugin.ts b/x-pack/plugins/security_solution/server/plugin.ts index 8dab308affad8..003ba4c8cf190 100644 --- a/x-pack/plugins/security_solution/server/plugin.ts +++ b/x-pack/plugins/security_solution/server/plugin.ts @@ -62,7 +62,6 @@ import { registerPolicyRoutes } from './endpoint/routes/policy'; import { EndpointArtifactClient, ManifestManager } from './endpoint/services'; import { EndpointAppContextService } from './endpoint/endpoint_app_context_services'; import { EndpointAppContext } from './endpoint/types'; -import { registerDownloadArtifactRoute } from './endpoint/routes/artifacts'; import { initUsageCollectors } from './usage'; import type { SecuritySolutionRequestHandlerContext } from './types'; import { registerTrustedAppsRoutes } from './endpoint/routes/trusted_apps'; @@ -206,7 +205,6 @@ export class Plugin implements IPlugin { - migrateArtifactsToFleet( - savedObjectsClient, - artifactClient, - logger, - fleetServerEnabled - ).finally(() => { + migrateArtifactsToFleet(savedObjectsClient, artifactClient, logger).finally(() => { logger.info('Dependent plugin setup complete - Starting ManifestTask'); if (this.manifestTask) { diff --git a/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy_with_agents_setup.ts b/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy_with_agents_setup.ts index 38510eff72d05..48b7513c87da2 100644 --- a/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy_with_agents_setup.ts +++ b/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy_with_agents_setup.ts @@ -8,15 +8,17 @@ import expect from '@kbn/expect'; import { skipIfNoDockerRegistry } from '../../helpers'; import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; -import { setupFleetAndAgents, getSupertestWithoutAuth } from '../agents/services'; -import { AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS } from '../../../../plugins/fleet/common'; +import { setupFleetAndAgents } from '../agents/services'; +import { + AGENT_POLICY_INDEX, + AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS, +} from '../../../../plugins/fleet/common'; export default function (providerContext: FtrProviderContext) { const { getService } = providerContext; const supertest = getService('supertest'); const esArchiver = getService('esArchiver'); - const supertestWithoutAuth = getSupertestWithoutAuth(providerContext); - const kibanaServer = getService('kibanaServer'); + const esClient = getService('es'); async function getEnrollmentKeyForPolicyId(policyId: string) { const listRes = await supertest.get(`/api/fleet/enrollment-api-keys`).expect(200); @@ -32,41 +34,23 @@ export default function (providerContext: FtrProviderContext) { return res.body.item; } - // Enroll an agent to get the actions for an agent as encrypted saved object are not expose otherwise - async function getAgentActionsForEnrollmentKey(enrollmentAPIToken: string) { - const kibanaVersionAccessor = kibanaServer.version; - const kibanaVersion = await kibanaVersionAccessor.get(); - - const { body: enrollmentResponse } = await supertestWithoutAuth - .post(`/api/ingest_manager/fleet/agents/enroll`) - .set('kbn-xsrf', 'xxx') - .set('Authorization', `ApiKey ${enrollmentAPIToken}`) - .send({ - type: 'PERMANENT', - metadata: { - local: { - elastic: { agent: { version: kibanaVersion } }, + async function hasFleetServerPoliciesForPolicy(policyId: string) { + const res = await esClient.search({ + index: AGENT_POLICY_INDEX, + ignore_unavailable: true, + body: { + query: { + term: { + policy_id: policyId, }, - user_provided: {}, }, - }) - .expect(200); - - const agentAccessAPIKey = enrollmentResponse.item.access_api_key; - - // Agent checkin - const { body: checkinApiResponse } = await supertestWithoutAuth - .post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/checkin`) - .set('kbn-xsrf', 'xx') - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .send({ - events: [], - }) - .expect(200); - - expect(checkinApiResponse.actions).length(1); + size: 1, + sort: [{ revision_idx: { order: 'desc' } }], + }, + }); - return checkinApiResponse.actions[0]; + // @ts-expect-error TotalHit + return res.body.hits.total.value !== 0; } // Test all the side effect that should occurs when we create|update an agent policy @@ -103,15 +87,7 @@ export default function (providerContext: FtrProviderContext) { const enrollmentKey = await getEnrollmentKeyForPolicyId(policyId); expect(enrollmentKey).not.empty(); - const action = await getAgentActionsForEnrollmentKey(enrollmentKey.api_key); - - expect(action.type).to.be('POLICY_CHANGE'); - const agentPolicy = action.data.policy; - expect(agentPolicy.id).to.be(policyId); - // should have system inputs - expect(agentPolicy.inputs).length(3); - // should have default output - expect(agentPolicy.outputs.default).not.empty(); + expect(await hasFleetServerPoliciesForPolicy(policyId)).to.be(true); }); }); @@ -134,9 +110,7 @@ export default function (providerContext: FtrProviderContext) { const enrollmentKey = await getEnrollmentKeyForPolicyId(policyId); expect(enrollmentKey).not.empty(); - const action = await getAgentActionsForEnrollmentKey(enrollmentKey.api_key); - expect(action.type).to.be('POLICY_CHANGE'); - expect(action.data.policy.id).to.be(policyId); + expect(await hasFleetServerPoliciesForPolicy(policyId)).to.be(true); }); }); }); diff --git a/x-pack/test/fleet_api_integration/apis/agents/acks.ts b/x-pack/test/fleet_api_integration/apis/agents/acks.ts deleted file mode 100644 index 427c9c2394d9d..0000000000000 --- a/x-pack/test/fleet_api_integration/apis/agents/acks.ts +++ /dev/null @@ -1,250 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; -import uuid from 'uuid'; -import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; -import { getSupertestWithoutAuth } from './services'; - -export default function (providerContext: FtrProviderContext) { - const { getService } = providerContext; - const esArchiver = getService('esArchiver'); - const esClient = getService('es'); - - const supertestWithoutAuth = getSupertestWithoutAuth(providerContext); - const supertest = getService('supertest'); - let apiKey: { id: string; api_key: string }; - - describe('fleet_agents_acks', () => { - before(async () => { - await esArchiver.loadIfNeeded('fleet/agents'); - - const { body: apiKeyBody } = await esClient.security.createApiKey({ - body: { - name: `test access api key: ${uuid.v4()}`, - }, - }); - apiKey = apiKeyBody; - const { - body: { _source: agentDoc }, - } = await esClient.get({ - index: '.fleet-agents', - id: 'agent1', - }); - // @ts-expect-error has unknown type - agentDoc.access_api_key_id = apiKey.id; - await esClient.update({ - index: '.fleet-agents', - id: 'agent1', - refresh: true, - body: { - doc: agentDoc, - }, - }); - }); - after(async () => { - await esArchiver.unload('fleet/agents'); - }); - - it('should return a 401 if this a not a valid acks access', async () => { - await supertestWithoutAuth - .post(`/api/fleet/agents/agent1/acks`) - .set('kbn-xsrf', 'xx') - .set('Authorization', 'ApiKey NOT_A_VALID_TOKEN') - .send({ - action_ids: [], - }) - .expect(401); - }); - - it('should return a 200 if this a valid acks request', async () => { - const { body: apiResponse } = await supertestWithoutAuth - .post(`/api/fleet/agents/agent1/acks`) - .set('kbn-xsrf', 'xx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - events: [ - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: '48cebde1-c906-4893-b89f-595d943b72a1', - agent_id: 'agent1', - message: 'hello', - payload: 'payload', - }, - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-05T14:32:03.36764-05:00', - action_id: '48cebde1-c906-4893-b89f-595d943b72a2', - agent_id: 'agent1', - message: 'hello2', - payload: 'payload2', - }, - ], - }) - .expect(200); - expect(apiResponse.action).to.be('acks'); - - const { body: eventResponse } = await supertest - .get(`/api/fleet/agents/agent1/events`) - .set('kbn-xsrf', 'xx') - .expect(200); - const expectedEvents = eventResponse.list.filter( - (item: Record) => - item.action_id === '48cebde1-c906-4893-b89f-595d943b72a1' || - item.action_id === '48cebde1-c906-4893-b89f-595d943b72a2' - ); - expect(expectedEvents.length).to.eql(2); - const { id, ...expectedEvent } = expectedEvents.find( - (item: Record) => item.action_id === '48cebde1-c906-4893-b89f-595d943b72a1' - ); - expect(expectedEvent).to.eql({ - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: '48cebde1-c906-4893-b89f-595d943b72a1', - agent_id: 'agent1', - message: 'hello', - payload: 'payload', - }); - }); - - it('should return a 400 when request event list contains event for another agent id', async () => { - const { body: apiResponse } = await supertestWithoutAuth - .post(`/api/fleet/agents/agent1/acks`) - .set('kbn-xsrf', 'xx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - events: [ - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: '48cebde1-c906-4893-b89f-595d943b72a1', - agent_id: 'agent2', - message: 'hello', - payload: 'payload', - }, - ], - }) - .expect(400); - expect(apiResponse.message).to.eql( - 'agent events contains events with different agent id from currently authorized agent' - ); - }); - - it('should return a 400 when request event list contains action that does not belong to agent current actions', async () => { - const { body: apiResponse } = await supertestWithoutAuth - .post(`/api/fleet/agents/agent1/acks`) - .set('kbn-xsrf', 'xx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - events: [ - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: '48cebde1-c906-4893-b89f-595d943b72a1', - agent_id: 'agent1', - message: 'hello', - payload: 'payload', - }, - { - type: 'ACTION_RESULT', - subtype: 'CONFIG', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: 'does-not-exist', - agent_id: 'agent1', - message: 'hello', - payload: 'payload', - }, - ], - }) - .expect(400); - expect(apiResponse.message).to.eql('One or more actions cannot be found'); - }); - - it('should return a 400 when request event list contains action types that are not allowed for acknowledgement', async () => { - const { body: apiResponse } = await supertestWithoutAuth - .post(`/api/fleet/agents/agent1/acks`) - .set('kbn-xsrf', 'xx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - events: [ - { - type: 'ACTION', - subtype: 'FAILED', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: '48cebde1-c906-4893-b89f-595d943b72a1', - agent_id: 'agent1', - message: 'hello', - payload: 'payload', - }, - ], - }) - .expect(400); - expect(apiResponse.message).to.eql( - 'ACTION not allowed for acknowledgment only ACTION_RESULT' - ); - }); - - it('ack upgrade should update fleet-agent SO', async () => { - const { body: actionRes } = await supertest - .post(`/api/fleet/agents/agent1/actions`) - .set('kbn-xsrf', 'xx') - .send({ - action: { - type: 'UPGRADE', - ack_data: { version: '8.0.0' }, - }, - }) - .expect(200); - const actionId = actionRes.item.id; - await supertestWithoutAuth - .post(`/api/fleet/agents/agent1/acks`) - .set('kbn-xsrf', 'xx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - events: [ - { - type: 'ACTION_RESULT', - subtype: 'ACKNOWLEDGED', - timestamp: '2020-09-21T13:25:29.02838-04:00', - action_id: actionId, - agent_id: 'agent1', - message: - "Action '70d97288-ffd9-4549-8c49-2423a844f67f' of type 'UPGRADE' acknowledged.", - }, - ], - }) - .expect(200); - - const res = await esClient.get<{ upgraded_at: unknown }>({ - index: '.fleet-agents', - id: 'agent1', - }); - expect(res.body._source?.upgraded_at).to.be.ok(); - }); - }); -} diff --git a/x-pack/test/fleet_api_integration/apis/agents/checkin.ts b/x-pack/test/fleet_api_integration/apis/agents/checkin.ts deleted file mode 100644 index 9150b81abf366..0000000000000 --- a/x-pack/test/fleet_api_integration/apis/agents/checkin.ts +++ /dev/null @@ -1,114 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; -import uuid from 'uuid'; - -import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; -import { getSupertestWithoutAuth, setupFleetAndAgents } from './services'; -import { skipIfNoDockerRegistry } from '../../helpers'; -import { AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS } from '../../../../plugins/fleet/common'; - -export default function (providerContext: FtrProviderContext) { - const { getService } = providerContext; - const esArchiver = getService('esArchiver'); - const esClient = getService('es'); - - const supertest = getSupertestWithoutAuth(providerContext); - let apiKey: { id: string; api_key: string }; - - describe('fleet_agents_checkin', () => { - skipIfNoDockerRegistry(providerContext); - before(async () => { - await esArchiver.loadIfNeeded('fleet/agents'); - - const { body: apiKeyBody } = await esClient.security.createApiKey({ - body: { - name: `test access api key: ${uuid.v4()}`, - }, - }); - apiKey = apiKeyBody; - const { - body: { _source: agentDoc }, - } = await esClient.get({ - index: '.fleet-agents', - id: 'agent1', - }); - // @ts-expect-error agentDoc has unknown type - agentDoc.access_api_key_id = apiKey.id; - await esClient.update({ - index: '.fleet-agents', - id: 'agent1', - refresh: true, - body: { - doc: agentDoc, - }, - }); - }); - setupFleetAndAgents(providerContext); - after(async () => { - // Wait before agent status is updated - return new Promise((resolve) => setTimeout(resolve, AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS)); - }); - after(async () => { - await esArchiver.unload('fleet/agents'); - }); - - it('should return a 401 if this a not a valid checkin access', async () => { - await supertest - .post(`/api/fleet/agents/agent1/checkin`) - .set('kbn-xsrf', 'xx') - .set('Authorization', 'ApiKey NOT_A_VALID_TOKEN') - .send({ - events: [], - }) - .expect(401); - }); - - it('should return a 400 if for a malformed request payload', async () => { - await supertest - .post(`/api/fleet/agents/agent1/checkin`) - .set('kbn-xsrf', 'xx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - events: ['i-am-not-valid-event'], - metadata: {}, - }) - .expect(400); - }); - - it('should return a 200 if this a valid checkin access', async () => { - const { body: apiResponse } = await supertest - .post(`/api/fleet/agents/agent1/checkin`) - .set('kbn-xsrf', 'xx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - events: [ - { - type: 'STATE', - timestamp: '2019-01-04T14:32:03.36764-05:00', - subtype: 'STARTING', - message: 'State change: STARTING', - agent_id: 'agent1', - }, - ], - local_metadata: { - cpu: 12, - }, - }) - .expect(200); - - expect(apiResponse.action).to.be('checkin'); - }); - }); -} diff --git a/x-pack/test/fleet_api_integration/apis/agents/complete_flow.ts b/x-pack/test/fleet_api_integration/apis/agents/complete_flow.ts deleted file mode 100644 index 493c5026eebc4..0000000000000 --- a/x-pack/test/fleet_api_integration/apis/agents/complete_flow.ts +++ /dev/null @@ -1,376 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; -import { setupFleetAndAgents, getSupertestWithoutAuth } from './services'; -import { skipIfNoDockerRegistry } from '../../helpers'; -import { AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS } from '../../../../plugins/fleet/common'; - -export default function (providerContext: FtrProviderContext) { - const { getService } = providerContext; - const esArchiver = getService('esArchiver'); - const supertest = getService('supertest'); - const kibanaServer = getService('kibanaServer'); - - const supertestWithoutAuth = getSupertestWithoutAuth(providerContext); - const esClient = getService('es'); - - describe('fleet_agent_flow', () => { - skipIfNoDockerRegistry(providerContext); - before(async () => { - await esArchiver.load('fleet/empty_fleet_server'); - }); - setupFleetAndAgents(providerContext); - after(async () => { - // Wait before agent status is updated - return new Promise((resolve) => setTimeout(resolve, AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS)); - }); - after(async () => { - await esArchiver.unload('fleet/empty_fleet_server'); - }); - - it('should work', async () => { - const kibanaVersionAccessor = kibanaServer.version; - const kibanaVersion = await kibanaVersionAccessor.get(); - - const { body: policiesRes } = await supertest.get(`/api/fleet/agent_policies`).expect(200); - - expect(policiesRes.items).length(2); - const { id: defaultPolicyId } = policiesRes.items.find((p: any) => p.is_default); - - // Get enrollment token - const { body: enrollmentApiKeysResponse } = await supertest - .get(`/api/fleet/enrollment-api-keys`) - .expect(200); - - expect(enrollmentApiKeysResponse.list).length(2); - const { id: enrollmentKeyId } = enrollmentApiKeysResponse.list.find( - (key: any) => key.policy_id === defaultPolicyId - ); - - const { body: enrollmentApiKeyResponse } = await supertest - .get(`/api/fleet/enrollment-api-keys/${enrollmentKeyId}`) - .expect(200); - - expect(enrollmentApiKeyResponse.item).to.have.key('api_key'); - const enrollmentAPIToken = enrollmentApiKeyResponse.item.api_key; - // Enroll agent - const { body: enrollmentResponse } = await supertestWithoutAuth - .post(`/api/fleet/agents/enroll`) - .set('kbn-xsrf', 'xxx') - .set('Authorization', `ApiKey ${enrollmentAPIToken}`) - .send({ - type: 'PERMANENT', - metadata: { - local: { - elastic: { agent: { version: kibanaVersion } }, - }, - user_provided: {}, - }, - }) - .expect(200); - - const agentAccessAPIKey = enrollmentResponse.item.access_api_key; - - // Agent checkin - const { body: checkinApiResponse } = await supertestWithoutAuth - .post(`/api/fleet/agents/${enrollmentResponse.item.id}/checkin`) - .set('kbn-xsrf', 'xx') - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .send({ - events: [], - }) - .expect(200); - - expect(checkinApiResponse.actions).length(1); - expect(checkinApiResponse.actions[0].type).be('POLICY_CHANGE'); - const policyChangeAction = checkinApiResponse.actions[0]; - const defaultOutputApiKey = policyChangeAction.data.policy.outputs.default.api_key; - - // Ack actions - await supertestWithoutAuth - .post(`/api/fleet/agents/${enrollmentResponse.item.id}/acks`) - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .set('kbn-xsrf', 'xx') - - .send({ - events: [ - { - type: 'ACTION_RESULT', - subtype: 'ACKNOWLEDGED', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: policyChangeAction.id, - agent_id: enrollmentResponse.item.id, - message: 'hello', - payload: 'payload', - }, - ], - }) - .expect(200); - - // Second agent checkin - const { body: secondCheckinApiResponse } = await supertestWithoutAuth - .post(`/api/fleet/agents/${enrollmentResponse.item.id}/checkin`) - .set('kbn-xsrf', 'xx') - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .send({ - events: [], - }) - .expect(200); - expect(secondCheckinApiResponse.actions).length(0); - - // Get agent - const { body: getAgentApiResponse } = await supertest - .get(`/api/fleet/agents/${enrollmentResponse.item.id}`) - .expect(200); - - expect(getAgentApiResponse.item.packages).to.contain( - 'system', - "Agent should run the 'system' package" - ); - - // Unenroll agent - await supertest - .post(`/api/fleet/agents/${enrollmentResponse.item.id}/unenroll`) - .set('kbn-xsrf', 'xx') - .expect(200); - - // Checkin after unenrollment - const { body: checkinAfterUnenrollResponse } = await supertestWithoutAuth - .post(`/api/fleet/agents/${enrollmentResponse.item.id}/checkin`) - .set('kbn-xsrf', 'xx') - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .send({ - events: [], - }) - .expect(200); - - expect(checkinAfterUnenrollResponse.actions).length(1); - expect(checkinAfterUnenrollResponse.actions[0].type).be('UNENROLL'); - const unenrollAction = checkinAfterUnenrollResponse.actions[0]; - - // ack unenroll actions - await supertestWithoutAuth - .post(`/api/fleet/agents/${enrollmentResponse.item.id}/acks`) - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .set('kbn-xsrf', 'xx') - .send({ - events: [ - { - type: 'ACTION_RESULT', - subtype: 'ACKNOWLEDGED', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: unenrollAction.id, - agent_id: enrollmentResponse.item.id, - message: 'hello', - payload: 'payload', - }, - ], - }) - .expect(200); - - // Checkin after unenrollment acknowledged - await supertestWithoutAuth - .post(`/api/fleet/agents/${enrollmentResponse.item.id}/checkin`) - .set('kbn-xsrf', 'xx') - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .send({ - events: [], - }) - .expect(401); - - // very api key are invalidated - const { - body: { api_keys: accessAPIKeys }, - } = await esClient.security.getApiKey({ - id: Buffer.from(agentAccessAPIKey, 'base64').toString('utf8').split(':')[0], - }); - expect(accessAPIKeys).length(1); - expect(accessAPIKeys[0].invalidated).eql(true); - - const { - body: { api_keys: outputAPIKeys }, - } = await esClient.security.getApiKey({ - id: defaultOutputApiKey.split(':')[0], - }); - expect(outputAPIKeys).length(1); - expect(outputAPIKeys[0].invalidated).eql(true); - }); - - // BWC for agent <= 7.9 - it('should work with 7.9 APIs', async () => { - const kibanaVersionAccessor = kibanaServer.version; - const kibanaVersion = await kibanaVersionAccessor.get(); - - // Get enrollment token - const { body: policiesRes } = await supertest.get(`/api/fleet/agent_policies`).expect(200); - - expect(policiesRes.items).length(2); - const { id: defaultPolicyId } = policiesRes.items.find((p: any) => p.is_default); - - // Get enrollment token - const { body: enrollmentApiKeysResponse } = await supertest - .get(`/api/fleet/enrollment-api-keys`) - .expect(200); - - expect(enrollmentApiKeysResponse.list).length(2); - const { id: enrollmentKeyId } = enrollmentApiKeysResponse.list.find( - (key: any) => key.policy_id === defaultPolicyId - ); - - const { body: enrollmentApiKeyResponse } = await supertest - .get(`/api/fleet/enrollment-api-keys/${enrollmentKeyId}`) - .expect(200); - - expect(enrollmentApiKeyResponse.item).to.have.key('api_key'); - const enrollmentAPIToken = enrollmentApiKeyResponse.item.api_key; - // Enroll agent - const { body: enrollmentResponse } = await supertestWithoutAuth - .post(`/api/ingest_manager/fleet/agents/enroll`) - .set('kbn-xsrf', 'xxx') - .set('Authorization', `ApiKey ${enrollmentAPIToken}`) - .send({ - type: 'PERMANENT', - metadata: { - local: { - elastic: { agent: { version: kibanaVersion } }, - }, - user_provided: {}, - }, - }) - .expect(200); - - const agentAccessAPIKey = enrollmentResponse.item.access_api_key; - - // Agent checkin - const { body: checkinApiResponse } = await supertestWithoutAuth - .post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/checkin`) - .set('kbn-xsrf', 'xx') - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .send({ - events: [], - }) - .expect(200); - - expect(checkinApiResponse.actions).length(1); - expect(checkinApiResponse.actions[0].type).be('POLICY_CHANGE'); - const policyChangeAction = checkinApiResponse.actions[0]; - const defaultOutputApiKey = policyChangeAction.data.policy.outputs.default.api_key; - - // Ack actions - await supertestWithoutAuth - .post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/acks`) - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .set('kbn-xsrf', 'xx') - - .send({ - events: [ - { - type: 'ACTION_RESULT', - subtype: 'ACKNOWLEDGED', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: policyChangeAction.id, - agent_id: enrollmentResponse.item.id, - message: 'hello', - payload: 'payload', - }, - ], - }) - .expect(200); - - // Second agent checkin - const { body: secondCheckinApiResponse } = await supertestWithoutAuth - .post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/checkin`) - .set('kbn-xsrf', 'xx') - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .send({ - events: [], - }) - .expect(200); - expect(secondCheckinApiResponse.actions).length(0); - - // Get agent - const { body: getAgentApiResponse } = await supertest - .get(`/api/fleet/agents/${enrollmentResponse.item.id}`) - .expect(200); - - expect(getAgentApiResponse.item.packages).to.contain( - 'system', - "Agent should run the 'system' package" - ); - - // Unenroll agent - await supertest - .post(`/api/fleet/agents/${enrollmentResponse.item.id}/unenroll`) - .set('kbn-xsrf', 'xx') - .expect(200); - - // Checkin after unenrollment - const { body: checkinAfterUnenrollResponse } = await supertestWithoutAuth - .post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/checkin`) - .set('kbn-xsrf', 'xx') - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .send({ - events: [], - }) - .expect(200); - - expect(checkinAfterUnenrollResponse.actions).length(1); - expect(checkinAfterUnenrollResponse.actions[0].type).be('UNENROLL'); - const unenrollAction = checkinAfterUnenrollResponse.actions[0]; - - // ack unenroll actions - await supertestWithoutAuth - .post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/acks`) - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .set('kbn-xsrf', 'xx') - .send({ - events: [ - { - type: 'ACTION_RESULT', - subtype: 'ACKNOWLEDGED', - timestamp: '2019-01-04T14:32:03.36764-05:00', - action_id: unenrollAction.id, - agent_id: enrollmentResponse.item.id, - message: 'hello', - payload: 'payload', - }, - ], - }) - .expect(200); - - // Checkin after unenrollment acknowledged - await supertestWithoutAuth - .post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/checkin`) - .set('kbn-xsrf', 'xx') - .set('Authorization', `ApiKey ${agentAccessAPIKey}`) - .send({ - events: [], - }) - .expect(401); - - // very api key are invalidated - const { - body: { api_keys: accessAPIKeys }, - } = await esClient.security.getApiKey({ - id: Buffer.from(agentAccessAPIKey, 'base64').toString('utf8').split(':')[0], - }); - expect(accessAPIKeys).length(1); - expect(accessAPIKeys[0].invalidated).eql(true); - - const { - body: { api_keys: outputAPIKeys }, - } = await esClient.security.getApiKey({ - id: defaultOutputApiKey.split(':')[0], - }); - expect(outputAPIKeys).length(1); - expect(outputAPIKeys[0].invalidated).eql(true); - }); - }); -} diff --git a/x-pack/test/fleet_api_integration/apis/agents/enroll.ts b/x-pack/test/fleet_api_integration/apis/agents/enroll.ts deleted file mode 100644 index f61a13253f8a1..0000000000000 --- a/x-pack/test/fleet_api_integration/apis/agents/enroll.ts +++ /dev/null @@ -1,225 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; -import uuid from 'uuid'; - -import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; -import { getSupertestWithoutAuth, setupFleetAndAgents, getEsClientForAPIKey } from './services'; -import { skipIfNoDockerRegistry } from '../../helpers'; - -export default function (providerContext: FtrProviderContext) { - const { getService } = providerContext; - - const esArchiver = getService('esArchiver'); - const esClient = getService('es'); - const kibanaServer = getService('kibanaServer'); - const supertestWithAuth = getService('supertest'); - const supertest = getSupertestWithoutAuth(providerContext); - - let apiKey: { id: string; api_key: string }; - let kibanaVersion: string; - - describe('fleet_agents_enroll', () => { - skipIfNoDockerRegistry(providerContext); - before(async () => { - await esArchiver.load('fleet/agents'); - - const { body: apiKeyBody } = await esClient.security.createApiKey({ - body: { - name: `test access api key: ${uuid.v4()}`, - }, - }); - apiKey = apiKeyBody; - const { - body: { _source: enrollmentApiKeyDoc }, - } = await esClient.get({ - index: '.fleet-enrollment-api-keys', - id: 'ed22ca17-e178-4cfe-8b02-54ea29fbd6d0', - }); - // @ts-ignore - enrollmentApiKeyDoc.api_key_id = apiKey.id; - await esClient.update({ - index: '.fleet-enrollment-api-keys', - id: 'ed22ca17-e178-4cfe-8b02-54ea29fbd6d0', - refresh: true, - body: { - doc: enrollmentApiKeyDoc, - }, - }); - const kibanaVersionAccessor = kibanaServer.version; - kibanaVersion = await kibanaVersionAccessor.get(); - }); - setupFleetAndAgents(providerContext); - after(async () => { - await esArchiver.unload('fleet/agents'); - }); - - it('should not allow enrolling in a managed policy', async () => { - // update existing policy to managed - await supertestWithAuth - .put(`/api/fleet/agent_policies/policy1`) - .set('kbn-xsrf', 'xxxx') - .send({ - name: 'Test policy', - namespace: 'default', - is_managed: true, - }) - .expect(200); - - // try to enroll in managed policy - const { body } = await supertest - .post(`/api/fleet/agents/enroll`) - .set('kbn-xsrf', 'xxx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - type: 'PERMANENT', - metadata: { - local: { - elastic: { agent: { version: kibanaVersion } }, - }, - user_provided: {}, - }, - }) - .expect(400); - - expect(body.message).to.contain('Cannot enroll in managed policy'); - - // restore to original (unmanaged) - await supertestWithAuth - .put(`/api/fleet/agent_policies/policy1`) - .set('kbn-xsrf', 'xxxx') - .send({ - name: 'Test policy', - namespace: 'default', - is_managed: false, - }) - .expect(200); - }); - - it('should not allow to enroll an agent with a invalid enrollment', async () => { - await supertest - .post(`/api/fleet/agents/enroll`) - .set('kbn-xsrf', 'xxx') - .set('Authorization', 'ApiKey NOTAVALIDKEY') - .send({ - type: 'PERMANENT', - metadata: { - local: { - elastic: { agent: { version: kibanaVersion } }, - }, - user_provided: {}, - }, - }) - .expect(401); - }); - - it('should not allow to enroll an agent with a version > kibana', async () => { - const { body: apiResponse } = await supertest - .post(`/api/fleet/agents/enroll`) - .set('kbn-xsrf', 'xxx') - .set( - 'authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - shared_id: 'agent2_filebeat', - type: 'PERMANENT', - metadata: { - local: { - elastic: { agent: { version: '999.0.0' } }, - }, - user_provided: {}, - }, - }) - .expect(400); - expect(apiResponse.message).to.match(/is not compatible/); - }); - - it('should allow to enroll an agent with a valid enrollment token', async () => { - const { body: apiResponse } = await supertest - .post(`/api/fleet/agents/enroll`) - .set('kbn-xsrf', 'xxx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - type: 'PERMANENT', - metadata: { - local: { - elastic: { agent: { version: kibanaVersion } }, - }, - user_provided: {}, - }, - }) - .expect(200); - expect(apiResponse.item).to.have.keys('id', 'active', 'access_api_key', 'type', 'policy_id'); - }); - - it('when enrolling an agent it should generate an access api key with limited privileges', async () => { - const { body: apiResponse } = await supertest - .post(`/api/fleet/agents/enroll`) - .set('kbn-xsrf', 'xxx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) - .send({ - type: 'PERMANENT', - metadata: { - local: { - elastic: { agent: { version: kibanaVersion } }, - }, - user_provided: {}, - }, - }) - .expect(200); - - const { body: privileges } = await getEsClientForAPIKey( - providerContext, - apiResponse.item.access_api_key - ).security.hasPrivileges({ - body: { - cluster: ['all', 'monitor', 'manage_api_key'], - index: [ - { - names: ['log-*', 'metrics-*', 'events-*', '*'], - privileges: ['write', 'create_index'], - }, - ], - }, - }); - expect(privileges.cluster).to.eql({ - all: false, - monitor: false, - manage_api_key: false, - }); - expect(privileges.index).to.eql({ - '*': { - create_index: false, - write: false, - }, - 'events-*': { - create_index: false, - write: false, - }, - 'log-*': { - create_index: false, - write: false, - }, - 'metrics-*': { - create_index: false, - write: false, - }, - }); - }); - }); -} diff --git a/x-pack/test/fleet_api_integration/apis/agents_setup.ts b/x-pack/test/fleet_api_integration/apis/agents_setup.ts deleted file mode 100644 index 25b4e16535fda..0000000000000 --- a/x-pack/test/fleet_api_integration/apis/agents_setup.ts +++ /dev/null @@ -1,128 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../api_integration/ftr_provider_context'; -import { skipIfNoDockerRegistry } from '../helpers'; - -export default function (providerContext: FtrProviderContext) { - const { getService } = providerContext; - const supertest = getService('supertest'); - const es = getService('es'); - const esArchiver = getService('esArchiver'); - - describe('fleet_agents_setup', () => { - skipIfNoDockerRegistry(providerContext); - before(async () => { - await esArchiver.load('empty_kibana'); - await esArchiver.load('fleet/empty_fleet_server'); - }); - - after(async () => { - await esArchiver.unload('empty_kibana'); - await esArchiver.unload('fleet/empty_fleet_server'); - }); - - beforeEach(async () => { - try { - await es.security.deleteUser({ - username: 'fleet_enroll', - }); - } catch (e) { - if (e.meta?.statusCode !== 404) { - throw e; - } - } - try { - await es.security.deleteRole({ - name: 'fleet_enroll', - }); - } catch (e) { - if (e.meta?.statusCode !== 404) { - throw e; - } - } - }); - - it('should create a fleet_enroll user and role', async () => { - const { body: apiResponse } = await supertest - .post(`/api/fleet/agents/setup`) - .set('kbn-xsrf', 'xxxx') - .expect(200); - - expect(apiResponse.isInitialized).to.be(true); - - const { body: userResponse } = await es.security.getUser({ - username: 'fleet_enroll', - }); - - expect(userResponse).to.have.key('fleet_enroll'); - expect(userResponse.fleet_enroll.roles).to.eql(['fleet_enroll']); - - const { body: roleResponse } = await es.security.getRole({ - name: 'fleet_enroll', - }); - expect(roleResponse).to.have.key('fleet_enroll'); - expect(roleResponse.fleet_enroll).to.eql({ - cluster: ['monitor', 'manage_api_key'], - indices: [ - { - names: ['logs-*', 'metrics-*', 'traces-*', '.logs-endpoint.diagnostic.collection-*'], - privileges: ['auto_configure', 'create_doc'], - allow_restricted_indices: false, - }, - ], - applications: [], - run_as: [], - metadata: {}, - transient_metadata: { enabled: true }, - }); - }); - - it('should not create or update the fleet_enroll user if called multiple times', async () => { - await supertest.post(`/api/fleet/agents/setup`).set('kbn-xsrf', 'xxxx').expect(200); - - const { body: userResponseFirstTime } = await es.security.getUser({ - username: 'fleet_enroll', - }); - - await supertest.post(`/api/fleet/agents/setup`).set('kbn-xsrf', 'xxxx').expect(200); - - const { body: userResponseSecondTime } = await es.security.getUser({ - username: 'fleet_enroll', - }); - - expect(userResponseFirstTime.fleet_enroll.metadata.updated_at).to.be( - userResponseSecondTime.fleet_enroll.metadata.updated_at - ); - }); - - it.skip('should create or update the fleet_enroll user if called multiple times with forceRecreate flag', async () => { - await supertest.post(`/api/fleet/agents/setup`).set('kbn-xsrf', 'xxxx').expect(200); - - const { body: userResponseFirstTime } = await es.security.getUser({ - username: 'fleet_enroll', - }); - - await supertest - .post(`/api/fleet/agents/setup`) - .set('kbn-xsrf', 'xxxx') - .send({ - forceRecreate: true, - }) - .expect(200); - - const { body: userResponseSecondTime } = await es.security.getUser({ - username: 'fleet_enroll', - }); - - expect(userResponseFirstTime.fleet_enroll.metadata.updated_at).to.not.be( - userResponseSecondTime.fleet_enroll.metadata.updated_at - ); - }); - }); -} diff --git a/x-pack/test/fleet_api_integration/apis/index.js b/x-pack/test/fleet_api_integration/apis/index.js index ce5075e3e3b76..722d15751564d 100644 --- a/x-pack/test/fleet_api_integration/apis/index.js +++ b/x-pack/test/fleet_api_integration/apis/index.js @@ -14,17 +14,10 @@ export default function ({ loadTestFile }) { // Fleet setup loadTestFile(require.resolve('./fleet_setup')); - // Agent setup - loadTestFile(require.resolve('./agents_setup')); - // Agents loadTestFile(require.resolve('./agents/delete')); loadTestFile(require.resolve('./agents/list')); - loadTestFile(require.resolve('./agents/enroll')); loadTestFile(require.resolve('./agents/unenroll')); - loadTestFile(require.resolve('./agents/checkin')); - loadTestFile(require.resolve('./agents/acks')); - loadTestFile(require.resolve('./agents/complete_flow')); loadTestFile(require.resolve('./agents/actions')); loadTestFile(require.resolve('./agents/upgrade')); loadTestFile(require.resolve('./agents/reassign')); diff --git a/x-pack/test/fleet_api_integration/apis/settings/update.ts b/x-pack/test/fleet_api_integration/apis/settings/update.ts index 73fff0be39043..2c4992b21d71a 100644 --- a/x-pack/test/fleet_api_integration/apis/settings/update.ts +++ b/x-pack/test/fleet_api_integration/apis/settings/update.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { Client } from 'elasticsearch'; +import { AGENT_POLICY_INDEX } from '../../../../plugins/fleet/common'; import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; import { skipIfNoDockerRegistry } from '../../helpers'; import { setupFleetAndAgents } from '../agents/services'; @@ -15,7 +15,7 @@ export default function (providerContext: FtrProviderContext) { const { getService } = providerContext; const supertest = getService('supertest'); const kibanaServer = getService('kibanaServer'); - const esClient: Client = getService('legacyEs'); + const esClient = getService('es'); const esArchiver = getService('esArchiver'); describe('Settings - update', async function () { @@ -62,7 +62,7 @@ export default function (providerContext: FtrProviderContext) { await supertest .put(`/api/fleet/settings`) .set('kbn-xsrf', 'xxxx') - .send({ kibana_urls: ['http://localhost:1232/abc', 'http://localhost:1232/abc'] }) + .send({ fleet_server_hosts: ['http://localhost:1232/abc', 'http://localhost:1232/abc'] }) .expect(200); const getTestPolicy1Res = await kibanaServer.savedObjects.get({ @@ -89,18 +89,12 @@ export default function (providerContext: FtrProviderContext) { createdAgentPolicyIds.push(testPolicyRes.item.id); const beforeRes = await esClient.search({ - index: '.kibana', + index: AGENT_POLICY_INDEX, + ignore_unavailable: true, body: { query: { - bool: { - must: [ - { - terms: { - type: ['fleet-agent-actions'], - }, - }, - { match: { 'fleet-agent-actions.policy_id': testPolicyRes.item.id } }, - ], + term: { + policy_id: testPolicyRes.item.id, }, }, }, @@ -109,28 +103,22 @@ export default function (providerContext: FtrProviderContext) { await supertest .put(`/api/fleet/settings`) .set('kbn-xsrf', 'xxxx') - .send({ kibana_urls: ['http://localhost:1232/abc', 'http://localhost:1232/abc'] }) + .send({ fleet_server_hosts: ['http://localhost:1232/abc', 'http://localhost:1232/abc'] }) .expect(200); const res = await esClient.search({ - index: '.kibana', + index: AGENT_POLICY_INDEX, + ignore_unavailable: true, body: { query: { - bool: { - must: [ - { - terms: { - type: ['fleet-agent-actions'], - }, - }, - { match: { 'fleet-agent-actions.policy_id': testPolicyRes.item.id } }, - ], + term: { + policy_id: testPolicyRes.item.id, }, }, }, }); - expect(res.hits.hits.length).equal(beforeRes.hits.hits.length + 1); + expect(res.body.hits.hits.length).equal(beforeRes.body.hits.hits.length + 1); }); }); } diff --git a/x-pack/test/functional/es_archives/endpoint/artifacts/api_feature/data.json b/x-pack/test/functional/es_archives/endpoint/artifacts/api_feature/data.json deleted file mode 100644 index e983512bec8a0..0000000000000 --- a/x-pack/test/functional/es_archives/endpoint/artifacts/api_feature/data.json +++ /dev/null @@ -1,218 +0,0 @@ -{ - "type": "doc", - "value": { - "id": "endpoint:user-artifact:endpoint-exceptionlist-macos-v1-d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "index": ".kibana", - "source": { - "references": [ - ], - "endpoint:user-artifact": { - "body": "eJyrVkrNKynKTC1WsoqOrQUAJxkFKQ==", - "created": 1594402653532, - "compressionAlgorithm": "zlib", - "encryptionAlgorithm": "none", - "identifier": "endpoint-exceptionlist-macos-v1", - "encodedSha256": "f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda", - "encodedSize": 14, - "decodedSha256": "d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "decodedSize": 22 - }, - "type": "endpoint:user-artifact", - "updated_at": "2020-07-10T17:38:47.584Z" - } - } -} - -{ - "type": "doc", - "value": { - "id": "endpoint:user-artifact:endpoint-exceptionlist-windows-v1-8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e", - "index": ".kibana", - "source": { - "references": [ - ], - "endpoint:user-artifact": { - "body": "eJzFkL0KwjAUhV+lZA55gG4OXcXJRYqE9LZeiElJbotSsvsIbr6ij2AaakVwUqTr+fkOnIGBIYfgWb4bGJ1bYDnzeGw1MP7m1Qi6iqZUhKbZOKvAe1GjBuGxMeBi3rbgJFkXY2iU7iqoojpR4RSreyV9Enupu1EttPSEimdrsRUs8OHj6C8L99v1ksBPGLnOU4p8QYtlYKHkM21+QFLn4FU3kEZCOU4vcOzKWDqAyybGP54tetSLPluGB+Nu8h4=", - "created": 1594402653532, - "compressionAlgorithm": "zlib", - "encryptionAlgorithm": "none", - "identifier": "endpoint-exceptionlist-windows-v1", - "encodedSha256": "73015ee5131dabd1b48aa4776d3e766d836f8dd8c9fa8999c9b931f60027f07f", - "encodedSize": 191, - "decodedSha256": "8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e", - "decodedSize": 704 - }, - "type": "endpoint:user-artifact", - "updated_at": "2020-07-10T17:38:47.584Z" - } - } -} - -{ - "type": "doc", - "value": { - "id": "endpoint:user-artifact-manifest:endpoint-manifest-v1", - "index": ".kibana", - "source": { - "references": [ - ], - "endpoint:user-artifact-manifest": { - "created": 1593183699663, - "schemaVersion": "v1", - "semanticVersion": "1.0.1", - "artifacts": [ - { - "artifactId": "endpoint-exceptionlist-macos-v1-d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658" - }, - { - "artifactId": "endpoint-exceptionlist-windows-v1-8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e" - } - ] - }, - "type": "endpoint:user-artifact-manifest", - "updated_at": "2020-06-26T15:01:39.704Z" - } - } -} - -{ - "type": "doc", - "value": { - "id": "exception-list-agnostic:13a7ef40-b63b-11ea-ace9-591c8e572c76", - "index": ".kibana", - "source": { - "exception-list-agnostic": { - "_tags": [ - "endpoint", - "process", - "malware", - "os:linux" - ], - "created_at": "2020-06-24T16:52:23.689Z", - "created_by": "akahan", - "description": "This is a sample agnostic endpoint type exception", - "list_id": "endpoint_list", - "list_type": "list", - "name": "Sample Endpoint Exception List", - "tags": [ - "user added string for a tag", - "malware" - ], - "tie_breaker_id": "e3b20e6e-c023-4575-a033-47990115969c", - "type": "endpoint", - "updated_by": "akahan" - }, - "references": [ - ], - "type": "exception-list-agnostic", - "updated_at": "2020-06-24T16:52:23.732Z" - } - } -} - -{ - "type": "doc", - "value": { - "id": "exception-list-agnostic:679b95a0-b714-11ea-a4c9-0963ae39bc3d", - "index": ".kibana", - "source": { - "exception-list-agnostic": { - "_tags": [ - "os:windows" - ], - "comments": [ - ], - "created_at": "2020-06-25T18:48:05.326Z", - "created_by": "akahan", - "description": "This is a sample endpoint type exception", - "entries": [ - { - "field": "actingProcess.file.signer", - "operator": "included", - "type": "match", - "value": "Elastic, N.V." - }, - { - "field": "event.category", - "operator": "included", - "type": "match_any", - "value": [ - "process", - "malware" - ] - } - ], - "item_id": "61142b8f-5876-4709-9952-95160cd58f2f", - "list_id": "endpoint_list", - "list_type": "item", - "name": "Sample Endpoint Exception List", - "tags": [ - "user added string for a tag", - "malware" - ], - "tie_breaker_id": "b36176d2-bc75-4641-a8e3-e811c6bc30d8", - "type": "endpoint", - "updated_by": "akahan" - }, - "references": [ - ], - "type": "exception-list-agnostic", - "updated_at": "2020-06-25T18:48:05.369Z" - } - } -} - -{ - "type": "doc", - "value": { - "id": "fleet-agents:a34d87c1-726e-4c30-b2ff-1b4b95f59d2a", - "index": ".kibana", - "source": { - "fleet-agents": { - "access_api_key_id": "8ZnT7HIBwLFvkUEPQaT3", - "active": true, - "policy_id": "2dd2a110-b6f6-11ea-a66d-63cf082a3b58", - "enrolled_at": "2020-06-25T18:52:47.290Z", - "local_metadata": { - "os": "macos" - }, - "type": "PERMANENT", - "user_provided_metadata": { - "region": "us-east" - } - }, - "references": [ - ], - "type": "fleet-agents", - "updated_at": "2020-06-25T18:52:48.464Z", - "migrationVersion": { - "fleet-agents": "7.10.0" - } - } - } -} - -{ - "type": "doc", - "value": { - "id": "fleet-enrollment-api-keys:8178eb66-392f-4b76-9dc9-704ed1a5c56e", - "index": ".kibana", - "source": { - "fleet-enrollment-api-keys": { - "active": true, - "api_key": "8ZnT7HIBwLFvkUEPQaT3", - "api_key_id": "8ZnT7HIBwLFvkUEPQaT3", - "policy_id": "2dd2a110-b6f6-11ea-a66d-63cf082a3b58", - "created_at": "2020-06-25T17:25:30.065Z", - "name": "Default (93aa98c8-d650-422e-aa7b-663dae3dff83)" - }, - "references": [ - ], - "type": "fleet-enrollment-api-keys", - "updated_at": "2020-06-25T17:25:30.114Z", - "migrationVersion": { - "fleet-enrollment-api-keys": "7.10.0" - } - } - } -} diff --git a/x-pack/test/functional/es_archives/endpoint/artifacts/fleet_artifacts/data.json b/x-pack/test/functional/es_archives/endpoint/artifacts/fleet_artifacts/data.json deleted file mode 100644 index 730a7478c13a1..0000000000000 --- a/x-pack/test/functional/es_archives/endpoint/artifacts/fleet_artifacts/data.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "type": "doc", - "value": { - "id": "0dce5b12-b88e-4141-ac0f-e93eefd7bb9f", - "index": ".fleet-artifacts_1", - "source": { - "body": "eJyrVkrNKynKTC1WsoqOrQUAJxkFKQ==", - "created": "2021-03-10T21:51:33.155Z", - "compression_algorithm": "zlib", - "encryption_algorithm": "none", - "identifier": "endpoint-exceptionlist-macos-v1", - "encoded_sha256": "f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda", - "encoded_size": 14, - "decoded_sha256": "d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "decoded_size": 22, - "package_name": "endpoint", - "relative_url": "/api/fleet/artifacts/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "type": "exceptionlist" - } - } -} - -{ - "type": "doc", - "value": { - "id": "3c656388-4b51-4903-abc9-ee726657a164", - "index": ".fleet-artifacts_1", - "source": { - "body": "eJzFkL0KwjAUhV+lZA55gG4OXcXJRYqE9LZeiElJbotSsvsIbr6ij2AaakVwUqTr+fkOnIGBIYfgWb4bGJ1bYDnzeGw1MP7m1Qi6iqZUhKbZOKvAe1GjBuGxMeBi3rbgJFkXY2iU7iqoojpR4RSreyV9Enupu1EttPSEimdrsRUs8OHj6C8L99v1ksBPGLnOU4p8QYtlYKHkM21+QFLn4FU3kEZCOU4vcOzKWDqAyybGP54tetSLPluGB+Nu8h4=", - "created": "2021-03-10T21:51:33.155Z", - "compression_algorithm": "zlib", - "encryption_algorithm": "none", - "identifier": "endpoint-exceptionlist-windows-v1", - "encoded_sha256": "73015ee5131dabd1b48aa4776d3e766d836f8dd8c9fa8999c9b931f60027f07f", - "encoded_size": 191, - "decoded_sha256": "8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e", - "decoded_size": 704, - "package_name": "endpoint", - "relative_url": "/api/fleet/artifacts/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "type": "exceptionlist" - } - } -} - -{ - "type": "doc", - "value": { - "id": "9596fbb6-64d0-432f-99e3-8b7eb559244c", - "index": ".fleet-artifacts_1", - "source": { - "body": "eJyrVkrNKynKTC1WsoqOrQUAJxkFKQ==", - "compressionAlgorithm": "zlib", - "created": "2021-03-10T21:51:31.136Z", - "decodedSha256": "d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "decodedSize": 14, - "encodedSha256": "f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda", - "encodedSize": 22, - "encryptionAlgorithm": "none", - "identifier": "endpoint-trustlist-macos-v1", - "packageName": "endpoint", - "relative_url": "/api/fleet/artifacts/endpoint-trustlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "type": "trustlist" - } - } -} - -{ - "type": "doc", - "value": { - "id": "74536df6-6bdb-499d-bb08-46789dadb026", - "index": ".fleet-artifacts_1", - "source": { - "body": "eJyrVkrNKynKTC1WsoqOrQUAJxkFKQ==", - "compressionAlgorithm": "zlib", - "created": "2021-03-10T21:51:32.146Z", - "decodedSha256": "d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "decodedSize": 14, - "encodedSha256": "f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda", - "encodedSize": 22, - "encryptionAlgorithm": "none", - "identifier": "endpoint-trustlist-windows-v1", - "packageName": "endpoint", - "relative_url": "/api/fleet/artifacts/endpoint-trustlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "type": "trustlist" - } - } -} - -{ - "type": "doc", - "value": { - "id": "6ebf4306-2113-4316-8295-6bc00ebea385", - "index": ".fleet-artifacts_1", - "source": { - "body": "eJyrVkrNKynKTC1WsoqOrQUAJxkFKQ==", - "compressionAlgorithm": "zlib", - "created": "2021-03-10T21:51:33.155Z", - "decodedSha256": "d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "decodedSize": 14, - "encodedSha256": "f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda", - "encodedSize": 22, - "encryptionAlgorithm": "none", - "identifier": "endpoint-trustlist-linux-v1", - "packageName": "endpoint", - "relative_url": "/api/fleet/artifacts/endpoint-trustlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", - "type": "trustlist" - } - } -} diff --git a/x-pack/test/functional/es_archives/endpoint/artifacts/fleet_artifacts/mappings.json b/x-pack/test/functional/es_archives/endpoint/artifacts/fleet_artifacts/mappings.json deleted file mode 100644 index 132b605890dc0..0000000000000 --- a/x-pack/test/functional/es_archives/endpoint/artifacts/fleet_artifacts/mappings.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".fleet-artifacts": { - } - }, - "index": ".fleet-artifacts_1", - "mappings": { - "_meta": { - "migrationHash": "766a1f59e685a9c07b04480e9a5dc2727843bd1f" - }, - "dynamic": "false", - "properties": { - "body": { - "type": "binary" - }, - "compression_algorithm": { - "index": false, - "type": "keyword" - }, - "created": { - "type": "date" - }, - "decoded_sha256": { - "type": "keyword" - }, - "decoded_size": { - "index": false, - "type": "long" - }, - "encoded_sha256": { - "type": "keyword" - }, - "encoded_size": { - "index": false, - "type": "long" - }, - "encryption_algorithm": { - "index": false, - "type": "keyword" - }, - "identifier": { - "type": "keyword" - }, - "package_name": { - "type": "keyword" - }, - "relative_url": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "settings": { - "index": { - "number_of_replicas": "1", - "number_of_shards": "1" - } - } - } -} diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts index 75f266e29a91e..5584299fff1e2 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts @@ -188,7 +188,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-exceptionlist-windows-v1': { compression_algorithm: 'zlib', @@ -200,7 +200,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-trustlist-linux-v1': { compression_algorithm: 'zlib', @@ -212,7 +212,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-trustlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-trustlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-trustlist-macos-v1': { compression_algorithm: 'zlib', @@ -224,7 +224,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-trustlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-trustlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-trustlist-windows-v1': { compression_algorithm: 'zlib', @@ -236,7 +236,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-trustlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-trustlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, }, // The manifest version could have changed when the Policy was updated because the @@ -337,7 +337,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-exceptionlist-windows-v1': { compression_algorithm: 'zlib', @@ -349,7 +349,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-trustlist-linux-v1': { compression_algorithm: 'zlib', @@ -361,7 +361,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-trustlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-trustlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-trustlist-macos-v1': { compression_algorithm: 'zlib', @@ -373,7 +373,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-trustlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-trustlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-trustlist-windows-v1': { compression_algorithm: 'zlib', @@ -385,7 +385,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-trustlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-trustlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, }, // The manifest version could have changed when the Policy was updated because the @@ -484,7 +484,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-exceptionlist-windows-v1': { compression_algorithm: 'zlib', @@ -496,7 +496,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-trustlist-linux-v1': { compression_algorithm: 'zlib', @@ -508,7 +508,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-trustlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-trustlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-trustlist-macos-v1': { compression_algorithm: 'zlib', @@ -520,7 +520,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-trustlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-trustlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, 'endpoint-trustlist-windows-v1': { compression_algorithm: 'zlib', @@ -532,7 +532,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { encoded_size: 22, encryption_algorithm: 'none', relative_url: - '/api/endpoint/artifacts/download/endpoint-trustlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + '/api/fleet/artifacts/endpoint-trustlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, }, // The manifest version could have changed when the Policy was updated because the diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts b/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts deleted file mode 100644 index 14e08992de9b4..0000000000000 --- a/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts +++ /dev/null @@ -1,417 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; -import { createHash } from 'crypto'; -import { inflateSync } from 'zlib'; - -import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; -import { getSupertestWithoutAuth } from '../../../fleet_api_integration/apis/agents/services'; - -export default function (providerContext: FtrProviderContext) { - const { getService } = providerContext; - const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - const supertestWithoutAuth = getSupertestWithoutAuth(providerContext); - let agentAccessAPIKey: string; - - // flaky https://github.com/elastic/kibana/issues/96515 - describe.skip('artifact download', () => { - const esArchiverSnapshots = [ - 'endpoint/artifacts/fleet_artifacts', - 'endpoint/artifacts/api_feature', - ]; - - before(async () => { - await Promise.all( - esArchiverSnapshots.map((archivePath) => esArchiver.load(archivePath, { useCreate: true })) - ); - - const { body: enrollmentApiKeysResponse } = await supertest - .get(`/api/fleet/enrollment-api-keys`) - .expect(200); - expect(enrollmentApiKeysResponse.list).length(2); - - const { body: enrollmentApiKeyResponse } = await supertest - .get(`/api/fleet/enrollment-api-keys/${enrollmentApiKeysResponse.list[0].id}`) - .expect(200); - expect(enrollmentApiKeyResponse.item).to.have.key('api_key'); - const enrollmentAPIToken = enrollmentApiKeyResponse.item.api_key; - - // 2. Enroll agent - const { body: enrollmentResponse } = await supertestWithoutAuth - .post(`/api/fleet/agents/enroll`) - .set('kbn-xsrf', 'xxx') - .set('Authorization', `ApiKey ${enrollmentAPIToken}`) - .send({ - type: 'PERMANENT', - metadata: { - local: { - elastic: { - agent: { - version: '7.0.0', - }, - }, - }, - user_provided: {}, - }, - }) - .expect(200); - - agentAccessAPIKey = enrollmentResponse.item.access_api_key; - }); - after(() => - Promise.all(esArchiverSnapshots.map((archivePath) => esArchiver.unload(archivePath))) - ); - - it('should fail to find artifact with invalid hash', async () => { - await supertestWithoutAuth - .get('/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/abcd') - .set('kbn-xsrf', 'xxx') - .set('authorization', `ApiKey ${agentAccessAPIKey}`) - .send() - .expect(404); - }); - - it('should fail on invalid api key with 401', async () => { - await supertestWithoutAuth - .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/1825fb19fcc6dc391cae0bc4a2e96dd7f728a0c3ae9e1469251ada67f9e1b975' - ) - .set('kbn-xsrf', 'xxx') - .set('authorization', `ApiKey iNvAlId`) - .send() - .expect(401); - }); - - it('should download an artifact with list items', async () => { - await supertestWithoutAuth - .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' - ) - .set('kbn-xsrf', 'xxx') - .set('authorization', `ApiKey ${agentAccessAPIKey}`) - .send() - .expect(200) - .expect((response) => { - expect(response.body.byteLength).to.equal(191); - const encodedHash = createHash('sha256').update(response.body).digest('hex'); - expect(encodedHash).to.equal( - '73015ee5131dabd1b48aa4776d3e766d836f8dd8c9fa8999c9b931f60027f07f' - ); - const decodedBody = inflateSync(response.body); - const decodedHash = createHash('sha256').update(decodedBody).digest('hex'); - expect(decodedHash).to.equal( - '8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' - ); - expect(decodedBody.byteLength).to.equal(704); - const artifactJson = JSON.parse(decodedBody.toString()); - expect(artifactJson).to.eql({ - entries: [ - { - type: 'simple', - entries: [ - { - field: 'actingProcess.file.signer', - operator: 'included', - type: 'exact_cased', - value: 'Elastic, N.V.', - }, - { - entries: [ - { - field: 'signer', - operator: 'included', - type: 'exact_cased', - value: '😈', - }, - { - field: 'trusted', - operator: 'included', - type: 'exact_cased', - value: 'true', - }, - ], - field: 'file.signature', - type: 'nested', - }, - ], - }, - { - type: 'simple', - entries: [ - { - field: 'actingProcess.file.signer', - operator: 'included', - type: 'exact_cased', - value: 'Another signer', - }, - { - entries: [ - { - field: 'signer', - operator: 'included', - type: 'exact_cased', - value: 'Evil', - }, - { - field: 'trusted', - operator: 'included', - type: 'exact_cased', - value: 'true', - }, - ], - field: 'file.signature', - type: 'nested', - }, - ], - }, - ], - }); - }); - }); - - it('should download an artifact with unicode characters', async () => { - await supertestWithoutAuth - .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' - ) - .set('kbn-xsrf', 'xxx') - .set('authorization', `ApiKey ${agentAccessAPIKey}`) - .send() - .expect(200) - .expect((response) => { - JSON.parse(inflateSync(response.body).toString()); - }) - .then(async () => { - await supertestWithoutAuth - .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' - ) - .set('kbn-xsrf', 'xxx') - .set('authorization', `ApiKey ${agentAccessAPIKey}`) - .send() - .expect(200) - .expect((response) => { - const encodedHash = createHash('sha256').update(response.body).digest('hex'); - expect(encodedHash).to.equal( - '73015ee5131dabd1b48aa4776d3e766d836f8dd8c9fa8999c9b931f60027f07f' - ); - expect(response.body.byteLength).to.equal(191); - const decodedBody = inflateSync(response.body); - const decodedHash = createHash('sha256').update(decodedBody).digest('hex'); - expect(decodedHash).to.equal( - '8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' - ); - expect(decodedBody.byteLength).to.equal(704); - const artifactJson = JSON.parse(decodedBody.toString()); - expect(artifactJson).to.eql({ - entries: [ - { - type: 'simple', - entries: [ - { - field: 'actingProcess.file.signer', - operator: 'included', - type: 'exact_cased', - value: 'Elastic, N.V.', - }, - { - entries: [ - { - field: 'signer', - operator: 'included', - type: 'exact_cased', - value: '😈', - }, - { - field: 'trusted', - operator: 'included', - type: 'exact_cased', - value: 'true', - }, - ], - field: 'file.signature', - type: 'nested', - }, - ], - }, - { - type: 'simple', - entries: [ - { - field: 'actingProcess.file.signer', - operator: 'included', - type: 'exact_cased', - value: 'Another signer', - }, - { - entries: [ - { - field: 'signer', - operator: 'included', - type: 'exact_cased', - value: 'Evil', - }, - { - field: 'trusted', - operator: 'included', - type: 'exact_cased', - value: 'true', - }, - ], - field: 'file.signature', - type: 'nested', - }, - ], - }, - ], - }); - }); - }); - }); - - it('should download an artifact with empty exception list', async () => { - await supertestWithoutAuth - .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658' - ) - .set('kbn-xsrf', 'xxx') - .set('authorization', `ApiKey ${agentAccessAPIKey}`) - .send() - .expect(200) - .expect((response) => { - JSON.parse(inflateSync(response.body).toString()); - }) - .then(async () => { - await supertestWithoutAuth - .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658' - ) - .set('kbn-xsrf', 'xxx') - .set('authorization', `ApiKey ${agentAccessAPIKey}`) - .send() - .expect(200) - .expect((response) => { - const encodedHash = createHash('sha256').update(response.body).digest('hex'); - expect(encodedHash).to.equal( - 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda' - ); - expect(response.body.byteLength).to.equal(22); - const decodedBody = inflateSync(response.body); - const decodedHash = createHash('sha256').update(decodedBody).digest('hex'); - expect(decodedHash).to.equal( - 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658' - ); - expect(decodedBody.byteLength).to.equal(14); - const artifactJson = JSON.parse(decodedBody.toString()); - expect(artifactJson.entries.length).to.equal(0); - }); - }); - }); - - it('should download an artifact from cache', async () => { - await supertestWithoutAuth - .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' - ) - .set('kbn-xsrf', 'xxx') - .set('authorization', `ApiKey ${agentAccessAPIKey}`) - .send() - .expect(200) - .expect((response) => { - JSON.parse(inflateSync(response.body).toString()); - }) - .then(async () => { - await supertestWithoutAuth - .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' - ) - .set('kbn-xsrf', 'xxx') - .set('authorization', `ApiKey ${agentAccessAPIKey}`) - .send() - .expect(200) - .expect((response) => { - expect(response.body.byteLength).to.equal(191); - const encodedHash = createHash('sha256').update(response.body).digest('hex'); - expect(encodedHash).to.equal( - '73015ee5131dabd1b48aa4776d3e766d836f8dd8c9fa8999c9b931f60027f07f' - ); - const decodedBody = inflateSync(response.body); - const decodedHash = createHash('sha256').update(decodedBody).digest('hex'); - expect(decodedHash).to.equal( - '8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' - ); - expect(decodedBody.byteLength).to.equal(704); - const artifactJson = JSON.parse(decodedBody.toString()); - expect(artifactJson).to.eql({ - entries: [ - { - type: 'simple', - entries: [ - { - field: 'actingProcess.file.signer', - operator: 'included', - type: 'exact_cased', - value: 'Elastic, N.V.', - }, - { - entries: [ - { - field: 'signer', - operator: 'included', - type: 'exact_cased', - value: '😈', - }, - { - field: 'trusted', - operator: 'included', - type: 'exact_cased', - value: 'true', - }, - ], - field: 'file.signature', - type: 'nested', - }, - ], - }, - { - type: 'simple', - entries: [ - { - field: 'actingProcess.file.signer', - operator: 'included', - type: 'exact_cased', - value: 'Another signer', - }, - { - entries: [ - { - field: 'signer', - operator: 'included', - type: 'exact_cased', - value: 'Evil', - }, - { - field: 'trusted', - operator: 'included', - type: 'exact_cased', - value: 'true', - }, - ], - field: 'file.signature', - type: 'nested', - }, - ], - }, - ], - }); - }); - }); - }); - }); -} diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/index.ts b/x-pack/test/security_solution_endpoint_api_int/apis/index.ts index 233292d3b9099..9cf8a5e6e4c6d 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/index.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/index.ts @@ -32,7 +32,6 @@ export default function endpointAPIIntegrationTests(providerContext: FtrProvider loadTestFile(require.resolve('./metadata')); loadTestFile(require.resolve('./metadata_v1')); loadTestFile(require.resolve('./policy')); - loadTestFile(require.resolve('./artifacts')); loadTestFile(require.resolve('./package')); }); } From 6faf07d0c014c4013f6352ddb8f47e4ad4694e08 Mon Sep 17 00:00:00 2001 From: Zacqary Adam Xeper Date: Thu, 15 Apr 2021 16:29:09 -0500 Subject: [PATCH 40/68] [Fleet] Add latest package flag and remove force flag (#97289) * [Fleet] Add latest package flag and remove force flag * Fix installing latest package when old package is still installed --- .../common/constants/preconfiguration.ts | 2 + .../common/types/models/preconfiguration.ts | 4 +- .../plugins/fleet/server/constants/index.ts | 1 + .../server/services/epm/packages/install.ts | 77 ++++++------------- .../fleet/server/services/preconfiguration.ts | 16 ++-- .../server/types/models/preconfiguration.ts | 7 +- 6 files changed, 42 insertions(+), 65 deletions(-) diff --git a/x-pack/plugins/fleet/common/constants/preconfiguration.ts b/x-pack/plugins/fleet/common/constants/preconfiguration.ts index 376ba551b1359..da011f31783c3 100644 --- a/x-pack/plugins/fleet/common/constants/preconfiguration.ts +++ b/x-pack/plugins/fleet/common/constants/preconfiguration.ts @@ -7,3 +7,5 @@ export const PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE = 'fleet-preconfiguration-deletion-record'; + +export const PRECONFIGURATION_LATEST_KEYWORD = 'latest'; diff --git a/x-pack/plugins/fleet/common/types/models/preconfiguration.ts b/x-pack/plugins/fleet/common/types/models/preconfiguration.ts index c9fff1c1581bd..61a5cb63400a0 100644 --- a/x-pack/plugins/fleet/common/types/models/preconfiguration.ts +++ b/x-pack/plugins/fleet/common/types/models/preconfiguration.ts @@ -28,6 +28,4 @@ export interface PreconfiguredAgentPolicy extends Omit; } -export interface PreconfiguredPackage extends Omit { - force?: boolean; -} +export type PreconfiguredPackage = Omit; diff --git a/x-pack/plugins/fleet/server/constants/index.ts b/x-pack/plugins/fleet/server/constants/index.ts index 343fa756e79c3..aa4fbd9cfeb97 100644 --- a/x-pack/plugins/fleet/server/constants/index.ts +++ b/x-pack/plugins/fleet/server/constants/index.ts @@ -53,4 +53,5 @@ export { ENROLLMENT_API_KEYS_INDEX, AGENTS_INDEX, PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE, + PRECONFIGURATION_LATEST_KEYWORD, } from '../../common'; diff --git a/x-pack/plugins/fleet/server/services/epm/packages/install.ts b/x-pack/plugins/fleet/server/services/epm/packages/install.ts index 168ec55b14876..4373251a969bc 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/install.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/install.ts @@ -21,7 +21,6 @@ import { import { PACKAGES_SAVED_OBJECT_TYPE, MAX_TIME_COMPLETE_INSTALL } from '../../../constants'; import type { KibanaAssetType } from '../../../types'; import type { - AssetReference, Installation, AssetType, EsAssetReference, @@ -46,29 +45,6 @@ import { removeInstallation } from './remove'; import { getPackageSavedObjects } from './get'; import { _installPackage } from './_install_package'; -export async function installLatestPackage(options: { - savedObjectsClient: SavedObjectsClientContract; - pkgName: string; - esClient: ElasticsearchClient; -}): Promise { - const { savedObjectsClient, pkgName, esClient } = options; - try { - const latestPackage = await Registry.fetchFindLatestPackage(pkgName); - const pkgkey = Registry.pkgToPkgKey({ - name: latestPackage.name, - version: latestPackage.version, - }); - return installPackage({ - installSource: 'registry', - savedObjectsClient, - pkgkey, - esClient, - }).then(({ assets }) => assets); - } catch (err) { - throw err; - } -} - export async function ensureInstalledDefaultPackages( savedObjectsClient: SavedObjectsClientContract, esClient: ElasticsearchClient @@ -97,14 +73,17 @@ export async function ensureInstalledDefaultPackages( }); } -export async function isPackageVersionInstalled(options: { +async function isPackageVersionOrLaterInstalled(options: { savedObjectsClient: SavedObjectsClientContract; pkgName: string; - pkgVersion?: string; + pkgVersion: string; }): Promise { const { savedObjectsClient, pkgName, pkgVersion } = options; const installedPackage = await getInstallation({ savedObjectsClient, pkgName }); - if (installedPackage && (!pkgVersion || installedPackage.version === pkgVersion)) { + if ( + installedPackage && + (installedPackage.version === pkgVersion || semverLt(pkgVersion, installedPackage.version)) + ) { return installedPackage; } return false; @@ -115,37 +94,31 @@ export async function ensureInstalledPackage(options: { pkgName: string; esClient: ElasticsearchClient; pkgVersion?: string; - force?: boolean; }): Promise { - const { savedObjectsClient, pkgName, esClient, pkgVersion, force } = options; - const installedPackage = await isPackageVersionInstalled({ + const { savedObjectsClient, pkgName, esClient, pkgVersion } = options; + + // If pkgVersion isn't specified, find the latest package version + const pkgKeyProps = pkgVersion + ? { name: pkgName, version: pkgVersion } + : await Registry.fetchFindLatestPackage(pkgName); + + const installedPackage = await isPackageVersionOrLaterInstalled({ savedObjectsClient, - pkgName, - pkgVersion, + pkgName: pkgKeyProps.name, + pkgVersion: pkgKeyProps.version, }); if (installedPackage) { return installedPackage; } - // if the requested packaged was not found to be installed, install - if (pkgVersion) { - const pkgkey = Registry.pkgToPkgKey({ - name: pkgName, - version: pkgVersion, - }); - await installPackage({ - installSource: 'registry', - savedObjectsClient, - pkgkey, - esClient, - force, - }); - } else { - await installLatestPackage({ - savedObjectsClient, - pkgName, - esClient, - }); - } + const pkgkey = Registry.pkgToPkgKey(pkgKeyProps); + await installPackage({ + installSource: 'registry', + savedObjectsClient, + pkgkey, + esClient, + force: true, // Always force outdated packages to be installed if a later version isn't installed + }); + const installation = await getInstallation({ savedObjectsClient, pkgName }); if (!installation) throw new Error(`could not get installation ${pkgName}`); return installation; diff --git a/x-pack/plugins/fleet/server/services/preconfiguration.ts b/x-pack/plugins/fleet/server/services/preconfiguration.ts index 3bd3169673b31..ffb16d286c45a 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration.ts @@ -19,7 +19,10 @@ import type { PreconfiguredAgentPolicy, PreconfiguredPackage, } from '../../common'; -import { PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE } from '../constants'; +import { + PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE, + PRECONFIGURATION_LATEST_KEYWORD, +} from '../constants'; import { escapeSearchQueryPhrase } from './saved_object'; @@ -64,8 +67,8 @@ export async function ensurePreconfiguredPackagesAndPolicies( // Preinstall packages specified in Kibana config const preconfiguredPackages = await Promise.all( - packages.map(({ name, version, force }) => - ensureInstalledPreconfiguredPackage(soClient, esClient, name, version, force) + packages.map(({ name, version }) => + ensureInstalledPreconfiguredPackage(soClient, esClient, name, version) ) ); @@ -202,15 +205,14 @@ async function ensureInstalledPreconfiguredPackage( soClient: SavedObjectsClientContract, esClient: ElasticsearchClient, pkgName: string, - pkgVersion: string, - force?: boolean + pkgVersion: string ) { + const isLatest = pkgVersion === PRECONFIGURATION_LATEST_KEYWORD; return ensureInstalledPackage({ savedObjectsClient: soClient, pkgName, esClient, - pkgVersion, - force, + pkgVersion: isLatest ? undefined : pkgVersion, }); } diff --git a/x-pack/plugins/fleet/server/types/models/preconfiguration.ts b/x-pack/plugins/fleet/server/types/models/preconfiguration.ts index f697e436fcf4a..11336af6c2635 100644 --- a/x-pack/plugins/fleet/server/types/models/preconfiguration.ts +++ b/x-pack/plugins/fleet/server/types/models/preconfiguration.ts @@ -8,6 +8,8 @@ import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; import semverValid from 'semver/functions/valid'; +import { PRECONFIGURATION_LATEST_KEYWORD } from '../../constants'; + import { AgentPolicyBaseSchema } from './agent_policy'; import { NamespaceSchema } from './package_policy'; @@ -27,14 +29,13 @@ export const PreconfiguredPackagesSchema = schema.arrayOf( name: schema.string(), version: schema.string({ validate: (value) => { - if (!semverValid(value)) { + if (value !== PRECONFIGURATION_LATEST_KEYWORD && !semverValid(value)) { return i18n.translate('xpack.fleet.config.invalidPackageVersionError', { - defaultMessage: 'must be a valid semver', + defaultMessage: 'must be a valid semver, or the keyword `latest`', }); } }, }), - force: schema.maybe(schema.boolean()), }) ); From 35214416f80901a47e41de7e694a4894b863aeac Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 15 Apr 2021 14:54:49 -0700 Subject: [PATCH 41/68] Extract License service from CCR and Watcher into license_api_guard plugin in x-pack (#95973) * Localize error messages. --- .github/CODEOWNERS | 1 + docs/developer/plugin-list.asciidoc | 4 + src/plugins/es_ui_shared/tsconfig.json | 2 +- tsconfig.json | 1 + x-pack/.i18nrc.json | 1 + .../cross_cluster_replication/kibana.json | 1 + .../server/plugin.ts | 37 +++--- .../register_create_route.test.ts | 3 +- .../register_delete_route.test.ts | 3 +- .../register_fetch_route.test.ts | 3 +- .../register_get_route.test.ts | 3 +- .../register_pause_route.test.ts | 3 +- .../register_resume_route.test.ts | 3 +- .../register_update_route.test.ts | 3 +- .../register_create_route.test.ts | 3 +- .../register_fetch_route.test.ts | 3 +- .../follower_index/register_get_route.test.ts | 3 +- .../register_pause_route.test.ts | 3 +- .../register_resume_route.test.ts | 3 +- .../register_unfollow_route.test.ts | 3 +- .../server/services/index.ts | 1 - .../server/services/license.ts | 91 -------------- .../server/shared_imports.ts | 1 + .../cross_cluster_replication/server/types.ts | 11 +- .../cross_cluster_replication/tsconfig.json | 1 + x-pack/plugins/license_api_guard/READM.md | 3 + .../jest.config.js} | 6 +- x-pack/plugins/license_api_guard/kibana.json | 8 ++ .../plugins/license_api_guard/server/index.ts | 16 +++ .../license_api_guard/server/license.test.ts | 105 ++++++++++++++++ .../license_api_guard/server/license.ts | 113 ++++++++++++++++++ .../server/shared_imports.ts | 12 ++ .../plugins/license_api_guard/tsconfig.json | 17 +++ .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - x-pack/plugins/watcher/kibana.json | 1 + .../license_pre_routing_factory.test.js | 40 ------- .../license_pre_routing_factory.ts | 32 ----- x-pack/plugins/watcher/server/plugin.ts | 62 +++++----- .../routes/api/indices/register_get_route.ts | 8 +- .../api/license/register_refresh_route.ts | 7 +- .../routes/api/register_list_fields_route.ts | 12 +- .../routes/api/register_load_history_route.ts | 12 +- .../api/settings/register_load_route.ts | 8 +- .../action/register_acknowledge_route.ts | 12 +- .../api/watch/register_activate_route.ts | 8 +- .../api/watch/register_deactivate_route.ts | 12 +- .../routes/api/watch/register_delete_route.ts | 8 +- .../api/watch/register_execute_route.ts | 8 +- .../api/watch/register_history_route.ts | 8 +- .../routes/api/watch/register_load_route.ts | 8 +- .../routes/api/watch/register_save_route.ts | 8 +- .../api/watch/register_visualize_route.ts | 8 +- .../api/watches/register_delete_route.ts | 7 +- .../routes/api/watches/register_list_route.ts | 8 +- .../plugins/watcher/server/shared_imports.ts | 1 + x-pack/plugins/watcher/server/types.ts | 19 +-- x-pack/plugins/watcher/tsconfig.json | 1 + 58 files changed, 432 insertions(+), 339 deletions(-) delete mode 100644 x-pack/plugins/cross_cluster_replication/server/services/license.ts create mode 100644 x-pack/plugins/license_api_guard/READM.md rename x-pack/plugins/{watcher/server/lib/license_pre_routing_factory/index.ts => license_api_guard/jest.config.js} (67%) create mode 100644 x-pack/plugins/license_api_guard/kibana.json create mode 100644 x-pack/plugins/license_api_guard/server/index.ts create mode 100644 x-pack/plugins/license_api_guard/server/license.test.ts create mode 100644 x-pack/plugins/license_api_guard/server/license.ts create mode 100644 x-pack/plugins/license_api_guard/server/shared_imports.ts create mode 100644 x-pack/plugins/license_api_guard/tsconfig.json delete mode 100644 x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.test.js delete mode 100644 x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 92e39c2e634e5..0692e94e8b028 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -312,6 +312,7 @@ /x-pack/plugins/console_extensions/ @elastic/es-ui /x-pack/plugins/grokdebugger/ @elastic/es-ui /x-pack/plugins/index_management/ @elastic/es-ui +/x-pack/plugins/license_api_guard/ @elastic/es-ui /x-pack/plugins/license_management/ @elastic/es-ui /x-pack/plugins/painless_lab/ @elastic/es-ui /x-pack/plugins/remote_clusters/ @elastic/es-ui diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 353a77527d1d5..de7253e34d103 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -444,6 +444,10 @@ the infrastructure monitoring use-case within Kibana. |Visualization editor allowing to quickly and easily configure compelling visualizations to use on dashboards and canvas workpads. +|{kib-repo}blob/{branch}/x-pack/plugins/license_api_guard[licenseApiGuard] +|WARNING: Missing README. + + |{kib-repo}blob/{branch}/x-pack/plugins/license_management/README.md[licenseManagement] |This plugin enables users to activate a trial license, downgrade to Basic, and upload a new license. diff --git a/src/plugins/es_ui_shared/tsconfig.json b/src/plugins/es_ui_shared/tsconfig.json index 9bcda2e0614de..5f136d09b2ce4 100644 --- a/src/plugins/es_ui_shared/tsconfig.json +++ b/src/plugins/es_ui_shared/tsconfig.json @@ -16,6 +16,6 @@ ], "references": [ { "path": "../../core/tsconfig.json" }, - { "path": "../data/tsconfig.json" }, + { "path": "../data/tsconfig.json" } ] } diff --git a/tsconfig.json b/tsconfig.json index 40763ede1bbdd..ac15fe14b4d2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -105,6 +105,7 @@ { "path": "./x-pack/plugins/infra/tsconfig.json" }, { "path": "./x-pack/plugins/ingest_pipelines/tsconfig.json" }, { "path": "./x-pack/plugins/lens/tsconfig.json" }, + { "path": "./x-pack/plugins/license_api_guard/tsconfig.json" }, { "path": "./x-pack/plugins/license_management/tsconfig.json" }, { "path": "./x-pack/plugins/licensing/tsconfig.json" }, { "path": "./x-pack/plugins/logstash/tsconfig.json" }, diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 6bbbf6cd6b82d..3fee52ff55857 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -31,6 +31,7 @@ "xpack.fleet": "plugins/fleet", "xpack.ingestPipelines": "plugins/ingest_pipelines", "xpack.lens": "plugins/lens", + "xpack.licenseApiGuard": "plugins/license_api_guard", "xpack.licenseMgmt": "plugins/license_management", "xpack.licensing": "plugins/licensing", "xpack.lists": "plugins/lists", diff --git a/x-pack/plugins/cross_cluster_replication/kibana.json b/x-pack/plugins/cross_cluster_replication/kibana.json index 292820f81adbe..f130d0173cc89 100644 --- a/x-pack/plugins/cross_cluster_replication/kibana.json +++ b/x-pack/plugins/cross_cluster_replication/kibana.json @@ -6,6 +6,7 @@ "requiredPlugins": [ "home", "licensing", + "licenseApiGuard", "management", "remoteClusters", "indexManagement", diff --git a/x-pack/plugins/cross_cluster_replication/server/plugin.ts b/x-pack/plugins/cross_cluster_replication/server/plugin.ts index 1150f191441fc..e3a1de1dbfaba 100644 --- a/x-pack/plugins/cross_cluster_replication/server/plugin.ts +++ b/x-pack/plugins/cross_cluster_replication/server/plugin.ts @@ -7,9 +7,9 @@ import { Observable } from 'rxjs'; import { first } from 'rxjs/operators'; -import { i18n } from '@kbn/i18n'; import { CoreSetup, + CoreStart, ILegacyCustomClusterClient, Plugin, Logger, @@ -19,12 +19,11 @@ import { import { Index } from '../../index_management/server'; import { PLUGIN } from '../common/constants'; -import type { Dependencies, CcrRequestHandlerContext } from './types'; +import { SetupDependencies, StartDependencies, CcrRequestHandlerContext } from './types'; import { registerApiRoutes } from './routes'; -import { License } from './services'; import { elasticsearchJsPlugin } from './client/elasticsearch_ccr'; import { CrossClusterReplicationConfig } from './config'; -import { isEsError } from './shared_imports'; +import { License, isEsError } from './shared_imports'; import { formatEsError } from './lib/format_es_error'; async function getCustomEsClient(getStartServices: CoreSetup['getStartServices']) { @@ -77,7 +76,7 @@ export class CrossClusterReplicationServerPlugin implements Plugin { - const { state, message } = license.check(pluginId, minimumLicenseType); - const hasRequiredLicense = state === 'valid'; - - // Retrieving security checks the results of GET /_xpack as well as license state, - // so we're also checking whether the security is disabled in elasticsearch.yml. - this._isEsSecurityEnabled = license.getFeature('security').isEnabled; - - if (hasRequiredLicense) { - this.licenseStatus = { isValid: true }; - } else { - this.licenseStatus = { - isValid: false, - message: message || defaultErrorMessage, - }; - if (message) { - logger.info(message); - } - } - }); - } - - guardApiRoute(handler: RequestHandler) { - const license = this; - - return function licenseCheck( - ctx: CcrRequestHandlerContext, - request: KibanaRequest, - response: KibanaResponseFactory - ) { - const licenseStatus = license.getStatus(); - - if (!licenseStatus.isValid) { - return response.customError({ - body: { - message: licenseStatus.message || '', - }, - statusCode: 403, - }); - } - - return handler(ctx, request, response); - }; - } - - getStatus() { - return this.licenseStatus; - } - - // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility - get isEsSecurityEnabled() { - return this._isEsSecurityEnabled; - } -} diff --git a/x-pack/plugins/cross_cluster_replication/server/shared_imports.ts b/x-pack/plugins/cross_cluster_replication/server/shared_imports.ts index df9b3dd53cc1f..4252a2a5c32d4 100644 --- a/x-pack/plugins/cross_cluster_replication/server/shared_imports.ts +++ b/x-pack/plugins/cross_cluster_replication/server/shared_imports.ts @@ -6,3 +6,4 @@ */ export { isEsError } from '../../../../src/plugins/es_ui_shared/server'; +export { License } from '../../license_api_guard/server'; diff --git a/x-pack/plugins/cross_cluster_replication/server/types.ts b/x-pack/plugins/cross_cluster_replication/server/types.ts index 2bec53170084d..7314fda70027f 100644 --- a/x-pack/plugins/cross_cluster_replication/server/types.ts +++ b/x-pack/plugins/cross_cluster_replication/server/types.ts @@ -7,20 +7,23 @@ import { IRouter, ILegacyScopedClusterClient, RequestHandlerContext } from 'src/core/server'; import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; -import { LicensingPluginSetup } from '../../licensing/server'; +import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/server'; import { IndexManagementPluginSetup } from '../../index_management/server'; import { RemoteClustersPluginSetup } from '../../remote_clusters/server'; -import { License } from './services'; -import { isEsError } from './shared_imports'; +import { License, isEsError } from './shared_imports'; import { formatEsError } from './lib/format_es_error'; -export interface Dependencies { +export interface SetupDependencies { licensing: LicensingPluginSetup; indexManagement: IndexManagementPluginSetup; remoteClusters: RemoteClustersPluginSetup; features: FeaturesPluginSetup; } +export interface StartDependencies { + licensing: LicensingPluginStart; +} + export interface RouteDependencies { router: CcrPluginRouter; license: License; diff --git a/x-pack/plugins/cross_cluster_replication/tsconfig.json b/x-pack/plugins/cross_cluster_replication/tsconfig.json index 9c7590b9c2553..e0923553beadc 100644 --- a/x-pack/plugins/cross_cluster_replication/tsconfig.json +++ b/x-pack/plugins/cross_cluster_replication/tsconfig.json @@ -27,5 +27,6 @@ { "path": "../../../src/plugins/kibana_react/tsconfig.json" }, { "path": "../../../src/plugins/es_ui_shared/tsconfig.json" }, { "path": "../../../src/plugins/data/tsconfig.json" }, + { "path": "../license_api_guard/tsconfig.json" }, ] } diff --git a/x-pack/plugins/license_api_guard/READM.md b/x-pack/plugins/license_api_guard/READM.md new file mode 100644 index 0000000000000..767223125b12c --- /dev/null +++ b/x-pack/plugins/license_api_guard/READM.md @@ -0,0 +1,3 @@ +# License API guard plugin + +This plugin is used by ES UI plugins to reject API requests to plugins that are unsupported by the user's license. \ No newline at end of file diff --git a/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/index.ts b/x-pack/plugins/license_api_guard/jest.config.js similarity index 67% rename from x-pack/plugins/watcher/server/lib/license_pre_routing_factory/index.ts rename to x-pack/plugins/license_api_guard/jest.config.js index a86cdb1f20f7b..e0f348ceabd85 100644 --- a/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/index.ts +++ b/x-pack/plugins/license_api_guard/jest.config.js @@ -5,4 +5,8 @@ * 2.0. */ -export { licensePreRoutingFactory } from './license_pre_routing_factory'; +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/x-pack/plugins/license_api_guard'], +}; diff --git a/x-pack/plugins/license_api_guard/kibana.json b/x-pack/plugins/license_api_guard/kibana.json new file mode 100644 index 0000000000000..0fdf7ffed8988 --- /dev/null +++ b/x-pack/plugins/license_api_guard/kibana.json @@ -0,0 +1,8 @@ +{ + "id": "licenseApiGuard", + "version": "0.0.1", + "kibanaVersion": "kibana", + "configPath": ["xpack", "licenseApiGuard"], + "server": true, + "ui": false +} diff --git a/x-pack/plugins/license_api_guard/server/index.ts b/x-pack/plugins/license_api_guard/server/index.ts new file mode 100644 index 0000000000000..3c4abd4e17c30 --- /dev/null +++ b/x-pack/plugins/license_api_guard/server/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { License } from './license'; + +/** dummy plugin*/ +export function plugin() { + return new (class LicenseApiGuardPlugin { + setup() {} + start() {} + })(); +} diff --git a/x-pack/plugins/license_api_guard/server/license.test.ts b/x-pack/plugins/license_api_guard/server/license.test.ts new file mode 100644 index 0000000000000..e9da393f53478 --- /dev/null +++ b/x-pack/plugins/license_api_guard/server/license.test.ts @@ -0,0 +1,105 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { of } from 'rxjs'; +import type { KibanaRequest, RequestHandlerContext } from 'src/core/server'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { httpServerMock } from 'src/core/server/http/http_server.mocks'; + +import { License } from './license'; +import { LicenseCheckState, licensingMock } from './shared_imports'; + +describe('License API guard', () => { + const pluginName = 'testPlugin'; + const currentLicenseType = 'basic'; + + const testRoute = ({ licenseState }: { licenseState: string }) => { + const license = new License(); + + const logger = { + warn: jest.fn(), + }; + + license.setup({ pluginName, logger }); + + const licenseMock = licensingMock.createLicenseMock(); + licenseMock.type = currentLicenseType; + licenseMock.check('test', 'basic'); // Flush default mocked state + licenseMock.check.mockReturnValue({ state: licenseState as LicenseCheckState }); // Replace with new mocked state + + const licensing = { + license$: of(licenseMock), + }; + + license.start({ + pluginId: 'id', + minimumLicenseType: 'basic', + licensing, + }); + + const route = jest.fn(); + const guardedRoute = license.guardApiRoute(route); + const forbidden = jest.fn(); + const responseMock = httpServerMock.createResponseFactory(); + responseMock.forbidden = forbidden; + guardedRoute({} as RequestHandlerContext, {} as KibanaRequest, responseMock); + + return { + errorResponse: + forbidden.mock.calls.length > 0 + ? forbidden.mock.calls[forbidden.mock.calls.length - 1][0] + : undefined, + logMesssage: + logger.warn.mock.calls.length > 0 + ? logger.warn.mock.calls[logger.warn.mock.calls.length - 1][0] + : undefined, + route, + }; + }; + + describe('valid license', () => { + it('the original route is called and nothing is logged', () => { + const { errorResponse, logMesssage, route } = testRoute({ licenseState: 'valid' }); + + expect(errorResponse).toBeUndefined(); + expect(logMesssage).toBeUndefined(); + expect(route).toHaveBeenCalled(); + }); + }); + + [ + { + licenseState: 'invalid', + expectedMessage: `Your ${currentLicenseType} license does not support ${pluginName}. Please upgrade your license.`, + }, + { + licenseState: 'expired', + expectedMessage: `You cannot use ${pluginName} because your ${currentLicenseType} license has expired.`, + }, + { + licenseState: 'unavailable', + expectedMessage: `You cannot use ${pluginName} because license information is not available at this time.`, + }, + ].forEach(({ licenseState, expectedMessage }) => { + describe(`${licenseState} license`, () => { + it('replies with and logs the error message', () => { + const { errorResponse, logMesssage, route } = testRoute({ licenseState }); + + // We depend on the call to `response.forbidden()` to generate the 403 status code, + // so we can't assert for it here. + expect(errorResponse).toEqual({ + body: { + message: expectedMessage, + }, + }); + + expect(logMesssage).toBe(expectedMessage); + expect(route).not.toHaveBeenCalled(); + }); + }); + }); +}); diff --git a/x-pack/plugins/license_api_guard/server/license.ts b/x-pack/plugins/license_api_guard/server/license.ts new file mode 100644 index 0000000000000..3b0fbc8422d63 --- /dev/null +++ b/x-pack/plugins/license_api_guard/server/license.ts @@ -0,0 +1,113 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { + Logger, + KibanaRequest, + KibanaResponseFactory, + RequestHandler, + RequestHandlerContext, +} from 'src/core/server'; + +import { ILicense, LicenseType, LicenseCheckState, LicensingPluginStart } from './shared_imports'; + +type LicenseLogger = Pick; +type LicenseDependency = Pick; + +interface SetupSettings { + pluginName: string; + logger: LicenseLogger; +} + +interface StartSettings { + pluginId: string; + minimumLicenseType: LicenseType; + licensing: LicenseDependency; +} + +export class License { + private pluginName?: string; + private logger?: LicenseLogger; + private licenseCheckState: LicenseCheckState = 'unavailable'; + private licenseType?: LicenseType; + + private _isEsSecurityEnabled: boolean = false; + + setup({ pluginName, logger }: SetupSettings) { + this.pluginName = pluginName; + this.logger = logger; + } + + start({ pluginId, minimumLicenseType, licensing }: StartSettings) { + licensing.license$.subscribe((license: ILicense) => { + this.licenseType = license.type; + this.licenseCheckState = license.check(pluginId, minimumLicenseType!).state; + // Retrieving security checks the results of GET /_xpack as well as license state, + // so we're also checking whether security is disabled in elasticsearch.yml. + this._isEsSecurityEnabled = license.getFeature('security').isEnabled; + }); + } + + private getLicenseErrorMessage(licenseCheckState: LicenseCheckState): string { + switch (licenseCheckState) { + case 'invalid': + return i18n.translate('xpack.licenseApiGuard.license.errorUnsupportedMessage', { + defaultMessage: + 'Your {licenseType} license does not support {pluginName}. Please upgrade your license.', + values: { licenseType: this.licenseType!, pluginName: this.pluginName }, + }); + + case 'expired': + return i18n.translate('xpack.licenseApiGuard.license.errorExpiredMessage', { + defaultMessage: + 'You cannot use {pluginName} because your {licenseType} license has expired.', + values: { licenseType: this.licenseType!, pluginName: this.pluginName }, + }); + + case 'unavailable': + return i18n.translate('xpack.licenseApiGuard.license.errorUnavailableMessage', { + defaultMessage: + 'You cannot use {pluginName} because license information is not available at this time.', + values: { pluginName: this.pluginName }, + }); + } + + return i18n.translate('xpack.licenseApiGuard.license.genericErrorMessage', { + defaultMessage: 'You cannot use {pluginName} because the license check failed.', + values: { pluginName: this.pluginName }, + }); + } + + guardApiRoute( + handler: RequestHandler + ) { + return ( + ctx: Context, + request: KibanaRequest, + response: KibanaResponseFactory + ) => { + // We'll only surface license errors if users attempt disallowed access to the API. + if (this.licenseCheckState !== 'valid') { + const licenseErrorMessage = this.getLicenseErrorMessage(this.licenseCheckState); + this.logger?.warn(licenseErrorMessage); + + return response.forbidden({ + body: { + message: licenseErrorMessage, + }, + }); + } + + return handler(ctx, request, response); + }; + } + + public get isEsSecurityEnabled() { + return this._isEsSecurityEnabled; + } +} diff --git a/x-pack/plugins/license_api_guard/server/shared_imports.ts b/x-pack/plugins/license_api_guard/server/shared_imports.ts new file mode 100644 index 0000000000000..1318706df11c9 --- /dev/null +++ b/x-pack/plugins/license_api_guard/server/shared_imports.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { ILicense, LicenseType, LicenseCheckState } from '../../licensing/common/types'; + +export type { LicensingPluginStart } from '../../licensing/server'; + +export { licensingMock } from '../../licensing/server/mocks'; diff --git a/x-pack/plugins/license_api_guard/tsconfig.json b/x-pack/plugins/license_api_guard/tsconfig.json new file mode 100644 index 0000000000000..1b6ea789760d5 --- /dev/null +++ b/x-pack/plugins/license_api_guard/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "server/**/*" + ], + "references": [ + { "path": "../licensing/tsconfig.json" }, + { "path": "../../../src/core/tsconfig.json" } + ] +} diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 9ce17b052e3ab..f5b685a609b49 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7241,7 +7241,6 @@ "xpack.crossClusterReplication.followerIndexList.table.statusColumnTitle": "ステータス", "xpack.crossClusterReplication.homeBreadcrumbTitle": "クラスター横断レプリケーション", "xpack.crossClusterReplication.indexMgmtBadge.followerLabel": "フォロワー", - "xpack.crossClusterReplication.licenseCheckErrorMessage": "ライセンス確認失敗", "xpack.crossClusterReplication.pauseFollowerIndex.confirmModal.cancelButtonText": "キャンセル", "xpack.crossClusterReplication.pauseFollowerIndex.confirmModal.confirmButtonText": "複製を中止", "xpack.crossClusterReplication.pauseFollowerIndex.confirmModal.multiplePauseDescription": "これらのフォロワーインデックスの複製が一時停止されます:", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 4a2f682ca2f4f..88639fa7246c0 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -7303,7 +7303,6 @@ "xpack.crossClusterReplication.followerIndexList.table.statusColumnTitle": "状态", "xpack.crossClusterReplication.homeBreadcrumbTitle": "跨集群复制", "xpack.crossClusterReplication.indexMgmtBadge.followerLabel": "Follower", - "xpack.crossClusterReplication.licenseCheckErrorMessage": "许可证检查失败", "xpack.crossClusterReplication.pauseAutoFollowPatternsLabel": "暂停{total, plural, other {复制}}", "xpack.crossClusterReplication.pauseFollowerIndex.confirmModal.cancelButtonText": "取消", "xpack.crossClusterReplication.pauseFollowerIndex.confirmModal.confirmButtonText": "暂停复制", diff --git a/x-pack/plugins/watcher/kibana.json b/x-pack/plugins/watcher/kibana.json index 695686715cb6a..b9df25d80e62e 100644 --- a/x-pack/plugins/watcher/kibana.json +++ b/x-pack/plugins/watcher/kibana.json @@ -5,6 +5,7 @@ "requiredPlugins": [ "home", "licensing", + "licenseApiGuard", "management", "charts", "data", diff --git a/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.test.js b/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.test.js deleted file mode 100644 index 4b39eb71cd5ba..0000000000000 --- a/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.test.js +++ /dev/null @@ -1,40 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { kibanaResponseFactory } from '../../../../../../src/core/server'; -import { licensePreRoutingFactory } from './license_pre_routing_factory'; - -describe('license_pre_routing_factory', () => { - describe('#reportingFeaturePreRoutingFactory', () => { - let mockDeps; - let licenseStatus; - - beforeEach(() => { - mockDeps = { getLicenseStatus: () => licenseStatus }; - }); - - describe('status is not valid', () => { - it('replies with 403', () => { - licenseStatus = { hasRequired: false }; - const routeWithLicenseCheck = licensePreRoutingFactory(mockDeps, () => {}); - const stubRequest = {}; - const response = routeWithLicenseCheck({}, stubRequest, kibanaResponseFactory); - expect(response.status).toBe(403); - }); - }); - - describe('status is valid', () => { - it('replies with nothing', () => { - licenseStatus = { hasRequired: true }; - const routeWithLicenseCheck = licensePreRoutingFactory(mockDeps, () => null); - const stubRequest = {}; - const response = routeWithLicenseCheck({}, stubRequest, kibanaResponseFactory); - expect(response).toBe(null); - }); - }); - }); -}); diff --git a/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts b/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts deleted file mode 100644 index d28f091f386d8..0000000000000 --- a/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts +++ /dev/null @@ -1,32 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { KibanaRequest, KibanaResponseFactory, RequestHandler } from 'kibana/server'; -import type { RouteDependencies, WatcherRequestHandlerContext } from '../../types'; - -export const licensePreRoutingFactory = ( - { getLicenseStatus }: RouteDependencies, - handler: RequestHandler -) => { - return function licenseCheck( - ctx: Context, - request: KibanaRequest, - response: KibanaResponseFactory - ) { - const licenseStatus = getLicenseStatus(); - if (!licenseStatus.hasRequired) { - return response.customError({ - body: { - message: licenseStatus.message || '', - }, - statusCode: 403, - }); - } - - return handler(ctx, request, response); - }; -}; diff --git a/x-pack/plugins/watcher/server/plugin.ts b/x-pack/plugins/watcher/server/plugin.ts index ceade131fc5af..99ece23ef0c45 100644 --- a/x-pack/plugins/watcher/server/plugin.ts +++ b/x-pack/plugins/watcher/server/plugin.ts @@ -5,17 +5,21 @@ * 2.0. */ +import { i18n } from '@kbn/i18n'; + import { CoreSetup, + CoreStart, ILegacyCustomClusterClient, Logger, Plugin, PluginInitializerContext, } from 'kibana/server'; + import { PLUGIN, INDEX_NAMES } from '../common/constants'; import type { - Dependencies, - LicenseStatus, + SetupDependencies, + StartDependencies, RouteDependencies, WatcherRequestHandlerContext, } from './types'; @@ -28,6 +32,7 @@ import { registerWatchRoutes } from './routes/api/watch'; import { registerListFieldsRoute } from './routes/api/register_list_fields_route'; import { registerLoadHistoryRoute } from './routes/api/register_load_history_route'; import { elasticsearchJsPlugin } from './lib/elasticsearch_js_plugin'; +import { License, isEsError } from './shared_imports'; async function getCustomEsClient(getStartServices: CoreSetup['getStartServices']) { const [core] = await getStartServices(); @@ -36,23 +41,20 @@ async function getCustomEsClient(getStartServices: CoreSetup['getStartServices'] } export class WatcherServerPlugin implements Plugin { - private readonly log: Logger; + private readonly license: License; + private readonly logger: Logger; private watcherESClient?: ILegacyCustomClusterClient; - private licenseStatus: LicenseStatus = { - hasRequired: false, - }; - constructor(ctx: PluginInitializerContext) { - this.log = ctx.logger.get(); + this.logger = ctx.logger.get(); + this.license = new License(); } - setup({ http, getStartServices }: CoreSetup, { licensing, features }: Dependencies) { - const router = http.createRouter(); - const routeDependencies: RouteDependencies = { - router, - getLicenseStatus: () => this.licenseStatus, - }; + setup({ http, getStartServices }: CoreSetup, { licensing, features }: SetupDependencies) { + this.license.setup({ + pluginName: PLUGIN.getI18nName(i18n), + logger: this.logger, + }); features.registerElasticsearchFeature({ id: 'watcher', @@ -90,6 +92,13 @@ export class WatcherServerPlugin implements Plugin { } ); + const router = http.createRouter(); + const routeDependencies: RouteDependencies = { + router, + license: this.license, + lib: { isEsError }, + }; + registerListFieldsRoute(routeDependencies); registerLoadHistoryRoute(routeDependencies); registerIndicesRoutes(routeDependencies); @@ -97,29 +106,16 @@ export class WatcherServerPlugin implements Plugin { registerSettingsRoutes(routeDependencies); registerWatchesRoutes(routeDependencies); registerWatchRoutes(routeDependencies); + } - licensing.license$.subscribe(async (license) => { - const { state, message } = license.check(PLUGIN.ID, PLUGIN.MINIMUM_LICENSE_REQUIRED); - const hasMinimumLicense = state === 'valid'; - if (hasMinimumLicense && license.getFeature(PLUGIN.ID)) { - this.log.info('Enabling Watcher plugin.'); - this.licenseStatus = { - hasRequired: true, - }; - } else { - if (message) { - this.log.info(message); - } - this.licenseStatus = { - hasRequired: false, - message, - }; - } + start(core: CoreStart, { licensing }: StartDependencies) { + this.license.start({ + pluginId: PLUGIN.ID, + minimumLicenseType: PLUGIN.MINIMUM_LICENSE_REQUIRED, + licensing, }); } - start() {} - stop() { if (this.watcherESClient) { this.watcherESClient.close(); diff --git a/x-pack/plugins/watcher/server/routes/api/indices/register_get_route.ts b/x-pack/plugins/watcher/server/routes/api/indices/register_get_route.ts index b234bed9f7d4d..3b79b7b94ec85 100644 --- a/x-pack/plugins/watcher/server/routes/api/indices/register_get_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/indices/register_get_route.ts @@ -8,9 +8,7 @@ import { schema } from '@kbn/config-schema'; import { ILegacyScopedClusterClient } from 'kibana/server'; import { reduce, size } from 'lodash'; -import { isEsError } from '../../../shared_imports'; import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; const bodySchema = schema.object({ pattern: schema.string() }, { unknowns: 'allow' }); @@ -65,15 +63,15 @@ function getIndices(dataClient: ILegacyScopedClusterClient, pattern: string, lim }); } -export function registerGetRoute(deps: RouteDependencies) { - deps.router.post( +export function registerGetRoute({ router, license, lib: { isEsError } }: RouteDependencies) { + router.post( { path: '/api/watcher/indices', validate: { body: bodySchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const { pattern } = request.body; try { diff --git a/x-pack/plugins/watcher/server/routes/api/license/register_refresh_route.ts b/x-pack/plugins/watcher/server/routes/api/license/register_refresh_route.ts index 0db4c7fae6a49..796494880b8e5 100644 --- a/x-pack/plugins/watcher/server/routes/api/license/register_refresh_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/license/register_refresh_route.ts @@ -6,7 +6,6 @@ */ import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; /* In order for the client to have the most up-to-date snapshot of the current license, it needs to make a round-trip to the kibana server. This refresh endpoint is provided @@ -14,13 +13,13 @@ for when the client needs to check the license, but doesn't need to pull data fr server for any reason, i.e., when adding a new watch. */ -export function registerRefreshRoute(deps: RouteDependencies) { - deps.router.get( +export function registerRefreshRoute({ router, license }: RouteDependencies) { + router.get( { path: '/api/watcher/license/refresh', validate: false, }, - licensePreRoutingFactory(deps, (ctx, request, response) => { + license.guardApiRoute((ctx, request, response) => { return response.ok({ body: { success: true } }); }) ); diff --git a/x-pack/plugins/watcher/server/routes/api/register_list_fields_route.ts b/x-pack/plugins/watcher/server/routes/api/register_list_fields_route.ts index 0882fc3a65027..445249a70f0b2 100644 --- a/x-pack/plugins/watcher/server/routes/api/register_list_fields_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/register_list_fields_route.ts @@ -7,10 +7,8 @@ import { schema } from '@kbn/config-schema'; import { ILegacyScopedClusterClient } from 'kibana/server'; -import { isEsError } from '../../shared_imports'; // @ts-ignore import { Fields } from '../../models/fields/index'; -import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory'; import { RouteDependencies } from '../../types'; const bodySchema = schema.object({ @@ -29,15 +27,19 @@ function fetchFields(dataClient: ILegacyScopedClusterClient, indexes: string[]) return dataClient.callAsCurrentUser('fieldCaps', params); } -export function registerListFieldsRoute(deps: RouteDependencies) { - deps.router.post( +export function registerListFieldsRoute({ + router, + license, + lib: { isEsError }, +}: RouteDependencies) { + router.post( { path: '/api/watcher/fields', validate: { body: bodySchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const { indexes } = request.body; try { diff --git a/x-pack/plugins/watcher/server/routes/api/register_load_history_route.ts b/x-pack/plugins/watcher/server/routes/api/register_load_history_route.ts index 629f29734c603..67153b810c6b9 100644 --- a/x-pack/plugins/watcher/server/routes/api/register_load_history_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/register_load_history_route.ts @@ -8,10 +8,8 @@ import { schema } from '@kbn/config-schema'; import { get } from 'lodash'; import { ILegacyScopedClusterClient } from 'kibana/server'; -import { isEsError } from '../../shared_imports'; import { INDEX_NAMES } from '../../../common/constants'; import { RouteDependencies } from '../../types'; -import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory'; // @ts-ignore import { WatchHistoryItem } from '../../models/watch_history_item/index'; @@ -32,15 +30,19 @@ function fetchHistoryItem(dataClient: ILegacyScopedClusterClient, watchHistoryIt }); } -export function registerLoadHistoryRoute(deps: RouteDependencies) { - deps.router.get( +export function registerLoadHistoryRoute({ + router, + license, + lib: { isEsError }, +}: RouteDependencies) { + router.get( { path: '/api/watcher/history/{id}', validate: { params: paramsSchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const id = request.params.id; try { diff --git a/x-pack/plugins/watcher/server/routes/api/settings/register_load_route.ts b/x-pack/plugins/watcher/server/routes/api/settings/register_load_route.ts index ef5c7c6177ce9..2cc1b97fb065e 100644 --- a/x-pack/plugins/watcher/server/routes/api/settings/register_load_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/settings/register_load_route.ts @@ -6,11 +6,9 @@ */ import { ILegacyScopedClusterClient } from 'kibana/server'; -import { isEsError } from '../../../shared_imports'; // @ts-ignore import { Settings } from '../../../models/settings/index'; import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; function fetchClusterSettings(client: ILegacyScopedClusterClient) { return client.callAsInternalUser('cluster.getSettings', { @@ -19,13 +17,13 @@ function fetchClusterSettings(client: ILegacyScopedClusterClient) { }); } -export function registerLoadRoute(deps: RouteDependencies) { - deps.router.get( +export function registerLoadRoute({ router, license, lib: { isEsError } }: RouteDependencies) { + router.get( { path: '/api/watcher/settings', validate: false, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { try { const settings = await fetchClusterSettings(ctx.watcher!.client); return response.ok({ body: Settings.fromUpstreamJson(settings).downstreamJson }); diff --git a/x-pack/plugins/watcher/server/routes/api/watch/action/register_acknowledge_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/action/register_acknowledge_route.ts index 1afec0ada9104..eb35a62dea235 100644 --- a/x-pack/plugins/watcher/server/routes/api/watch/action/register_acknowledge_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watch/action/register_acknowledge_route.ts @@ -8,11 +8,9 @@ import { schema } from '@kbn/config-schema'; import { get } from 'lodash'; import { ILegacyScopedClusterClient } from 'kibana/server'; -import { isEsError } from '../../../../shared_imports'; // @ts-ignore import { WatchStatus } from '../../../../models/watch_status/index'; import { RouteDependencies } from '../../../../types'; -import { licensePreRoutingFactory } from '../../../../lib/license_pre_routing_factory'; const paramsSchema = schema.object({ watchId: schema.string(), @@ -30,15 +28,19 @@ function acknowledgeAction( }); } -export function registerAcknowledgeRoute(deps: RouteDependencies) { - deps.router.put( +export function registerAcknowledgeRoute({ + router, + license, + lib: { isEsError }, +}: RouteDependencies) { + router.put( { path: '/api/watcher/watch/{watchId}/action/{actionId}/acknowledge', validate: { params: paramsSchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const { watchId, actionId } = request.params; try { diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_activate_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_activate_route.ts index 85d1d0c51f0b3..db9a4ca43d9ce 100644 --- a/x-pack/plugins/watcher/server/routes/api/watch/register_activate_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watch/register_activate_route.ts @@ -8,9 +8,7 @@ import { schema } from '@kbn/config-schema'; import { ILegacyScopedClusterClient } from 'kibana/server'; import { get } from 'lodash'; -import { isEsError } from '../../../shared_imports'; import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; // @ts-ignore import { WatchStatus } from '../../../models/watch_status/index'; @@ -24,15 +22,15 @@ const paramsSchema = schema.object({ watchId: schema.string(), }); -export function registerActivateRoute(deps: RouteDependencies) { - deps.router.put( +export function registerActivateRoute({ router, license, lib: { isEsError } }: RouteDependencies) { + router.put( { path: '/api/watcher/watch/{watchId}/activate', validate: { params: paramsSchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const { watchId } = request.params; try { diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_deactivate_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_deactivate_route.ts index 071c9d17beee1..be012c888c3ee 100644 --- a/x-pack/plugins/watcher/server/routes/api/watch/register_deactivate_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watch/register_deactivate_route.ts @@ -8,9 +8,7 @@ import { schema } from '@kbn/config-schema'; import { ILegacyScopedClusterClient } from 'kibana/server'; import { get } from 'lodash'; -import { isEsError } from '../../../shared_imports'; import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; // @ts-ignore import { WatchStatus } from '../../../models/watch_status/index'; @@ -24,15 +22,19 @@ function deactivateWatch(dataClient: ILegacyScopedClusterClient, watchId: string }); } -export function registerDeactivateRoute(deps: RouteDependencies) { - deps.router.put( +export function registerDeactivateRoute({ + router, + license, + lib: { isEsError }, +}: RouteDependencies) { + router.put( { path: '/api/watcher/watch/{watchId}/deactivate', validate: { params: paramsSchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const { watchId } = request.params; try { diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_delete_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_delete_route.ts index ebf5b41bc589c..0cc65a61db728 100644 --- a/x-pack/plugins/watcher/server/routes/api/watch/register_delete_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watch/register_delete_route.ts @@ -7,9 +7,7 @@ import { schema } from '@kbn/config-schema'; import { ILegacyScopedClusterClient } from 'kibana/server'; -import { isEsError } from '../../../shared_imports'; import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; const paramsSchema = schema.object({ watchId: schema.string(), @@ -21,15 +19,15 @@ function deleteWatch(dataClient: ILegacyScopedClusterClient, watchId: string) { }); } -export function registerDeleteRoute(deps: RouteDependencies) { - deps.router.delete( +export function registerDeleteRoute({ router, license, lib: { isEsError } }: RouteDependencies) { + router.delete( { path: '/api/watcher/watch/{watchId}', validate: { params: paramsSchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const { watchId } = request.params; try { diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_execute_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_execute_route.ts index e2078ac5cc1d9..25305b86c11c1 100644 --- a/x-pack/plugins/watcher/server/routes/api/watch/register_execute_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watch/register_execute_route.ts @@ -8,8 +8,6 @@ import { schema } from '@kbn/config-schema'; import { ILegacyScopedClusterClient } from 'kibana/server'; import { get } from 'lodash'; -import { isEsError } from '../../../shared_imports'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; import { RouteDependencies } from '../../../types'; // @ts-ignore @@ -33,15 +31,15 @@ function executeWatch(dataClient: ILegacyScopedClusterClient, executeDetails: an }); } -export function registerExecuteRoute(deps: RouteDependencies) { - deps.router.put( +export function registerExecuteRoute({ router, license, lib: { isEsError } }: RouteDependencies) { + router.put( { path: '/api/watcher/watch/execute', validate: { body: bodySchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const executeDetails = ExecuteDetails.fromDownstreamJson(request.body.executeDetails); const watch = Watch.fromDownstreamJson(request.body.watch); diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_history_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_history_route.ts index cafcf81511a4f..b5d82647a8113 100644 --- a/x-pack/plugins/watcher/server/routes/api/watch/register_history_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watch/register_history_route.ts @@ -10,9 +10,7 @@ import { ILegacyScopedClusterClient } from 'kibana/server'; import { get } from 'lodash'; import { fetchAllFromScroll } from '../../../lib/fetch_all_from_scroll'; import { INDEX_NAMES, ES_SCROLL_SETTINGS } from '../../../../common/constants'; -import { isEsError } from '../../../shared_imports'; import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; // @ts-ignore import { WatchHistoryItem } from '../../../models/watch_history_item/index'; @@ -50,8 +48,8 @@ function fetchHistoryItems(dataClient: ILegacyScopedClusterClient, watchId: any, .then((response: any) => fetchAllFromScroll(response, dataClient)); } -export function registerHistoryRoute(deps: RouteDependencies) { - deps.router.get( +export function registerHistoryRoute({ router, license, lib: { isEsError } }: RouteDependencies) { + router.get( { path: '/api/watcher/watch/{watchId}/history', validate: { @@ -59,7 +57,7 @@ export function registerHistoryRoute(deps: RouteDependencies) { query: querySchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const { watchId } = request.params; const { startTime } = request.query; diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_load_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_load_route.ts index bba60cf93054c..2f9321cc4c365 100644 --- a/x-pack/plugins/watcher/server/routes/api/watch/register_load_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watch/register_load_route.ts @@ -8,8 +8,6 @@ import { schema } from '@kbn/config-schema'; import { ILegacyScopedClusterClient } from 'kibana/server'; import { get } from 'lodash'; -import { isEsError } from '../../../shared_imports'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; // @ts-ignore import { Watch } from '../../../models/watch/index'; import { RouteDependencies } from '../../../types'; @@ -24,15 +22,15 @@ function fetchWatch(dataClient: ILegacyScopedClusterClient, watchId: string) { }); } -export function registerLoadRoute(deps: RouteDependencies) { - deps.router.get( +export function registerLoadRoute({ router, license, lib: { isEsError } }: RouteDependencies) { + router.get( { path: '/api/watcher/watch/{id}', validate: { params: paramsSchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const id = request.params.id; try { diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_save_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_save_route.ts index b4a219979e650..e93ad4d04272b 100644 --- a/x-pack/plugins/watcher/server/routes/api/watch/register_save_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watch/register_save_route.ts @@ -9,9 +9,7 @@ import { schema } from '@kbn/config-schema'; import { i18n } from '@kbn/i18n'; import { WATCH_TYPES } from '../../../../common/constants'; import { serializeJsonWatch, serializeThresholdWatch } from '../../../../common/lib/serialization'; -import { isEsError } from '../../../shared_imports'; import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; const paramsSchema = schema.object({ id: schema.string(), @@ -26,8 +24,8 @@ const bodySchema = schema.object( { unknowns: 'allow' } ); -export function registerSaveRoute(deps: RouteDependencies) { - deps.router.put( +export function registerSaveRoute({ router, license, lib: { isEsError } }: RouteDependencies) { + router.put( { path: '/api/watcher/watch/{id}', validate: { @@ -35,7 +33,7 @@ export function registerSaveRoute(deps: RouteDependencies) { body: bodySchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const { id } = request.params; const { type, isNew, isActive, ...watchConfig } = request.body; diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_visualize_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_visualize_route.ts index 0310d7eed9d34..d7bf3729a930b 100644 --- a/x-pack/plugins/watcher/server/routes/api/watch/register_visualize_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watch/register_visualize_route.ts @@ -7,9 +7,7 @@ import { schema } from '@kbn/config-schema'; import { ILegacyScopedClusterClient } from 'kibana/server'; -import { isEsError } from '../../../shared_imports'; import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; // @ts-ignore import { Watch } from '../../../models/watch/index'; @@ -33,15 +31,15 @@ function fetchVisualizeData(dataClient: ILegacyScopedClusterClient, index: any, return dataClient.callAsCurrentUser('search', params); } -export function registerVisualizeRoute(deps: RouteDependencies) { - deps.router.post( +export function registerVisualizeRoute({ router, license, lib: { isEsError } }: RouteDependencies) { + router.post( { path: '/api/watcher/watch/visualize', validate: { body: bodySchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const watch = Watch.fromDownstreamJson(request.body.watch); const options = VisualizeOptions.fromDownstreamJson(request.body.options); const body = watch.getVisualizeQuery(options); diff --git a/x-pack/plugins/watcher/server/routes/api/watches/register_delete_route.ts b/x-pack/plugins/watcher/server/routes/api/watches/register_delete_route.ts index 631f6fdcb0903..0d837e080434e 100644 --- a/x-pack/plugins/watcher/server/routes/api/watches/register_delete_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watches/register_delete_route.ts @@ -8,7 +8,6 @@ import { schema } from '@kbn/config-schema'; import { ILegacyScopedClusterClient } from 'kibana/server'; import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; const bodySchema = schema.object({ watchIds: schema.arrayOf(schema.string()), @@ -42,15 +41,15 @@ function deleteWatches(dataClient: ILegacyScopedClusterClient, watchIds: string[ }); } -export function registerDeleteRoute(deps: RouteDependencies) { - deps.router.post( +export function registerDeleteRoute({ router, license }: RouteDependencies) { + router.post( { path: '/api/watcher/watches/delete', validate: { body: bodySchema, }, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { const results = await deleteWatches(ctx.watcher!.client, request.body.watchIds); return response.ok({ body: { results } }); }) diff --git a/x-pack/plugins/watcher/server/routes/api/watches/register_list_route.ts b/x-pack/plugins/watcher/server/routes/api/watches/register_list_route.ts index 6a4e85800fa8d..ef07a2b104f96 100644 --- a/x-pack/plugins/watcher/server/routes/api/watches/register_list_route.ts +++ b/x-pack/plugins/watcher/server/routes/api/watches/register_list_route.ts @@ -9,9 +9,7 @@ import { ILegacyScopedClusterClient } from 'kibana/server'; import { get } from 'lodash'; import { fetchAllFromScroll } from '../../../lib/fetch_all_from_scroll'; import { INDEX_NAMES, ES_SCROLL_SETTINGS } from '../../../../common/constants'; -import { isEsError } from '../../../shared_imports'; import { RouteDependencies } from '../../../types'; -import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory'; // @ts-ignore import { Watch } from '../../../models/watch/index'; @@ -30,13 +28,13 @@ function fetchWatches(dataClient: ILegacyScopedClusterClient) { .then((response: any) => fetchAllFromScroll(response, dataClient)); } -export function registerListRoute(deps: RouteDependencies) { - deps.router.get( +export function registerListRoute({ router, license, lib: { isEsError } }: RouteDependencies) { + router.get( { path: '/api/watcher/watches', validate: false, }, - licensePreRoutingFactory(deps, async (ctx, request, response) => { + license.guardApiRoute(async (ctx, request, response) => { try { const hits = await fetchWatches(ctx.watcher!.client); const watches = hits.map((hit: any) => { diff --git a/x-pack/plugins/watcher/server/shared_imports.ts b/x-pack/plugins/watcher/server/shared_imports.ts index df9b3dd53cc1f..4252a2a5c32d4 100644 --- a/x-pack/plugins/watcher/server/shared_imports.ts +++ b/x-pack/plugins/watcher/server/shared_imports.ts @@ -6,3 +6,4 @@ */ export { isEsError } from '../../../../src/plugins/es_ui_shared/server'; +export { License } from '../../license_api_guard/server'; diff --git a/x-pack/plugins/watcher/server/types.ts b/x-pack/plugins/watcher/server/types.ts index fccf4925b6ad8..0fab4981fb412 100644 --- a/x-pack/plugins/watcher/server/types.ts +++ b/x-pack/plugins/watcher/server/types.ts @@ -7,13 +7,18 @@ import type { ILegacyScopedClusterClient, IRouter, RequestHandlerContext } from 'src/core/server'; import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; -import { LicensingPluginSetup } from '../../licensing/server'; +import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/server'; +import { License, isEsError } from './shared_imports'; -export interface Dependencies { +export interface SetupDependencies { licensing: LicensingPluginSetup; features: FeaturesPluginSetup; } +export interface StartDependencies { + licensing: LicensingPluginStart; +} + export interface ServerShim { route: any; plugins: { @@ -23,12 +28,10 @@ export interface ServerShim { export interface RouteDependencies { router: WatcherRouter; - getLicenseStatus: () => LicenseStatus; -} - -export interface LicenseStatus { - hasRequired: boolean; - message?: string; + license: License; + lib: { + isEsError: typeof isEsError; + }; } /** diff --git a/x-pack/plugins/watcher/tsconfig.json b/x-pack/plugins/watcher/tsconfig.json index e8dabe8cd40a9..9f5c0db779f94 100644 --- a/x-pack/plugins/watcher/tsconfig.json +++ b/x-pack/plugins/watcher/tsconfig.json @@ -23,6 +23,7 @@ { "path": "../../../src/plugins/data/tsconfig.json" }, { "path": "../../../src/plugins/kibana_react/tsconfig.json" }, { "path": "../../../src/plugins/es_ui_shared/tsconfig.json" }, + { "path": "../license_api_guard/tsconfig.json" }, { "path": "../licensing/tsconfig.json" }, { "path": "../features/tsconfig.json" }, ] From 875c47593618b4b55622ca90beb387a0cbc837dc Mon Sep 17 00:00:00 2001 From: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Date: Thu, 15 Apr 2021 17:58:51 -0400 Subject: [PATCH 42/68] happy it is fix (#97313) --- .../timelines/containers/index.test.tsx | 18 ++++++-- .../public/timelines/containers/index.tsx | 46 ++++++++++--------- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/x-pack/plugins/security_solution/public/timelines/containers/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/containers/index.test.tsx index b24a50a516325..ddcecb885a8ff 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/containers/index.test.tsx @@ -230,13 +230,25 @@ describe('useTimelineEvents', () => { // useEffect on params request await waitForNextUpdate(); - rerender({ ...props, startDate, endDate }); + rerender({ + ...props, + startDate, + endDate, + language: 'eql', + eqlOptions: { + eventCategoryField: 'category', + tiebreakerField: '', + timestampField: '@timestamp', + query: 'find it EQL', + size: 100, + }, + }); // useEffect on params request await waitForNextUpdate(); - expect(mockSearch).toHaveBeenCalledTimes(2); + mockSearch.mockReset(); result.current[1].loadPage(4); await waitForNextUpdate(); - expect(mockSearch).toHaveBeenCalledTimes(3); + expect(mockSearch).toHaveBeenCalledTimes(1); }); }); }); diff --git a/x-pack/plugins/security_solution/public/timelines/containers/index.tsx b/x-pack/plugins/security_solution/public/timelines/containers/index.tsx index ab4b4358fd326..5f464b5ed943f 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/containers/index.tsx @@ -98,6 +98,29 @@ export const initSortDefault = [ }, ]; +const deStructureEqlOptions = (eqlOptions?: EqlOptionsSelected) => ({ + ...(!isEmpty(eqlOptions?.eventCategoryField) + ? { + eventCategoryField: eqlOptions?.eventCategoryField, + } + : {}), + ...(!isEmpty(eqlOptions?.size) + ? { + size: eqlOptions?.size, + } + : {}), + ...(!isEmpty(eqlOptions?.tiebreakerField) + ? { + tiebreakerField: eqlOptions?.tiebreakerField, + } + : {}), + ...(!isEmpty(eqlOptions?.timestampField) + ? { + timestampField: eqlOptions?.timestampField, + } + : {}), +}); + export const useTimelineEvents = ({ docValueFields, endDate, @@ -293,26 +316,7 @@ export const useTimelineEvents = ({ querySize: prevRequest?.pagination.querySize ?? 0, sort: prevRequest?.sort ?? initSortDefault, timerange: prevRequest?.timerange ?? {}, - ...(!isEmpty(prevEqlRequest?.eventCategoryField) - ? { - eventCategoryField: prevEqlRequest?.eventCategoryField, - } - : {}), - ...(!isEmpty(prevEqlRequest?.size) - ? { - size: prevEqlRequest?.size, - } - : {}), - ...(!isEmpty(prevEqlRequest?.tiebreakerField) - ? { - tiebreakerField: prevEqlRequest?.tiebreakerField, - } - : {}), - ...(!isEmpty(prevEqlRequest?.timestampField) - ? { - timestampField: prevEqlRequest?.timestampField, - } - : {}), + ...deStructureEqlOptions(prevEqlRequest), }; const currentSearchParameters = { @@ -325,7 +329,7 @@ export const useTimelineEvents = ({ from: startDate, to: endDate, }, - ...(eqlOptions ? eqlOptions : {}), + ...deStructureEqlOptions(eqlOptions), }; const newActivePage = deepEqual(prevSearchParameters, currentSearchParameters) From 689c4d40cda3e4beb86fa87e790ecbba73a44109 Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 15 Apr 2021 17:12:52 -0700 Subject: [PATCH 43/68] [ci/baseline] check public API doc count to populate baseline metrics (#97320) Co-authored-by: spalger --- .ci/Jenkinsfile_baseline_capture | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/Jenkinsfile_baseline_capture b/.ci/Jenkinsfile_baseline_capture index 7fefbbb26fd12..b729f5d9da082 100644 --- a/.ci/Jenkinsfile_baseline_capture +++ b/.ci/Jenkinsfile_baseline_capture @@ -36,6 +36,7 @@ kibanaPipeline(timeoutMinutes: 210) { tasks([ kibanaPipeline.functionalTestProcess('oss-baseline', './test/scripts/jenkins_baseline.sh'), kibanaPipeline.functionalTestProcess('xpack-baseline', './test/scripts/jenkins_xpack_baseline.sh'), + kibanaPipeline.scriptTask('Check Public API Docs', 'test/scripts/checks/plugin_public_api_docs.sh'), ]) } } From 9d0b495a30c54b1b5757e6bdb096b78112f843f1 Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 15 Apr 2021 17:13:38 -0700 Subject: [PATCH 44/68] [ci] ship Jest unit test junit with runbld in jest worker (#97197) Co-authored-by: Brian Seeders Co-authored-by: spalger --- vars/kibanaPipeline.groovy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vars/kibanaPipeline.groovy b/vars/kibanaPipeline.groovy index 466a04d9b6b39..b8afdb9cde3ef 100644 --- a/vars/kibanaPipeline.groovy +++ b/vars/kibanaPipeline.groovy @@ -468,7 +468,13 @@ def allCiTasks() { }, jest: { workers.ci(name: 'jest', size: 'n2-standard-16', ramDisk: false) { - scriptTask('Jest Unit Tests', 'test/scripts/test/jest_unit.sh')() + catchErrors { + scriptTask('Jest Unit Tests', 'test/scripts/test/jest_unit.sh')() + } + + catchErrors { + runbld.junit() + } } }, ]) From 6e5c9278baa586e03323a871c45e5ca74d328292 Mon Sep 17 00:00:00 2001 From: John Schulz Date: Thu, 15 Apr 2021 21:01:28 -0400 Subject: [PATCH 45/68] [Fleet] Use 'hosted agent policy' naming in UI & API messages (#97287) ## Summary ### What this PR _does_ change - [x] Replace all UI & API instances of "managed policy" with "hosted agent policy" #93504 - [x] Replace all UI & API instances of "unmanaged policy" with "regular agent policy" #93504 - [x] Update most variable names containing `managed` to `hosted`

screenshots Screen Shot 2021-04-15 at 10 54 01 AM Screen Shot 2021-04-15 at 11 40 47 AM Screen Shot 2021-04-15 at 11 40 59 AM
### What this PR _does not_ change - [ ] The `is_managed` property of the agent policy saved object* - [ ] The updated error messages in https://github.com/elastic/kibana/issues/92591
*why not change the is_managed property?

Changing the property will require a migration from 7.12. That's not a problem, but we haven't decided on a new name/approach yet. Rather than update to is_hosted: boolean now and potentially something like managed_by: enum later, we'll update it when we have a decision.

TL;DR: It's a trivial update to make later and a minuscule amount of debt to pay until then. Less than cost of doing it twice.

### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --- .../agent_policy/details_page/index.tsx | 4 +- .../sections/agents/agent_list_page/index.tsx | 4 +- .../fleet/server/services/agent_policy.ts | 6 +- .../fleet/server/services/agents/crud.ts | 5 +- .../server/services/agents/reassign.test.ts | 85 +++++------ .../fleet/server/services/agents/reassign.ts | 4 +- .../server/services/agents/unenroll.test.ts | 140 ++++++++---------- .../fleet/server/services/agents/unenroll.ts | 2 +- .../fleet/server/services/agents/upgrade.ts | 16 +- .../fleet/server/services/package_policy.ts | 2 +- .../translations/translations/ja-JP.json | 2 +- .../translations/translations/zh-CN.json | 2 +- .../apis/agent_policy/agent_policy.ts | 26 ++-- .../apis/agents/reassign.ts | 16 +- .../apis/agents/unenroll.ts | 20 +-- .../apis/agents/upgrade.ts | 26 ++-- .../apis/package_policy/create.ts | 20 +-- .../apis/package_policy/delete.ts | 12 +- .../apis/package_policy/update.ts | 2 +- 19 files changed, 191 insertions(+), 203 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx index 3e6ca5944c380..65cf62a279a22 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx @@ -106,9 +106,9 @@ export const AgentPolicyDetailsPage: React.FunctionComponent = () => { {agentPolicy?.is_managed && ( = () => { if (!agent.policy_id) return true; const agentPolicy = agentPoliciesIndexedById[agent.policy_id]; - const isManaged = agentPolicy?.is_managed === true; - return !isManaged; + const isHosted = agentPolicy?.is_managed === true; + return !isHosted; }; const columns = [ diff --git a/x-pack/plugins/fleet/server/services/agent_policy.ts b/x-pack/plugins/fleet/server/services/agent_policy.ts index e398eb4527f52..6237951805547 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.ts @@ -476,7 +476,7 @@ class AgentPolicyService { } if (oldAgentPolicy.is_managed && !options?.force) { - throw new IngestManagerError(`Cannot update integrations of managed policy ${id}`); + throw new IngestManagerError(`Cannot update integrations of hosted agent policy ${id}`); } return await this._update( @@ -507,7 +507,7 @@ class AgentPolicyService { } if (oldAgentPolicy.is_managed && !options?.force) { - throw new IngestManagerError(`Cannot remove integrations of managed policy ${id}`); + throw new IngestManagerError(`Cannot remove integrations of hosted agent policy ${id}`); } return await this._update( @@ -550,7 +550,7 @@ class AgentPolicyService { } if (agentPolicy.is_managed) { - throw new AgentPolicyDeletionError(`Cannot delete managed policy ${id}`); + throw new AgentPolicyDeletionError(`Cannot delete hosted agent policy ${id}`); } const { diff --git a/x-pack/plugins/fleet/server/services/agents/crud.ts b/x-pack/plugins/fleet/server/services/agents/crud.ts index a23efa1e50fc0..b8ce7c36e507f 100644 --- a/x-pack/plugins/fleet/server/services/agents/crud.ts +++ b/x-pack/plugins/fleet/server/services/agents/crud.ts @@ -255,9 +255,10 @@ export async function getAgentByAccessAPIKeyId( q: `access_api_key_id:${escapeSearchQueryPhrase(accessAPIKeyId)}`, }); - const agent = searchHitToAgent(res.body.hits.hits[0]); + const searchHit = res.body.hits.hits[0]; + const agent = searchHit && searchHitToAgent(searchHit); - if (!agent) { + if (!searchHit || !agent) { throw new AgentNotFoundError('Agent not found'); } if (agent.access_api_key_id !== accessAPIKeyId) { diff --git a/x-pack/plugins/fleet/server/services/agents/reassign.test.ts b/x-pack/plugins/fleet/server/services/agents/reassign.test.ts index f040ba57c38be..4dfc29df8c398 100644 --- a/x-pack/plugins/fleet/server/services/agents/reassign.test.ts +++ b/x-pack/plugins/fleet/server/services/agents/reassign.test.ts @@ -13,63 +13,63 @@ import { AgentReassignmentError } from '../../errors'; import { reassignAgent, reassignAgents } from './reassign'; -const agentInManagedDoc = { - _id: 'agent-in-managed-policy', - _source: { policy_id: 'managed-agent-policy' }, +const agentInHostedDoc = { + _id: 'agent-in-hosted-policy', + _source: { policy_id: 'hosted-agent-policy' }, }; -const agentInManagedDoc2 = { - _id: 'agent-in-managed-policy2', - _source: { policy_id: 'managed-agent-policy' }, +const agentInHostedDoc2 = { + _id: 'agent-in-hosted-policy2', + _source: { policy_id: 'hosted-agent-policy' }, }; -const agentInUnmanagedDoc = { - _id: 'agent-in-unmanaged-policy', - _source: { policy_id: 'unmanaged-agent-policy' }, +const agentInRegularDoc = { + _id: 'agent-in-regular-policy', + _source: { policy_id: 'regular-agent-policy' }, }; -const unmanagedAgentPolicySO = { - id: 'unmanaged-agent-policy', +const regularAgentPolicySO = { + id: 'regular-agent-policy', attributes: { is_managed: false }, } as SavedObject; -const unmanagedAgentPolicySO2 = { - id: 'unmanaged-agent-policy-2', +const regularAgentPolicySO2 = { + id: 'regular-agent-policy-2', attributes: { is_managed: false }, } as SavedObject; -const managedAgentPolicySO = { - id: 'managed-agent-policy', +const hostedAgentPolicySO = { + id: 'hosted-agent-policy', attributes: { is_managed: true }, } as SavedObject; describe('reassignAgent (singular)', () => { - it('can reassign from unmanaged policy to unmanaged', async () => { + it('can reassign from regular agent policy to regular', async () => { const { soClient, esClient } = createClientsMock(); - await reassignAgent(soClient, esClient, agentInUnmanagedDoc._id, unmanagedAgentPolicySO.id); + await reassignAgent(soClient, esClient, agentInRegularDoc._id, regularAgentPolicySO.id); // calls ES update with correct values expect(esClient.update).toBeCalledTimes(1); const calledWith = esClient.update.mock.calls[0]; - expect(calledWith[0]?.id).toBe(agentInUnmanagedDoc._id); - expect(calledWith[0]?.body?.doc).toHaveProperty('policy_id', unmanagedAgentPolicySO.id); + expect(calledWith[0]?.id).toBe(agentInRegularDoc._id); + expect(calledWith[0]?.body?.doc).toHaveProperty('policy_id', regularAgentPolicySO.id); }); - it('cannot reassign from unmanaged policy to managed', async () => { + it('cannot reassign from regular agent policy to hosted', async () => { const { soClient, esClient } = createClientsMock(); await expect( - reassignAgent(soClient, esClient, agentInUnmanagedDoc._id, managedAgentPolicySO.id) + reassignAgent(soClient, esClient, agentInRegularDoc._id, hostedAgentPolicySO.id) ).rejects.toThrowError(AgentReassignmentError); // does not call ES update expect(esClient.update).toBeCalledTimes(0); }); - it('cannot reassign from managed policy', async () => { + it('cannot reassign from hosted agent policy', async () => { const { soClient, esClient } = createClientsMock(); await expect( - reassignAgent(soClient, esClient, agentInManagedDoc._id, unmanagedAgentPolicySO.id) + reassignAgent(soClient, esClient, agentInHostedDoc._id, regularAgentPolicySO.id) ).rejects.toThrowError(AgentReassignmentError); // does not call ES update expect(esClient.update).toBeCalledTimes(0); await expect( - reassignAgent(soClient, esClient, agentInManagedDoc._id, managedAgentPolicySO.id) + reassignAgent(soClient, esClient, agentInHostedDoc._id, hostedAgentPolicySO.id) ).rejects.toThrowError(AgentReassignmentError); // does not call ES update expect(esClient.update).toBeCalledTimes(0); @@ -77,22 +77,17 @@ describe('reassignAgent (singular)', () => { }); describe('reassignAgents (plural)', () => { - it('agents in managed policies are not updated', async () => { + it('agents in hosted policies are not updated', async () => { const { soClient, esClient } = createClientsMock(); - const idsToReassign = [agentInUnmanagedDoc._id, agentInManagedDoc._id, agentInManagedDoc2._id]; - await reassignAgents( - soClient, - esClient, - { agentIds: idsToReassign }, - unmanagedAgentPolicySO2.id - ); + const idsToReassign = [agentInRegularDoc._id, agentInHostedDoc._id, agentInHostedDoc2._id]; + await reassignAgents(soClient, esClient, { agentIds: idsToReassign }, regularAgentPolicySO2.id); // calls ES update with correct values const calledWith = esClient.bulk.mock.calls[0][0]; - // only 1 are unmanaged and bulk write two line per update + // only 1 are regular and bulk write two line per update expect(calledWith.body.length).toBe(2); // @ts-expect-error - expect(calledWith.body[0].update._id).toEqual(agentInUnmanagedDoc._id); + expect(calledWith.body[0].update._id).toEqual(agentInRegularDoc._id); }); }); @@ -112,12 +107,12 @@ function createClientsMock() { }); soClientMock.get.mockImplementation(async (_, id) => { switch (id) { - case unmanagedAgentPolicySO.id: - return unmanagedAgentPolicySO; - case managedAgentPolicySO.id: - return managedAgentPolicySO; - case unmanagedAgentPolicySO2.id: - return unmanagedAgentPolicySO2; + case regularAgentPolicySO.id: + return regularAgentPolicySO; + case hostedAgentPolicySO.id: + return hostedAgentPolicySO; + case regularAgentPolicySO2.id: + return regularAgentPolicySO2; default: throw new Error(`${id} not found`); } @@ -133,17 +128,17 @@ function createClientsMock() { esClientMock.mget.mockImplementation(async () => { return { body: { - docs: [agentInManagedDoc, agentInUnmanagedDoc, agentInManagedDoc2], + docs: [agentInHostedDoc, agentInRegularDoc, agentInHostedDoc2], }, }; }); // @ts-expect-error esClientMock.get.mockImplementation(async ({ id }) => { switch (id) { - case agentInManagedDoc._id: - return { body: agentInManagedDoc }; - case agentInUnmanagedDoc._id: - return { body: agentInUnmanagedDoc }; + case agentInHostedDoc._id: + return { body: agentInHostedDoc }; + case agentInRegularDoc._id: + return { body: agentInRegularDoc }; default: throw new Error(`${id} not found`); } diff --git a/x-pack/plugins/fleet/server/services/agents/reassign.ts b/x-pack/plugins/fleet/server/services/agents/reassign.ts index 2d94e8b9e9247..4c95d19e2f13a 100644 --- a/x-pack/plugins/fleet/server/services/agents/reassign.ts +++ b/x-pack/plugins/fleet/server/services/agents/reassign.ts @@ -57,14 +57,14 @@ export async function reassignAgentIsAllowed( const agentPolicy = await getAgentPolicyForAgent(soClient, esClient, agentId); if (agentPolicy?.is_managed) { throw new AgentReassignmentError( - `Cannot reassign an agent from managed agent policy ${agentPolicy.id}` + `Cannot reassign an agent from hosted agent policy ${agentPolicy.id}` ); } const newAgentPolicy = await agentPolicyService.get(soClient, newAgentPolicyId); if (newAgentPolicy?.is_managed) { throw new AgentReassignmentError( - `Cannot reassign an agent to managed agent policy ${newAgentPolicy.id}` + `Cannot reassign an agent to hosted agent policy ${newAgentPolicy.id}` ); } diff --git a/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts b/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts index 938ece1364b40..24a3dea3bcb91 100644 --- a/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts +++ b/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts @@ -13,82 +13,82 @@ import { AgentUnenrollmentError } from '../../errors'; import { unenrollAgent, unenrollAgents } from './unenroll'; -const agentInManagedDoc = { - _id: 'agent-in-managed-policy', - _source: { policy_id: 'managed-agent-policy' }, +const agentInHostedDoc = { + _id: 'agent-in-hosted-policy', + _source: { policy_id: 'hosted-agent-policy' }, }; -const agentInUnmanagedDoc = { - _id: 'agent-in-unmanaged-policy', - _source: { policy_id: 'unmanaged-agent-policy' }, +const agentInRegularDoc = { + _id: 'agent-in-regular-policy', + _source: { policy_id: 'regular-agent-policy' }, }; -const agentInUnmanagedDoc2 = { - _id: 'agent-in-unmanaged-policy2', - _source: { policy_id: 'unmanaged-agent-policy' }, +const agentInRegularDoc2 = { + _id: 'agent-in-regular-policy2', + _source: { policy_id: 'regular-agent-policy' }, }; -const unmanagedAgentPolicySO = { - id: 'unmanaged-agent-policy', +const regularAgentPolicySO = { + id: 'regular-agent-policy', attributes: { is_managed: false }, } as SavedObject; -const managedAgentPolicySO = { - id: 'managed-agent-policy', +const hostedAgentPolicySO = { + id: 'hosted-agent-policy', attributes: { is_managed: true }, } as SavedObject; describe('unenrollAgent (singular)', () => { - it('can unenroll from unmanaged policy', async () => { + it('can unenroll from regular agent policy', async () => { const { soClient, esClient } = createClientMock(); - await unenrollAgent(soClient, esClient, agentInUnmanagedDoc._id); + await unenrollAgent(soClient, esClient, agentInRegularDoc._id); // calls ES update with correct values expect(esClient.update).toBeCalledTimes(1); const calledWith = esClient.update.mock.calls[0]; - expect(calledWith[0]?.id).toBe(agentInUnmanagedDoc._id); + expect(calledWith[0]?.id).toBe(agentInRegularDoc._id); expect(calledWith[0]?.body).toHaveProperty('doc.unenrollment_started_at'); }); - it('cannot unenroll from managed policy by default', async () => { + it('cannot unenroll from hosted agent policy by default', async () => { const { soClient, esClient } = createClientMock(); - await expect(unenrollAgent(soClient, esClient, agentInManagedDoc._id)).rejects.toThrowError( + await expect(unenrollAgent(soClient, esClient, agentInHostedDoc._id)).rejects.toThrowError( AgentUnenrollmentError ); // does not call ES update expect(esClient.update).toBeCalledTimes(0); }); - it('cannot unenroll from managed policy with revoke=true', async () => { + it('cannot unenroll from hosted agent policy with revoke=true', async () => { const { soClient, esClient } = createClientMock(); await expect( - unenrollAgent(soClient, esClient, agentInManagedDoc._id, { revoke: true }) + unenrollAgent(soClient, esClient, agentInHostedDoc._id, { revoke: true }) ).rejects.toThrowError(AgentUnenrollmentError); // does not call ES update expect(esClient.update).toBeCalledTimes(0); }); - it('can unenroll from managed policy with force=true', async () => { + it('can unenroll from hosted agent policy with force=true', async () => { const { soClient, esClient } = createClientMock(); - await unenrollAgent(soClient, esClient, agentInManagedDoc._id, { force: true }); + await unenrollAgent(soClient, esClient, agentInHostedDoc._id, { force: true }); // calls ES update with correct values expect(esClient.update).toBeCalledTimes(1); const calledWith = esClient.update.mock.calls[0]; - expect(calledWith[0]?.id).toBe(agentInManagedDoc._id); + expect(calledWith[0]?.id).toBe(agentInHostedDoc._id); expect(calledWith[0]?.body).toHaveProperty('doc.unenrollment_started_at'); }); - it('can unenroll from managed policy with force=true and revoke=true', async () => { + it('can unenroll from hosted agent policy with force=true and revoke=true', async () => { const { soClient, esClient } = createClientMock(); - await unenrollAgent(soClient, esClient, agentInManagedDoc._id, { force: true, revoke: true }); + await unenrollAgent(soClient, esClient, agentInHostedDoc._id, { force: true, revoke: true }); // calls ES update with correct values expect(esClient.update).toBeCalledTimes(1); const calledWith = esClient.update.mock.calls[0]; - expect(calledWith[0]?.id).toBe(agentInManagedDoc._id); + expect(calledWith[0]?.id).toBe(agentInHostedDoc._id); expect(calledWith[0]?.body).toHaveProperty('doc.unenrolled_at'); }); }); describe('unenrollAgents (plural)', () => { - it('can unenroll from an unmanaged policy', async () => { + it('can unenroll from an regular agent policy', async () => { const { soClient, esClient } = createClientMock(); - const idsToUnenroll = [agentInUnmanagedDoc._id, agentInUnmanagedDoc2._id]; + const idsToUnenroll = [agentInRegularDoc._id, agentInRegularDoc2._id]; await unenrollAgents(soClient, esClient, { agentIds: idsToUnenroll }); // calls ES update with correct values @@ -102,37 +102,29 @@ describe('unenrollAgents (plural)', () => { expect(doc).toHaveProperty('unenrollment_started_at'); } }); - it('cannot unenroll from a managed policy by default', async () => { + it('cannot unenroll from a hosted agent policy by default', async () => { const { soClient, esClient } = createClientMock(); - const idsToUnenroll = [ - agentInUnmanagedDoc._id, - agentInManagedDoc._id, - agentInUnmanagedDoc2._id, - ]; + const idsToUnenroll = [agentInRegularDoc._id, agentInHostedDoc._id, agentInRegularDoc2._id]; await unenrollAgents(soClient, esClient, { agentIds: idsToUnenroll }); // calls ES update with correct values - const onlyUnmanaged = [agentInUnmanagedDoc._id, agentInUnmanagedDoc2._id]; + const onlyRegular = [agentInRegularDoc._id, agentInRegularDoc2._id]; const calledWith = esClient.bulk.mock.calls[1][0]; const ids = calledWith?.body .filter((i: any) => i.update !== undefined) .map((i: any) => i.update._id); const docs = calledWith?.body.filter((i: any) => i.doc).map((i: any) => i.doc); - expect(ids).toEqual(onlyUnmanaged); + expect(ids).toEqual(onlyRegular); for (const doc of docs) { expect(doc).toHaveProperty('unenrollment_started_at'); } }); - it('cannot unenroll from a managed policy with revoke=true', async () => { + it('cannot unenroll from a hosted agent policy with revoke=true', async () => { const { soClient, esClient } = createClientMock(); - const idsToUnenroll = [ - agentInUnmanagedDoc._id, - agentInManagedDoc._id, - agentInUnmanagedDoc2._id, - ]; + const idsToUnenroll = [agentInRegularDoc._id, agentInHostedDoc._id, agentInRegularDoc2._id]; const unenrolledResponse = await unenrollAgents(soClient, esClient, { agentIds: idsToUnenroll, @@ -141,39 +133,35 @@ describe('unenrollAgents (plural)', () => { expect(unenrolledResponse.items).toMatchObject([ { - id: 'agent-in-unmanaged-policy', + id: 'agent-in-regular-policy', success: true, }, { - id: 'agent-in-managed-policy', + id: 'agent-in-hosted-policy', success: false, }, { - id: 'agent-in-unmanaged-policy2', + id: 'agent-in-regular-policy2', success: true, }, ]); // calls ES update with correct values - const onlyUnmanaged = [agentInUnmanagedDoc._id, agentInUnmanagedDoc2._id]; + const onlyRegular = [agentInRegularDoc._id, agentInRegularDoc2._id]; const calledWith = esClient.bulk.mock.calls[0][0]; const ids = calledWith?.body .filter((i: any) => i.update !== undefined) .map((i: any) => i.update._id); const docs = calledWith?.body.filter((i: any) => i.doc).map((i: any) => i.doc); - expect(ids).toEqual(onlyUnmanaged); + expect(ids).toEqual(onlyRegular); for (const doc of docs) { expect(doc).toHaveProperty('unenrolled_at'); } }); - it('can unenroll from managed policy with force=true', async () => { + it('can unenroll from hosted agent policy with force=true', async () => { const { soClient, esClient } = createClientMock(); - const idsToUnenroll = [ - agentInUnmanagedDoc._id, - agentInManagedDoc._id, - agentInUnmanagedDoc2._id, - ]; + const idsToUnenroll = [agentInRegularDoc._id, agentInHostedDoc._id, agentInRegularDoc2._id]; await unenrollAgents(soClient, esClient, { agentIds: idsToUnenroll, force: true }); // calls ES update with correct values @@ -188,14 +176,10 @@ describe('unenrollAgents (plural)', () => { } }); - it('can unenroll from managed policy with force=true and revoke=true', async () => { + it('can unenroll from hosted agent policy with force=true and revoke=true', async () => { const { soClient, esClient } = createClientMock(); - const idsToUnenroll = [ - agentInUnmanagedDoc._id, - agentInManagedDoc._id, - agentInUnmanagedDoc2._id, - ]; + const idsToUnenroll = [agentInRegularDoc._id, agentInHostedDoc._id, agentInRegularDoc2._id]; const unenrolledResponse = await unenrollAgents(soClient, esClient, { agentIds: idsToUnenroll, @@ -205,15 +189,15 @@ describe('unenrollAgents (plural)', () => { expect(unenrolledResponse.items).toMatchObject([ { - id: 'agent-in-unmanaged-policy', + id: 'agent-in-regular-policy', success: true, }, { - id: 'agent-in-managed-policy', + id: 'agent-in-hosted-policy', success: true, }, { - id: 'agent-in-unmanaged-policy2', + id: 'agent-in-regular-policy2', success: true, }, ]); @@ -248,10 +232,10 @@ function createClientMock() { soClientMock.get.mockImplementation(async (_, id) => { switch (id) { - case unmanagedAgentPolicySO.id: - return unmanagedAgentPolicySO; - case managedAgentPolicySO.id: - return managedAgentPolicySO; + case regularAgentPolicySO.id: + return regularAgentPolicySO; + case hostedAgentPolicySO.id: + return hostedAgentPolicySO; default: throw new Error('not found'); } @@ -267,12 +251,12 @@ function createClientMock() { // @ts-expect-error esClientMock.get.mockImplementation(async ({ id }) => { switch (id) { - case agentInManagedDoc._id: - return { body: agentInManagedDoc }; - case agentInUnmanagedDoc2._id: - return { body: agentInUnmanagedDoc2 }; - case agentInUnmanagedDoc._id: - return { body: agentInUnmanagedDoc }; + case agentInHostedDoc._id: + return { body: agentInHostedDoc }; + case agentInRegularDoc2._id: + return { body: agentInRegularDoc2 }; + case agentInRegularDoc._id: + return { body: agentInRegularDoc }; default: throw new Error('not found'); } @@ -287,12 +271,12 @@ function createClientMock() { // @ts-expect-error const docs = params?.body.docs.map(({ _id }) => { switch (_id) { - case agentInManagedDoc._id: - return agentInManagedDoc; - case agentInUnmanagedDoc2._id: - return agentInUnmanagedDoc2; - case agentInUnmanagedDoc._id: - return agentInUnmanagedDoc; + case agentInHostedDoc._id: + return agentInHostedDoc; + case agentInRegularDoc2._id: + return agentInRegularDoc2; + case agentInRegularDoc._id: + return agentInRegularDoc; default: throw new Error('not found'); } diff --git a/x-pack/plugins/fleet/server/services/agents/unenroll.ts b/x-pack/plugins/fleet/server/services/agents/unenroll.ts index c97dc128de591..fc1f80fe7521b 100644 --- a/x-pack/plugins/fleet/server/services/agents/unenroll.ts +++ b/x-pack/plugins/fleet/server/services/agents/unenroll.ts @@ -29,7 +29,7 @@ async function unenrollAgentIsAllowed( const agentPolicy = await getAgentPolicyForAgent(soClient, esClient, agentId); if (agentPolicy?.is_managed) { throw new AgentUnenrollmentError( - `Cannot unenroll ${agentId} from a managed agent policy ${agentPolicy.id}` + `Cannot unenroll ${agentId} from a hosted agent policy ${agentPolicy.id}` ); } diff --git a/x-pack/plugins/fleet/server/services/agents/upgrade.ts b/x-pack/plugins/fleet/server/services/agents/upgrade.ts index c791a5b7c10ce..61e785828bf23 100644 --- a/x-pack/plugins/fleet/server/services/agents/upgrade.ts +++ b/x-pack/plugins/fleet/server/services/agents/upgrade.ts @@ -47,7 +47,7 @@ export async function sendUpgradeAgentAction({ const agentPolicy = await getAgentPolicyForAgent(soClient, esClient, agentId); if (agentPolicy?.is_managed) { throw new IngestManagerError( - `Cannot upgrade agent ${agentId} in managed policy ${agentPolicy.id}` + `Cannot upgrade agent ${agentId} in hosted agent policy ${agentPolicy.id}` ); } @@ -119,17 +119,17 @@ export async function sendUpgradeAgentsActions( const agentPolicies = await agentPolicyService.getByIDs(soClient, Array.from(policyIdsToGet), { fields: ['is_managed'], }); - const managedPolicies = agentPolicies.reduce>((acc, policy) => { + const hostedPolicies = agentPolicies.reduce>((acc, policy) => { acc[policy.id] = policy.is_managed; return acc; }, {}); - const isManagedAgent = (agent: Agent) => agent.policy_id && managedPolicies[agent.policy_id]; + const isHostedAgent = (agent: Agent) => agent.policy_id && hostedPolicies[agent.policy_id]; - // results from getAgents with options.kuery '' (or even 'active:false') may include managed agents + // results from getAgents with options.kuery '' (or even 'active:false') may include hosted agents // filter them out unless options.force const agentsToCheckUpgradeable = 'kuery' in options && !options.force - ? givenAgents.filter((agent: Agent) => !isManagedAgent(agent)) + ? givenAgents.filter((agent: Agent) => !isHostedAgent(agent)) : givenAgents; const kibanaVersion = appContextService.getKibanaVersion(); @@ -141,8 +141,10 @@ export async function sendUpgradeAgentsActions( throw new IngestManagerError(`${agent.id} is not upgradeable`); } - if (!options.force && isManagedAgent(agent)) { - throw new IngestManagerError(`Cannot upgrade agent in managed policy ${agent.policy_id}`); + if (!options.force && isHostedAgent(agent)) { + throw new IngestManagerError( + `Cannot upgrade agent in hosted agent policy ${agent.policy_id}` + ); } return agent; }) diff --git a/x-pack/plugins/fleet/server/services/package_policy.ts b/x-pack/plugins/fleet/server/services/package_policy.ts index 0857338469794..7c009299a3de3 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.ts @@ -76,7 +76,7 @@ class PackagePolicyService { } if (parentAgentPolicy.is_managed && !options?.force) { throw new IngestManagerError( - `Cannot add integrations to managed policy ${parentAgentPolicy.id}` + `Cannot add integrations to hosted agent policy ${parentAgentPolicy.id}` ); } if ( diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index f5b685a609b49..29f162a005a98 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -23479,4 +23479,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "フィールドを選択してください。", "xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。" } -} \ No newline at end of file +} diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 88639fa7246c0..0553e3c195532 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -23847,4 +23847,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "此字段必填。", "xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。" } -} \ No newline at end of file +} diff --git a/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts b/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts index 8dcc3049ccd3a..779c4d767c000 100644 --- a/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts +++ b/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts @@ -327,37 +327,37 @@ export default function ({ getService }: FtrProviderContext) { after(async () => { await esArchiver.unload('fleet/empty_fleet_server'); }); - let managedPolicy: any | undefined; - it('should prevent managed policies being deleted', async () => { + let hostedPolicy: any | undefined; + it('should prevent hosted policies being deleted', async () => { const { body: { item: createdPolicy }, } = await supertest .post(`/api/fleet/agent_policies`) .set('kbn-xsrf', 'xxxx') .send({ - name: 'Managed policy', + name: 'Hosted policy', namespace: 'default', is_managed: true, }) .expect(200); - managedPolicy = createdPolicy; + hostedPolicy = createdPolicy; const { body } = await supertest .post('/api/fleet/agent_policies/delete') .set('kbn-xsrf', 'xxx') - .send({ agentPolicyId: managedPolicy.id }) + .send({ agentPolicyId: hostedPolicy.id }) .expect(400); - expect(body.message).to.contain('Cannot delete managed policy'); + expect(body.message).to.contain('Cannot delete hosted agent policy'); }); - it('should allow unmanaged policies being deleted', async () => { + it('should allow regular policies being deleted', async () => { const { - body: { item: unmanagedPolicy }, + body: { item: regularPolicy }, } = await supertest - .put(`/api/fleet/agent_policies/${managedPolicy.id}`) + .put(`/api/fleet/agent_policies/${hostedPolicy.id}`) .set('kbn-xsrf', 'xxxx') .send({ - name: 'Unmanaged policy', + name: 'Regular policy', namespace: 'default', is_managed: false, }) @@ -366,11 +366,11 @@ export default function ({ getService }: FtrProviderContext) { const { body } = await supertest .post('/api/fleet/agent_policies/delete') .set('kbn-xsrf', 'xxx') - .send({ agentPolicyId: unmanagedPolicy.id }); + .send({ agentPolicyId: regularPolicy.id }); expect(body).to.eql({ - id: unmanagedPolicy.id, - name: 'Unmanaged policy', + id: regularPolicy.id, + name: 'Regular policy', }); }); }); diff --git a/x-pack/test/fleet_api_integration/apis/agents/reassign.ts b/x-pack/test/fleet_api_integration/apis/agents/reassign.ts index 47bafd57ea3ad..ad3c224bb9236 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/reassign.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/reassign.ts @@ -55,8 +55,8 @@ export default function (providerContext: FtrProviderContext) { .expect(404); }); - it('can reassign from unmanaged policy to unmanaged', async () => { - // policy2 is not managed + it('can reassign from regular agent policy to regular', async () => { + // policy2 is not hosted // reassign succeeds await supertest .put(`/api/fleet/agents/agent1/reassign`) @@ -67,8 +67,8 @@ export default function (providerContext: FtrProviderContext) { .expect(200); }); - it('cannot reassign from unmanaged policy to managed', async () => { - // agent1 is enrolled in policy1. set policy1 to managed + it('cannot reassign from regular agent policy to hosted', async () => { + // agent1 is enrolled in policy1. set policy1 to hosted await supertest .put(`/api/fleet/agent_policies/policy1`) .set('kbn-xsrf', 'xxx') @@ -138,8 +138,8 @@ export default function (providerContext: FtrProviderContext) { expect(agent3data.body.item.policy_id).to.eql('policy2'); }); - it('should allow to reassign multiple agents by id -- mixed invalid, managed, etc', async () => { - // agent1 is enrolled in policy1. set policy1 to managed + it('should allow to reassign multiple agents by id -- mixed invalid, hosted, etc', async () => { + // agent1 is enrolled in policy1. set policy1 to hosted await supertest .put(`/api/fleet/agent_policies/policy1`) .set('kbn-xsrf', 'xxx') @@ -157,7 +157,7 @@ export default function (providerContext: FtrProviderContext) { expect(body).to.eql({ agent2: { success: false, - error: 'Cannot reassign an agent from managed agent policy policy1', + error: 'Cannot reassign an agent from hosted agent policy policy1', }, INVALID_ID: { success: false, @@ -165,7 +165,7 @@ export default function (providerContext: FtrProviderContext) { }, agent3: { success: false, - error: 'Cannot reassign an agent from managed agent policy policy1', + error: 'Cannot reassign an agent from hosted agent policy policy1', }, }); diff --git a/x-pack/test/fleet_api_integration/apis/agents/unenroll.ts b/x-pack/test/fleet_api_integration/apis/agents/unenroll.ts index 60a588090048a..f0e41d75136c3 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/unenroll.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/unenroll.ts @@ -74,8 +74,8 @@ export default function (providerContext: FtrProviderContext) { await esArchiver.unload('fleet/empty_fleet_server'); }); - it('/agents/{agent_id}/unenroll should fail for managed policy', async () => { - // set policy to managed + it('/agents/{agent_id}/unenroll should fail for hosted agent policy', async () => { + // set policy to hosted await supertest .put(`/api/fleet/agent_policies/policy1`) .set('kbn-xsrf', 'xxx') @@ -85,8 +85,8 @@ export default function (providerContext: FtrProviderContext) { await supertest.post(`/api/fleet/agents/agent1/unenroll`).set('kbn-xsrf', 'xxx').expect(400); }); - it('/agents/{agent_id}/unenroll should allow from unmanaged policy', async () => { - // set policy to unmanaged + it('/agents/{agent_id}/unenroll should allow from regular agent policy', async () => { + // set policy to regular await supertest .put(`/api/fleet/agent_policies/policy1`) .set('kbn-xsrf', 'xxx') @@ -117,8 +117,8 @@ export default function (providerContext: FtrProviderContext) { expect(outputAPIKeys[0].invalidated).eql(true); }); - it('/agents/bulk_unenroll should not allow unenroll from managed policy', async () => { - // set policy to managed + it('/agents/bulk_unenroll should not allow unenroll from hosted agent policy', async () => { + // set policy to hosted await supertest .put(`/api/fleet/agent_policies/policy1`) .set('kbn-xsrf', 'xxx') @@ -138,11 +138,11 @@ export default function (providerContext: FtrProviderContext) { expect(unenrolledBody).to.eql({ agent2: { success: false, - error: 'Cannot unenroll agent2 from a managed agent policy policy1', + error: 'Cannot unenroll agent2 from a hosted agent policy policy1', }, agent3: { success: false, - error: 'Cannot unenroll agent3 from a managed agent policy policy1', + error: 'Cannot unenroll agent3 from a hosted agent policy policy1', }, }); // but agents are still enrolled @@ -158,8 +158,8 @@ export default function (providerContext: FtrProviderContext) { expect(agent2data.body.item.active).to.eql(true); }); - it('/agents/bulk_unenroll should allow to unenroll multiple agents by id from an unmanaged policy', async () => { - // set policy to unmanaged + it('/agents/bulk_unenroll should allow to unenroll multiple agents by id from an regular agent policy', async () => { + // set policy to regular await supertest .put(`/api/fleet/agent_policies/policy1`) .set('kbn-xsrf', 'xxx') diff --git a/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts b/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts index 545399134c79d..142c360e9232a 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts @@ -210,8 +210,8 @@ export default function (providerContext: FtrProviderContext) { expect(res.body.message).to.equal('agent agent1 is not upgradeable'); }); - it('enrolled in a managed policy should respond 400 to upgrade and not update the agent SOs', async () => { - // update enrolled policy to managed + it('enrolled in a hosted agent policy should respond 400 to upgrade and not update the agent SOs', async () => { + // update enrolled policy to hosted await supertest.put(`/api/fleet/agent_policies/policy1`).set('kbn-xsrf', 'xxxx').send({ name: 'Test policy', namespace: 'default', @@ -229,13 +229,15 @@ export default function (providerContext: FtrProviderContext) { }, }, }); - // attempt to upgrade agent in managed policy + // attempt to upgrade agent in hosted agent policy const { body } = await supertest .post(`/api/fleet/agents/agent1/upgrade`) .set('kbn-xsrf', 'xxx') .send({ version: kibanaVersion }) .expect(400); - expect(body.message).to.contain('Cannot upgrade agent agent1 in managed policy policy1'); + expect(body.message).to.contain( + 'Cannot upgrade agent agent1 in hosted agent policy policy1' + ); const agent1data = await supertest.get(`/api/fleet/agents/agent1`); expect(typeof agent1data.body.item.upgrade_started_at).to.be('undefined'); @@ -543,12 +545,12 @@ export default function (providerContext: FtrProviderContext) { .expect(400); }); - it('enrolled in a managed policy bulk upgrade should respond with 200 and object of results. Should not update the managed agent SOs', async () => { - // move agent2 to policy2 to keep it unmanaged + it('enrolled in a hosted agent policy bulk upgrade should respond with 200 and object of results. Should not update the hosted agent SOs', async () => { + // move agent2 to policy2 to keep it regular await supertest.put(`/api/fleet/agents/agent2/reassign`).set('kbn-xsrf', 'xxx').send({ policy_id: 'policy2', }); - // update enrolled policy to managed + // update enrolled policy to hosted await supertest.put(`/api/fleet/agent_policies/policy1`).set('kbn-xsrf', 'xxxx').send({ name: 'Test policy', namespace: 'default', @@ -580,7 +582,7 @@ export default function (providerContext: FtrProviderContext) { }, }, }); - // attempt to upgrade agent in managed policy + // attempt to upgrade agent in hosted agent policy const { body } = await supertest .post(`/api/fleet/agents/bulk_upgrade`) .set('kbn-xsrf', 'xxx') @@ -591,7 +593,7 @@ export default function (providerContext: FtrProviderContext) { .expect(200); expect(body).to.eql({ - agent1: { success: false, error: 'Cannot upgrade agent in managed policy policy1' }, + agent1: { success: false, error: 'Cannot upgrade agent in hosted agent policy policy1' }, agent2: { success: true }, }); @@ -604,8 +606,8 @@ export default function (providerContext: FtrProviderContext) { expect(typeof agent2data.body.item.upgrade_started_at).to.be('string'); }); - it('enrolled in a managed policy bulk upgrade with force flag should respond with 200 and update the agent SOs', async () => { - // update enrolled policy to managed + it('enrolled in a hosted agent policy bulk upgrade with force flag should respond with 200 and update the agent SOs', async () => { + // update enrolled policy to hosted await supertest.put(`/api/fleet/agent_policies/policy1`).set('kbn-xsrf', 'xxxx').send({ name: 'Test policy', namespace: 'default', @@ -637,7 +639,7 @@ export default function (providerContext: FtrProviderContext) { }, }, }); - // attempt to upgrade agent in managed policy + // attempt to upgrade agent in hosted agent policy const { body } = await supertest .post(`/api/fleet/agents/bulk_upgrade`) .set('kbn-xsrf', 'xxx') diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/create.ts b/x-pack/test/fleet_api_integration/apis/package_policy/create.ts index e2e1cc2f584bb..27c5328b3ab08 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/create.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/create.ts @@ -46,20 +46,20 @@ export default function (providerContext: FtrProviderContext) { .send({ agentPolicyId }); }); - it('can only add to managed agent policies using the force parameter', async function () { - // get a managed policy + it('can only add to hosted agent policies using the force parameter', async function () { + // get a hosted policy const { - body: { item: managedPolicy }, + body: { item: hostedPolicy }, } = await supertest .post(`/api/fleet/agent_policies`) .set('kbn-xsrf', 'xxxx') .send({ - name: `Managed policy from ${Date.now()}`, + name: `Hosted policy from ${Date.now()}`, namespace: 'default', is_managed: true, }); - // try to add an integration to the managed policy + // try to add an integration to the hosted policy const { body: responseWithoutForce } = await supertest .post(`/api/fleet/package_policies`) .set('kbn-xsrf', 'xxxx') @@ -67,7 +67,7 @@ export default function (providerContext: FtrProviderContext) { name: 'filetest-1', description: '', namespace: 'default', - policy_id: managedPolicy.id, + policy_id: hostedPolicy.id, enabled: true, output_id: '', inputs: [], @@ -80,7 +80,9 @@ export default function (providerContext: FtrProviderContext) { .expect(400); expect(responseWithoutForce.statusCode).to.be(400); - expect(responseWithoutForce.message).to.contain('Cannot add integrations to managed policy'); + expect(responseWithoutForce.message).to.contain( + 'Cannot add integrations to hosted agent policy' + ); // try same request with `force: true` const { body: responseWithForce } = await supertest @@ -91,7 +93,7 @@ export default function (providerContext: FtrProviderContext) { name: 'filetest-1', description: '', namespace: 'default', - policy_id: managedPolicy.id, + policy_id: hostedPolicy.id, enabled: true, output_id: '', inputs: [], @@ -107,7 +109,7 @@ export default function (providerContext: FtrProviderContext) { // delete policy we just made await supertest.post(`/api/fleet/agent_policies/delete`).set('kbn-xsrf', 'xxxx').send({ - agentPolicyId: managedPolicy.id, + agentPolicyId: hostedPolicy.id, }); }); diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/delete.ts b/x-pack/test/fleet_api_integration/apis/package_policy/delete.ts index 15aba758c85d0..5889349f57fa0 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/delete.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/delete.ts @@ -87,8 +87,8 @@ export default function (providerContext: FtrProviderContext) { await getService('esArchiver').unload('fleet/empty_fleet_server'); }); - it('should fail on managed agent policies', async function () { - // update existing policy to managed + it('should fail on hosted agent policies', async function () { + // update existing policy to hosted await supertest .put(`/api/fleet/agent_policies/${agentPolicy.id}`) .set('kbn-xsrf', 'xxxx') @@ -110,7 +110,9 @@ export default function (providerContext: FtrProviderContext) { expect(Array.isArray(results)); expect(results.length).to.be(1); expect(results[0].success).to.be(false); - expect(results[0].body.message).to.contain('Cannot remove integrations of managed policy'); + expect(results[0].body.message).to.contain( + 'Cannot remove integrations of hosted agent policy' + ); // same, but with force const { body: resultsWithForce } = await supertest @@ -124,7 +126,7 @@ export default function (providerContext: FtrProviderContext) { expect(resultsWithForce.length).to.be(1); expect(resultsWithForce[0].success).to.be(true); - // revert existing policy to unmanaged + // revert existing policy to regular await supertest .put(`/api/fleet/agent_policies/${agentPolicy.id}`) .set('kbn-xsrf', 'xxxx') @@ -136,7 +138,7 @@ export default function (providerContext: FtrProviderContext) { .expect(200); }); - it('should work for unmanaged policies', async function () { + it('should work for regular policies', async function () { await supertest .post(`/api/fleet/package_policies/delete`) .set('kbn-xsrf', 'xxxx') diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/update.ts b/x-pack/test/fleet_api_integration/apis/package_policy/update.ts index 6e6a475cd4824..5a0ff90669def 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/update.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/update.ts @@ -46,7 +46,7 @@ export default function (providerContext: FtrProviderContext) { .post(`/api/fleet/agent_policies`) .set('kbn-xsrf', 'xxxx') .send({ - name: 'Test managed policy', + name: 'Test hosted agent policy', namespace: 'default', is_managed: true, }); From 540924b5be2544b2a5fd1ec90560dbcd2cd42c3a Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Thu, 15 Apr 2021 20:28:18 -0500 Subject: [PATCH 46/68] [Security Solution][Detections] Adds Nested CTI row renderer (#96275) * Move alert-specific mocks to more declarative mock file * Add placeholder interface for ECS threat fields * Test and implement CTI row renderer The display details are not yet implemented, but those will be fleshed out in the ThreatMatchRow component. * Pass full fields data to our row renderers This data is not used by any existing row renderers and so this commit is mostly just plumbing that data through. This is necessary, however, for our new threat match row renderer as it requires nested fields, which cannot be retrieved through the mechanism that retrieves the existing row renderer data. However, these nested fields are available, if requested, through this other data structure, hence this plumbing. For now to minimize changes I'm marking this as an optional field; however in reality a value will always be present. * Rewrite existing row renderer in terms of flattened data Updates logic, tests and mocks accordingly. * Moving logic into discrete files * helpers * explicit fields file, which will hopefully be part of the renderer API at some point * parent component to split data into "rows" as defined by our renderer * row component for stateless presentation of a single match * Register threat match row rendere Adds tentative copy, example row, and accompanying mock data. * WIP: Rendering draggable fields but hit the data loss issue with nested fields being flattened * WIP: implementing row renderer against new data format I haven't yet deleted the old (new?) unused path yet. Cleanup to come. * Updating based on new data * Rewrites isInstance logic for new data as helper, hasThreatMatchValue * Updating types and tests * Adds to the previously empty ThreatEcs * Revert "Pass full fields data to our row renderers" This reverts commit 19c93ee0732166747b5472433cd5fc813638e21b. We ended up extending the existing data (albeit from the fields response!). * Fix draggables * adds contextId and eventId to pass to draggable * We don't have a order-independent key for each individual ThreatMatchRow, due to matched.id not being mapped/returned in the fields response * Fixes up a few things related to using the new data format * Move indicator field strings to constants * Fix example data for CTI row renderer * Adds missing Threat ECS types * Move CTI field constants to common folder In order to use these in both the row renderer and the server request, we need to move them to common/ * Remove redundant CTI fields from client request These are currently hardcoded on the backend of the events/all query (via TIMELINE_EVENTS_FIELDS); declaring them on both ends is arguably confusing, and we're going with YAGNI for now. * Add missing graphQL type This was causing type errors as this enum exists both here and in common/, and I had only updated one of them. * Updates tests One is still failing due to an outdated test subject, but I expect this to change after an upcoming meeting so leaving it for now. * Split ThreatMatchRow into subcomponents One for displaying match details, and another for indicator details The indicator details will be sparse, so there's going to be some conditional rendering in there. * Make CTI row renderer look nice * Adds translations for copy * Fixes most of our layout woes with more flexbox! * Conditional rendering of indicator details based on data * tests * Make indicator reference field an external link Leverages the existing FormattedFieldValue component, with one minor tweak to add this field to the URL allowlist. * Back to consistent horizontal spacing, here The draggable badges are a little odd in that their full box isn't indicated until hover, making the visual weight a little off. * Add hr as a visual separator between each match "row" of the row renderer * Fix tests broken due to addition of a new row renderer These tests are all implicitly testing the list of row renderers. * Full-width hr At certain container widths, a half-width hr is not sufficient. * More descriptive constant Obviates the need for the accompanying comments. * More realistic data Also ensures less traffic to urlhaus ;) * Remove useless comment * Add threat_match row renderer type to GQL client Gennin' beanz * Ensure contextId is unique for each CTI subrow We need to add the row index to our contextId to ensure that our draggables work correctly for multiple rows, since each row will necessarily have the same eventId and timelineId. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../security_solution/common/cti/constants.ts | 34 ++++ .../security_solution/common/ecs/index.ts | 2 + .../common/ecs/rule/index.ts | 2 +- .../common/ecs/threat/index.ts | 25 +++ .../matrix_histogram/events/index.ts | 4 +- .../common/types/timeline/index.ts | 1 + .../public/common/mock/index.ts | 1 + .../common/mock/mock_detection_alerts.ts | 112 +++++++++++ .../public/common/mock/mock_ecs.ts | 66 ------- .../public/common/mock/mock_timeline_data.ts | 24 +++ .../public/graphql/introspection.json | 6 + .../security_solution/public/graphql/types.ts | 1 + .../row_renderers_browser/catalog/index.tsx | 8 + .../catalog/translations.ts | 13 ++ .../row_renderers_browser/examples/index.tsx | 1 + .../examples/threat_match.tsx | 23 +++ .../threat_match_row.test.tsx.snap | 33 ++++ .../threat_match_row_renderer.test.tsx.snap | 31 +++ .../timeline/body/renderers/cti/helpers.ts | 28 +++ .../body/renderers/cti/indicator_details.tsx | 117 +++++++++++ .../body/renderers/cti/match_details.tsx | 64 ++++++ .../renderers/cti/threat_match_row.test.tsx | 187 ++++++++++++++++++ .../body/renderers/cti/threat_match_row.tsx | 95 +++++++++ .../cti/threat_match_row_renderer.test.tsx | 65 ++++++ .../cti/threat_match_row_renderer.tsx | 17 ++ .../body/renderers/cti/threat_match_rows.tsx | 41 ++++ .../body/renderers/formatted_field.tsx | 8 +- .../timeline/body/renderers/index.ts | 2 + .../__snapshots__/index.test.tsx.snap | 5 + .../__snapshots__/index.test.tsx.snap | 5 + .../__snapshots__/index.test.tsx.snap | 5 + .../timelines/containers/index.test.tsx | 4 +- .../server/graphql/timeline/schema.gql.ts | 1 + .../security_solution/server/graphql/types.ts | 1 + .../timeline/factory/events/all/constants.ts | 11 +- 35 files changed, 963 insertions(+), 80 deletions(-) create mode 100644 x-pack/plugins/security_solution/common/cti/constants.ts create mode 100644 x-pack/plugins/security_solution/common/ecs/threat/index.ts create mode 100644 x-pack/plugins/security_solution/public/common/mock/mock_detection_alerts.ts create mode 100644 x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/examples/threat_match.tsx create mode 100644 x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/__snapshots__/threat_match_row.test.tsx.snap create mode 100644 x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/__snapshots__/threat_match_row_renderer.test.tsx.snap create mode 100644 x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/helpers.ts create mode 100644 x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/indicator_details.tsx create mode 100644 x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/match_details.tsx create mode 100644 x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row.test.tsx create mode 100644 x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row.tsx create mode 100644 x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row_renderer.test.tsx create mode 100644 x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row_renderer.tsx create mode 100644 x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_rows.tsx diff --git a/x-pack/plugins/security_solution/common/cti/constants.ts b/x-pack/plugins/security_solution/common/cti/constants.ts new file mode 100644 index 0000000000000..cdd4a564f3d73 --- /dev/null +++ b/x-pack/plugins/security_solution/common/cti/constants.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { INDICATOR_DESTINATION_PATH } from '../constants'; + +export const MATCHED_ATOMIC = 'matched.atomic'; +export const MATCHED_FIELD = 'matched.field'; +export const MATCHED_TYPE = 'matched.type'; +export const INDICATOR_MATCH_SUBFIELDS = [MATCHED_ATOMIC, MATCHED_FIELD, MATCHED_TYPE]; + +export const INDICATOR_MATCHED_ATOMIC = `${INDICATOR_DESTINATION_PATH}.${MATCHED_ATOMIC}`; +export const INDICATOR_MATCHED_FIELD = `${INDICATOR_DESTINATION_PATH}.${MATCHED_FIELD}`; +export const INDICATOR_MATCHED_TYPE = `${INDICATOR_DESTINATION_PATH}.${MATCHED_TYPE}`; + +export const EVENT_DATASET = 'event.dataset'; +export const EVENT_REFERENCE = 'event.reference'; +export const PROVIDER = 'provider'; + +export const INDICATOR_DATASET = `${INDICATOR_DESTINATION_PATH}.${EVENT_DATASET}`; +export const INDICATOR_REFERENCE = `${INDICATOR_DESTINATION_PATH}.${EVENT_REFERENCE}`; +export const INDICATOR_PROVIDER = `${INDICATOR_DESTINATION_PATH}.${PROVIDER}`; + +export const CTI_ROW_RENDERER_FIELDS = [ + INDICATOR_MATCHED_ATOMIC, + INDICATOR_MATCHED_FIELD, + INDICATOR_MATCHED_TYPE, + INDICATOR_DATASET, + INDICATOR_REFERENCE, + INDICATOR_PROVIDER, +]; diff --git a/x-pack/plugins/security_solution/common/ecs/index.ts b/x-pack/plugins/security_solution/common/ecs/index.ts index 4c57f6419d5db..8054b3c8521db 100644 --- a/x-pack/plugins/security_solution/common/ecs/index.ts +++ b/x-pack/plugins/security_solution/common/ecs/index.ts @@ -28,6 +28,7 @@ import { UserEcs } from './user'; import { WinlogEcs } from './winlog'; import { ProcessEcs } from './process'; import { SystemEcs } from './system'; +import { ThreatEcs } from './threat'; import { Ransomware } from './ransomware'; export interface Ecs { @@ -58,6 +59,7 @@ export interface Ecs { process?: ProcessEcs; file?: FileEcs; system?: SystemEcs; + threat?: ThreatEcs; // This should be temporary eql?: { parentId: string; sequenceNumber: string }; Ransomware?: Ransomware; diff --git a/x-pack/plugins/security_solution/common/ecs/rule/index.ts b/x-pack/plugins/security_solution/common/ecs/rule/index.ts index 5463b21f6b7f7..ae7e5064a8ece 100644 --- a/x-pack/plugins/security_solution/common/ecs/rule/index.ts +++ b/x-pack/plugins/security_solution/common/ecs/rule/index.ts @@ -9,7 +9,7 @@ export interface RuleEcs { id?: string[]; rule_id?: string[]; name?: string[]; - false_positives: string[]; + false_positives?: string[]; saved_id?: string[]; timeline_id?: string[]; timeline_title?: string[]; diff --git a/x-pack/plugins/security_solution/common/ecs/threat/index.ts b/x-pack/plugins/security_solution/common/ecs/threat/index.ts new file mode 100644 index 0000000000000..19923a82dc846 --- /dev/null +++ b/x-pack/plugins/security_solution/common/ecs/threat/index.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EventEcs } from '../event'; + +interface ThreatMatchEcs { + atomic?: string[]; + field?: string[]; + type?: string[]; +} + +export interface ThreatIndicatorEcs { + matched?: ThreatMatchEcs; + event?: EventEcs & { reference?: string[] }; + provider?: string[]; + type?: string[]; +} + +export interface ThreatEcs { + indicator: ThreatIndicatorEcs[]; +} diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/events/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/events/index.ts index b2e0461b0b9b8..4df376acb256e 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/events/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/events/index.ts @@ -26,7 +26,9 @@ export interface EventsActionGroupData { doc_count: number; } -export type Fields = Record; +export interface Fields { + [x: string]: T | Array>; +} export interface EventHit extends SearchHit { sort: string[]; diff --git a/x-pack/plugins/security_solution/common/types/timeline/index.ts b/x-pack/plugins/security_solution/common/types/timeline/index.ts index 5fb7d1a74fc36..9def70048410a 100644 --- a/x-pack/plugins/security_solution/common/types/timeline/index.ts +++ b/x-pack/plugins/security_solution/common/types/timeline/index.ts @@ -206,6 +206,7 @@ export enum RowRendererId { system_fim = 'system_fim', system_security_event = 'system_security_event', system_socket = 'system_socket', + threat_match = 'threat_match', zeek = 'zeek', } diff --git a/x-pack/plugins/security_solution/public/common/mock/index.ts b/x-pack/plugins/security_solution/public/common/mock/index.ts index 469c3d9101eb4..ee34cc1798b54 100644 --- a/x-pack/plugins/security_solution/public/common/mock/index.ts +++ b/x-pack/plugins/security_solution/public/common/mock/index.ts @@ -10,6 +10,7 @@ export * from './header'; export * from './hook_wrapper'; export * from './index_pattern'; export * from './mock_detail_item'; +export * from './mock_detection_alerts'; export * from './mock_ecs'; export * from './mock_local_storage'; export * from './mock_timeline_data'; diff --git a/x-pack/plugins/security_solution/public/common/mock/mock_detection_alerts.ts b/x-pack/plugins/security_solution/public/common/mock/mock_detection_alerts.ts new file mode 100644 index 0000000000000..2d93e7e0dc3a7 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/mock/mock_detection_alerts.ts @@ -0,0 +1,112 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Ecs } from '../../../common/ecs'; +import { TimelineNonEcsData } from '../../../common/search_strategy'; + +export const mockEcsDataWithAlert: Ecs = { + _id: '1', + timestamp: '2018-11-05T19:03:25.937Z', + host: { + name: ['apache'], + ip: ['192.168.0.1'], + }, + event: { + id: ['1'], + action: ['Action'], + category: ['Access'], + module: ['nginx'], + severity: [3], + }, + source: { + ip: ['192.168.0.1'], + port: [80], + }, + destination: { + ip: ['192.168.0.3'], + port: [6343], + }, + user: { + id: ['1'], + name: ['john.dee'], + }, + geo: { + region_name: ['xx'], + country_iso_code: ['xx'], + }, + signal: { + rule: { + created_at: ['2020-01-10T21:11:45.839Z'], + updated_at: ['2020-01-10T21:11:45.839Z'], + created_by: ['elastic'], + description: ['24/7'], + enabled: [true], + false_positives: ['test-1'], + filters: [], + from: ['now-300s'], + id: ['b5ba41ab-aaf3-4f43-971b-bdf9434ce0ea'], + immutable: [false], + index: ['auditbeat-*'], + interval: ['5m'], + rule_id: ['rule-id-1'], + language: ['kuery'], + output_index: ['.siem-signals-default'], + max_signals: [100], + risk_score: ['21'], + query: ['user.name: root or user.name: admin'], + references: ['www.test.co'], + saved_id: ["Garrett's IP"], + timeline_id: ['1234-2136-11ea-9864-ebc8cc1cb8c2'], + timeline_title: ['Untitled timeline'], + severity: ['low'], + updated_by: ['elastic'], + tags: [], + to: ['now'], + type: ['saved_query'], + threat: [], + note: ['# this is some markdown documentation'], + version: ['1'], + }, + }, +}; + +export const getDetectionAlertMock = (overrides: Partial = {}): Ecs => ({ + ...mockEcsDataWithAlert, + ...overrides, +}); + +export const getThreatMatchDetectionAlert = (overrides: Partial = {}): Ecs => ({ + ...mockEcsDataWithAlert, + signal: { + ...mockEcsDataWithAlert.signal, + rule: { + ...mockEcsDataWithAlert.rule, + name: ['mock threat_match rule'], + type: ['threat_match'], + }, + }, + threat: { + indicator: [ + { + matched: { + atomic: ['matched.atomic'], + field: ['matched.atomic'], + type: ['matched.domain'], + }, + }, + ], + }, + ...overrides, +}); + +export const getDetectionAlertFieldsMock = ( + fields: TimelineNonEcsData[] = [] +): TimelineNonEcsData[] => [ + { field: '@timestamp', value: ['2021-03-27T06:28:47.292Z'] }, + { field: 'signal.rule.type', value: ['threat_match'] }, + ...fields, +]; diff --git a/x-pack/plugins/security_solution/public/common/mock/mock_ecs.ts b/x-pack/plugins/security_solution/public/common/mock/mock_ecs.ts index a28c2cc3bc581..f44c5c335cd21 100644 --- a/x-pack/plugins/security_solution/public/common/mock/mock_ecs.ts +++ b/x-pack/plugins/security_solution/public/common/mock/mock_ecs.ts @@ -1026,69 +1026,3 @@ export const mockEcsData: Ecs[] = [ }, }, ]; - -export const mockEcsDataWithAlert: Ecs = { - _id: '1', - timestamp: '2018-11-05T19:03:25.937Z', - host: { - name: ['apache'], - ip: ['192.168.0.1'], - }, - event: { - id: ['1'], - action: ['Action'], - category: ['Access'], - module: ['nginx'], - severity: [3], - }, - source: { - ip: ['192.168.0.1'], - port: [80], - }, - destination: { - ip: ['192.168.0.3'], - port: [6343], - }, - user: { - id: ['1'], - name: ['john.dee'], - }, - geo: { - region_name: ['xx'], - country_iso_code: ['xx'], - }, - signal: { - rule: { - created_at: ['2020-01-10T21:11:45.839Z'], - updated_at: ['2020-01-10T21:11:45.839Z'], - created_by: ['elastic'], - description: ['24/7'], - enabled: [true], - false_positives: ['test-1'], - filters: [], - from: ['now-300s'], - id: ['b5ba41ab-aaf3-4f43-971b-bdf9434ce0ea'], - immutable: [false], - index: ['auditbeat-*'], - interval: ['5m'], - rule_id: ['rule-id-1'], - language: ['kuery'], - output_index: ['.siem-signals-default'], - max_signals: [100], - risk_score: ['21'], - query: ['user.name: root or user.name: admin'], - references: ['www.test.co'], - saved_id: ["Garrett's IP"], - timeline_id: ['1234-2136-11ea-9864-ebc8cc1cb8c2'], - timeline_title: ['Untitled timeline'], - severity: ['low'], - updated_by: ['elastic'], - tags: [], - to: ['now'], - type: ['saved_query'], - threat: [], - note: ['# this is some markdown documentation'], - version: ['1'], - }, - }, -}; diff --git a/x-pack/plugins/security_solution/public/common/mock/mock_timeline_data.ts b/x-pack/plugins/security_solution/public/common/mock/mock_timeline_data.ts index f016b6cc34539..6a3c6468f43d5 100644 --- a/x-pack/plugins/security_solution/public/common/mock/mock_timeline_data.ts +++ b/x-pack/plugins/security_solution/public/common/mock/mock_timeline_data.ts @@ -1088,6 +1088,30 @@ export const mockTimelineData: TimelineItem[] = [ geo: { region_name: ['xx'], country_iso_code: ['xx'] }, }, }, + { + _id: '32', + data: [], + ecs: { + _id: 'BuBP4W0BOpWiDweSoYSg', + timestamp: '2019-10-18T23:59:15.091Z', + threat: { + indicator: [ + { + matched: { + atomic: ['192.168.1.1'], + field: ['source.ip'], + type: ['ip'], + }, + event: { + dataset: ['threatintel.example_dataset'], + reference: ['https://example.com'], + }, + provider: ['indicator_provider'], + }, + ], + }, + }, + }, ]; export const mockFimFileCreatedEvent: Ecs = { diff --git a/x-pack/plugins/security_solution/public/graphql/introspection.json b/x-pack/plugins/security_solution/public/graphql/introspection.json index 0a41ca05b8753..752173ded5163 100644 --- a/x-pack/plugins/security_solution/public/graphql/introspection.json +++ b/x-pack/plugins/security_solution/public/graphql/introspection.json @@ -1699,6 +1699,12 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "threat_match", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, { "name": "zeek", "description": "", "isDeprecated": false, "deprecationReason": null } ], "possibleTypes": null diff --git a/x-pack/plugins/security_solution/public/graphql/types.ts b/x-pack/plugins/security_solution/public/graphql/types.ts index 8ffd2995d0d97..a41111c3e123a 100644 --- a/x-pack/plugins/security_solution/public/graphql/types.ts +++ b/x-pack/plugins/security_solution/public/graphql/types.ts @@ -298,6 +298,7 @@ export enum RowRendererId { system_fim = 'system_fim', system_security_event = 'system_security_event', system_socket = 'system_socket', + threat_match = 'threat_match', zeek = 'zeek', } diff --git a/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/catalog/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/catalog/index.tsx index 283a239acad24..f724c19913c8e 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/catalog/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/catalog/index.tsx @@ -24,6 +24,7 @@ import { SystemFimExample, SystemSecurityEventExample, SystemSocketExample, + ThreatMatchExample, ZeekExample, } from '../examples'; import * as i18n from './translations'; @@ -204,6 +205,13 @@ export const renderers: RowRendererOption[] = [ example: SuricataExample, searchableDescription: `${i18n.SURICATA_DESCRIPTION_PART1} ${i18n.SURICATA_NAME} ${i18n.SURICATA_DESCRIPTION_PART2}`, }, + { + id: RowRendererId.threat_match, + name: i18n.THREAT_MATCH_NAME, + description: i18n.THREAT_MATCH_DESCRIPTION, + example: ThreatMatchExample, + searchableDescription: `${i18n.THREAT_MATCH_NAME} ${i18n.THREAT_MATCH_DESCRIPTION}`, + }, { id: RowRendererId.zeek, name: i18n.ZEEK_NAME, diff --git a/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/catalog/translations.ts b/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/catalog/translations.ts index a0d6d4e121891..95dce2e96d186 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/catalog/translations.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/catalog/translations.ts @@ -230,6 +230,19 @@ export const SYSTEM_DESCRIPTION_PART3 = i18n.translate( 'All datasets send both periodic state information (e.g. all currently running processes) and real-time changes (e.g. when a new process starts or stops).', } ); +export const THREAT_MATCH_NAME = i18n.translate( + 'xpack.securitySolution.eventRenderers.threatMatchName', + { + defaultMessage: 'Threat Indicator Match', + } +); + +export const THREAT_MATCH_DESCRIPTION = i18n.translate( + 'xpack.securitySolution.eventRenderers.threatMatchDescription', + { + defaultMessage: 'Summarizes events that matched threat indicators', + } +); export const ZEEK_NAME = i18n.translate('xpack.securitySolution.eventRenderers.zeekName', { defaultMessage: 'Zeek (formerly Bro)', diff --git a/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/examples/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/examples/index.tsx index 6932ca01835cc..da9d6923c2b76 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/examples/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/examples/index.tsx @@ -19,4 +19,5 @@ export * from './system_file'; export * from './system_fim'; export * from './system_security_event'; export * from './system_socket'; +export * from './threat_match'; export * from './zeek'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/examples/threat_match.tsx b/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/examples/threat_match.tsx new file mode 100644 index 0000000000000..9d7e5d48315e3 --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/examples/threat_match.tsx @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { mockTimelineData } from '../../../../common/mock/mock_timeline_data'; +import { threatMatchRowRenderer } from '../../timeline/body/renderers/cti/threat_match_row_renderer'; +import { ROW_RENDERER_BROWSER_EXAMPLE_TIMELINE_ID } from '../constants'; + +const ThreatMatchExampleComponent: React.FC = () => ( + <> + {threatMatchRowRenderer.renderRow({ + browserFields: {}, + data: mockTimelineData[31].ecs, + timelineId: ROW_RENDERER_BROWSER_EXAMPLE_TIMELINE_ID, + })} + +); +export const ThreatMatchExample = React.memo(ThreatMatchExampleComponent); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/__snapshots__/threat_match_row.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/__snapshots__/threat_match_row.test.tsx.snap new file mode 100644 index 0000000000000..5e86ba25e4ba8 --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/__snapshots__/threat_match_row.test.tsx.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ThreatMatchRowView matches the registered snapshot 1`] = ` + + + + + + + + +`; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/__snapshots__/threat_match_row_renderer.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/__snapshots__/threat_match_row_renderer.test.tsx.snap new file mode 100644 index 0000000000000..6e6dbddc6d9a0 --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/__snapshots__/threat_match_row_renderer.test.tsx.snap @@ -0,0 +1,31 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`threatMatchRowRenderer #renderRow renders correctly against snapshot 1`] = ` + + + + + + + +`; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/helpers.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/helpers.ts new file mode 100644 index 0000000000000..84dcef327736b --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/helpers.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { get, isEmpty } from 'lodash'; +import styled from 'styled-components'; + +import { INDICATOR_DESTINATION_PATH } from '../../../../../../../common/constants'; +import { INDICATOR_MATCH_SUBFIELDS } from '../../../../../../../common/cti/constants'; +import { Ecs } from '../../../../../../../common/ecs'; +import { ThreatIndicatorEcs } from '../../../../../../../common/ecs/threat'; + +const getIndicatorEcs = (data: Ecs): ThreatIndicatorEcs[] => + get(data, INDICATOR_DESTINATION_PATH) ?? []; + +export const hasThreatMatchValue = (data: Ecs): boolean => + getIndicatorEcs(data).some((indicator) => + INDICATOR_MATCH_SUBFIELDS.some( + (indicatorMatchSubField) => !isEmpty(get(indicator, indicatorMatchSubField)) + ) + ); + +export const HorizontalSpacer = styled.div` + margin: 0 ${({ theme }) => theme.eui.paddingSizes.xs}; +`; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/indicator_details.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/indicator_details.tsx new file mode 100644 index 0000000000000..11846632f740e --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/indicator_details.tsx @@ -0,0 +1,117 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { + INDICATOR_DATASET, + INDICATOR_MATCHED_TYPE, + INDICATOR_PROVIDER, + INDICATOR_REFERENCE, +} from '../../../../../../../common/cti/constants'; +import { DraggableBadge } from '../../../../../../common/components/draggables'; +import { FormattedFieldValue } from '../formatted_field'; +import { HorizontalSpacer } from './helpers'; + +interface IndicatorDetailsProps { + contextId: string; + eventId: string; + indicatorDataset: string | undefined; + indicatorProvider: string | undefined; + indicatorReference: string | undefined; + indicatorType: string | undefined; +} + +export const IndicatorDetails: React.FC = ({ + contextId, + eventId, + indicatorDataset, + indicatorProvider, + indicatorReference, + indicatorType, +}) => ( + + {indicatorType && ( + + + + )} + {indicatorDataset && ( + <> + + + + + + + + + + )} + {indicatorProvider && ( + <> + + + + + + + + + + )} + {indicatorReference && ( + <> + + {':'} + + + + + + )} + +); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/match_details.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/match_details.tsx new file mode 100644 index 0000000000000..2195421301d31 --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/match_details.tsx @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { INDICATOR_MATCHED_FIELD } from '../../../../../../../common/cti/constants'; +import { DraggableBadge } from '../../../../../../common/components/draggables'; +import { HorizontalSpacer } from './helpers'; + +interface MatchDetailsProps { + contextId: string; + eventId: string; + sourceField: string; + sourceValue: string; +} + +export const MatchDetails: React.FC = ({ + contextId, + eventId, + sourceField, + sourceValue, +}) => ( + + + + + + + + + + + + + +); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row.test.tsx new file mode 100644 index 0000000000000..7f580642130fe --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row.test.tsx @@ -0,0 +1,187 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { shallow } from 'enzyme'; +import React from 'react'; + +import { TestProviders } from '../../../../../../common/mock'; +import { useMountAppended } from '../../../../../../common/utils/use_mount_appended'; +import { ThreatMatchRowProps, ThreatMatchRowView } from './threat_match_row'; + +describe('ThreatMatchRowView', () => { + const mount = useMountAppended(); + + it('renders an indicator match row', () => { + const wrapper = shallow( + + ); + + expect(wrapper.find('[data-test-subj="threat-match-row"]').exists()).toEqual(true); + }); + + it('matches the registered snapshot', () => { + const wrapper = shallow( + + ); + + expect(wrapper).toMatchSnapshot(); + }); + + describe('field rendering', () => { + let baseProps: ThreatMatchRowProps; + const render = (props: ThreatMatchRowProps) => + mount( + + + + ); + + beforeEach(() => { + baseProps = { + contextId: 'contextId', + eventId: 'eventId', + indicatorDataset: 'dataset', + indicatorProvider: 'provider', + indicatorReference: 'http://example.com', + indicatorType: 'domain', + sourceField: 'host.name', + sourceValue: 'http://elastic.co', + }; + }); + + it('renders the match field', () => { + const wrapper = render(baseProps); + const matchField = wrapper.find('[data-test-subj="threat-match-details-source-field"]'); + expect(matchField.props()).toEqual( + expect.objectContaining({ + value: 'host.name', + }) + ); + }); + + it('renders the match value', () => { + const wrapper = render(baseProps); + const matchValue = wrapper.find('[data-test-subj="threat-match-details-source-value"]'); + expect(matchValue.props()).toEqual( + expect.objectContaining({ + field: 'host.name', + value: 'http://elastic.co', + }) + ); + }); + + it('renders the indicator type, if present', () => { + const wrapper = render(baseProps); + const indicatorType = wrapper.find( + '[data-test-subj="threat-match-indicator-details-indicator-type"]' + ); + expect(indicatorType.props()).toEqual( + expect.objectContaining({ + value: 'domain', + }) + ); + }); + + it('does not render the indicator type, if absent', () => { + const wrapper = render({ + ...baseProps, + indicatorType: undefined, + }); + const indicatorType = wrapper.find( + '[data-test-subj="threat-match-indicator-details-indicator-type"]' + ); + expect(indicatorType.exists()).toBeFalsy(); + }); + + it('renders the indicator dataset, if present', () => { + const wrapper = render(baseProps); + const indicatorDataset = wrapper.find( + '[data-test-subj="threat-match-indicator-details-indicator-dataset"]' + ); + expect(indicatorDataset.props()).toEqual( + expect.objectContaining({ + value: 'dataset', + }) + ); + }); + + it('does not render the indicator dataset, if absent', () => { + const wrapper = render({ + ...baseProps, + indicatorDataset: undefined, + }); + const indicatorDataset = wrapper.find( + '[data-test-subj="threat-match-indicator-details-indicator-dataset"]' + ); + expect(indicatorDataset.exists()).toBeFalsy(); + }); + + it('renders the indicator provider, if present', () => { + const wrapper = render(baseProps); + const indicatorProvider = wrapper.find( + '[data-test-subj="threat-match-indicator-details-indicator-provider"]' + ); + expect(indicatorProvider.props()).toEqual( + expect.objectContaining({ + value: 'provider', + }) + ); + }); + + it('does not render the indicator provider, if absent', () => { + const wrapper = render({ + ...baseProps, + indicatorProvider: undefined, + }); + const indicatorProvider = wrapper.find( + '[data-test-subj="threat-match-indicator-details-indicator-provider"]' + ); + expect(indicatorProvider.exists()).toBeFalsy(); + }); + + it('renders the indicator reference, if present', () => { + const wrapper = render(baseProps); + const indicatorReference = wrapper.find( + '[data-test-subj="threat-match-indicator-details-indicator-reference"]' + ); + expect(indicatorReference.props()).toEqual( + expect.objectContaining({ + value: 'http://example.com', + }) + ); + }); + + it('does not render the indicator reference, if absent', () => { + const wrapper = render({ + ...baseProps, + indicatorReference: undefined, + }); + const indicatorReference = wrapper.find( + '[data-test-subj="threat-match-indicator-details-indicator-reference"]' + ); + expect(indicatorReference.exists()).toBeFalsy(); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row.tsx new file mode 100644 index 0000000000000..ba5b0127df526 --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row.tsx @@ -0,0 +1,95 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { get } from 'lodash'; +import React from 'react'; +import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; + +import { Fields } from '../../../../../../../common/search_strategy'; +import { + EVENT_DATASET, + EVENT_REFERENCE, + MATCHED_ATOMIC, + MATCHED_FIELD, + MATCHED_TYPE, + PROVIDER, +} from '../../../../../../../common/cti/constants'; +import { MatchDetails } from './match_details'; +import { IndicatorDetails } from './indicator_details'; + +export interface ThreatMatchRowProps { + contextId: string; + eventId: string; + indicatorDataset: string | undefined; + indicatorProvider: string | undefined; + indicatorReference: string | undefined; + indicatorType: string | undefined; + sourceField: string; + sourceValue: string; +} + +export const ThreatMatchRow = ({ + contextId, + data, + eventId, +}: { + contextId: string; + data: Fields; + eventId: string; +}) => { + const props = { + contextId, + eventId, + indicatorDataset: get(data, EVENT_DATASET)[0] as string | undefined, + indicatorReference: get(data, EVENT_REFERENCE)[0] as string | undefined, + indicatorProvider: get(data, PROVIDER)[0] as string | undefined, + indicatorType: get(data, MATCHED_TYPE)[0] as string | undefined, + sourceField: get(data, MATCHED_FIELD)[0] as string, + sourceValue: get(data, MATCHED_ATOMIC)[0] as string, + }; + + return ; +}; + +export const ThreatMatchRowView = ({ + contextId, + eventId, + indicatorDataset, + indicatorProvider, + indicatorReference, + indicatorType, + sourceField, + sourceValue, +}: ThreatMatchRowProps) => { + return ( + + + + + + + + + ); +}; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row_renderer.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row_renderer.test.tsx new file mode 100644 index 0000000000000..6687179e5b887 --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row_renderer.test.tsx @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { shallow } from 'enzyme'; +import React from 'react'; + +import { getThreatMatchDetectionAlert } from '../../../../../../common/mock'; + +import { threatMatchRowRenderer } from './threat_match_row_renderer'; + +describe('threatMatchRowRenderer', () => { + let threatMatchData: ReturnType; + + beforeEach(() => { + threatMatchData = getThreatMatchDetectionAlert(); + }); + + describe('#isInstance', () => { + it('is false for an empty event', () => { + const emptyEvent = { + _id: 'my_id', + '@timestamp': ['2020-11-17T14:48:08.922Z'], + }; + expect(threatMatchRowRenderer.isInstance(emptyEvent)).toBe(false); + }); + + it('is false for an alert with indicator data but no match', () => { + const indicatorTypeData = getThreatMatchDetectionAlert({ + threat: { + indicator: [{ type: ['url'] }], + }, + }); + expect(threatMatchRowRenderer.isInstance(indicatorTypeData)).toBe(false); + }); + + it('is false for an alert with threat match fields but no data', () => { + const emptyThreatMatchData = getThreatMatchDetectionAlert({ + threat: { + indicator: [{ matched: { type: [] } }], + }, + }); + expect(threatMatchRowRenderer.isInstance(emptyThreatMatchData)).toBe(false); + }); + + it('is true for an alert event with present indicator match fields', () => { + expect(threatMatchRowRenderer.isInstance(threatMatchData)).toBe(true); + }); + }); + + describe('#renderRow', () => { + it('renders correctly against snapshot', () => { + const children = threatMatchRowRenderer.renderRow({ + browserFields: {}, + data: threatMatchData, + timelineId: 'test', + }); + const wrapper = shallow({children}); + expect(wrapper).toMatchSnapshot(); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row_renderer.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row_renderer.tsx new file mode 100644 index 0000000000000..2a7e8ce02d79f --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_row_renderer.tsx @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { RowRendererId } from '../../../../../../../common/types/timeline'; +import { RowRenderer } from '../row_renderer'; +import { hasThreatMatchValue } from './helpers'; +import { ThreatMatchRows } from './threat_match_rows'; + +export const threatMatchRowRenderer: RowRenderer = { + id: RowRendererId.threat_match, + isInstance: hasThreatMatchValue, + renderRow: ThreatMatchRows, +}; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_rows.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_rows.tsx new file mode 100644 index 0000000000000..cc34f9e63b5e2 --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/cti/threat_match_rows.tsx @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiHorizontalRule } from '@elastic/eui'; +import { get } from 'lodash'; +import React, { Fragment } from 'react'; +import styled from 'styled-components'; + +import { Fields } from '../../../../../../../common/search_strategy'; +import { ID_FIELD_NAME } from '../../../../../../common/components/event_details/event_id'; +import { RowRenderer, RowRendererContainer } from '../row_renderer'; +import { ThreatMatchRow } from './threat_match_row'; + +const SpacedContainer = styled.div` + margin: ${({ theme }) => theme.eui.paddingSizes.s} 0; +`; + +export const ThreatMatchRows: RowRenderer['renderRow'] = ({ data, timelineId }) => { + const indicators = get(data, 'threat.indicator') as Fields[]; + const eventId = get(data, ID_FIELD_NAME); + + return ( + + + {indicators.map((indicator, index) => { + const contextId = `threat-match-row-${timelineId}-${eventId}-${index}`; + return ( + + + {index < indicators.length - 1 && } + + ); + })} + + + ); +}; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field.tsx index e227c87b99870..12effcd3fa81f 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field.tsx @@ -9,6 +9,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui'; import { isNumber, isEmpty } from 'lodash/fp'; import React from 'react'; +import { INDICATOR_REFERENCE } from '../../../../../../common/cti/constants'; import { DefaultDraggable } from '../../../../../common/components/draggables'; import { Bytes, BYTES_FORMAT } from './bytes'; import { Duration, EVENT_DURATION_FIELD_NAME } from '../../../duration'; @@ -116,7 +117,12 @@ const FormattedFieldValueComponent: React.FC<{ ); } else if ( - [RULE_REFERENCE_FIELD_NAME, REFERENCE_URL_FIELD_NAME, EVENT_URL_FIELD_NAME].includes(fieldName) + [ + RULE_REFERENCE_FIELD_NAME, + REFERENCE_URL_FIELD_NAME, + EVENT_URL_FIELD_NAME, + INDICATOR_REFERENCE, + ].includes(fieldName) ) { return renderUrl({ contextId, eventId, fieldName, linkValue, truncate, value }); } else if (columnNamesNotDraggable.includes(fieldName)) { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/index.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/index.ts index 209a9414f62f1..537a24bbfd953 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/index.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/index.ts @@ -15,6 +15,7 @@ import { suricataRowRenderer } from './suricata/suricata_row_renderer'; import { unknownColumnRenderer } from './unknown_column_renderer'; import { zeekRowRenderer } from './zeek/zeek_row_renderer'; import { systemRowRenderers } from './system/generic_row_renderer'; +import { threatMatchRowRenderer } from './cti/threat_match_row_renderer'; // The row renderers are order dependent and will return the first renderer // which returns true from its isInstance call. The bottom renderers which @@ -24,6 +25,7 @@ import { systemRowRenderers } from './system/generic_row_renderer'; // plainRowRenderer always returns true to everything which is why it always // should be last. export const defaultRowRenderers: RowRenderer[] = [ + threatMatchRowRenderer, ...auditdRowRenderers, ...systemRowRenderers, suricataRowRenderer, diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/eql_tab_content/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/eql_tab_content/__snapshots__/index.test.tsx.snap index 7d237ecaf92df..9ec1fa7071277 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/eql_tab_content/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/eql_tab_content/__snapshots__/index.test.tsx.snap @@ -143,6 +143,11 @@ In other use cases the message field can be used to concatenate different values renderCellValue={[Function]} rowRenderers={ Array [ + Object { + "id": "threat_match", + "isInstance": [Function], + "renderRow": [Function], + }, Object { "id": "auditd", "isInstance": [Function], diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/__snapshots__/index.test.tsx.snap index ef73ba9f24db3..ce59d191a472d 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/__snapshots__/index.test.tsx.snap @@ -138,6 +138,11 @@ In other use cases the message field can be used to concatenate different values renderCellValue={[Function]} rowRenderers={ Array [ + Object { + "id": "threat_match", + "isInstance": [Function], + "renderRow": [Function], + }, Object { "id": "auditd", "isInstance": [Function], diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/__snapshots__/index.test.tsx.snap index 46c85f634ff6b..f6ff6b50221b7 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/__snapshots__/index.test.tsx.snap @@ -279,6 +279,11 @@ In other use cases the message field can be used to concatenate different values renderCellValue={[Function]} rowRenderers={ Array [ + Object { + "id": "threat_match", + "isInstance": [Function], + "renderRow": [Function], + }, Object { "id": "auditd", "isInstance": [Function], diff --git a/x-pack/plugins/security_solution/public/timelines/containers/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/containers/index.test.tsx index ddcecb885a8ff..496107e910d76 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/containers/index.test.tsx @@ -159,7 +159,7 @@ describe('useTimelineEvents', () => { loadPage: result.current[1].loadPage, pageInfo: result.current[1].pageInfo, refetch: result.current[1].refetch, - totalCount: 31, + totalCount: 32, updatedAt: result.current[1].updatedAt, }, ]); @@ -202,7 +202,7 @@ describe('useTimelineEvents', () => { loadPage: result.current[1].loadPage, pageInfo: result.current[1].pageInfo, refetch: result.current[1].refetch, - totalCount: 31, + totalCount: 32, updatedAt: result.current[1].updatedAt, }, ]); diff --git a/x-pack/plugins/security_solution/server/graphql/timeline/schema.gql.ts b/x-pack/plugins/security_solution/server/graphql/timeline/schema.gql.ts index 05a824e3630bd..98e7103e61224 100644 --- a/x-pack/plugins/security_solution/server/graphql/timeline/schema.gql.ts +++ b/x-pack/plugins/security_solution/server/graphql/timeline/schema.gql.ts @@ -171,6 +171,7 @@ export const timelineSchema = gql` system_fim system_security_event system_socket + threat_match zeek } diff --git a/x-pack/plugins/security_solution/server/graphql/types.ts b/x-pack/plugins/security_solution/server/graphql/types.ts index 29d366e20c299..a60a6dd6093d1 100644 --- a/x-pack/plugins/security_solution/server/graphql/types.ts +++ b/x-pack/plugins/security_solution/server/graphql/types.ts @@ -300,6 +300,7 @@ export enum RowRendererId { system_fim = 'system_fim', system_security_event = 'system_security_event', system_socket = 'system_socket', + threat_match = 'threat_match', zeek = 'zeek', } diff --git a/x-pack/plugins/security_solution/server/search_strategy/timeline/factory/events/all/constants.ts b/x-pack/plugins/security_solution/server/search_strategy/timeline/factory/events/all/constants.ts index 29b0df9e4bbf7..38188a1616bfc 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/timeline/factory/events/all/constants.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/timeline/factory/events/all/constants.ts @@ -5,14 +5,7 @@ * 2.0. */ -export const TIMELINE_CTI_FIELDS = [ - 'threat.indicator.event.dataset', - 'threat.indicator.event.reference', - 'threat.indicator.matched.atomic', - 'threat.indicator.matched.field', - 'threat.indicator.matched.type', - 'threat.indicator.provider', -]; +import { CTI_ROW_RENDERER_FIELDS } from '../../../../../../common/cti/constants'; export const TIMELINE_EVENTS_FIELDS = [ '@timestamp', @@ -239,5 +232,5 @@ export const TIMELINE_EVENTS_FIELDS = [ 'zeek.ssl.established', 'zeek.ssl.resumed', 'zeek.ssl.version', - ...TIMELINE_CTI_FIELDS, + ...CTI_ROW_RENDERER_FIELDS, ]; From b5ae056ac4e75e99c1171977ca1395c250c78b16 Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Thu, 15 Apr 2021 21:27:43 -0500 Subject: [PATCH 47/68] [Security Solution][Detections] ML Rules accept multiple ML Job IDs (#97073) * Adds helper to normalize legacy ML rule field to an array This will be used on read of rules, to normalize legacy rules while avoiding an explicit migration. * Fix our detection-specific ML search function Luckily this was just a translation layer to our anomaly call, and the underlying functions already accepted an array of strings. * WIP: Run rules against multiple ML Job IDs We don't yet support creation of rules with multiple job ids, either on the API or the UI, but when we do they will work. Note: the logic was previously to generate an error if the underlying job was not running, but to still query and generate alerts. Extending that logic to multiple jobs: if any are not running, we generate an error but continue querying and generating alerts. * WIP: updating ml rule schemas to support multiple job IDs * Simplify normalization method We don't care about null or empty string values here; those were holdovers from copying the logic of normalizeThreshold and don't apply to this situation. * Move normalized types to separate file to fix circular dependency Our use of NonEmptyArray within common/schemas seemed to be causing the above; this fixes it for now. * Normalize ML job_ids param at the API layer Previous changes to the base types already covered the majority of routes; this updates the miscellaneous helpers that don't leverage those shared utilities. At the DB level, the forthcoming migration will ensure that we always have "normalized" job IDs as an array. * Count stopped ML Jobs as partial failure during ML Rule execution Since we continue to query anomalies and potentially generate alerts, a "failure" status is no longer the most accurate for this situation. * Update 7.13 alerts migration to allow multi-job ML Rules This ensures that we can assume string[] for this field during rule execution. * Display N job statuses on rule details * WIP: converts MLJobSelect to a multiselect Unfortunately, the SuperSelect does not allow multiselect so we need to convert this to a combobox. Luckily we can reuse most of the code here and remain relatively clean. Since all combobox options must be the same (fixed) height, we're somewhat more limited than before for displaying the rows. The truncation appears fine, but I need to figure out a way to display the full description as well. * Update client-side logic to handle an array of ML job_ids * Marginally more legible error message * Conditionally call our normalize helper only if we have a value This fixes a type error where TS could not infer that the return value would not be undefined despite knowing that the argument was never undefined. I tried some fancy conditional generic types, but that didn't work. This is more analogous to normalizeThresholdObject now, anyway. * Fix remaining type error * Clean up our ML executor tests with existing contract mocks * Update ML Executor tests with new logic We now record a partial failure instead of an error. * Add and update tests for new ML normalization logic * Add and update integration tests for ML Rules Ensures that dealing with legacy job formats continues to work in the API. * Fix a type error These params can no longer be strings. * Update ML cypress test to create a rule with 2 ML jobs If we can create a rule with 2 jobs, we should also be able to create a rule with 1 job. * Remove unused constant * Persist a partial failure message written by a rule executor We added the result.warning field as a way to indicate that a partial failure was written to the rule, but neglected to account for that in the main rule execution code, which caused a success status to immediately overwrite the partial failure if the rule execution did not otherwise fail/short-circuit. --- .../server/saved_objects/migrations.test.ts | 52 ++++++++++++ .../server/saved_objects/migrations.ts | 6 ++ .../schemas/common/schemas.ts | 3 +- .../schemas/types/normalized_ml_job_id.ts | 22 +++++ .../common/detection_engine/utils.test.ts | 18 ++++ .../common/detection_engine/utils.ts | 3 + .../machine_learning_rule.spec.ts | 6 +- .../security_solution/cypress/objects/rule.ts | 4 +- .../cypress/screens/create_new_rule.ts | 5 +- .../cypress/tasks/create_new_rule.ts | 13 +-- .../exceptions/add_exception_modal/index.tsx | 5 +- .../exceptions/edit_exception_modal/index.tsx | 5 +- .../rules/description_step/index.tsx | 6 +- .../description_step/ml_job_description.tsx | 12 ++- .../components/rules/ml_job_select/index.tsx | 67 ++++++++------- .../rules/step_define_rule/index.tsx | 2 +- .../rules/step_define_rule/translations.tsx | 2 +- .../detection_engine/rules/types.ts | 2 +- .../rules/all/__mocks__/mock.ts | 2 +- .../rules/create/helpers.test.ts | 4 +- .../detection_engine/rules/helpers.test.tsx | 8 +- .../pages/detection_engine/rules/helpers.tsx | 2 +- .../pages/detection_engine/rules/types.ts | 4 +- .../rules/patch_rules_bulk_route.test.ts | 2 +- .../routes/rules/patch_rules_route.test.ts | 2 +- .../routes/rules/utils.test.ts | 4 +- .../rules/create_rules.test.ts | 22 ++++- .../detection_engine/rules/create_rules.ts | 9 +- .../rules/patch_rules.test.ts | 27 +++++- .../lib/detection_engine/rules/patch_rules.ts | 9 +- .../schemas/rule_converters.ts | 7 +- .../schemas/rule_schemas.mock.ts | 2 +- .../detection_engine/schemas/rule_schemas.ts | 4 +- .../signals/executors/ml.test.ts | 82 ++++++------------- .../detection_engine/signals/executors/ml.ts | 28 ++++--- .../signals/find_ml_signals.ts | 6 +- .../signals/rule_status_service.mock.ts | 36 ++------ .../signals/signal_rule_alert_type.ts | 2 +- .../security_and_spaces/tests/create_rules.ts | 15 ++++ .../security_and_spaces/tests/patch_rules.ts | 16 ++++ .../security_and_spaces/tests/update_rules.ts | 22 +++++ .../detection_engine_api_integration/utils.ts | 6 +- 42 files changed, 365 insertions(+), 189 deletions(-) create mode 100644 x-pack/plugins/security_solution/common/detection_engine/schemas/types/normalized_ml_job_id.ts diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts b/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts index 4df75ab60b496..a080809bbc968 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts @@ -973,6 +973,58 @@ describe('7.13.0', () => { }, }); }); + + test('security solution ML alert with string in machineLearningJobId is converted to an array', () => { + const migration713 = getMigrations(encryptedSavedObjectsSetup)['7.13.0']; + const alert = getMockData({ + alertTypeId: 'siem.signals', + params: { + anomalyThreshold: 20, + machineLearningJobId: 'my_job_id', + }, + }); + + expect(migration713(alert, migrationContext)).toEqual({ + ...alert, + attributes: { + ...alert.attributes, + params: { + anomalyThreshold: 20, + machineLearningJobId: ['my_job_id'], + exceptionsList: [], + riskScoreMapping: [], + severityMapping: [], + threat: [], + }, + }, + }); + }); + + test('security solution ML alert with an array in machineLearningJobId is preserved', () => { + const migration713 = getMigrations(encryptedSavedObjectsSetup)['7.13.0']; + const alert = getMockData({ + alertTypeId: 'siem.signals', + params: { + anomalyThreshold: 20, + machineLearningJobId: ['my_job_id', 'my_other_job_id'], + }, + }); + + expect(migration713(alert, migrationContext)).toEqual({ + ...alert, + attributes: { + ...alert.attributes, + params: { + anomalyThreshold: 20, + machineLearningJobId: ['my_job_id', 'my_other_job_id'], + exceptionsList: [], + riskScoreMapping: [], + severityMapping: [], + threat: [], + }, + }, + }); + }); }); function getUpdatedAt(): string { diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations.ts b/x-pack/plugins/alerting/server/saved_objects/migrations.ts index 8ebeb401b313c..c9327ed8f186a 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations.ts @@ -400,6 +400,12 @@ function removeNullsFromSecurityRules( ? params.lists : [], threatFilters: convertNullToUndefined(params.threatFilters), + machineLearningJobId: + params.machineLearningJobId == null + ? undefined + : Array.isArray(params.machineLearningJobId) + ? params.machineLearningJobId + : [params.machineLearningJobId], }, }, }; diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/common/schemas.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/common/schemas.ts index c61ab85f43270..b5f88aa144814 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/common/schemas.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/common/schemas.ts @@ -22,6 +22,7 @@ import { PositiveIntegerGreaterThanZero } from '../types/positive_integer_greate import { PositiveInteger } from '../types/positive_integer'; import { NonEmptyString } from '../types/non_empty_string'; import { parseScheduleDates } from '../../parse_schedule_dates'; +import { machine_learning_job_id_normalized } from '../types/normalized_ml_job_id'; export const author = t.array(t.string); export type Author = t.TypeOf; @@ -230,7 +231,7 @@ export type AnomalyThreshold = t.TypeOf; export const anomalyThresholdOrUndefined = t.union([anomaly_threshold, t.undefined]); export type AnomalyThresholdOrUndefined = t.TypeOf; -export const machine_learning_job_id = t.string; +export const machine_learning_job_id = t.union([t.string, machine_learning_job_id_normalized]); export type MachineLearningJobId = t.TypeOf; export const machineLearningJobIdOrUndefined = t.union([machine_learning_job_id, t.undefined]); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/types/normalized_ml_job_id.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/types/normalized_ml_job_id.ts new file mode 100644 index 0000000000000..c826bce92c8a0 --- /dev/null +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/types/normalized_ml_job_id.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +/* eslint-disable @typescript-eslint/naming-convention */ + +import * as t from 'io-ts'; + +import { NonEmptyArray } from './non_empty_array'; + +export const machine_learning_job_id_normalized = NonEmptyArray(t.string); +export type MachineLearningJobIdNormalized = t.TypeOf; + +export const machineLearningJobIdNormalizedOrUndefined = t.union([ + machine_learning_job_id_normalized, + t.undefined, +]); +export type MachineLearningJobIdNormalizedOrUndefined = t.TypeOf< + typeof machineLearningJobIdNormalizedOrUndefined +>; diff --git a/x-pack/plugins/security_solution/common/detection_engine/utils.test.ts b/x-pack/plugins/security_solution/common/detection_engine/utils.test.ts index 9377255dc85d5..c477036a07d85 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/utils.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/utils.test.ts @@ -10,6 +10,7 @@ import { hasLargeValueList, hasNestedEntry, isThreatMatchRule, + normalizeMachineLearningJobIds, normalizeThresholdField, } from './utils'; import { EntriesArray } from '../shared_imports'; @@ -175,3 +176,20 @@ describe('normalizeThresholdField', () => { expect(normalizeThresholdField('')).toEqual([]); }); }); + +describe('normalizeMachineLearningJobIds', () => { + it('converts a string to a string array', () => { + expect(normalizeMachineLearningJobIds('ml_job_id')).toEqual(['ml_job_id']); + }); + + it('preserves a single-valued array ', () => { + expect(normalizeMachineLearningJobIds(['ml_job_id'])).toEqual(['ml_job_id']); + }); + + it('preserves a multi-valued array ', () => { + expect(normalizeMachineLearningJobIds(['ml_job_id', 'other_ml_job_id'])).toEqual([ + 'ml_job_id', + 'other_ml_job_id', + ]); + }); +}); diff --git a/x-pack/plugins/security_solution/common/detection_engine/utils.ts b/x-pack/plugins/security_solution/common/detection_engine/utils.ts index 1f4e4e140ce18..a8e0ffcccef82 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/utils.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/utils.ts @@ -62,5 +62,8 @@ export const normalizeThresholdObject = (threshold: Threshold): ThresholdNormali }; }; +export const normalizeMachineLearningJobIds = (value: string | string[]): string[] => + Array.isArray(value) ? value : [value]; + export const getRuleStatusText = (value: JobStatus | null | undefined): JobStatus | null => value === 'partial failure' ? 'warning' : value != null ? value : null; diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_rules/machine_learning_rule.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_rules/machine_learning_rule.spec.ts index e420b970ad85f..6b88246cf5fb6 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_rules/machine_learning_rule.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_rules/machine_learning_rule.spec.ts @@ -129,8 +129,10 @@ describe('Detection rules, machine learning', () => { ); getDetails(RULE_TYPE_DETAILS).should('have.text', 'Machine Learning'); getDetails(TIMELINE_TEMPLATE_DETAILS).should('have.text', 'None'); - cy.get(MACHINE_LEARNING_JOB_STATUS).should('have.text', 'Stopped'); - cy.get(MACHINE_LEARNING_JOB_ID).should('have.text', machineLearningRule.machineLearningJob); + machineLearningRule.machineLearningJobs.forEach((machineLearningJob, jobIndex) => { + cy.get(MACHINE_LEARNING_JOB_STATUS).eq(jobIndex).should('have.text', 'Stopped'); + cy.get(MACHINE_LEARNING_JOB_ID).eq(jobIndex).should('have.text', machineLearningJob); + }); }); cy.get(SCHEDULE_DETAILS).within(() => { getDetails(RUNS_EVERY_DETAILS).should( diff --git a/x-pack/plugins/security_solution/cypress/objects/rule.ts b/x-pack/plugins/security_solution/cypress/objects/rule.ts index e85b3f45b4ea6..f083cc5da6f53 100644 --- a/x-pack/plugins/security_solution/cypress/objects/rule.ts +++ b/x-pack/plugins/security_solution/cypress/objects/rule.ts @@ -78,7 +78,7 @@ export interface ThreatIndicatorRule extends CustomRule { } export interface MachineLearningRule { - machineLearningJob: string; + machineLearningJobs: string[]; anomalyScoreThreshold: string; name: string; description: string; @@ -244,7 +244,7 @@ export const newThresholdRule: ThresholdRule = { }; export const machineLearningRule: MachineLearningRule = { - machineLearningJob: 'linux_anomalous_network_service', + machineLearningJobs: ['linux_anomalous_network_service', 'linux_anomalous_network_activity_ecs'], anomalyScoreThreshold: '20', name: 'New ML Rule Test', description: 'The new ML rule description.', diff --git a/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts b/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts index b2b7e434348b4..8b9d9b144910d 100644 --- a/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts +++ b/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts @@ -108,9 +108,10 @@ export const LOOK_BACK_INTERVAL = export const LOOK_BACK_TIME_TYPE = '[data-test-subj="detectionEngineStepScheduleRuleFrom"] [data-test-subj="timeType"]'; -export const MACHINE_LEARNING_DROPDOWN = '[data-test-subj="mlJobSelect"] button'; +export const MACHINE_LEARNING_DROPDOWN_INPUT = + '[data-test-subj="mlJobSelect"] [data-test-subj="comboBoxInput"]'; -export const MACHINE_LEARNING_LIST = '.euiContextMenuItem__text'; +export const MACHINE_LEARNING_DROPDOWN_ITEM = '.euiFilterSelectItem'; export const MACHINE_LEARNING_TYPE = '[data-test-subj="machineLearningRuleType"]'; diff --git a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts index 0c663a95a4bda..2b7308757f9f4 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts @@ -44,8 +44,7 @@ import { INVESTIGATION_NOTES_TEXTAREA, LOOK_BACK_INTERVAL, LOOK_BACK_TIME_TYPE, - MACHINE_LEARNING_DROPDOWN, - MACHINE_LEARNING_LIST, + MACHINE_LEARNING_DROPDOWN_INPUT, MACHINE_LEARNING_TYPE, MITRE_ATTACK_ADD_SUBTECHNIQUE_BUTTON, MITRE_ATTACK_ADD_TACTIC_BUTTON, @@ -86,6 +85,7 @@ import { THRESHOLD_FIELD_SELECTION, THRESHOLD_INPUT_AREA, THRESHOLD_TYPE, + MACHINE_LEARNING_DROPDOWN_ITEM, } from '../screens/create_new_rule'; import { TOAST_ERROR } from '../screens/shared'; import { SERVER_SIDE_EVENT_COUNT } from '../screens/timeline'; @@ -434,14 +434,17 @@ export const fillDefineIndicatorMatchRuleAndContinue = (rule: ThreatIndicatorRul }; export const fillDefineMachineLearningRuleAndContinue = (rule: MachineLearningRule) => { - cy.get(MACHINE_LEARNING_DROPDOWN).click({ force: true }); - cy.contains(MACHINE_LEARNING_LIST, rule.machineLearningJob).click(); + rule.machineLearningJobs.forEach((machineLearningJob) => { + cy.get(MACHINE_LEARNING_DROPDOWN_INPUT).click({ force: true }); + cy.contains(MACHINE_LEARNING_DROPDOWN_ITEM, machineLearningJob).click(); + cy.get(MACHINE_LEARNING_DROPDOWN_INPUT).type('{esc}'); + }); cy.get(ANOMALY_THRESHOLD_INPUT).type(`{selectall}${machineLearningRule.anomalyScoreThreshold}`, { force: true, }); getDefineContinueButton().should('exist').click({ force: true }); - cy.get(MACHINE_LEARNING_DROPDOWN).should('not.exist'); + cy.get(MACHINE_LEARNING_DROPDOWN_INPUT).should('not.exist'); }; export const goToDefineStepTab = () => { diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx index 07dcb2272748f..8b7fe572b9d24 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx @@ -140,10 +140,7 @@ export const AddExceptionModal = memo(function AddExceptionModal({ memoSignalIndexName ); - const memoMlJobIds = useMemo( - () => (maybeRule?.machine_learning_job_id != null ? [maybeRule.machine_learning_job_id] : []), - [maybeRule] - ); + const memoMlJobIds = useMemo(() => maybeRule?.machine_learning_job_id ?? [], [maybeRule]); const { loading: mlJobLoading, jobs } = useGetInstalledJob(memoMlJobIds); const memoRuleIndices = useMemo(() => { diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.tsx index 2c996c600261b..5ad3baabedb6a 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.tsx @@ -123,10 +123,7 @@ export const EditExceptionModal = memo(function EditExceptionModal({ memoSignalIndexName ); - const memoMlJobIds = useMemo( - () => (maybeRule?.machine_learning_job_id != null ? [maybeRule.machine_learning_job_id] : []), - [maybeRule] - ); + const memoMlJobIds = useMemo(() => maybeRule?.machine_learning_job_id ?? [], [maybeRule]); const { loading: mlJobLoading, jobs } = useGetInstalledJob(memoMlJobIds); const memoRuleIndices = useMemo(() => { diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/description_step/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/description_step/index.tsx index 4e330f7c0bd07..9c40853794743 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/description_step/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/description_step/index.tsx @@ -36,7 +36,7 @@ import { buildThresholdDescription, buildThreatMappingDescription, } from './helpers'; -import { buildMlJobDescription } from './ml_job_description'; +import { buildMlJobsDescription } from './ml_job_description'; import { buildActionsDescription } from './actions_description'; import { buildThrottleDescription } from './throttle_description'; import { Threats, Type } from '../../../../../common/detection_engine/schemas/common/schemas'; @@ -74,8 +74,8 @@ export const StepRuleDescriptionComponent = ({ if (key === 'machineLearningJobId') { return [ ...acc, - buildMlJobDescription( - get(key, data) as string, + buildMlJobsDescription( + get(key, data) as string[], (get(key, schema) as { label: string }).label ), ]; diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/description_step/ml_job_description.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/description_step/ml_job_description.tsx index d430a964ed79f..27afe847f7612 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/description_step/ml_job_description.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/description_step/ml_job_description.tsx @@ -104,7 +104,15 @@ const MlJobDescriptionComponent: React.FC<{ jobId: string }> = ({ jobId }) => { export const MlJobDescription = React.memo(MlJobDescriptionComponent); -export const buildMlJobDescription = (jobId: string, label: string): ListItems => ({ +const MlJobsDescription: React.FC<{ jobIds: string[] }> = ({ jobIds }) => ( + <> + {jobIds.map((jobId) => ( + + ))} + +); + +export const buildMlJobsDescription = (jobIds: string[], label: string): ListItems => ({ title: label, - description: , + description: , }); diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/index.tsx index cffdeeb491f2a..e5521492d3b5e 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/index.tsx @@ -8,12 +8,13 @@ import React, { useCallback, useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { + EuiComboBox, + EuiComboBoxOptionOption, EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiIcon, EuiLink, - EuiSuperSelect, EuiText, } from '@elastic/eui'; @@ -27,6 +28,13 @@ import { ENABLE_ML_JOB_WARNING, } from '../step_define_rule/translations'; +interface MlJobValue { + id: string; + description: string; +} + +type MlJobOption = EuiComboBoxOptionOption; + const HelpTextWarningContainer = styled.div` margin-top: 10px; `; @@ -65,9 +73,9 @@ const HelpText: React.FC<{ href: string; showEnableWarning: boolean }> = ({ ); -const JobDisplay: React.FC<{ title: string; description: string }> = ({ title, description }) => ( +const JobDisplay: React.FC = ({ id, description }) => ( <> - {title} + {id}

{description}

@@ -79,45 +87,44 @@ interface MlJobSelectProps { field: FieldHook; } +const renderJobOption = (option: MlJobOption) => ( + +); + export const MlJobSelect: React.FC = ({ describedByIds = [], field }) => { - const jobId = field.value as string; + const jobIds = field.value as string[]; const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); const { loading, jobs } = useSecurityJobs(false); const mlUrl = useKibana().services.application.getUrlForApp('ml'); - const handleJobChange = useCallback( - (machineLearningJobId: string) => { - field.setValue(machineLearningJobId); + const handleJobSelect = useCallback( + (selectedJobOptions: MlJobOption[]): void => { + const selectedJobIds = selectedJobOptions.map((option) => option.value!.id); + field.setValue(selectedJobIds); }, [field] ); - const placeholderOption = { - value: 'placeholder', - inputDisplay: ML_JOB_SELECT_PLACEHOLDER_TEXT, - dropdownDisplay: ML_JOB_SELECT_PLACEHOLDER_TEXT, - disabled: true, - }; const jobOptions = jobs.map((job) => ({ - value: job.id, - inputDisplay: job.id, - dropdownDisplay: , + value: { + id: job.id, + description: job.description, + }, + label: job.id, })); - const options = [placeholderOption, ...jobOptions]; + const selectedJobOptions = jobOptions.filter((option) => jobIds.includes(option.value.id)); - const isJobRunning = useMemo(() => { - // If the selected job is not found in the list, it means the placeholder is selected - // and so we don't want to show the warning, thus isJobRunning will be true when 'job == null' - const job = jobs.find(({ id }) => id === jobId); - return job == null || isJobStarted(job.jobState, job.datafeedState); - }, [jobs, jobId]); + const allJobsRunning = useMemo(() => { + const selectedJobs = jobs.filter(({ id }) => jobIds.includes(id)); + return selectedJobs.every((job) => isJobStarted(job.jobState, job.datafeedState)); + }, [jobs, jobIds]); return ( } + helpText={} isInvalid={isInvalid} error={errorMessage} data-test-subj="mlJobSelect" @@ -125,12 +132,14 @@ export const MlJobSelect: React.FC = ({ describedByIds = [], f > - diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx index 362dbb4bb722b..29342bd32298e 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx @@ -65,7 +65,7 @@ interface StepDefineRuleProps extends RuleStepProps { const stepDefineDefaultValue: DefineStepRule = { anomalyThreshold: 50, index: [], - machineLearningJobId: '', + machineLearningJobId: [], ruleType: 'query', threatIndex: [], queryBar: { diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/translations.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/translations.tsx index 8d83854f9250c..273c8cf28a18a 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/translations.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/translations.tsx @@ -68,7 +68,7 @@ export const ENABLE_ML_JOB_WARNING = i18n.translate( 'xpack.securitySolution.detectionEngine.createRule.stepDefineRule.mlEnableJobWarningTitle', { defaultMessage: - 'This ML job is not currently running. Please set this job to run via "ML job settings" before activating this rule.', + 'One or more selected ML jobs are not currently running. Please set these job(s) to run via "ML job settings" before activating this rule.', } ); diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/types.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/types.ts index b14297e34bd3e..2c3d6484aebdd 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/types.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/types.ts @@ -123,7 +123,7 @@ export const RuleSchema = t.intersection([ last_success_message: t.string, last_success_at: t.string, meta: MetaRule, - machine_learning_job_id: t.string, + machine_learning_job_id: t.array(t.string), output_index: t.string, query: t.string, rule_name_override, diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/__mocks__/mock.ts b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/__mocks__/mock.ts index ee2c2c48d22ee..821413b361701 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/__mocks__/mock.ts +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/__mocks__/mock.ts @@ -185,7 +185,7 @@ export const mockActionsStepRule = (enabled = false): ActionsStepRule => ({ export const mockDefineStepRule = (): DefineStepRule => ({ ruleType: 'query', anomalyThreshold: 50, - machineLearningJobId: '', + machineLearningJobId: [], index: ['filebeat-'], queryBar: mockQueryBar, threatQueryBar: mockQueryBar, diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts index fdb0513d7b708..98d3dadc7bbcb 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts @@ -249,14 +249,14 @@ describe('helpers', () => { ...mockData, ruleType: 'machine_learning', anomalyThreshold: 44, - machineLearningJobId: 'some_jobert_id', + machineLearningJobId: ['some_jobert_id'], }; const result = formatDefineStepData(mockStepData); const expected: DefineStepRuleJson = { type: 'machine_learning', anomaly_threshold: 44, - machine_learning_job_id: 'some_jobert_id', + machine_learning_job_id: ['some_jobert_id'], timeline_id: '86aa74d0-2136-11ea-9864-ebc8cc1cb8c2', timeline_title: 'Titled timeline', }; diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx index 9c2e7751753ee..4c3e5b18d4c1b 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx @@ -34,7 +34,7 @@ import { import { getThreatMock } from '../../../../../common/detection_engine/schemas/types/threat.mock'; describe('rule helpers', () => { - // @ts-ignore + // @ts-expect-error moment.suppressDeprecationWarnings = true; describe('getStepsData', () => { test('returns object with about, define, schedule and actions step properties formatted', () => { @@ -51,7 +51,7 @@ describe('rule helpers', () => { ruleType: 'saved_query', anomalyThreshold: 50, index: ['auditbeat-*'], - machineLearningJobId: '', + machineLearningJobId: [], queryBar: { query: { query: 'user.name: root or user.name: admin', @@ -204,7 +204,7 @@ describe('rule helpers', () => { const expected = { ruleType: 'saved_query', anomalyThreshold: 50, - machineLearningJobId: '', + machineLearningJobId: [], index: ['auditbeat-*'], queryBar: { query: { @@ -246,7 +246,7 @@ describe('rule helpers', () => { const expected = { ruleType: 'saved_query', anomalyThreshold: 50, - machineLearningJobId: '', + machineLearningJobId: [], index: ['auditbeat-*'], queryBar: { query: { diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.tsx index 9bc3ab9103b42..03688264bcf46 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.tsx @@ -81,7 +81,7 @@ export const getActionsStepsData = ( export const getDefineStepsData = (rule: Rule): DefineStepRule => ({ ruleType: rule.type, anomalyThreshold: rule.anomaly_threshold ?? 50, - machineLearningJobId: rule.machine_learning_job_id ?? '', + machineLearningJobId: rule.machine_learning_job_id ?? [], index: rule.index ?? [], threatIndex: rule.threat_index ?? [], threatQueryBar: { diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/types.ts b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/types.ts index 8eb26073e52d2..58994c5a5f556 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/types.ts +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/types.ts @@ -126,7 +126,7 @@ export interface AboutStepRiskScore { export interface DefineStepRule { anomalyThreshold: number; index: string[]; - machineLearningJobId: string; + machineLearningJobId: string[]; queryBar: FieldValueQueryBar; ruleType: Type; timeline: FieldValueTimeline; @@ -153,7 +153,7 @@ export interface DefineStepRuleJson { anomaly_threshold?: number; index?: string[]; filters?: Filter[]; - machine_learning_job_id?: string; + machine_learning_job_id?: string[]; saved_id?: string; query?: string; language?: string; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.test.ts index b83dad92d43b5..b6dd8a3fe0431 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.test.ts @@ -76,7 +76,7 @@ describe('patch_rules_bulk', () => { data: expect.objectContaining({ params: expect.objectContaining({ anomalyThreshold: 4, - machineLearningJobId: 'some_job_id', + machineLearningJobId: ['some_job_id'], }), }), }) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.test.ts index 2fa72ae2a097e..9920ec5229a02 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.test.ts @@ -105,7 +105,7 @@ describe('patch_rules', () => { data: expect.objectContaining({ params: expect.objectContaining({ anomalyThreshold: 4, - machineLearningJobId: 'some_job_id', + machineLearningJobId: ['some_job_id'], }), }), }) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.test.ts index ffa699daf9c95..b841507bc7a6b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.test.ts @@ -87,14 +87,14 @@ describe('utils', () => { test('transforms ML Rule fields', () => { const mlRule = getAlertMock(getMlRuleParams()); mlRule.params.anomalyThreshold = 55; - mlRule.params.machineLearningJobId = 'some_job_id'; + mlRule.params.machineLearningJobId = ['some_job_id']; mlRule.params.type = 'machine_learning'; const rule = transformAlertToRule(mlRule); expect(rule).toEqual( expect.objectContaining({ anomaly_threshold: 55, - machine_learning_job_id: 'some_job_id', + machine_learning_job_id: ['some_job_id'], type: 'machine_learning', }) ); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.test.ts index bf114518533bc..c719412d27e4d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.test.ts @@ -9,7 +9,7 @@ import { createRules } from './create_rules'; import { getCreateMlRulesOptionsMock } from './create_rules.mock'; describe('createRules', () => { - it('calls the alertsClient with ML params', async () => { + it('calls the alertsClient with legacy ML params', async () => { const ruleOptions = getCreateMlRulesOptionsMock(); await createRules(ruleOptions); expect(ruleOptions.alertsClient.create).toHaveBeenCalledWith( @@ -17,7 +17,25 @@ describe('createRules', () => { data: expect.objectContaining({ params: expect.objectContaining({ anomalyThreshold: 55, - machineLearningJobId: 'new_job_id', + machineLearningJobId: ['new_job_id'], + }), + }), + }) + ); + }); + + it('calls the alertsClient with ML params', async () => { + const ruleOptions = { + ...getCreateMlRulesOptionsMock(), + machineLearningJobId: ['new_job_1', 'new_job_2'], + }; + await createRules(ruleOptions); + expect(ruleOptions.alertsClient.create).toHaveBeenCalledWith( + expect.objectContaining({ + data: expect.objectContaining({ + params: expect.objectContaining({ + anomalyThreshold: 55, + machineLearningJobId: ['new_job_1', 'new_job_2'], }), }), }) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.ts index 2a3d83f4baca7..db039bbc31390 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.ts @@ -5,7 +5,10 @@ * 2.0. */ -import { normalizeThresholdObject } from '../../../../common/detection_engine/utils'; +import { + normalizeMachineLearningJobIds, + normalizeThresholdObject, +} from '../../../../common/detection_engine/utils'; import { transformRuleToAlertAction } from '../../../../common/detection_engine/transform_actions'; import { SanitizedAlert } from '../../../../../alerting/common'; import { SERVER_APP_ID, SIGNALS_ID } from '../../../../common/constants'; @@ -89,7 +92,9 @@ export const createRules = async ({ timelineId, timelineTitle, meta, - machineLearningJobId, + machineLearningJobId: machineLearningJobId + ? normalizeMachineLearningJobIds(machineLearningJobId) + : undefined, filters, maxSignals, riskScore, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts index 65466b46f8d5e..e275a02b2b0c1 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts @@ -41,7 +41,7 @@ describe('patchRules', () => { ); }); - it('calls the alertsClient with ML params', async () => { + it('calls the alertsClient with legacy ML params', async () => { const rulesOptionsMock = getPatchMlRulesOptionsMock(); const ruleOptions: PatchRulesOptions = { ...rulesOptionsMock, @@ -56,7 +56,30 @@ describe('patchRules', () => { data: expect.objectContaining({ params: expect.objectContaining({ anomalyThreshold: 55, - machineLearningJobId: 'new_job_id', + machineLearningJobId: ['new_job_id'], + }), + }), + }) + ); + }); + + it('calls the alertsClient with new ML params', async () => { + const rulesOptionsMock = getPatchMlRulesOptionsMock(); + const ruleOptions: PatchRulesOptions = { + ...rulesOptionsMock, + machineLearningJobId: ['new_job_1', 'new_job_2'], + enabled: true, + }; + if (ruleOptions.rule != null) { + ruleOptions.rule.enabled = false; + } + await patchRules(ruleOptions); + expect(ruleOptions.alertsClient.update).toHaveBeenCalledWith( + expect.objectContaining({ + data: expect.objectContaining({ + params: expect.objectContaining({ + anomalyThreshold: 55, + machineLearningJobId: ['new_job_1', 'new_job_2'], }), }), }) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts index bf769e46ab7bd..bccd1f2fb73ca 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts @@ -14,7 +14,10 @@ import { addTags } from './add_tags'; import { calculateVersion, calculateName, calculateInterval, removeUndefined } from './utils'; import { ruleStatusSavedObjectsClientFactory } from '../signals/rule_status_saved_objects_client'; import { internalRuleUpdate, RuleParams } from '../schemas/rule_schemas'; -import { normalizeThresholdObject } from '../../../../common/detection_engine/utils'; +import { + normalizeMachineLearningJobIds, + normalizeThresholdObject, +} from '../../../../common/detection_engine/utils'; class PatchError extends Error { public readonly statusCode: number; @@ -167,7 +170,9 @@ export const patchRules = async ({ version: calculatedVersion, exceptionsList, anomalyThreshold, - machineLearningJobId, + machineLearningJobId: machineLearningJobId + ? normalizeMachineLearningJobIds(machineLearningJobId) + : undefined, } ); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts index 65cf1d2f723c6..ee7ecaadfd95c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts @@ -7,7 +7,10 @@ import uuid from 'uuid'; import { SavedObject } from 'kibana/server'; -import { normalizeThresholdObject } from '../../../../common/detection_engine/utils'; +import { + normalizeMachineLearningJobIds, + normalizeThresholdObject, +} from '../../../../common/detection_engine/utils'; import { InternalRuleCreate, RuleParams, @@ -103,7 +106,7 @@ export const typeSpecificSnakeToCamel = (params: CreateTypeSpecific): TypeSpecif return { type: params.type, anomalyThreshold: params.anomaly_threshold, - machineLearningJobId: params.machine_learning_job_id, + machineLearningJobId: normalizeMachineLearningJobIds(params.machine_learning_job_id), }; } default: { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.mock.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.mock.ts index 8c5825325bd2e..846a4e26410a3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.mock.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.mock.ts @@ -88,7 +88,7 @@ export const getMlRuleParams = (): MachineLearningRuleParams => { ...getBaseRuleParams(), type: 'machine_learning', anomalyThreshold: 42, - machineLearningJobId: 'my-job', + machineLearningJobId: ['my-job'], }; }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.ts index cd2b5d0b9eda7..79b862d6419c2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.ts @@ -36,7 +36,6 @@ import { query, queryOrUndefined, filtersOrUndefined, - machine_learning_job_id, max_signals, risk_score, risk_score_mapping, @@ -62,6 +61,7 @@ import { updated_at, } from '../../../../common/detection_engine/schemas/common/schemas'; import { SIGNALS_ID, SERVER_APP_ID } from '../../../../common/constants'; +import { machine_learning_job_id_normalized } from '../../../../common/detection_engine/schemas/types/normalized_ml_job_id'; const nonEqlLanguages = t.keyof({ kuery: null, lucene: null }); export const baseRuleParams = t.exact( @@ -167,7 +167,7 @@ export type ThresholdRuleParams = t.TypeOf; const machineLearningSpecificRuleParams = t.type({ type: t.literal('machine_learning'), anomalyThreshold: anomaly_threshold, - machineLearningJobId: machine_learning_job_id, + machineLearningJobId: machine_learning_job_id_normalized, }); export const machineLearningRuleParams = t.intersection([ baseRuleParams, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.test.ts index a3db2e5cbfd99..e157750a7d51b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.test.ts @@ -15,52 +15,21 @@ import { buildRuleMessageFactory } from '../rule_messages'; import { getListClientMock } from '../../../../../../lists/server/services/lists/list_client.mock'; import { findMlSignals } from '../find_ml_signals'; import { bulkCreateMlSignals } from '../bulk_create_ml_signals'; +import { mlPluginServerMock } from '../../../../../../ml/server/mocks'; +import { sampleRuleSO } from '../__mocks__/es_results'; +import { getRuleStatusServiceMock } from '../rule_status_service.mock'; jest.mock('../find_ml_signals'); jest.mock('../bulk_create_ml_signals'); describe('ml_executor', () => { - const jobsSummaryMock = jest.fn(); - const mlMock = { - mlClient: { - callAsInternalUser: jest.fn(), - close: jest.fn(), - asScoped: jest.fn(), - }, - jobServiceProvider: jest.fn().mockReturnValue({ - jobsSummary: jobsSummaryMock, - }), - anomalyDetectorsProvider: jest.fn(), - mlSystemProvider: jest.fn(), - modulesProvider: jest.fn(), - resultsServiceProvider: jest.fn(), - alertingServiceProvider: jest.fn(), - }; + let jobsSummaryMock: jest.Mock; + let mlMock: ReturnType; + let ruleStatusService: ReturnType; const exceptionItems = [getExceptionListItemSchemaMock()]; let logger: ReturnType; let alertServices: AlertServicesMock; - let ruleStatusService: Record; - const mlSO = { - id: '04128c15-0d1b-4716-a4c5-46997ac7f3bd', - type: 'alert', - version: '1', - updated_at: '2020-03-27T22:55:59.577Z', - attributes: { - actions: [], - enabled: true, - name: 'rule-name', - tags: ['some fake tag 1', 'some fake tag 2'], - createdBy: 'sample user', - createdAt: '2020-03-27T22:55:59.577Z', - updatedBy: 'sample user', - schedule: { - interval: '5m', - }, - throttle: 'no_actions', - params: getMlRuleParams(), - }, - references: [], - }; + const mlSO = sampleRuleSO(getMlRuleParams()); const buildRuleMessage = buildRuleMessageFactory({ id: mlSO.id, ruleId: mlSO.attributes.params.ruleId, @@ -69,15 +38,14 @@ describe('ml_executor', () => { }); beforeEach(() => { + jobsSummaryMock = jest.fn(); alertServices = alertsMock.createAlertServices(); logger = loggingSystemMock.createLogger(); - ruleStatusService = { - success: jest.fn(), - find: jest.fn(), - goingToRun: jest.fn(), - error: jest.fn(), - partialFailure: jest.fn(), - }; + mlMock = mlPluginServerMock.createSetupContract(); + mlMock.jobServiceProvider.mockReturnValue({ + jobsSummary: jobsSummaryMock, + }); + ruleStatusService = getRuleStatusServiceMock(); (findMlSignals as jest.Mock).mockResolvedValue({ _shards: {}, hits: { @@ -98,7 +66,7 @@ describe('ml_executor', () => { rule: mlSO, ml: undefined, exceptionItems, - ruleStatusService: (ruleStatusService as unknown) as RuleStatusService, + ruleStatusService, services: alertServices, logger, refresh: false, @@ -108,13 +76,13 @@ describe('ml_executor', () => { ).rejects.toThrow('ML plugin unavailable during rule execution'); }); - it('should throw an error if Machine learning job summary was null', async () => { + it('should record a partial failure if Machine learning job summary was null', async () => { jobsSummaryMock.mockResolvedValue([]); await mlExecutor({ rule: mlSO, ml: mlMock, exceptionItems, - ruleStatusService: (ruleStatusService as unknown) as RuleStatusService, + ruleStatusService, services: alertServices, logger, refresh: false, @@ -122,14 +90,14 @@ describe('ml_executor', () => { listClient: getListClientMock(), }); expect(logger.warn).toHaveBeenCalled(); - expect(logger.warn.mock.calls[0][0]).toContain('Machine learning job is not started'); - expect(ruleStatusService.error).toHaveBeenCalled(); - expect(ruleStatusService.error.mock.calls[0][0]).toContain( - 'Machine learning job is not started' + expect(logger.warn.mock.calls[0][0]).toContain('Machine learning job(s) are not started'); + expect(ruleStatusService.partialFailure).toHaveBeenCalled(); + expect(ruleStatusService.partialFailure.mock.calls[0][0]).toContain( + 'Machine learning job(s) are not started' ); }); - it('should log an error if Machine learning job was not started', async () => { + it('should record a partial failure if Machine learning job was not started', async () => { jobsSummaryMock.mockResolvedValue([ { id: 'some_job_id', @@ -150,10 +118,10 @@ describe('ml_executor', () => { listClient: getListClientMock(), }); expect(logger.warn).toHaveBeenCalled(); - expect(logger.warn.mock.calls[0][0]).toContain('Machine learning job is not started'); - expect(ruleStatusService.error).toHaveBeenCalled(); - expect(ruleStatusService.error.mock.calls[0][0]).toContain( - 'Machine learning job is not started' + expect(logger.warn.mock.calls[0][0]).toContain('Machine learning job(s) are not started'); + expect(ruleStatusService.partialFailure).toHaveBeenCalled(); + expect(ruleStatusService.partialFailure.mock.calls[0][0]).toContain( + 'Machine learning job(s) are not started' ); }); }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts index 338ad2dbe9d40..928767e922d67 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts @@ -58,20 +58,28 @@ export const mlExecutor = async ({ const fakeRequest = {} as KibanaRequest; const summaryJobs = await ml .jobServiceProvider(fakeRequest, services.savedObjectsClient) - .jobsSummary([ruleParams.machineLearningJobId]); - const jobSummary = summaryJobs.find((job) => job.id === ruleParams.machineLearningJobId); + .jobsSummary(ruleParams.machineLearningJobId); + const jobSummaries = summaryJobs.filter((job) => + ruleParams.machineLearningJobId.includes(job.id) + ); - if (jobSummary == null || !isJobStarted(jobSummary.jobState, jobSummary.datafeedState)) { + if ( + jobSummaries.length < 1 || + jobSummaries.some((job) => !isJobStarted(job.jobState, job.datafeedState)) + ) { const errorMessage = buildRuleMessage( - 'Machine learning job is not started:', - `job id: "${ruleParams.machineLearningJobId}"`, - `job status: "${jobSummary?.jobState}"`, - `datafeed status: "${jobSummary?.datafeedState}"` + 'Machine learning job(s) are not started:', + ...jobSummaries.map((job) => + [ + `job id: "${job.id}"`, + `job status: "${job.jobState}"`, + `datafeed status: "${job.datafeedState}"`, + ].join(', ') + ) ); logger.warn(errorMessage); result.warning = true; - // TODO: change this to partialFailure since we don't immediately exit rule function and still do actions at the end? - await ruleStatusService.error(errorMessage); + await ruleStatusService.partialFailure(errorMessage); } const anomalyResults = await findMlSignals({ @@ -80,7 +88,7 @@ export const mlExecutor = async ({ // currently unused by the mlAnomalySearch function. request: ({} as unknown) as KibanaRequest, savedObjectsClient: services.savedObjectsClient, - jobId: ruleParams.machineLearningJobId, + jobIds: ruleParams.machineLearningJobId, anomalyThreshold: ruleParams.anomalyThreshold, from: ruleParams.from, to: ruleParams.to, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/find_ml_signals.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/find_ml_signals.ts index 12fe32e15d734..6870ae2d80bbf 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/find_ml_signals.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/find_ml_signals.ts @@ -16,7 +16,7 @@ export const findMlSignals = async ({ ml, request, savedObjectsClient, - jobId, + jobIds, anomalyThreshold, from, to, @@ -25,7 +25,7 @@ export const findMlSignals = async ({ ml: MlPluginSetup; request: KibanaRequest; savedObjectsClient: SavedObjectsClientContract; - jobId: string; + jobIds: string[]; anomalyThreshold: number; from: string; to: string; @@ -33,7 +33,7 @@ export const findMlSignals = async ({ }): Promise => { const { mlAnomalySearch } = ml.mlSystemProvider(request, savedObjectsClient); const params = { - jobIds: [jobId], + jobIds, threshold: anomalyThreshold, earliestMs: dateMath.parse(from)?.valueOf() ?? 0, latestMs: dateMath.parse(to)?.valueOf() ?? 0, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/rule_status_service.mock.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/rule_status_service.mock.ts index 04f2b6ff799da..1ecdf09880873 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/rule_status_service.mock.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/rule_status_service.mock.ts @@ -5,37 +5,11 @@ * 2.0. */ -import { SavedObjectsClientContract } from '../../../../../../../src/core/server'; -import { RuleStatusSavedObjectsClient } from './rule_status_saved_objects_client'; import { RuleStatusService } from './rule_status_service'; -export type RuleStatusServiceMock = jest.Mocked; - -export const ruleStatusServiceFactoryMock = async ({ - alertId, - ruleStatusClient, -}: { - alertId: string; - ruleStatusClient: RuleStatusSavedObjectsClient; -}): Promise => { - return { - goingToRun: jest.fn(), - - success: jest.fn(), - - partialFailure: jest.fn(), - - error: jest.fn(), - }; -}; - -export type RuleStatusSavedObjectsClientMock = jest.Mocked; - -export const ruleStatusSavedObjectsClientFactory = ( - savedObjectsClient: SavedObjectsClientContract -): RuleStatusSavedObjectsClientMock => ({ - find: jest.fn(), - create: jest.fn(), - update: jest.fn(), - delete: jest.fn(), +export const getRuleStatusServiceMock = (): jest.Mocked => ({ + goingToRun: jest.fn(), + success: jest.fn(), + partialFailure: jest.fn(), + error: jest.fn(), }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts index 419141d98d15a..637826a943480 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts @@ -330,7 +330,7 @@ export const signalRulesAlertType = ({ `[+] Finished indexing ${result.createdSignalsCount} signals into ${outputIndex}` ) ); - if (!hasError && !wroteWarningStatus) { + if (!hasError && !wroteWarningStatus && !result.warning) { await ruleStatusService.success('succeeded', { bulkCreateTimeDurations: result.bulkCreateTimes, searchAfterTimeDurations: result.searchAfterTimes, diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_rules.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_rules.ts index 29eb84cddcb0b..5ec3374598776 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_rules.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_rules.ts @@ -224,6 +224,21 @@ export default ({ getService }: FtrProviderContext) => { expect(bodyToCompare).to.eql(getSimpleRuleOutputWithoutRuleId()); }); + it('creates a single Machine Learning rule from a legacy ML Rule format', async () => { + const legacyMlRule = { + ...getSimpleMlRule(), + machine_learning_job_id: 'some_job_id', + }; + const { body } = await supertest + .post(DETECTION_ENGINE_RULES_URL) + .set('kbn-xsrf', 'true') + .send(legacyMlRule) + .expect(200); + + const bodyToCompare = removeServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getSimpleMlRuleOutput()); + }); + it('should create a single Machine Learning rule', async () => { const { body } = await supertest .post(DETECTION_ENGINE_RULES_URL) diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/patch_rules.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/patch_rules.ts index bc42ef92e6b2c..d20eb0492bbc4 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/patch_rules.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/patch_rules.ts @@ -55,6 +55,22 @@ export default ({ getService }: FtrProviderContext) => { expect(bodyToCompare).to.eql(outputRule); }); + it("should patch a machine_learning rule's job ID if in a legacy format", async () => { + await createRule(supertest, getSimpleMlRule('rule-1')); + + // patch a simple rule's name + const { body } = await supertest + .patch(DETECTION_ENGINE_RULES_URL) + .set('kbn-xsrf', 'true') + .send({ rule_id: 'rule-1', machine_learning_job_id: 'some_job_id' }) + .expect(200); + + const outputRule = getSimpleMlRuleOutput(); + outputRule.version = 2; + const bodyToCompare = removeServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(outputRule); + }); + it('should patch a single rule property of name using a rule_id of type "machine learning"', async () => { await createRule(supertest, getSimpleMlRule('rule-1')); diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules.ts index eebf4305a3ac1..5a4a04f71b3d5 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules.ts @@ -62,6 +62,28 @@ export default ({ getService }: FtrProviderContext) => { expect(bodyToCompare).to.eql(outputRule); }); + it("should update a rule's machine learning job ID if given a legacy job ID format", async () => { + await createRule(supertest, getSimpleMlRule('rule-1')); + + // update rule's machine_learning_job_id + const updatedRule = getSimpleMlRuleUpdate('rule-1'); + // @ts-expect-error updatedRule is the full union type here and thus is not narrowed to our ML params + updatedRule.machine_learning_job_id = 'legacy_job_id'; + delete updatedRule.id; + + const { body } = await supertest + .put(DETECTION_ENGINE_RULES_URL) + .set('kbn-xsrf', 'true') + .send(updatedRule) + .expect(200); + + const outputRule = getSimpleMlRuleOutput(); + outputRule.machine_learning_job_id = ['legacy_job_id']; + outputRule.version = 2; + const bodyToCompare = removeServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(outputRule); + }); + it('should update a single rule property of name using a rule_id with a machine learning job', async () => { await createRule(supertest, getSimpleMlRule('rule-1')); diff --git a/x-pack/test/detection_engine_api_integration/utils.ts b/x-pack/test/detection_engine_api_integration/utils.ts index a9c128ee87703..d821b57faf225 100644 --- a/x-pack/test/detection_engine_api_integration/utils.ts +++ b/x-pack/test/detection_engine_api_integration/utils.ts @@ -172,7 +172,7 @@ export const getSimpleMlRule = (ruleId = 'rule-1', enabled = false): CreateRules risk_score: 1, rule_id: ruleId, severity: 'high', - machine_learning_job_id: 'some_job_id', + machine_learning_job_id: ['some_job_id'], type: 'machine_learning', }); @@ -189,7 +189,7 @@ export const getSimpleMlRuleUpdate = (ruleId = 'rule-1', enabled = false): Updat risk_score: 1, rule_id: ruleId, severity: 'high', - machine_learning_job_id: 'some_job_id', + machine_learning_job_id: ['some_job_id'], type: 'machine_learning', }); @@ -344,7 +344,7 @@ export const getSimpleMlRuleOutput = (ruleId = 'rule-1'): Partial = name: 'Simple ML Rule', description: 'Simple Machine Learning Rule', anomaly_threshold: 44, - machine_learning_job_id: 'some_job_id', + machine_learning_job_id: ['some_job_id'], type: 'machine_learning', }; }; From 347882f01a3accfc01bd714dc4de4e8adbf52f26 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Thu, 15 Apr 2021 22:05:14 -0700 Subject: [PATCH 48/68] skip flaky suite (#91360) --- x-pack/test/api_integration/apis/security_solution/tls.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/api_integration/apis/security_solution/tls.ts b/x-pack/test/api_integration/apis/security_solution/tls.ts index eadf7d2aac7ae..a8e0517e6ccdb 100644 --- a/x-pack/test/api_integration/apis/security_solution/tls.ts +++ b/x-pack/test/api_integration/apis/security_solution/tls.ts @@ -84,7 +84,8 @@ export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const supertest = getService('supertest'); - describe('Tls Test with Packetbeat', () => { + // Failing: See https://github.com/elastic/kibana/issues/91360 + describe.skip('Tls Test with Packetbeat', () => { describe('Tls Test', () => { before(() => esArchiver.load('packetbeat/tls')); after(() => esArchiver.unload('packetbeat/tls')); From 9987e3d73b8632f0e4c70b52286ea7be0353e555 Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 15 Apr 2021 22:12:23 -0700 Subject: [PATCH 49/68] [kbnClient] fix basePath handling and export reponse type (#97277) Co-authored-by: spalger Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../src/kbn_client/kbn_client_import_export.ts | 1 + .../src/kbn_client/kbn_client_requester.ts | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts b/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts index bb5b99fdc4439..7f4d0160923bf 100644 --- a/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts +++ b/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts @@ -115,6 +115,7 @@ export class KbnClientImportExport { excludeExportDetails: true, includeReferencesDeep: true, }, + responseType: 'text', }); if (typeof resp.data !== 'string') { diff --git a/packages/kbn-test/src/kbn_client/kbn_client_requester.ts b/packages/kbn-test/src/kbn_client/kbn_client_requester.ts index 2e1575aee1897..31cd3a6899568 100644 --- a/packages/kbn-test/src/kbn_client/kbn_client_requester.ts +++ b/packages/kbn-test/src/kbn_client/kbn_client_requester.ts @@ -10,7 +10,7 @@ import Url from 'url'; import Https from 'https'; import Qs from 'querystring'; -import Axios, { AxiosResponse } from 'axios'; +import Axios, { AxiosResponse, ResponseType } from 'axios'; import { ToolingLog, isAxiosRequestError, isAxiosResponseError } from '@kbn/dev-utils'; const isConcliftOnGetError = (error: any) => { @@ -53,6 +53,7 @@ export interface ReqOptions { body?: any; retries?: number; headers?: Record; + responseType?: ResponseType; } const delay = (ms: number) => @@ -84,11 +85,16 @@ export class KbnClientRequester { } public resolveUrl(relativeUrl: string = '/') { - return Url.resolve(this.pickUrl(), relativeUrl); + let baseUrl = this.pickUrl(); + if (!baseUrl.endsWith('/')) { + baseUrl += '/'; + } + const relative = relativeUrl.startsWith('/') ? relativeUrl.slice(1) : relativeUrl; + return Url.resolve(baseUrl, relative); } async request(options: ReqOptions): Promise> { - const url = Url.resolve(this.pickUrl(), options.path); + const url = this.resolveUrl(options.path); const description = options.description || `${options.method} ${url}`; let attempt = 0; const maxAttempts = options.retries ?? DEFAULT_MAX_ATTEMPTS; @@ -107,6 +113,9 @@ export class KbnClientRequester { 'kbn-xsrf': 'kbn-client', }, httpsAgent: this.httpsAgent, + responseType: options.responseType, + // work around https://github.com/axios/axios/issues/2791 + transformResponse: options.responseType === 'text' ? [(x) => x] : undefined, paramsSerializer: (params) => Qs.stringify(params), }); From 15e8ca11618e4af082120a498f4bb8ac4c3bc267 Mon Sep 17 00:00:00 2001 From: Michael Dokolin Date: Fri, 16 Apr 2021 10:09:34 +0200 Subject: [PATCH 50/68] [Reporting] Remove legacy elasticsearch client usage from the reporting plugin (#97184) --- x-pack/plugins/reporting/common/types.ts | 4 +- x-pack/plugins/reporting/server/core.ts | 7 - .../export_types/csv/execute_job.test.ts | 541 ++++++++++-------- .../server/export_types/csv/execute_job.ts | 9 +- .../csv/generate_csv/hit_iterator.test.ts | 59 +- .../csv/generate_csv/hit_iterator.ts | 39 +- .../export_types/csv/generate_csv/index.ts | 8 +- .../png/execute_job/index.test.ts | 10 - .../printable_pdf/execute_job/index.test.ts | 10 - .../reporting/server/lib/store/report.ts | 4 +- .../reporting/server/lib/store/store.test.ts | 79 ++- .../reporting/server/lib/store/store.ts | 186 +++--- x-pack/plugins/reporting/server/plugin.ts | 3 +- .../server/routes/diagnostic/config.test.ts | 23 +- .../server/routes/diagnostic/config.ts | 10 +- .../server/routes/generation.test.ts | 17 +- .../reporting/server/routes/jobs.test.ts | 118 ++-- .../reporting/server/routes/lib/jobs_query.ts | 153 +++-- .../create_mock_reportingplugin.ts | 3 +- 19 files changed, 638 insertions(+), 645 deletions(-) diff --git a/x-pack/plugins/reporting/common/types.ts b/x-pack/plugins/reporting/common/types.ts index 5e20381e35898..2148cf983d889 100644 --- a/x-pack/plugins/reporting/common/types.ts +++ b/x-pack/plugins/reporting/common/types.ts @@ -40,8 +40,8 @@ export interface LayoutParams { export interface ReportDocumentHead { _id: string; _index: string; - _seq_no: unknown; - _primary_term: unknown; + _seq_no: number; + _primary_term: number; } export interface TaskRunResult { diff --git a/x-pack/plugins/reporting/server/core.ts b/x-pack/plugins/reporting/server/core.ts index b0f0a8c8c7ece..03c76941a6e99 100644 --- a/x-pack/plugins/reporting/server/core.ts +++ b/x-pack/plugins/reporting/server/core.ts @@ -10,7 +10,6 @@ import * as Rx from 'rxjs'; import { first, map, take } from 'rxjs/operators'; import { BasePath, - ElasticsearchServiceSetup, IClusterClient, KibanaRequest, PluginInitializerContext, @@ -38,7 +37,6 @@ export interface ReportingInternalSetup { basePath: Pick; router: ReportingPluginRouter; features: FeaturesPluginSetup; - elasticsearch: ElasticsearchServiceSetup; licensing: LicensingPluginSetup; security?: SecurityPluginSetup; spaces?: SpacesPluginSetup; @@ -212,11 +210,6 @@ export class ReportingCore { return this.pluginSetupDeps; } - // NOTE: Uses the Legacy API - public getElasticsearchService() { - return this.getPluginSetupDeps().elasticsearch; - } - private async getSavedObjectsClient(request: KibanaRequest) { const { savedObjects } = await this.getPluginStartDeps(); return savedObjects.getScopedClient(request) as SavedObjectsClientContract; diff --git a/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts b/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts index c0235ee56e00f..f63c07e51dd03 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts @@ -5,8 +5,9 @@ * 2.0. */ +import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; import nodeCrypto from '@elastic/node-crypto'; -import { ElasticsearchServiceSetup, IUiSettingsClient } from 'kibana/server'; +import { ElasticsearchClient, IUiSettingsClient } from 'kibana/server'; import moment from 'moment'; // @ts-ignore import Puid from 'puid'; @@ -50,20 +51,12 @@ describe('CSV Execute Job', function () { let defaultElasticsearchResponse: any; let encryptedHeaders: any; - let clusterStub: any; let configGetStub: any; + let mockEsClient: DeeplyMockedKeys; let mockReportingConfig: ReportingConfig; let mockReportingCore: ReportingCore; - let callAsCurrentUserStub: any; let cancellationToken: any; - const mockElasticsearch = { - legacy: { - client: { - asScoped: () => clusterStub, - }, - }, - }; const mockUiSettingsClient = { get: sinon.stub(), }; @@ -85,10 +78,10 @@ describe('CSV Execute Job', function () { mockReportingCore = await createMockReportingCore(mockReportingConfig); mockReportingCore.getUiSettingsServiceFactory = () => Promise.resolve((mockUiSettingsClient as unknown) as IUiSettingsClient); - mockReportingCore.getElasticsearchService = () => - mockElasticsearch as ElasticsearchServiceSetup; mockReportingCore.setConfig(mockReportingConfig); + mockEsClient = (await mockReportingCore.getEsClient()).asScoped({} as any) + .asCurrentUser as typeof mockEsClient; cancellationToken = new CancellationToken(); defaultElasticsearchResponse = { @@ -97,14 +90,9 @@ describe('CSV Execute Job', function () { }, _scroll_id: 'defaultScrollId', }; - clusterStub = { - callAsCurrentUser() {}, - }; - - callAsCurrentUserStub = sinon - .stub(clusterStub, 'callAsCurrentUser') - .resolves(defaultElasticsearchResponse); + mockEsClient.search.mockResolvedValue({ body: defaultElasticsearchResponse } as any); + mockEsClient.scroll.mockResolvedValue({ body: defaultElasticsearchResponse } as any); mockUiSettingsClient.get.withArgs(CSV_SEPARATOR_SETTING).returns(','); mockUiSettingsClient.get.withArgs(CSV_QUOTE_VALUES_SETTING).returns(true); @@ -127,7 +115,7 @@ describe('CSV Execute Job', function () { }); describe('basic Elasticsearch call behavior', function () { - it('should decrypt encrypted headers and pass to callAsCurrentUser', async function () { + it('should decrypt encrypted headers and pass to the elasticsearch client', async function () { const runTask = runTaskFnFactory(mockReportingCore, mockLogger); await runTask( 'job456', @@ -138,8 +126,7 @@ describe('CSV Execute Job', function () { }), cancellationToken ); - expect(callAsCurrentUserStub.called).toBe(true); - expect(callAsCurrentUserStub.firstCall.args[0]).toEqual('search'); + expect(mockEsClient.search).toHaveBeenCalled(); }); it('should pass the index and body to execute the initial search', async function () { @@ -160,21 +147,22 @@ describe('CSV Execute Job', function () { await runTask('job777', job, cancellationToken); - const searchCall = callAsCurrentUserStub.firstCall; - expect(searchCall.args[0]).toBe('search'); - expect(searchCall.args[1].index).toBe(index); - expect(searchCall.args[1].body).toBe(body); + expect(mockEsClient.search).toHaveBeenCalledWith(expect.objectContaining({ body, index })); }); it('should pass the scrollId from the initial search to the subsequent scroll', async function () { const scrollId = getRandomScrollId(); - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{}], + + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: scrollId, }, - _scroll_id: scrollId, - }); - callAsCurrentUserStub.onSecondCall().resolves(defaultElasticsearchResponse); + } as any); + mockEsClient.scroll.mockResolvedValue({ body: defaultElasticsearchResponse } as any); + const runTask = runTaskFnFactory(mockReportingCore, mockLogger); await runTask( 'job456', @@ -186,10 +174,9 @@ describe('CSV Execute Job', function () { cancellationToken ); - const scrollCall = callAsCurrentUserStub.secondCall; - - expect(scrollCall.args[0]).toBe('scroll'); - expect(scrollCall.args[1].scrollId).toBe(scrollId); + expect(mockEsClient.scroll).toHaveBeenCalledWith( + expect.objectContaining({ scroll_id: scrollId }) + ); }); it('should not execute scroll if there are no hits from the search', async function () { @@ -204,28 +191,27 @@ describe('CSV Execute Job', function () { cancellationToken ); - expect(callAsCurrentUserStub.callCount).toBe(2); - - const searchCall = callAsCurrentUserStub.firstCall; - expect(searchCall.args[0]).toBe('search'); - - const clearScrollCall = callAsCurrentUserStub.secondCall; - expect(clearScrollCall.args[0]).toBe('clearScroll'); + expect(mockEsClient.search).toHaveBeenCalled(); + expect(mockEsClient.clearScroll).toHaveBeenCalled(); }); it('should stop executing scroll if there are no hits', async function () { - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{}], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); - callAsCurrentUserStub.onSecondCall().resolves({ - hits: { - hits: [], + } as any); + mockEsClient.scroll.mockResolvedValueOnce({ + body: { + hits: { + hits: [], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); await runTask( @@ -238,33 +224,30 @@ describe('CSV Execute Job', function () { cancellationToken ); - expect(callAsCurrentUserStub.callCount).toBe(3); - - const searchCall = callAsCurrentUserStub.firstCall; - expect(searchCall.args[0]).toBe('search'); - - const scrollCall = callAsCurrentUserStub.secondCall; - expect(scrollCall.args[0]).toBe('scroll'); - - const clearScroll = callAsCurrentUserStub.thirdCall; - expect(clearScroll.args[0]).toBe('clearScroll'); + expect(mockEsClient.search).toHaveBeenCalled(); + expect(mockEsClient.scroll).toHaveBeenCalled(); + expect(mockEsClient.clearScroll).toHaveBeenCalled(); }); it('should call clearScroll with scrollId when there are no more hits', async function () { const lastScrollId = getRandomScrollId(); - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{}], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); - callAsCurrentUserStub.onSecondCall().resolves({ - hits: { - hits: [], + mockEsClient.scroll.mockResolvedValueOnce({ + body: { + hits: { + hits: [], + }, + _scroll_id: lastScrollId, }, - _scroll_id: lastScrollId, - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); await runTask( @@ -277,26 +260,28 @@ describe('CSV Execute Job', function () { cancellationToken ); - const lastCall = callAsCurrentUserStub.getCall(callAsCurrentUserStub.callCount - 1); - expect(lastCall.args[0]).toBe('clearScroll'); - expect(lastCall.args[1].scrollId).toEqual([lastScrollId]); + expect(mockEsClient.clearScroll).toHaveBeenCalledWith( + expect.objectContaining({ scroll_id: lastScrollId }) + ); }); it('calls clearScroll when there is an error iterating the hits', async function () { const lastScrollId = getRandomScrollId(); - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [ - { - _source: { - one: 'foo', - two: 'bar', + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [ + { + _source: { + one: 'foo', + two: 'bar', + }, }, - }, - ], + ], + }, + _scroll_id: lastScrollId, }, - _scroll_id: lastScrollId, - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -309,21 +294,23 @@ describe('CSV Execute Job', function () { `[TypeError: Cannot read property 'indexOf' of undefined]` ); - const lastCall = callAsCurrentUserStub.getCall(callAsCurrentUserStub.callCount - 1); - expect(lastCall.args[0]).toBe('clearScroll'); - expect(lastCall.args[1].scrollId).toEqual([lastScrollId]); + expect(mockEsClient.clearScroll).toHaveBeenCalledWith( + expect.objectContaining({ scroll_id: lastScrollId }) + ); }); }); describe('Warning when cells have formulas', () => { it('returns `csv_contains_formulas` when cells contain formulas', async function () { configGetStub.withArgs('csv', 'checkForFormulas').returns(true); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { one: '=SUM(A1:A2)', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: '=SUM(A1:A2)', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -343,12 +330,14 @@ describe('CSV Execute Job', function () { it('returns warnings when headings contain formulas', async function () { configGetStub.withArgs('csv', 'checkForFormulas').returns(true); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { '=SUM(A1:A2)': 'foo', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { '=SUM(A1:A2)': 'foo', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -369,12 +358,14 @@ describe('CSV Execute Job', function () { it('returns no warnings when cells have no formulas', async function () { configGetStub.withArgs('csv', 'checkForFormulas').returns(true); configGetStub.withArgs('csv', 'escapeFormulaValues').returns(false); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { one: 'foo', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: 'foo', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -395,12 +386,14 @@ describe('CSV Execute Job', function () { it('returns no warnings when cells have formulas but are escaped', async function () { configGetStub.withArgs('csv', 'checkForFormulas').returns(true); configGetStub.withArgs('csv', 'escapeFormulaValues').returns(true); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { '=SUM(A1:A2)': 'foo', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { '=SUM(A1:A2)': 'foo', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -421,12 +414,14 @@ describe('CSV Execute Job', function () { it('returns no warnings when configured not to', async () => { configGetStub.withArgs('csv', 'checkForFormulas').returns(false); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { one: '=SUM(A1:A2)', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: '=SUM(A1:A2)', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -448,12 +443,14 @@ describe('CSV Execute Job', function () { describe('Byte order mark encoding', () => { it('encodes CSVs with BOM', async () => { configGetStub.withArgs('csv', 'useByteOrderMarkEncoding').returns(true); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { one: 'one', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: 'one', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -469,12 +466,14 @@ describe('CSV Execute Job', function () { it('encodes CSVs without BOM', async () => { configGetStub.withArgs('csv', 'useByteOrderMarkEncoding').returns(false); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { one: 'one', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: 'one', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -492,12 +491,14 @@ describe('CSV Execute Job', function () { describe('Escaping cells with formulas', () => { it('escapes values with formulas', async () => { configGetStub.withArgs('csv', 'escapeFormulaValues').returns(true); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { one: `=cmd|' /C calc'!A0`, two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: `=cmd|' /C calc'!A0`, two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -513,12 +514,14 @@ describe('CSV Execute Job', function () { it('does not escapes values with formulas', async () => { configGetStub.withArgs('csv', 'escapeFormulaValues').returns(false); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { one: `=cmd|' /C calc'!A0`, two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: `=cmd|' /C calc'!A0`, two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -535,7 +538,7 @@ describe('CSV Execute Job', function () { describe('Elasticsearch call errors', function () { it('should reject Promise if search call errors out', async function () { - callAsCurrentUserStub.rejects(new Error()); + mockEsClient.search.mockRejectedValueOnce(new Error()); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ headers: encryptedHeaders, @@ -548,13 +551,15 @@ describe('CSV Execute Job', function () { }); it('should reject Promise if scroll call errors out', async function () { - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{}], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); - callAsCurrentUserStub.onSecondCall().rejects(new Error()); + } as any); + mockEsClient.scroll.mockRejectedValueOnce(new Error()); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ headers: encryptedHeaders, @@ -569,12 +574,14 @@ describe('CSV Execute Job', function () { describe('invalid responses', function () { it('should reject Promise if search returns hits but no _scroll_id', async function () { - callAsCurrentUserStub.resolves({ - hits: { - hits: [{}], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: undefined, }, - _scroll_id: undefined, - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -588,12 +595,14 @@ describe('CSV Execute Job', function () { }); it('should reject Promise if search returns no hits and no _scroll_id', async function () { - callAsCurrentUserStub.resolves({ - hits: { - hits: [], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [], + }, + _scroll_id: undefined, }, - _scroll_id: undefined, - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -607,19 +616,23 @@ describe('CSV Execute Job', function () { }); it('should reject Promise if scroll returns hits but no _scroll_id', async function () { - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{}], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); - callAsCurrentUserStub.onSecondCall().resolves({ - hits: { - hits: [{}], + mockEsClient.scroll.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: undefined, }, - _scroll_id: undefined, - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -633,19 +646,23 @@ describe('CSV Execute Job', function () { }); it('should reject Promise if scroll returns no hits and no _scroll_id', async function () { - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{}], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); - callAsCurrentUserStub.onSecondCall().resolves({ - hits: { - hits: [], + mockEsClient.scroll.mockResolvedValueOnce({ + body: { + hits: { + hits: [], + }, + _scroll_id: undefined, }, - _scroll_id: undefined, - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -663,21 +680,20 @@ describe('CSV Execute Job', function () { const scrollId = getRandomScrollId(); beforeEach(function () { - // We have to "re-stub" the callAsCurrentUser stub here so that we can use the fakeFunction - // that delays the Promise resolution so we have a chance to call cancellationToken.cancel(). - // Otherwise, we get into an endless loop, and don't have a chance to call cancel - callAsCurrentUserStub.restore(); - callAsCurrentUserStub = sinon - .stub(clusterStub, 'callAsCurrentUser') - .callsFake(async function () { - await delay(1); - return { + const searchStub = async () => { + await delay(1); + return { + body: { hits: { hits: [{}], }, _scroll_id: scrollId, - }; - }); + }, + }; + }; + + mockEsClient.search.mockImplementation(searchStub as typeof mockEsClient.search); + mockEsClient.scroll.mockImplementation(searchStub as typeof mockEsClient.scroll); }); it('should stop calling Elasticsearch when cancellationToken.cancel is called', async function () { @@ -693,10 +709,15 @@ describe('CSV Execute Job', function () { ); await delay(250); - const callCount = callAsCurrentUserStub.callCount; + + expect(mockEsClient.search).toHaveBeenCalled(); + expect(mockEsClient.scroll).toHaveBeenCalled(); + expect(mockEsClient.clearScroll).not.toHaveBeenCalled(); + cancellationToken.cancel(); await delay(250); - expect(callAsCurrentUserStub.callCount).toBe(callCount + 1); // last call is to clear the scroll + + expect(mockEsClient.clearScroll).toHaveBeenCalled(); }); it(`shouldn't call clearScroll if it never got a scrollId`, async function () { @@ -712,9 +733,7 @@ describe('CSV Execute Job', function () { ); cancellationToken.cancel(); - for (let i = 0; i < callAsCurrentUserStub.callCount; ++i) { - expect(callAsCurrentUserStub.getCall(i).args[1]).not.toBe('clearScroll'); // dead code? - } + expect(mockEsClient.clearScroll).not.toHaveBeenCalled(); }); it('should call clearScroll if it got a scrollId', async function () { @@ -732,9 +751,11 @@ describe('CSV Execute Job', function () { cancellationToken.cancel(); await delay(100); - const lastCall = callAsCurrentUserStub.getCall(callAsCurrentUserStub.callCount - 1); - expect(lastCall.args[0]).toBe('clearScroll'); - expect(lastCall.args[1].scrollId).toEqual([scrollId]); + expect(mockEsClient.clearScroll).toHaveBeenCalledWith( + expect.objectContaining({ + scroll_id: scrollId, + }) + ); }); }); @@ -788,12 +809,14 @@ describe('CSV Execute Job', function () { it('should write column headers to output, when there are results', async function () { const runTask = runTaskFnFactory(mockReportingCore, mockLogger); - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{ one: '1', two: '2' }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ one: '1', two: '2' }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const jobParams = getBasePayload({ headers: encryptedHeaders, @@ -809,12 +832,14 @@ describe('CSV Execute Job', function () { it('should use comma separated values of non-nested fields from _source', async function () { const runTask = runTaskFnFactory(mockReportingCore, mockLogger); - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{ _source: { one: 'foo', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: 'foo', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const jobParams = getBasePayload({ headers: encryptedHeaders, @@ -831,18 +856,22 @@ describe('CSV Execute Job', function () { it('should concatenate the hits from multiple responses', async function () { const runTask = runTaskFnFactory(mockReportingCore, mockLogger); - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{ _source: { one: 'foo', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: 'foo', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); - callAsCurrentUserStub.onSecondCall().resolves({ - hits: { - hits: [{ _source: { one: 'baz', two: 'qux' } }], + } as any); + mockEsClient.scroll.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: 'baz', two: 'qux' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const jobParams = getBasePayload({ headers: encryptedHeaders, @@ -860,12 +889,14 @@ describe('CSV Execute Job', function () { it('should use field formatters to format fields', async function () { const runTask = runTaskFnFactory(mockReportingCore, mockLogger); - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{ _source: { one: 'foo', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: 'foo', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const jobParams = getBasePayload({ headers: encryptedHeaders, @@ -962,12 +993,14 @@ describe('CSV Execute Job', function () { beforeEach(async function () { configGetStub.withArgs('csv', 'maxSizeBytes').returns(9); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { one: 'foo', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: 'foo', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -1002,12 +1035,14 @@ describe('CSV Execute Job', function () { Promise.resolve((mockUiSettingsClient as unknown) as IUiSettingsClient); configGetStub.withArgs('csv', 'maxSizeBytes').returns(18); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{ _source: { one: 'foo', two: 'bar' } }], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{ _source: { one: 'foo', two: 'bar' } }], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -1039,12 +1074,14 @@ describe('CSV Execute Job', function () { const scrollDuration = 'test'; configGetStub.withArgs('csv', 'scroll').returns({ duration: scrollDuration }); - callAsCurrentUserStub.onFirstCall().returns({ - hits: { - hits: [{}], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -1056,21 +1093,23 @@ describe('CSV Execute Job', function () { await runTask('job123', jobParams, cancellationToken); - const searchCall = callAsCurrentUserStub.firstCall; - expect(searchCall.args[0]).toBe('search'); - expect(searchCall.args[1].scroll).toBe(scrollDuration); + expect(mockEsClient.search).toHaveBeenCalledWith( + expect.objectContaining({ scroll: scrollDuration }) + ); }); it('passes scroll size to initial search call', async function () { const scrollSize = 100; configGetStub.withArgs('csv', 'scroll').returns({ size: scrollSize }); - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{}], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -1082,21 +1121,23 @@ describe('CSV Execute Job', function () { await runTask('job123', jobParams, cancellationToken); - const searchCall = callAsCurrentUserStub.firstCall; - expect(searchCall.args[0]).toBe('search'); - expect(searchCall.args[1].size).toBe(scrollSize); + expect(mockEsClient.search).toHaveBeenCalledWith( + expect.objectContaining({ size: scrollSize }) + ); }); it('passes scroll duration to subsequent scroll call', async function () { const scrollDuration = 'test'; configGetStub.withArgs('csv', 'scroll').returns({ duration: scrollDuration }); - callAsCurrentUserStub.onFirstCall().resolves({ - hits: { - hits: [{}], + mockEsClient.search.mockResolvedValueOnce({ + body: { + hits: { + hits: [{}], + }, + _scroll_id: 'scrollId', }, - _scroll_id: 'scrollId', - }); + } as any); const runTask = runTaskFnFactory(mockReportingCore, mockLogger); const jobParams = getBasePayload({ @@ -1108,9 +1149,9 @@ describe('CSV Execute Job', function () { await runTask('job123', jobParams, cancellationToken); - const scrollCall = callAsCurrentUserStub.secondCall; - expect(scrollCall.args[0]).toBe('scroll'); - expect(scrollCall.args[1].scroll).toBe(scrollDuration); + expect(mockEsClient.scroll).toHaveBeenCalledWith( + expect.objectContaining({ scroll: scrollDuration }) + ); }); }); }); diff --git a/x-pack/plugins/reporting/server/export_types/csv/execute_job.ts b/x-pack/plugins/reporting/server/export_types/csv/execute_job.ts index 0e13a91649406..57559d136ff3e 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/execute_job.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/execute_job.ts @@ -17,7 +17,7 @@ export const runTaskFnFactory: RunTaskFnFactory< const config = reporting.getConfig(); return async function runTask(jobId, job, cancellationToken) { - const elasticsearch = reporting.getElasticsearchService(); + const elasticsearch = await reporting.getEsClient(); const logger = parentLogger.clone([jobId]); const generateCsv = createGenerateCsv(logger); @@ -25,16 +25,13 @@ export const runTaskFnFactory: RunTaskFnFactory< const headers = await decryptJobHeaders(encryptionKey, job.headers, logger); const fakeRequest = reporting.getFakeRequest({ headers }, job.spaceId, logger); const uiSettingsClient = await reporting.getUiSettingsClient(fakeRequest, logger); - - const { callAsCurrentUser } = elasticsearch.legacy.client.asScoped(fakeRequest); - const callEndpoint = (endpoint: string, clientParams = {}, options = {}) => - callAsCurrentUser(endpoint, clientParams, options); + const { asCurrentUser: elasticsearchClient } = elasticsearch.asScoped(fakeRequest); const { content, maxSizeReached, size, csvContainsFormulas, warnings } = await generateCsv( job, config, uiSettingsClient, - callEndpoint, + elasticsearchClient, cancellationToken ); diff --git a/x-pack/plugins/reporting/server/export_types/csv/generate_csv/hit_iterator.test.ts b/x-pack/plugins/reporting/server/export_types/csv/generate_csv/hit_iterator.test.ts index 4baa81e8be6c9..6b1b7fc98a4b8 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/generate_csv/hit_iterator.test.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/generate_csv/hit_iterator.test.ts @@ -7,16 +7,18 @@ import expect from '@kbn/expect'; import sinon from 'sinon'; +import { elasticsearchServiceMock } from 'src/core/server/mocks'; import { CancellationToken } from '../../../../common'; import { createMockLevelLogger } from '../../../test_helpers/create_mock_levellogger'; import { ScrollConfig } from '../../../types'; import { createHitIterator } from './hit_iterator'; +const { asInternalUser: mockEsClient } = elasticsearchServiceMock.createClusterClient(); const mockLogger = createMockLevelLogger(); const debugLogStub = sinon.stub(mockLogger, 'debug'); const warnLogStub = sinon.stub(mockLogger, 'warn'); const errorLogStub = sinon.stub(mockLogger, 'error'); -const mockCallEndpoint = sinon.stub(); + const mockSearchRequest = {}; const mockConfig: ScrollConfig = { duration: '2s', size: 123 }; let realCancellationToken = new CancellationToken(); @@ -27,10 +29,30 @@ describe('hitIterator', function () { debugLogStub.resetHistory(); warnLogStub.resetHistory(); errorLogStub.resetHistory(); - mockCallEndpoint.resetHistory(); - mockCallEndpoint.resetBehavior(); - mockCallEndpoint.resolves({ _scroll_id: '123blah', hits: { hits: ['you found me'] } }); - mockCallEndpoint.onCall(11).resolves({ _scroll_id: '123blah', hits: {} }); + + mockEsClient.search.mockClear(); + mockEsClient.search.mockResolvedValue({ + body: { + _scroll_id: '123blah', + hits: { hits: ['you found me'] }, + }, + } as any); + + mockEsClient.scroll.mockClear(); + for (let i = 0; i < 10; i++) { + mockEsClient.scroll.mockResolvedValueOnce({ + body: { + _scroll_id: '123blah', + hits: { hits: ['you found me'] }, + }, + } as any); + } + mockEsClient.scroll.mockResolvedValueOnce({ + body: { + _scroll_id: '123blah', + hits: {}, + }, + } as any); isCancelledStub = sinon.stub(realCancellationToken, 'isCancelled'); isCancelledStub.returns(false); @@ -45,7 +67,7 @@ describe('hitIterator', function () { const hitIterator = createHitIterator(mockLogger); const iterator = hitIterator( mockConfig, - mockCallEndpoint, + mockEsClient, mockSearchRequest, realCancellationToken ); @@ -58,7 +80,7 @@ describe('hitIterator', function () { expect(hit).to.be('you found me'); } - expect(mockCallEndpoint.callCount).to.be(13); + expect(mockEsClient.scroll.mock.calls.length).to.be(11); expect(debugLogStub.callCount).to.be(13); expect(warnLogStub.callCount).to.be(0); expect(errorLogStub.callCount).to.be(0); @@ -73,7 +95,7 @@ describe('hitIterator', function () { const hitIterator = createHitIterator(mockLogger); const iterator = hitIterator( mockConfig, - mockCallEndpoint, + mockEsClient, mockSearchRequest, realCancellationToken ); @@ -86,7 +108,7 @@ describe('hitIterator', function () { expect(hit).to.be('you found me'); } - expect(mockCallEndpoint.callCount).to.be(3); + expect(mockEsClient.scroll.mock.calls.length).to.be(1); expect(debugLogStub.callCount).to.be(3); expect(warnLogStub.callCount).to.be(1); expect(errorLogStub.callCount).to.be(0); @@ -98,13 +120,20 @@ describe('hitIterator', function () { it('handles time out', async () => { // Setup - mockCallEndpoint.onCall(2).resolves({ status: 404 }); + mockEsClient.scroll.mockReset(); + mockEsClient.scroll.mockResolvedValueOnce({ + body: { + _scroll_id: '123blah', + hits: { hits: ['you found me'] }, + }, + } as any); + mockEsClient.scroll.mockResolvedValueOnce({ body: { status: 404 } } as any); // Begin const hitIterator = createHitIterator(mockLogger); const iterator = hitIterator( mockConfig, - mockCallEndpoint, + mockEsClient, mockSearchRequest, realCancellationToken ); @@ -125,7 +154,7 @@ describe('hitIterator', function () { errorThrown = true; } - expect(mockCallEndpoint.callCount).to.be(4); + expect(mockEsClient.scroll.mock.calls.length).to.be(2); expect(debugLogStub.callCount).to.be(4); expect(warnLogStub.callCount).to.be(0); expect(errorLogStub.callCount).to.be(1); @@ -134,13 +163,13 @@ describe('hitIterator', function () { it('handles scroll id could not be cleared', async () => { // Setup - mockCallEndpoint.withArgs('clearScroll').rejects({ status: 404 }); + mockEsClient.clearScroll.mockRejectedValueOnce({ status: 404 }); // Begin const hitIterator = createHitIterator(mockLogger); const iterator = hitIterator( mockConfig, - mockCallEndpoint, + mockEsClient, mockSearchRequest, realCancellationToken ); @@ -153,7 +182,7 @@ describe('hitIterator', function () { expect(hit).to.be('you found me'); } - expect(mockCallEndpoint.callCount).to.be(13); + expect(mockEsClient.scroll.mock.calls.length).to.be(11); expect(warnLogStub.callCount).to.be(1); expect(errorLogStub.callCount).to.be(1); }); diff --git a/x-pack/plugins/reporting/server/export_types/csv/generate_csv/hit_iterator.ts b/x-pack/plugins/reporting/server/export_types/csv/generate_csv/hit_iterator.ts index b00622399d691..72935e64dd6b5 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/generate_csv/hit_iterator.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/generate_csv/hit_iterator.ts @@ -5,54 +5,55 @@ * 2.0. */ +import { UnwrapPromise } from '@kbn/utility-types'; import { i18n } from '@kbn/i18n'; -import { SearchParams, SearchResponse } from 'elasticsearch'; +import { ElasticsearchClient } from 'src/core/server'; import { CancellationToken } from '../../../../common'; import { LevelLogger } from '../../../lib'; import { ScrollConfig } from '../../../types'; -export type EndpointCaller = (method: string, params: object) => Promise>; +type SearchResponse = UnwrapPromise>; +type SearchRequest = Required>[0]; -function parseResponse(request: SearchResponse) { - const response = request; - if (!response || !response._scroll_id) { +function parseResponse(response: SearchResponse) { + if (!response?.body._scroll_id) { throw new Error( i18n.translate('xpack.reporting.exportTypes.csv.hitIterator.expectedScrollIdErrorMessage', { defaultMessage: 'Expected {scrollId} in the following Elasticsearch response: {response}', - values: { response: JSON.stringify(response), scrollId: '_scroll_id' }, + values: { response: JSON.stringify(response?.body), scrollId: '_scroll_id' }, }) ); } - if (!response.hits) { + if (!response?.body.hits) { throw new Error( i18n.translate('xpack.reporting.exportTypes.csv.hitIterator.expectedHitsErrorMessage', { defaultMessage: 'Expected {hits} in the following Elasticsearch response: {response}', - values: { response: JSON.stringify(response), hits: 'hits' }, + values: { response: JSON.stringify(response?.body), hits: 'hits' }, }) ); } return { - scrollId: response._scroll_id, - hits: response.hits.hits, + scrollId: response.body._scroll_id, + hits: response.body.hits.hits, }; } export function createHitIterator(logger: LevelLogger) { return async function* hitIterator( scrollSettings: ScrollConfig, - callEndpoint: EndpointCaller, - searchRequest: SearchParams, + elasticsearchClient: ElasticsearchClient, + searchRequest: SearchRequest, cancellationToken: CancellationToken ) { logger.debug('executing search request'); - async function search(index: string | boolean | string[] | undefined, body: object) { + async function search(index: SearchRequest['index'], body: SearchRequest['body']) { return parseResponse( - await callEndpoint('search', { - ignore_unavailable: true, // ignores if the index pattern contains any aliases that point to closed indices + await elasticsearchClient.search({ index, body, + ignore_unavailable: true, // ignores if the index pattern contains any aliases that point to closed indices scroll: scrollSettings.duration, size: scrollSettings.size, }) @@ -62,8 +63,8 @@ export function createHitIterator(logger: LevelLogger) { async function scroll(scrollId: string | undefined) { logger.debug('executing scroll request'); return parseResponse( - await callEndpoint('scroll', { - scrollId, + await elasticsearchClient.scroll({ + scroll_id: scrollId, scroll: scrollSettings.duration, }) ); @@ -72,8 +73,8 @@ export function createHitIterator(logger: LevelLogger) { async function clearScroll(scrollId: string | undefined) { logger.debug('executing clearScroll request'); try { - await callEndpoint('clearScroll', { - scrollId: [scrollId], + await elasticsearchClient.clearScroll({ + scroll_id: scrollId, }); } catch (err) { // Do not throw the error, as the job can still be completed successfully diff --git a/x-pack/plugins/reporting/server/export_types/csv/generate_csv/index.ts b/x-pack/plugins/reporting/server/export_types/csv/generate_csv/index.ts index 629a81df350be..e5ed04f4cab66 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/generate_csv/index.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/generate_csv/index.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { IUiSettingsClient } from 'src/core/server'; +import { ElasticsearchClient, IUiSettingsClient } from 'src/core/server'; import { ReportingConfig } from '../../../'; import { CancellationToken } from '../../../../../../plugins/reporting/common'; import { CSV_BOM_CHARS } from '../../../../common/constants'; @@ -24,7 +24,7 @@ import { fieldFormatMapFactory } from './field_format_map'; import { createFlattenHit } from './flatten_hit'; import { createFormatCsvValues } from './format_csv_values'; import { getUiSettings } from './get_ui_settings'; -import { createHitIterator, EndpointCaller } from './hit_iterator'; +import { createHitIterator } from './hit_iterator'; interface SearchRequest { index: string; @@ -56,7 +56,7 @@ export function createGenerateCsv(logger: LevelLogger) { job: GenerateCsvParams, config: ReportingConfig, uiSettingsClient: IUiSettingsClient, - callEndpoint: EndpointCaller, + elasticsearchClient: ElasticsearchClient, cancellationToken: CancellationToken ): Promise { const settings = await getUiSettings(job.browserTimezone, uiSettingsClient, config, logger); @@ -79,7 +79,7 @@ export function createGenerateCsv(logger: LevelLogger) { const iterator = hitIterator( settings.scroll, - callEndpoint, + elasticsearchClient, job.searchRequest, cancellationToken ); diff --git a/x-pack/plugins/reporting/server/export_types/png/execute_job/index.test.ts b/x-pack/plugins/reporting/server/export_types/png/execute_job/index.test.ts index 3a5298981738d..34fe5360522b1 100644 --- a/x-pack/plugins/reporting/server/export_types/png/execute_job/index.test.ts +++ b/x-pack/plugins/reporting/server/export_types/png/execute_job/index.test.ts @@ -59,16 +59,6 @@ beforeEach(async () => { mockReporting = await createMockReportingCore(mockReportingConfig); - const mockElasticsearch = { - legacy: { - client: { - asScoped: () => ({ callAsCurrentUser: jest.fn() }), - }, - }, - }; - const mockGetElasticsearch = jest.fn(); - mockGetElasticsearch.mockImplementation(() => Promise.resolve(mockElasticsearch)); - mockReporting.getElasticsearchService = mockGetElasticsearch; // @ts-ignore over-riding config method mockReporting.config = mockReportingConfig; diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.test.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.test.ts index 0c6a55fb895b5..61eab18987f7c 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.test.ts +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.test.ts @@ -57,16 +57,6 @@ beforeEach(async () => { mockReporting = await createMockReportingCore(mockReportingConfig); - const mockElasticsearch = { - legacy: { - client: { - asScoped: () => ({ callAsCurrentUser: jest.fn() }), - }, - }, - }; - const mockGetElasticsearch = jest.fn(); - mockGetElasticsearch.mockImplementation(() => Promise.resolve(mockElasticsearch)); - mockReporting.getElasticsearchService = mockGetElasticsearch; // @ts-ignore over-riding config mockReporting.config = mockReportingConfig; diff --git a/x-pack/plugins/reporting/server/lib/store/report.ts b/x-pack/plugins/reporting/server/lib/store/report.ts index 817028cab1a39..9b98650e1d984 100644 --- a/x-pack/plugins/reporting/server/lib/store/report.ts +++ b/x-pack/plugins/reporting/server/lib/store/report.ts @@ -25,8 +25,8 @@ const puid = new Puid(); export class Report implements Partial { public _index?: string; public _id: string; - public _primary_term?: unknown; // set by ES - public _seq_no: unknown; // set by ES + public _primary_term?: number; // set by ES + public _seq_no?: number; // set by ES public readonly kibana_name: ReportSource['kibana_name']; public readonly kibana_id: ReportSource['kibana_id']; diff --git a/x-pack/plugins/reporting/server/lib/store/store.test.ts b/x-pack/plugins/reporting/server/lib/store/store.test.ts index 01d91f8bc2ac2..2af0fe7830eea 100644 --- a/x-pack/plugins/reporting/server/lib/store/store.test.ts +++ b/x-pack/plugins/reporting/server/lib/store/store.test.ts @@ -5,8 +5,8 @@ * 2.0. */ -import sinon from 'sinon'; -import { ElasticsearchServiceSetup } from 'src/core/server'; +import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; +import { ElasticsearchClient } from 'src/core/server'; import { ReportingConfig, ReportingCore } from '../../'; import { createMockConfig, @@ -21,9 +21,7 @@ describe('ReportingStore', () => { const mockLogger = createMockLevelLogger(); let mockConfig: ReportingConfig; let mockCore: ReportingCore; - - const callClusterStub = sinon.stub(); - const mockElasticsearch = { legacy: { client: { callAsInternalUser: callClusterStub } } }; + let mockEsClient: DeeplyMockedKeys; beforeEach(async () => { const reportingConfig = { @@ -33,17 +31,14 @@ describe('ReportingStore', () => { const mockSchema = createMockConfigSchema(reportingConfig); mockConfig = createMockConfig(mockSchema); mockCore = await createMockReportingCore(mockConfig); + mockEsClient = (await mockCore.getEsClient()).asInternalUser as typeof mockEsClient; - callClusterStub.reset(); - callClusterStub.withArgs('indices.exists').resolves({}); - callClusterStub.withArgs('indices.create').resolves({}); - callClusterStub.withArgs('index').resolves({ _id: 'stub-id', _index: 'stub-index' }); - callClusterStub.withArgs('indices.refresh').resolves({}); - callClusterStub.withArgs('update').resolves({}); - callClusterStub.withArgs('get').resolves({}); - - mockCore.getElasticsearchService = () => - (mockElasticsearch as unknown) as ElasticsearchServiceSetup; + mockEsClient.indices.create.mockResolvedValue({} as any); + mockEsClient.indices.exists.mockResolvedValue({} as any); + mockEsClient.indices.refresh.mockResolvedValue({} as any); + mockEsClient.get.mockResolvedValue({} as any); + mockEsClient.index.mockResolvedValue({ body: { _id: 'stub-id', _index: 'stub-index' } } as any); + mockEsClient.update.mockResolvedValue({} as any); }); describe('addReport', () => { @@ -88,14 +83,14 @@ describe('ReportingStore', () => { meta: {}, } as any); expect(store.addReport(mockReport)).rejects.toMatchInlineSnapshot( - `[TypeError: this.client.callAsInternalUser is not a function]` + `[Error: Report object from ES has missing fields!]` ); }); it('handles error creating the index', async () => { // setup - callClusterStub.withArgs('indices.exists').resolves(false); - callClusterStub.withArgs('indices.create').rejects(new Error('horrible error')); + mockEsClient.indices.exists.mockResolvedValue({ body: false } as any); + mockEsClient.indices.create.mockRejectedValue(new Error('horrible error')); const store = new ReportingStore(mockCore, mockLogger); const mockReport = new Report({ @@ -117,8 +112,8 @@ describe('ReportingStore', () => { */ it('ignores index creation error if the index already exists and continues adding the report', async () => { // setup - callClusterStub.withArgs('indices.exists').resolves(false); - callClusterStub.withArgs('indices.create').rejects(new Error('devastating error')); + mockEsClient.indices.exists.mockResolvedValue({ body: false } as any); + mockEsClient.indices.create.mockRejectedValue(new Error('devastating error')); const store = new ReportingStore(mockCore, mockLogger); const mockReport = new Report({ @@ -134,10 +129,9 @@ describe('ReportingStore', () => { it('skips creating the index if already exists', async () => { // setup - callClusterStub.withArgs('indices.exists').resolves(false); - callClusterStub - .withArgs('indices.create') - .rejects(new Error('resource_already_exists_exception')); // will be triggered but ignored + mockEsClient.indices.exists.mockResolvedValue({ body: false } as any); + // will be triggered but ignored + mockEsClient.indices.create.mockRejectedValue(new Error('resource_already_exists_exception')); const store = new ReportingStore(mockCore, mockLogger); const mockReport = new Report({ @@ -159,10 +153,9 @@ describe('ReportingStore', () => { it('allows username string to be `false`', async () => { // setup - callClusterStub.withArgs('indices.exists').resolves(false); - callClusterStub - .withArgs('indices.create') - .rejects(new Error('resource_already_exists_exception')); // will be triggered but ignored + mockEsClient.indices.exists.mockResolvedValue({ body: false } as any); + // will be triggered but ignored + mockEsClient.indices.create.mockRejectedValue(new Error('resource_already_exists_exception')); const store = new ReportingStore(mockCore, mockLogger); const mockReport = new Report({ @@ -192,8 +185,8 @@ describe('ReportingStore', () => { const mockReport: ReportDocument = { _id: '1234-foo-78', _index: '.reporting-test-17409', - _primary_term: 'primary_term string', - _seq_no: 'seq_no string', + _primary_term: 1234, + _seq_no: 5678, _source: { kibana_name: 'test', kibana_id: 'test123', @@ -210,7 +203,7 @@ describe('ReportingStore', () => { output: null, }, }; - callClusterStub.withArgs('get').resolves(mockReport); + mockEsClient.get.mockResolvedValue({ body: mockReport } as any); const store = new ReportingStore(mockCore, mockLogger); const report = new Report({ ...mockReport, @@ -221,8 +214,8 @@ describe('ReportingStore', () => { Report { "_id": "1234-foo-78", "_index": ".reporting-test-17409", - "_primary_term": "primary_term string", - "_seq_no": "seq_no string", + "_primary_term": 1234, + "_seq_no": 5678, "attempts": 0, "browser_type": "browser type string", "completed_at": undefined, @@ -267,10 +260,9 @@ describe('ReportingStore', () => { await store.setReportClaimed(report, { testDoc: 'test' } as any); - const updateCall = callClusterStub.getCalls().find((call) => call.args[0] === 'update'); - expect(updateCall && updateCall.args).toMatchInlineSnapshot(` + const [updateCall] = mockEsClient.update.mock.calls; + expect(updateCall).toMatchInlineSnapshot(` Array [ - "update", Object { "body": Object { "doc": Object { @@ -308,10 +300,9 @@ describe('ReportingStore', () => { await store.setReportFailed(report, { errors: 'yes' } as any); - const updateCall = callClusterStub.getCalls().find((call) => call.args[0] === 'update'); - expect(updateCall && updateCall.args).toMatchInlineSnapshot(` + const [updateCall] = mockEsClient.update.mock.calls; + expect(updateCall).toMatchInlineSnapshot(` Array [ - "update", Object { "body": Object { "doc": Object { @@ -349,10 +340,9 @@ describe('ReportingStore', () => { await store.setReportCompleted(report, { certainly_completed: 'yes' } as any); - const updateCall = callClusterStub.getCalls().find((call) => call.args[0] === 'update'); - expect(updateCall && updateCall.args).toMatchInlineSnapshot(` + const [updateCall] = mockEsClient.update.mock.calls; + expect(updateCall).toMatchInlineSnapshot(` Array [ - "update", Object { "body": Object { "doc": Object { @@ -395,10 +385,9 @@ describe('ReportingStore', () => { }, } as any); - const updateCall = callClusterStub.getCalls().find((call) => call.args[0] === 'update'); - expect(updateCall && updateCall.args).toMatchInlineSnapshot(` + const [updateCall] = mockEsClient.update.mock.calls; + expect(updateCall).toMatchInlineSnapshot(` Array [ - "update", Object { "body": Object { "doc": Object { diff --git a/x-pack/plugins/reporting/server/lib/store/store.ts b/x-pack/plugins/reporting/server/lib/store/store.ts index fdac471c26cb0..fc7bd9c23d769 100644 --- a/x-pack/plugins/reporting/server/lib/store/store.ts +++ b/x-pack/plugins/reporting/server/lib/store/store.ts @@ -5,8 +5,7 @@ * 2.0. */ -import { SearchParams } from 'elasticsearch'; -import { ElasticsearchServiceSetup } from 'src/core/server'; +import { ElasticsearchClient } from 'src/core/server'; import { LevelLogger, statuses } from '../'; import { ReportingCore } from '../../'; import { numberToDuration } from '../../../common/schema_utils'; @@ -14,7 +13,7 @@ import { JobStatus } from '../../../common/types'; import { ReportTaskParams } from '../tasks'; import { indexTimestamp } from './index_timestamp'; import { mapping } from './mapping'; -import { Report, ReportDocument } from './report'; +import { Report, ReportDocument, ReportSource } from './report'; /* * When searching for long-pending reports, we get a subset of fields @@ -45,59 +44,60 @@ export class ReportingStore { private readonly indexPrefix: string; // config setting of index prefix in system index name private readonly indexInterval: string; // config setting of index prefix: how often to poll for pending work private readonly queueTimeoutMins: number; // config setting of queue timeout, rounded up to nearest minute - private client: ElasticsearchServiceSetup['legacy']['client']; - private logger: LevelLogger; + private client?: ElasticsearchClient; - constructor(reporting: ReportingCore, logger: LevelLogger) { - const config = reporting.getConfig(); - const elasticsearch = reporting.getElasticsearchService(); + constructor(private reportingCore: ReportingCore, private logger: LevelLogger) { + const config = reportingCore.getConfig(); - this.client = elasticsearch.legacy.client; this.indexPrefix = config.get('index'); this.indexInterval = config.get('queue', 'indexInterval'); this.logger = logger.clone(['store']); this.queueTimeoutMins = Math.ceil(numberToDuration(config.get('queue', 'timeout')).asMinutes()); } + private async getClient() { + if (!this.client) { + ({ asInternalUser: this.client } = await this.reportingCore.getEsClient()); + } + + return this.client; + } + private async createIndex(indexName: string) { - return await this.client - .callAsInternalUser('indices.exists', { - index: indexName, - }) - .then((exists) => { - if (exists) { - return exists; - } - - const indexSettings = { - number_of_shards: 1, - auto_expand_replicas: '0-1', - }; - const body = { - settings: indexSettings, - mappings: { - properties: mapping, - }, - }; - - return this.client - .callAsInternalUser('indices.create', { - index: indexName, - body, - }) - .then(() => true) - .catch((err: Error) => { - const isIndexExistsError = err.message.match(/resource_already_exists_exception/); - if (isIndexExistsError) { - // Do not fail a job if the job runner hits the race condition. - this.logger.warn(`Automatic index creation failed: index already exists: ${err}`); - return; - } - - this.logger.error(err); - throw err; - }); - }); + const client = await this.getClient(); + const { body: exists } = await client.indices.exists({ index: indexName }); + + if (exists) { + return exists; + } + + const indexSettings = { + number_of_shards: 1, + auto_expand_replicas: '0-1', + }; + const body = { + settings: indexSettings, + mappings: { + properties: mapping, + }, + }; + + try { + await client.indices.create({ index: indexName, body }); + + return true; + } catch (error) { + const isIndexExistsError = error.message.match(/resource_already_exists_exception/); + if (isIndexExistsError) { + // Do not fail a job if the job runner hits the race condition. + this.logger.warn(`Automatic index creation failed: index already exists: ${error}`); + return; + } + + this.logger.error(error); + + throw error; + } } /* @@ -105,7 +105,7 @@ export class ReportingStore { */ private async indexReport(report: Report) { const doc = { - index: report._index, + index: report._index!, id: report._id, body: { ...report.toEsDocsJSON()._source, @@ -114,14 +114,20 @@ export class ReportingStore { status: statuses.JOB_STATUS_PENDING, }, }; - return await this.client.callAsInternalUser('index', doc); + + const client = await this.getClient(); + const { body } = await client.index(doc); + + return body; } /* * Called from addReport, which handles any errors */ private async refreshIndex(index: string) { - return await this.client.callAsInternalUser('indices.refresh', { index }); + const client = await this.getClient(); + + return client.indices.refresh({ index }); } public async addReport(report: Report): Promise { @@ -156,7 +162,8 @@ export class ReportingStore { } try { - const document = await this.client.callAsInternalUser('get', { + const client = await this.getClient(); + const { body: document } = await client.get({ index: taskJson.index, id: taskJson.id, }); @@ -166,17 +173,17 @@ export class ReportingStore { _index: document._index, _seq_no: document._seq_no, _primary_term: document._primary_term, - jobtype: document._source.jobtype, - attempts: document._source.attempts, - browser_type: document._source.browser_type, - created_at: document._source.created_at, - created_by: document._source.created_by, - max_attempts: document._source.max_attempts, - meta: document._source.meta, - payload: document._source.payload, - process_expiration: document._source.process_expiration, - status: document._source.status, - timeout: document._source.timeout, + jobtype: document._source?.jobtype, + attempts: document._source?.attempts, + browser_type: document._source?.browser_type, + created_at: document._source?.created_at, + created_by: document._source?.created_by, + max_attempts: document._source?.max_attempts, + meta: document._source?.meta, + payload: document._source?.payload, + process_expiration: document._source?.process_expiration, + status: document._source?.status, + timeout: document._source?.timeout, }); } catch (err) { this.logger.error('Error in finding a report! ' + JSON.stringify({ report: taskJson })); @@ -191,14 +198,17 @@ export class ReportingStore { try { checkReportIsEditable(report); - return await this.client.callAsInternalUser('update', { + const client = await this.getClient(); + const { body } = await client.update({ id: report._id, - index: report._index, + index: report._index!, if_seq_no: report._seq_no, if_primary_term: report._primary_term, refresh: true, body: { doc }, }); + + return (body as unknown) as ReportDocument; } catch (err) { this.logger.error('Error in setting report pending status!'); this.logger.error(err); @@ -215,14 +225,17 @@ export class ReportingStore { try { checkReportIsEditable(report); - return await this.client.callAsInternalUser('update', { + const client = await this.getClient(); + const { body } = await client.update({ id: report._id, - index: report._index, + index: report._index!, if_seq_no: report._seq_no, if_primary_term: report._primary_term, refresh: true, body: { doc }, }); + + return (body as unknown) as ReportDocument; } catch (err) { this.logger.error('Error in setting report processing status!'); this.logger.error(err); @@ -239,14 +252,17 @@ export class ReportingStore { try { checkReportIsEditable(report); - return await this.client.callAsInternalUser('update', { + const client = await this.getClient(); + const { body } = await client.update({ id: report._id, - index: report._index, + index: report._index!, if_seq_no: report._seq_no, if_primary_term: report._primary_term, refresh: true, body: { doc }, }); + + return (body as unknown) as ReportDocument; } catch (err) { this.logger.error('Error in setting report failed status!'); this.logger.error(err); @@ -267,14 +283,17 @@ export class ReportingStore { }; checkReportIsEditable(report); - return await this.client.callAsInternalUser('update', { + const client = await this.getClient(); + const { body } = await client.update({ id: report._id, - index: report._index, + index: report._index!, if_seq_no: report._seq_no, if_primary_term: report._primary_term, refresh: true, body: { doc }, }); + + return (body as unknown) as ReportDocument; } catch (err) { this.logger.error('Error in setting report complete status!'); this.logger.error(err); @@ -286,16 +305,17 @@ export class ReportingStore { try { checkReportIsEditable(report); - const updateParams = { + const client = await this.getClient(); + const { body } = await client.update({ id: report._id, - index: report._index, + index: report._index!, if_seq_no: report._seq_no, if_primary_term: report._primary_term, refresh: true, body: { doc: { process_expiration: null } }, - }; + }); - return await this.client.callAsInternalUser('update', updateParams); + return (body as unknown) as ReportDocument; } catch (err) { this.logger.error('Error in clearing expiration!'); this.logger.error(err); @@ -312,12 +332,11 @@ export class ReportingStore { * Pending reports are not included in this search: they may be scheduled in TM just not run yet. * TODO Should we get a list of the reports that are pending and scheduled in TM so we can exclude them from this query? */ - public async findZombieReportDocuments( - logger = this.logger - ): Promise { - const searchParams: SearchParams = { + public async findZombieReportDocuments(): Promise { + const client = await this.getClient(); + const { body } = await client.search({ index: this.indexPrefix + '-*', - filterPath: 'hits.hits', + filter_path: 'hits.hits', body: { sort: { created_at: { order: 'desc' } }, query: { @@ -335,13 +354,8 @@ export class ReportingStore { }, }, }, - }; - - const result = await this.client.callAsInternalUser( - 'search', - searchParams - ); + }); - return result.hits?.hits; + return body.hits?.hits as ReportRecordTimeout[]; } } diff --git a/x-pack/plugins/reporting/server/plugin.ts b/x-pack/plugins/reporting/server/plugin.ts index 3dc7e7ef3df92..75411b30ec0bd 100644 --- a/x-pack/plugins/reporting/server/plugin.ts +++ b/x-pack/plugins/reporting/server/plugin.ts @@ -47,7 +47,7 @@ export class ReportingPlugin registerUiSettings(core); - const { elasticsearch, http } = core; + const { http } = core; const { features, licensing, security, spaces, taskManager } = plugins; const { initializerContext: initContext, reportingCore } = this; @@ -56,7 +56,6 @@ export class ReportingPlugin reportingCore.pluginSetup({ features, - elasticsearch, licensing, basePath, router, diff --git a/x-pack/plugins/reporting/server/routes/diagnostic/config.test.ts b/x-pack/plugins/reporting/server/routes/diagnostic/config.test.ts index f35d8f5910da0..952a33ff64190 100644 --- a/x-pack/plugins/reporting/server/routes/diagnostic/config.test.ts +++ b/x-pack/plugins/reporting/server/routes/diagnostic/config.test.ts @@ -6,6 +6,8 @@ */ import { UnwrapPromise } from '@kbn/utility-types'; +import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; +import { ElasticsearchClient } from 'kibana/server'; import { setupServer } from 'src/core/server/test_utils'; import supertest from 'supertest'; import { ReportingCore } from '../..'; @@ -26,6 +28,7 @@ describe('POST /diagnose/config', () => { let core: ReportingCore; let mockSetupDeps: any; let config: any; + let mockEsClient: DeeplyMockedKeys; const mockLogger = createMockLevelLogger(); @@ -38,9 +41,6 @@ describe('POST /diagnose/config', () => { ); mockSetupDeps = createMockPluginSetup({ - elasticsearch: { - legacy: { client: { callAsInternalUser: jest.fn() } }, - }, router: httpSetup.createRouter(''), } as unknown) as any; @@ -58,6 +58,7 @@ describe('POST /diagnose/config', () => { }; core = await createMockReportingCore(config, mockSetupDeps); + mockEsClient = (await core.getEsClient()).asInternalUser as typeof mockEsClient; }); afterEach(async () => { @@ -65,15 +66,15 @@ describe('POST /diagnose/config', () => { }); it('returns a 200 by default when configured properly', async () => { - mockSetupDeps.elasticsearch.legacy.client.callAsInternalUser.mockImplementation(() => - Promise.resolve({ + mockEsClient.cluster.getSettings.mockResolvedValueOnce({ + body: { defaults: { http: { max_content_length: '100mb', }, }, - }) - ); + }, + } as any); registerDiagnoseConfig(core, mockLogger); await server.start(); @@ -94,15 +95,15 @@ describe('POST /diagnose/config', () => { it('returns a 200 with help text when not configured properly', async () => { config.get.mockImplementation(() => 10485760); - mockSetupDeps.elasticsearch.legacy.client.callAsInternalUser.mockImplementation(() => - Promise.resolve({ + mockEsClient.cluster.getSettings.mockResolvedValueOnce({ + body: { defaults: { http: { max_content_length: '5mb', }, }, - }) - ); + }, + } as any); registerDiagnoseConfig(core, mockLogger); await server.start(); diff --git a/x-pack/plugins/reporting/server/routes/diagnostic/config.ts b/x-pack/plugins/reporting/server/routes/diagnostic/config.ts index e3a01c464c36d..109849aa302f2 100644 --- a/x-pack/plugins/reporting/server/routes/diagnostic/config.ts +++ b/x-pack/plugins/reporting/server/routes/diagnostic/config.ts @@ -28,7 +28,7 @@ const numberToByteSizeValue = (value: number | ByteSizeValue) => { export const registerDiagnoseConfig = (reporting: ReportingCore, logger: Logger) => { const setupDeps = reporting.getPluginSetupDeps(); const userHandler = authorizedUserPreRoutingFactory(reporting); - const { router, elasticsearch } = setupDeps; + const { router } = setupDeps; router.post( { @@ -37,13 +37,13 @@ export const registerDiagnoseConfig = (reporting: ReportingCore, logger: Logger) }, userHandler(async (user, context, req, res) => { const warnings = []; - const { callAsInternalUser } = elasticsearch.legacy.client; + const { asInternalUser: elasticsearchClient } = await reporting.getEsClient(); const config = reporting.getConfig(); - const elasticClusterSettingsResponse = await callAsInternalUser('cluster.getSettings', { - includeDefaults: true, + const { body: clusterSettings } = await elasticsearchClient.cluster.getSettings({ + include_defaults: true, }); - const { persistent, transient, defaults: defaultSettings } = elasticClusterSettingsResponse; + const { persistent, transient, defaults: defaultSettings } = clusterSettings; const elasticClusterSettings = defaults({}, persistent, transient, defaultSettings); const elasticSearchMaxContent = get( diff --git a/x-pack/plugins/reporting/server/routes/generation.test.ts b/x-pack/plugins/reporting/server/routes/generation.test.ts index f6966a3b28ea9..0ce977e0a5431 100644 --- a/x-pack/plugins/reporting/server/routes/generation.test.ts +++ b/x-pack/plugins/reporting/server/routes/generation.test.ts @@ -6,8 +6,9 @@ */ import { UnwrapPromise } from '@kbn/utility-types'; +import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; import { of } from 'rxjs'; -import sinon from 'sinon'; +import { ElasticsearchClient } from 'kibana/server'; import { setupServer } from 'src/core/server/test_utils'; import supertest from 'supertest'; import { ReportingCore } from '..'; @@ -24,8 +25,8 @@ describe('POST /api/reporting/generate', () => { let server: SetupServerReturn['server']; let httpSetup: SetupServerReturn['httpSetup']; let mockExportTypesRegistry: ExportTypesRegistry; - let callClusterStub: any; let core: ReportingCore; + let mockEsClient: DeeplyMockedKeys; const config = { get: jest.fn().mockImplementation((...args) => { @@ -55,12 +56,7 @@ describe('POST /api/reporting/generate', () => { () => ({}) ); - callClusterStub = sinon.stub().resolves({}); - const mockSetupDeps = createMockPluginSetup({ - elasticsearch: { - legacy: { client: { callAsInternalUser: callClusterStub } }, - }, security: { license: { isEnabled: () => true }, authc: { @@ -85,6 +81,9 @@ describe('POST /api/reporting/generate', () => { runTaskFnFactory: () => async () => ({ runParamsTest: { test2: 'yes' } } as any), }); core.getExportTypesRegistry = () => mockExportTypesRegistry; + + mockEsClient = (await core.getEsClient()).asInternalUser as typeof mockEsClient; + mockEsClient.index.mockResolvedValue({ body: {} } as any); }); afterEach(async () => { @@ -144,7 +143,7 @@ describe('POST /api/reporting/generate', () => { }); it('returns 500 if job handler throws an error', async () => { - callClusterStub.withArgs('index').rejects('silly'); + mockEsClient.index.mockRejectedValueOnce('silly'); registerJobGenerationRoutes(core, mockLogger); @@ -157,7 +156,7 @@ describe('POST /api/reporting/generate', () => { }); it(`returns 200 if job handler doesn't error`, async () => { - callClusterStub.withArgs('index').resolves({ _id: 'foo', _index: 'foo-index' }); + mockEsClient.index.mockResolvedValueOnce({ body: { _id: 'foo', _index: 'foo-index' } } as any); registerJobGenerationRoutes(core, mockLogger); await server.start(); diff --git a/x-pack/plugins/reporting/server/routes/jobs.test.ts b/x-pack/plugins/reporting/server/routes/jobs.test.ts index 706a8d5dad7dd..885fc701935fe 100644 --- a/x-pack/plugins/reporting/server/routes/jobs.test.ts +++ b/x-pack/plugins/reporting/server/routes/jobs.test.ts @@ -6,7 +6,9 @@ */ import { UnwrapPromise } from '@kbn/utility-types'; +import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; import { of } from 'rxjs'; +import { ElasticsearchClient } from 'kibana/server'; import { setupServer } from 'src/core/server/test_utils'; import supertest from 'supertest'; import { ReportingCore } from '..'; @@ -29,6 +31,7 @@ describe('GET /api/reporting/jobs/download', () => { let httpSetup: SetupServerReturn['httpSetup']; let exportTypesRegistry: ExportTypesRegistry; let core: ReportingCore; + let mockEsClient: DeeplyMockedKeys; const config = createMockConfig(createMockConfigSchema()); const getHits = (...sources: any) => { @@ -47,9 +50,6 @@ describe('GET /api/reporting/jobs/download', () => { () => ({}) ); const mockSetupDeps = createMockPluginSetup({ - elasticsearch: { - legacy: { client: { callAsInternalUser: jest.fn() } }, - }, security: { license: { isEnabled: () => true, @@ -89,6 +89,8 @@ describe('GET /api/reporting/jobs/download', () => { validLicenses: ['basic', 'gold'], } as ExportTypeDefinition); core.getExportTypesRegistry = () => exportTypesRegistry; + + mockEsClient = (await core.getEsClient()).asInternalUser as typeof mockEsClient; }); afterEach(async () => { @@ -96,10 +98,7 @@ describe('GET /api/reporting/jobs/download', () => { }); it('fails on malformed download IDs', async () => { - // @ts-ignore - core.pluginSetupDeps.elasticsearch.legacy.client = { - callAsInternalUser: jest.fn().mockReturnValue(Promise.resolve(getHits())), - }; + mockEsClient.search.mockResolvedValueOnce({ body: getHits() } as any); registerJobInfoRoutes(core); await server.start(); @@ -171,11 +170,7 @@ describe('GET /api/reporting/jobs/download', () => { }); it('returns 404 if job not found', async () => { - // @ts-ignore - core.pluginSetupDeps.elasticsearch.legacy.client = { - callAsInternalUser: jest.fn().mockReturnValue(Promise.resolve(getHits())), - }; - + mockEsClient.search.mockResolvedValueOnce({ body: getHits() } as any); registerJobInfoRoutes(core); await server.start(); @@ -184,12 +179,9 @@ describe('GET /api/reporting/jobs/download', () => { }); it('returns a 401 if not a valid job type', async () => { - // @ts-ignore - core.pluginSetupDeps.elasticsearch.legacy.client = { - callAsInternalUser: jest - .fn() - .mockReturnValue(Promise.resolve(getHits({ jobtype: 'invalidJobType' }))), - }; + mockEsClient.search.mockResolvedValueOnce({ + body: getHits({ jobtype: 'invalidJobType' }), + } as any); registerJobInfoRoutes(core); await server.start(); @@ -198,14 +190,9 @@ describe('GET /api/reporting/jobs/download', () => { }); it('when a job is incomplete', async () => { - // @ts-ignore - core.pluginSetupDeps.elasticsearch.legacy.client = { - callAsInternalUser: jest - .fn() - .mockReturnValue( - Promise.resolve(getHits({ jobtype: 'unencodedJobType', status: 'pending' })) - ), - }; + mockEsClient.search.mockResolvedValueOnce({ + body: getHits({ jobtype: 'unencodedJobType', status: 'pending' }), + } as any); registerJobInfoRoutes(core); await server.start(); @@ -218,18 +205,13 @@ describe('GET /api/reporting/jobs/download', () => { }); it('when a job fails', async () => { - // @ts-ignore - core.pluginSetupDeps.elasticsearch.legacy.client = { - callAsInternalUser: jest.fn().mockReturnValue( - Promise.resolve( - getHits({ - jobtype: 'unencodedJobType', - status: 'failed', - output: { content: 'job failure message' }, - }) - ) - ), - }; + mockEsClient.search.mockResolvedValueOnce({ + body: getHits({ + jobtype: 'unencodedJobType', + status: 'failed', + output: { content: 'job failure message' }, + }), + } as any); registerJobInfoRoutes(core); await server.start(); @@ -243,7 +225,7 @@ describe('GET /api/reporting/jobs/download', () => { }); describe('successful downloads', () => { - const getCompleteHits = async ({ + const getCompleteHits = ({ jobType = 'unencodedJobType', outputContent = 'job output content', outputContentType = 'text/plain', @@ -260,11 +242,7 @@ describe('GET /api/reporting/jobs/download', () => { }; it('when a known job-type is complete', async () => { - const hits = getCompleteHits(); - // @ts-ignore - core.pluginSetupDeps.elasticsearch.legacy.client = { - callAsInternalUser: jest.fn().mockReturnValue(Promise.resolve(hits)), - }; + mockEsClient.search.mockResolvedValueOnce({ body: getCompleteHits() } as any); registerJobInfoRoutes(core); await server.start(); @@ -276,11 +254,7 @@ describe('GET /api/reporting/jobs/download', () => { }); it('succeeds when security is not there or disabled', async () => { - const hits = getCompleteHits(); - // @ts-ignore - core.pluginSetupDeps.elasticsearch.legacy.client = { - callAsInternalUser: jest.fn().mockReturnValue(Promise.resolve(hits)), - }; + mockEsClient.search.mockResolvedValueOnce({ body: getCompleteHits() } as any); // @ts-ignore core.pluginSetupDeps.security = null; @@ -297,14 +271,12 @@ describe('GET /api/reporting/jobs/download', () => { }); it(`doesn't encode output-content for non-specified job-types`, async () => { - const hits = getCompleteHits({ - jobType: 'unencodedJobType', - outputContent: 'test', - }); - // @ts-ignore - core.pluginSetupDeps.elasticsearch.legacy.client = { - callAsInternalUser: jest.fn().mockReturnValue(Promise.resolve(hits)), - }; + mockEsClient.search.mockResolvedValueOnce({ + body: getCompleteHits({ + jobType: 'unencodedJobType', + outputContent: 'test', + }), + } as any); registerJobInfoRoutes(core); await server.start(); @@ -316,15 +288,13 @@ describe('GET /api/reporting/jobs/download', () => { }); it(`base64 encodes output content for configured jobTypes`, async () => { - const hits = getCompleteHits({ - jobType: 'base64EncodedJobType', - outputContent: 'test', - outputContentType: 'application/pdf', - }); - // @ts-ignore - core.pluginSetupDeps.elasticsearch.legacy.client = { - callAsInternalUser: jest.fn().mockReturnValue(Promise.resolve(hits)), - }; + mockEsClient.search.mockResolvedValueOnce({ + body: getCompleteHits({ + jobType: 'base64EncodedJobType', + outputContent: 'test', + outputContentType: 'application/pdf', + }), + } as any); registerJobInfoRoutes(core); await server.start(); @@ -337,15 +307,13 @@ describe('GET /api/reporting/jobs/download', () => { }); it('refuses to return unknown content-types', async () => { - const hits = getCompleteHits({ - jobType: 'unencodedJobType', - outputContent: 'alert("all your base mine now");', - outputContentType: 'application/html', - }); - // @ts-ignore - core.pluginSetupDeps.elasticsearch.legacy.client = { - callAsInternalUser: jest.fn().mockReturnValue(Promise.resolve(hits)), - }; + mockEsClient.search.mockResolvedValueOnce({ + body: getCompleteHits({ + jobType: 'unencodedJobType', + outputContent: 'alert("all your base mine now");', + outputContentType: 'application/html', + }), + } as any); registerJobInfoRoutes(core); await server.start(); diff --git a/x-pack/plugins/reporting/server/routes/lib/jobs_query.ts b/x-pack/plugins/reporting/server/routes/lib/jobs_query.ts index 456c60e5c82e3..1db62f818216a 100644 --- a/x-pack/plugins/reporting/server/routes/lib/jobs_query.ts +++ b/x-pack/plugins/reporting/server/routes/lib/jobs_query.ts @@ -5,83 +5,59 @@ * 2.0. */ +import { UnwrapPromise } from '@kbn/utility-types'; import { i18n } from '@kbn/i18n'; -import { errors as elasticsearchErrors } from 'elasticsearch'; -import { get } from 'lodash'; +import { ResponseError } from '@elastic/elasticsearch/lib/errors'; +import { ElasticsearchClient } from 'src/core/server'; import { ReportingCore } from '../../'; import { ReportDocument } from '../../lib/store'; import { ReportingUser } from '../../types'; -const esErrors = elasticsearchErrors as Record; -const defaultSize = 10; - -// TODO: use SearchRequest from elasticsearch-client -interface QueryBody { - size?: number; - from?: number; - _source?: { - excludes: string[]; - }; - query: { - constant_score: { - filter: { - bool: { - must: Array>; - }; - }; - }; - }; -} +type SearchRequest = Required>[0]; interface GetOpts { includeContent?: boolean; } -// TODO: use SearchResult from elasticsearch-client -interface CountAggResult { - count: number; -} - +const defaultSize = 10; const getUsername = (user: ReportingUser) => (user ? user.username : false); -export function jobsQueryFactory(reportingCore: ReportingCore) { - const { elasticsearch } = reportingCore.getPluginSetupDeps(); - const { callAsInternalUser } = elasticsearch.legacy.client; - - function execQuery(queryType: string, body: QueryBody) { - const defaultBody: Record = { - search: { - _source: { - excludes: ['output.content'], - }, - sort: [{ created_at: { order: 'desc' } }], - size: defaultSize, - }, - }; +function getSearchBody(body: SearchRequest['body']): SearchRequest['body'] { + return { + _source: { + excludes: ['output.content'], + }, + sort: [{ created_at: { order: 'desc' } }], + size: defaultSize, + ...body, + }; +} +export function jobsQueryFactory(reportingCore: ReportingCore) { + function getIndex() { const config = reportingCore.getConfig(); - const index = config.get('index'); - const query = { - index: `${index}-*`, - body: Object.assign(defaultBody[queryType] || {}, body), - }; - - return callAsInternalUser(queryType, query).catch((err) => { - if (err instanceof esErrors['401']) return; - if (err instanceof esErrors['403']) return; - if (err instanceof esErrors['404']) return; - throw err; - }); + + return `${config.get('index')}-*`; } - type Result = number; + async function execQuery any>( + callback: T + ): Promise> | undefined> { + try { + const { asInternalUser: client } = await reportingCore.getEsClient(); + + return await callback(client); + } catch (error) { + if (error instanceof ResponseError && [401, 403, 404].includes(error.statusCode)) { + return; + } - function getHits(query: Promise) { - return query.then((res) => get(res, 'hits.hits', [])); + throw error; + } } return { - list( + async list( jobTypes: string[], user: ReportingUser, page = 0, @@ -89,32 +65,34 @@ export function jobsQueryFactory(reportingCore: ReportingCore) { jobIds: string[] | null ) { const username = getUsername(user); - const body: QueryBody = { + const body = getSearchBody({ size, from: size * page, query: { constant_score: { filter: { bool: { - must: [{ terms: { jobtype: jobTypes } }, { term: { created_by: username } }], + must: [ + { terms: { jobtype: jobTypes } }, + { term: { created_by: username } }, + ...(jobIds ? [{ ids: { values: jobIds } }] : []), + ], }, }, }, }, - }; + }); - if (jobIds) { - body.query.constant_score.filter.bool.must.push({ - ids: { values: jobIds }, - }); - } + const response = await execQuery((elasticsearchClient) => + elasticsearchClient.search({ body, index: getIndex() }) + ); - return getHits(execQuery('search', body)); + return response?.body.hits?.hits ?? []; }, - count(jobTypes: string[], user: ReportingUser) { + async count(jobTypes: string[], user: ReportingUser) { const username = getUsername(user); - const body: QueryBody = { + const body = { query: { constant_score: { filter: { @@ -126,17 +104,21 @@ export function jobsQueryFactory(reportingCore: ReportingCore) { }, }; - return execQuery('count', body).then((doc: CountAggResult) => { - if (!doc) return 0; - return doc.count; - }); + const response = await execQuery((elasticsearchClient) => + elasticsearchClient.count({ body, index: getIndex() }) + ); + + return response?.body.count ?? 0; }, - get(user: ReportingUser, id: string, opts: GetOpts = {}): Promise { - if (!id) return Promise.resolve(); - const username = getUsername(user); + async get(user: ReportingUser, id: string, opts: GetOpts = {}): Promise { + if (!id) { + return; + } - const body: QueryBody = { + const username = getUsername(user); + const body: SearchRequest['body'] = { + ...(opts.includeContent ? { _source: { excludes: [] } } : {}), query: { constant_score: { filter: { @@ -149,22 +131,23 @@ export function jobsQueryFactory(reportingCore: ReportingCore) { size: 1, }; - if (opts.includeContent) { - body._source = { - excludes: [], - }; + const response = await execQuery((elasticsearchClient) => + elasticsearchClient.search({ body, index: getIndex() }) + ); + + if (response?.body.hits?.hits?.length !== 1) { + return; } - return getHits(execQuery('search', body)).then((hits) => { - if (hits.length !== 1) return; - return hits[0]; - }); + return response.body.hits.hits[0] as ReportDocument; }, async delete(deleteIndex: string, id: string) { try { + const { asInternalUser: elasticsearchClient } = await reportingCore.getEsClient(); const query = { id, index: deleteIndex, refresh: true }; - return callAsInternalUser('delete', query); + + return await elasticsearchClient.delete(query); } catch (error) { throw new Error( i18n.translate('xpack.reporting.jobsQuery.deleteError', { diff --git a/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts b/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts index e42d87c50e118..952f801ba519d 100644 --- a/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts +++ b/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts @@ -37,7 +37,6 @@ import { createMockLevelLogger } from './create_mock_levellogger'; export const createMockPluginSetup = (setupMock?: any): ReportingInternalSetup => { return { features: featuresPluginMock.createSetup(), - elasticsearch: setupMock.elasticsearch || { legacy: { client: {} } }, basePath: { set: jest.fn() }, router: setupMock.router, security: setupMock.security, @@ -137,7 +136,7 @@ export const createMockReportingCore = async ( ) => { const mockReportingCore = ({ getConfig: () => config, - getElasticsearchService: () => setupDepsMock?.elasticsearch, + getEsClient: () => startDepsMock?.esClient, getDataService: () => startDepsMock?.data, } as unknown) as ReportingCore; From 106afd41b689fa0c3fc680d14b838d29650473e3 Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Fri, 16 Apr 2021 10:40:30 +0200 Subject: [PATCH 51/68] [SavedObjects] Add aggregations support (#96292) * step 1 to add aggs in the find function of saved object * setp 2 - add specific unit test to aggs + fix bug found during integrations * step 3 - add security api_integration arounds aggs * fix types * unit test added for aggs_utils * add documentation * fix docs * review I * doc * try to fix test * add the new property to the saved object globaltype * fix types * delete old files * fix types + test api integration * type fix + test * Update src/core/server/saved_objects/types.ts Co-authored-by: Rudolf Meijering * review I * change our validation to match discussion with Pierre and Rudolph * Validate multiple items nested filter query through KueryNode * remove unused import * review + put back test * migrate added tests to new TS file * fix documentation * fix license header * move stuff * duplicating test mappings * rename some stuff * move ALL the things * cast to aggregation container * update generated doc * add deep nested validation * rewrite the whole validation mechanism * some cleanup * minor cleanup * update generated doc * adapt telemetry client * fix API integ tests * fix doc * TOTO-less * remove xpack tests * list supported / unsupported aggregations * typo fix * extract some validation function * fix indent * add some unit tests * adapt FTR assertions * update doc * fix doc * doc again * cleanup test names * improve tsdoc on validation functions * perf nit Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Co-authored-by: Rudolf Meijering Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- docs/api/saved-objects/find.asciidoc | 11 +- ...gin-core-public.savedobjectsclient.find.md | 2 +- ...a-plugin-core-public.savedobjectsclient.md | 2 +- ...dobjectsfindresponsepublic.aggregations.md | 11 + ...e-public.savedobjectsfindresponsepublic.md | 3 +- ...gin-core-server.savedobjectsclient.find.md | 4 +- ...r.savedobjectsfindresponse.aggregations.md | 11 + ...in-core-server.savedobjectsfindresponse.md | 3 +- ...core-server.savedobjectsrepository.find.md | 4 +- ...vedobjectsutils.createemptyfindresponse.md | 2 +- ...na-plugin-core-server.savedobjectsutils.md | 2 +- src/core/public/public.api.md | 8 +- .../saved_objects/saved_objects_client.ts | 14 +- src/core/server/saved_objects/routes/find.ts | 16 + .../aggregations/aggs_types/bucket_aggs.ts | 86 ++++ .../lib/aggregations/aggs_types/index.ts | 15 + .../aggregations/aggs_types/metrics_aggs.ts | 94 ++++ .../service/lib/aggregations/index.ts | 9 + .../lib/aggregations/validation.test.ts | 431 ++++++++++++++++++ .../service/lib/aggregations/validation.ts | 229 ++++++++++ .../lib/aggregations/validation_utils.test.ts | 148 ++++++ .../lib/aggregations/validation_utils.ts | 80 ++++ .../service/lib/filter_utils.test.ts | 69 ++- .../saved_objects/service/lib/filter_utils.ts | 12 +- .../saved_objects/service/lib/repository.ts | 36 +- .../server/saved_objects/service/lib/utils.ts | 4 +- .../service/saved_objects_client.ts | 7 +- src/core/server/saved_objects/types.ts | 22 + src/core/server/server.api.md | 12 +- .../server/telemetry_saved_objects_client.ts | 4 +- .../apis/saved_objects/find.ts | 69 +++ .../encrypted_saved_objects_client_wrapper.ts | 4 +- .../secure_saved_objects_client_wrapper.ts | 6 +- .../spaces_saved_objects_client.ts | 8 +- 34 files changed, 1369 insertions(+), 69 deletions(-) create mode 100644 docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.aggregations.md create mode 100644 docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.aggregations.md create mode 100644 src/core/server/saved_objects/service/lib/aggregations/aggs_types/bucket_aggs.ts create mode 100644 src/core/server/saved_objects/service/lib/aggregations/aggs_types/index.ts create mode 100644 src/core/server/saved_objects/service/lib/aggregations/aggs_types/metrics_aggs.ts create mode 100644 src/core/server/saved_objects/service/lib/aggregations/index.ts create mode 100644 src/core/server/saved_objects/service/lib/aggregations/validation.test.ts create mode 100644 src/core/server/saved_objects/service/lib/aggregations/validation.ts create mode 100644 src/core/server/saved_objects/service/lib/aggregations/validation_utils.test.ts create mode 100644 src/core/server/saved_objects/service/lib/aggregations/validation_utils.ts diff --git a/docs/api/saved-objects/find.asciidoc b/docs/api/saved-objects/find.asciidoc index c43b58d3aa989..f04aeb8420620 100644 --- a/docs/api/saved-objects/find.asciidoc +++ b/docs/api/saved-objects/find.asciidoc @@ -53,9 +53,14 @@ experimental[] Retrieve a paginated set of {kib} saved objects by various condit (Optional, object) Filters to objects that have a relationship with the type and ID combination. `filter`:: - (Optional, string) The filter is a KQL string with the caveat that if you filter with an attribute from your type saved object. - It should look like that savedObjectType.attributes.title: "myTitle". However, If you used a direct attribute of a saved object like `updatedAt`, - you will have to define your filter like that savedObjectType.updatedAt > 2018-12-22. + (Optional, string) The filter is a KQL string with the caveat that if you filter with an attribute from your saved object type, + it should look like that: `savedObjectType.attributes.title: "myTitle"`. However, If you use a root attribute of a saved + object such as `updated_at`, you will have to define your filter like that: `savedObjectType.updated_at > 2018-12-22`. + +`aggs`:: + (Optional, string) **experimental** An aggregation structure, serialized as a string. The field format is similar to `filter`, meaning + that to use a saved object type attribute in the aggregation, the `savedObjectType.attributes.title`: "myTitle"` format + must be used. For root fields, the syntax is `savedObjectType.rootField` NOTE: As objects change in {kib}, the results on each page of the response also change. Use the find API for traditional paginated results, but avoid using it to export large amounts of data. diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.find.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.find.md index ddd8b207e3d78..fc9652b96450f 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.find.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.find.md @@ -9,5 +9,5 @@ Search for objects Signature: ```typescript -find: (options: SavedObjectsFindOptions) => Promise>; +find: (options: SavedObjectsFindOptions) => Promise>; ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.md index 6e53b169b8bed..1ec756f8d743d 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.md @@ -24,7 +24,7 @@ The constructor for this class is marked as internal. Third-party code should no | [bulkGet](./kibana-plugin-core-public.savedobjectsclient.bulkget.md) | | (objects?: Array<{
id: string;
type: string;
}>) => Promise<SavedObjectsBatchResponse<unknown>> | Returns an array of objects by id | | [create](./kibana-plugin-core-public.savedobjectsclient.create.md) | | <T = unknown>(type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise<SimpleSavedObject<T>> | Persists an object | | [delete](./kibana-plugin-core-public.savedobjectsclient.delete.md) | | (type: string, id: string, options?: SavedObjectsDeleteOptions | undefined) => ReturnType<SavedObjectsApi['delete']> | Deletes an object | -| [find](./kibana-plugin-core-public.savedobjectsclient.find.md) | | <T = unknown>(options: SavedObjectsFindOptions) => Promise<SavedObjectsFindResponsePublic<T>> | Search for objects | +| [find](./kibana-plugin-core-public.savedobjectsclient.find.md) | | <T = unknown, A = unknown>(options: SavedObjectsFindOptions) => Promise<SavedObjectsFindResponsePublic<T, unknown>> | Search for objects | | [get](./kibana-plugin-core-public.savedobjectsclient.get.md) | | <T = unknown>(type: string, id: string) => Promise<SimpleSavedObject<T>> | Fetches a single object | ## Methods diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.aggregations.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.aggregations.md new file mode 100644 index 0000000000000..14401b02f25c7 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.aggregations.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [SavedObjectsFindResponsePublic](./kibana-plugin-core-public.savedobjectsfindresponsepublic.md) > [aggregations](./kibana-plugin-core-public.savedobjectsfindresponsepublic.aggregations.md) + +## SavedObjectsFindResponsePublic.aggregations property + +Signature: + +```typescript +aggregations?: A; +``` diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.md index 7d75878041264..6f2276194f054 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.md @@ -11,13 +11,14 @@ Return type of the Saved Objects `find()` method. Signature: ```typescript -export interface SavedObjectsFindResponsePublic extends SavedObjectsBatchResponse +export interface SavedObjectsFindResponsePublic extends SavedObjectsBatchResponse ``` ## Properties | Property | Type | Description | | --- | --- | --- | +| [aggregations](./kibana-plugin-core-public.savedobjectsfindresponsepublic.aggregations.md) | A | | | [page](./kibana-plugin-core-public.savedobjectsfindresponsepublic.page.md) | number | | | [perPage](./kibana-plugin-core-public.savedobjectsfindresponsepublic.perpage.md) | number | | | [total](./kibana-plugin-core-public.savedobjectsfindresponsepublic.total.md) | number | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.find.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.find.md index 9a4c3df5d2d92..56d76125108d1 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.find.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.find.md @@ -9,7 +9,7 @@ Find all SavedObjects matching the search query Signature: ```typescript -find(options: SavedObjectsFindOptions): Promise>; +find(options: SavedObjectsFindOptions): Promise>; ``` ## Parameters @@ -20,5 +20,5 @@ find(options: SavedObjectsFindOptions): PromiseReturns: -`Promise>` +`Promise>` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.aggregations.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.aggregations.md new file mode 100644 index 0000000000000..17a899f4c8280 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.aggregations.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsFindResponse](./kibana-plugin-core-server.savedobjectsfindresponse.md) > [aggregations](./kibana-plugin-core-server.savedobjectsfindresponse.aggregations.md) + +## SavedObjectsFindResponse.aggregations property + +Signature: + +```typescript +aggregations?: A; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.md index fd56e8ce40e24..8176baf44acbd 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.md @@ -11,13 +11,14 @@ Return type of the Saved Objects `find()` method. Signature: ```typescript -export interface SavedObjectsFindResponse +export interface SavedObjectsFindResponse ``` ## Properties | Property | Type | Description | | --- | --- | --- | +| [aggregations](./kibana-plugin-core-server.savedobjectsfindresponse.aggregations.md) | A | | | [page](./kibana-plugin-core-server.savedobjectsfindresponse.page.md) | number | | | [per\_page](./kibana-plugin-core-server.savedobjectsfindresponse.per_page.md) | number | | | [pit\_id](./kibana-plugin-core-server.savedobjectsfindresponse.pit_id.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.find.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.find.md index d3e93e7af2aa0..5c823b7567918 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.find.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.find.md @@ -7,7 +7,7 @@ Signature: ```typescript -find(options: SavedObjectsFindOptions): Promise>; +find(options: SavedObjectsFindOptions): Promise>; ``` ## Parameters @@ -18,7 +18,7 @@ find(options: SavedObjectsFindOptions): PromiseReturns: -`Promise>` +`Promise>` {promise} - { saved\_objects: \[{ id, type, version, attributes }\], total, per\_page, page } diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.createemptyfindresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.createemptyfindresponse.md index 40e865cb02ce8..23cbebf22aa21 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.createemptyfindresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.createemptyfindresponse.md @@ -9,5 +9,5 @@ Creates an empty response for a find operation. This is only intended to be used Signature: ```typescript -static createEmptyFindResponse: ({ page, perPage, }: SavedObjectsFindOptions) => SavedObjectsFindResponse; +static createEmptyFindResponse: ({ page, perPage, }: SavedObjectsFindOptions) => SavedObjectsFindResponse; ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.md index 8c787364c4cbe..0148621e757b7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.md @@ -15,7 +15,7 @@ export declare class SavedObjectsUtils | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [createEmptyFindResponse](./kibana-plugin-core-server.savedobjectsutils.createemptyfindresponse.md) | static | <T>({ page, perPage, }: SavedObjectsFindOptions) => SavedObjectsFindResponse<T> | Creates an empty response for a find operation. This is only intended to be used by saved objects client wrappers. | +| [createEmptyFindResponse](./kibana-plugin-core-server.savedobjectsutils.createemptyfindresponse.md) | static | <T, A>({ page, perPage, }: SavedObjectsFindOptions) => SavedObjectsFindResponse<T, A> | Creates an empty response for a find operation. This is only intended to be used by saved objects client wrappers. | | [namespaceIdToString](./kibana-plugin-core-server.savedobjectsutils.namespaceidtostring.md) | static | (namespace?: string | undefined) => string | Converts a given saved object namespace ID to its string representation. All namespace IDs have an identical string representation, with the exception of the undefined namespace ID (which has a namespace string of 'default'). | | [namespaceStringToId](./kibana-plugin-core-server.savedobjectsutils.namespacestringtoid.md) | static | (namespace: string) => string | undefined | Converts a given saved object namespace string to its ID representation. All namespace strings have an identical ID representation, with the exception of the 'default' namespace string (which has a namespace ID of undefined). | diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 8c1753c2cabab..18133ebec3353 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -1224,7 +1224,7 @@ export class SavedObjectsClient { // Warning: (ae-forgotten-export) The symbol "SavedObjectsClientContract" needs to be exported by the entry point index.d.ts delete: (type: string, id: string, options?: SavedObjectsDeleteOptions | undefined) => ReturnType; // Warning: (ae-forgotten-export) The symbol "SavedObjectsFindOptions" needs to be exported by the entry point index.d.ts - find: (options: SavedObjectsFindOptions_2) => Promise>; + find: (options: SavedObjectsFindOptions_2) => Promise>; get: (type: string, id: string) => Promise>; update(type: string, id: string, attributes: T, { version, migrationVersion, references }?: SavedObjectsUpdateOptions): Promise>; } @@ -1244,6 +1244,8 @@ export interface SavedObjectsCreateOptions { // @public (undocumented) export interface SavedObjectsFindOptions { + // @alpha + aggs?: Record; defaultSearchOperator?: 'AND' | 'OR'; fields?: string[]; // Warning: (ae-forgotten-export) The symbol "KueryNode" needs to be exported by the entry point index.d.ts @@ -1284,7 +1286,9 @@ export interface SavedObjectsFindOptionsReference { } // @public -export interface SavedObjectsFindResponsePublic extends SavedObjectsBatchResponse { +export interface SavedObjectsFindResponsePublic extends SavedObjectsBatchResponse { + // (undocumented) + aggregations?: A; // (undocumented) page: number; // (undocumented) diff --git a/src/core/public/saved_objects/saved_objects_client.ts b/src/core/public/saved_objects/saved_objects_client.ts index 44466025de7e3..782ffa6897048 100644 --- a/src/core/public/saved_objects/saved_objects_client.ts +++ b/src/core/public/saved_objects/saved_objects_client.ts @@ -103,7 +103,9 @@ export interface SavedObjectsDeleteOptions { * * @public */ -export interface SavedObjectsFindResponsePublic extends SavedObjectsBatchResponse { +export interface SavedObjectsFindResponsePublic + extends SavedObjectsBatchResponse { + aggregations?: A; total: number; perPage: number; page: number; @@ -310,7 +312,7 @@ export class SavedObjectsClient { * @property {object} [options.hasReference] - { type, id } * @returns A find result with objects matching the specified search. */ - public find = ( + public find = ( options: SavedObjectsFindOptions ): Promise> => { const path = this.getPath(['_find']); @@ -326,6 +328,7 @@ export class SavedObjectsClient { sortField: 'sort_field', type: 'type', filter: 'filter', + aggs: 'aggs', namespaces: 'namespaces', preference: 'preference', }; @@ -342,6 +345,12 @@ export class SavedObjectsClient { query.has_reference = JSON.stringify(query.has_reference); } + // `aggs` is a structured object. we need to stringify it before sending it, as `fetch` + // is not doing it implicitly. + if (query.aggs) { + query.aggs = JSON.stringify(query.aggs); + } + const request: ReturnType = this.savedObjectsFetch(path, { method: 'GET', query, @@ -349,6 +358,7 @@ export class SavedObjectsClient { return request.then((resp) => { return renameKeys( { + aggregations: 'aggregations', saved_objects: 'savedObjects', total: 'total', per_page: 'perPage', diff --git a/src/core/server/saved_objects/routes/find.ts b/src/core/server/saved_objects/routes/find.ts index 6ba23747cf374..d21039db30e5f 100644 --- a/src/core/server/saved_objects/routes/find.ts +++ b/src/core/server/saved_objects/routes/find.ts @@ -44,6 +44,7 @@ export const registerFindRoute = (router: IRouter, { coreUsageData }: RouteDepen has_reference_operator: searchOperatorSchema, fields: schema.maybe(schema.oneOf([schema.string(), schema.arrayOf(schema.string())])), filter: schema.maybe(schema.string()), + aggs: schema.maybe(schema.string()), namespaces: schema.maybe( schema.oneOf([schema.string(), schema.arrayOf(schema.string())]) ), @@ -59,6 +60,20 @@ export const registerFindRoute = (router: IRouter, { coreUsageData }: RouteDepen const usageStatsClient = coreUsageData.getClient(); usageStatsClient.incrementSavedObjectsFind({ request: req }).catch(() => {}); + // manually validation to avoid using JSON.parse twice + let aggs; + if (query.aggs) { + try { + aggs = JSON.parse(query.aggs); + } catch (e) { + return res.badRequest({ + body: { + message: 'invalid aggs value', + }, + }); + } + } + const result = await context.core.savedObjects.client.find({ perPage: query.per_page, page: query.page, @@ -72,6 +87,7 @@ export const registerFindRoute = (router: IRouter, { coreUsageData }: RouteDepen hasReferenceOperator: query.has_reference_operator, fields: typeof query.fields === 'string' ? [query.fields] : query.fields, filter: query.filter, + aggs, namespaces, }); diff --git a/src/core/server/saved_objects/service/lib/aggregations/aggs_types/bucket_aggs.ts b/src/core/server/saved_objects/service/lib/aggregations/aggs_types/bucket_aggs.ts new file mode 100644 index 0000000000000..1508cab69a048 --- /dev/null +++ b/src/core/server/saved_objects/service/lib/aggregations/aggs_types/bucket_aggs.ts @@ -0,0 +1,86 @@ +/* + * 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 as s, ObjectType } from '@kbn/config-schema'; + +/** + * Schemas for the Bucket aggregations. + * + * Currently supported: + * - filter + * - histogram + * - terms + * + * Not implemented: + * - adjacency_matrix + * - auto_date_histogram + * - children + * - composite + * - date_histogram + * - date_range + * - diversified_sampler + * - filters + * - geo_distance + * - geohash_grid + * - geotile_grid + * - global + * - ip_range + * - missing + * - multi_terms + * - nested + * - parent + * - range + * - rare_terms + * - reverse_nested + * - sampler + * - significant_terms + * - significant_text + * - variable_width_histogram + */ +export const bucketAggsSchemas: Record = { + filter: s.object({ + term: s.recordOf(s.string(), s.oneOf([s.string(), s.boolean(), s.number()])), + }), + histogram: s.object({ + field: s.maybe(s.string()), + interval: s.maybe(s.number()), + min_doc_count: s.maybe(s.number()), + extended_bounds: s.maybe( + s.object({ + min: s.number(), + max: s.number(), + }) + ), + hard_bounds: s.maybe( + s.object({ + min: s.number(), + max: s.number(), + }) + ), + missing: s.maybe(s.number()), + keyed: s.maybe(s.boolean()), + order: s.maybe( + s.object({ + _count: s.string(), + _key: s.string(), + }) + ), + }), + terms: s.object({ + field: s.maybe(s.string()), + collect_mode: s.maybe(s.string()), + exclude: s.maybe(s.oneOf([s.string(), s.arrayOf(s.string())])), + include: s.maybe(s.oneOf([s.string(), s.arrayOf(s.string())])), + execution_hint: s.maybe(s.string()), + missing: s.maybe(s.number()), + min_doc_count: s.maybe(s.number()), + size: s.maybe(s.number()), + show_term_doc_count_error: s.maybe(s.boolean()), + order: s.maybe(s.oneOf([s.literal('asc'), s.literal('desc')])), + }), +}; diff --git a/src/core/server/saved_objects/service/lib/aggregations/aggs_types/index.ts b/src/core/server/saved_objects/service/lib/aggregations/aggs_types/index.ts new file mode 100644 index 0000000000000..7967fad0185fb --- /dev/null +++ b/src/core/server/saved_objects/service/lib/aggregations/aggs_types/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. + */ + +import { bucketAggsSchemas } from './bucket_aggs'; +import { metricsAggsSchemas } from './metrics_aggs'; + +export const aggregationSchemas = { + ...metricsAggsSchemas, + ...bucketAggsSchemas, +}; diff --git a/src/core/server/saved_objects/service/lib/aggregations/aggs_types/metrics_aggs.ts b/src/core/server/saved_objects/service/lib/aggregations/aggs_types/metrics_aggs.ts new file mode 100644 index 0000000000000..c05ae67cd2164 --- /dev/null +++ b/src/core/server/saved_objects/service/lib/aggregations/aggs_types/metrics_aggs.ts @@ -0,0 +1,94 @@ +/* + * 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 as s, ObjectType } from '@kbn/config-schema'; + +/** + * Schemas for the metrics Aggregations + * + * Currently supported: + * - avg + * - cardinality + * - min + * - max + * - sum + * - top_hits + * - weighted_avg + * + * Not implemented: + * - boxplot + * - extended_stats + * - geo_bounds + * - geo_centroid + * - geo_line + * - matrix_stats + * - median_absolute_deviation + * - percentile_ranks + * - percentiles + * - rate + * - scripted_metric + * - stats + * - string_stats + * - t_test + * - value_count + */ +export const metricsAggsSchemas: Record = { + avg: s.object({ + field: s.maybe(s.string()), + missing: s.maybe(s.oneOf([s.string(), s.number(), s.boolean()])), + }), + cardinality: s.object({ + field: s.maybe(s.string()), + precision_threshold: s.maybe(s.number()), + rehash: s.maybe(s.boolean()), + missing: s.maybe(s.oneOf([s.string(), s.number(), s.boolean()])), + }), + min: s.object({ + field: s.maybe(s.string()), + missing: s.maybe(s.oneOf([s.string(), s.number(), s.boolean()])), + format: s.maybe(s.string()), + }), + max: s.object({ + field: s.maybe(s.string()), + missing: s.maybe(s.oneOf([s.string(), s.number(), s.boolean()])), + format: s.maybe(s.string()), + }), + sum: s.object({ + field: s.maybe(s.string()), + missing: s.maybe(s.oneOf([s.string(), s.number(), s.boolean()])), + }), + top_hits: s.object({ + explain: s.maybe(s.boolean()), + docvalue_fields: s.maybe(s.oneOf([s.string(), s.arrayOf(s.string())])), + stored_fields: s.maybe(s.oneOf([s.string(), s.arrayOf(s.string())])), + from: s.maybe(s.number()), + size: s.maybe(s.number()), + sort: s.maybe(s.oneOf([s.literal('asc'), s.literal('desc')])), + seq_no_primary_term: s.maybe(s.boolean()), + version: s.maybe(s.boolean()), + track_scores: s.maybe(s.boolean()), + highlight: s.maybe(s.any()), + _source: s.maybe(s.oneOf([s.boolean(), s.string(), s.arrayOf(s.string())])), + }), + weighted_avg: s.object({ + format: s.maybe(s.string()), + value_type: s.maybe(s.string()), + value: s.maybe( + s.object({ + field: s.maybe(s.string()), + missing: s.maybe(s.number()), + }) + ), + weight: s.maybe( + s.object({ + field: s.maybe(s.string()), + missing: s.maybe(s.number()), + }) + ), + }), +}; diff --git a/src/core/server/saved_objects/service/lib/aggregations/index.ts b/src/core/server/saved_objects/service/lib/aggregations/index.ts new file mode 100644 index 0000000000000..f71d3e8daea9d --- /dev/null +++ b/src/core/server/saved_objects/service/lib/aggregations/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 { validateAndConvertAggregations } from './validation'; diff --git a/src/core/server/saved_objects/service/lib/aggregations/validation.test.ts b/src/core/server/saved_objects/service/lib/aggregations/validation.test.ts new file mode 100644 index 0000000000000..8a7c1c3719eb0 --- /dev/null +++ b/src/core/server/saved_objects/service/lib/aggregations/validation.test.ts @@ -0,0 +1,431 @@ +/* + * 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 { estypes } from '@elastic/elasticsearch'; +import { validateAndConvertAggregations } from './validation'; + +type AggsMap = Record; + +const mockMappings = { + properties: { + updated_at: { + type: 'date', + }, + foo: { + properties: { + title: { + type: 'text', + }, + description: { + type: 'text', + }, + bytes: { + type: 'number', + }, + }, + }, + bean: { + properties: { + canned: { + fields: { + text: { + type: 'text', + }, + }, + type: 'keyword', + }, + }, + }, + alert: { + properties: { + actions: { + type: 'nested', + properties: { + group: { + type: 'keyword', + }, + actionRef: { + type: 'keyword', + }, + actionTypeId: { + type: 'keyword', + }, + params: { + enabled: false, + type: 'object', + }, + }, + }, + params: { + type: 'flattened', + }, + }, + }, + }, +}; + +describe('validateAndConvertAggregations', () => { + it('validates a simple aggregations', () => { + expect( + validateAndConvertAggregations( + ['foo'], + { aggName: { max: { field: 'foo.attributes.bytes' } } }, + mockMappings + ) + ).toEqual({ + aggName: { + max: { + field: 'foo.bytes', + }, + }, + }); + }); + + it('validates a nested field in simple aggregations', () => { + expect( + validateAndConvertAggregations( + ['alert'], + { aggName: { cardinality: { field: 'alert.attributes.actions.group' } } }, + mockMappings + ) + ).toEqual({ + aggName: { + cardinality: { + field: 'alert.actions.group', + }, + }, + }); + }); + + it('validates a nested aggregations', () => { + expect( + validateAndConvertAggregations( + ['alert'], + { + aggName: { + cardinality: { + field: 'alert.attributes.actions.group', + }, + aggs: { + aggName: { + max: { field: 'alert.attributes.actions.group' }, + }, + }, + }, + }, + mockMappings + ) + ).toEqual({ + aggName: { + cardinality: { + field: 'alert.actions.group', + }, + aggs: { + aggName: { + max: { + field: 'alert.actions.group', + }, + }, + }, + }, + }); + }); + + it('validates a deeply nested aggregations', () => { + expect( + validateAndConvertAggregations( + ['alert'], + { + first: { + cardinality: { + field: 'alert.attributes.actions.group', + }, + aggs: { + second: { + max: { field: 'alert.attributes.actions.group' }, + aggs: { + third: { + min: { + field: 'alert.attributes.actions.actionTypeId', + }, + }, + }, + }, + }, + }, + }, + mockMappings + ) + ).toEqual({ + first: { + cardinality: { + field: 'alert.actions.group', + }, + aggs: { + second: { + max: { field: 'alert.actions.group' }, + aggs: { + third: { + min: { + field: 'alert.actions.actionTypeId', + }, + }, + }, + }, + }, + }, + }); + }); + + it('rewrites type attributes when valid', () => { + const aggregations: AggsMap = { + average: { + avg: { + field: 'alert.attributes.actions.group', + missing: 10, + }, + }, + }; + expect(validateAndConvertAggregations(['alert'], aggregations, mockMappings)).toEqual({ + average: { + avg: { + field: 'alert.actions.group', + missing: 10, + }, + }, + }); + }); + + it('rewrites root attributes when valid', () => { + const aggregations: AggsMap = { + average: { + avg: { + field: 'alert.updated_at', + missing: 10, + }, + }, + }; + expect(validateAndConvertAggregations(['alert'], aggregations, mockMappings)).toEqual({ + average: { + avg: { + field: 'updated_at', + missing: 10, + }, + }, + }); + }); + + it('throws an error when the `field` name is not using attributes path', () => { + const aggregations: AggsMap = { + average: { + avg: { + field: 'alert.actions.group', + missing: 10, + }, + }, + }; + expect(() => + validateAndConvertAggregations(['alert'], aggregations, mockMappings) + ).toThrowErrorMatchingInlineSnapshot( + `"[average.avg.field] Invalid attribute path: alert.actions.group"` + ); + }); + + it('throws an error when the `field` name is referencing an invalid field', () => { + const aggregations: AggsMap = { + average: { + avg: { + field: 'alert.attributes.actions.non_existing', + missing: 10, + }, + }, + }; + expect(() => + validateAndConvertAggregations(['alert'], aggregations, mockMappings) + ).toThrowErrorMatchingInlineSnapshot( + `"[average.avg.field] Invalid attribute path: alert.attributes.actions.non_existing"` + ); + }); + + it('throws an error when the attribute path is referencing an invalid root field', () => { + const aggregations: AggsMap = { + average: { + avg: { + field: 'alert.bad_root', + missing: 10, + }, + }, + }; + expect(() => + validateAndConvertAggregations(['alert'], aggregations, mockMappings) + ).toThrowErrorMatchingInlineSnapshot( + `"[average.avg.field] Invalid attribute path: alert.bad_root"` + ); + }); + + it('rewrites the `field` name even when nested', () => { + const aggregations: AggsMap = { + average: { + weighted_avg: { + value: { + field: 'alert.attributes.actions.group', + missing: 10, + }, + weight: { + field: 'alert.attributes.actions.actionRef', + }, + }, + }, + }; + expect(validateAndConvertAggregations(['alert'], aggregations, mockMappings)).toEqual({ + average: { + weighted_avg: { + value: { + field: 'alert.actions.group', + missing: 10, + }, + weight: { + field: 'alert.actions.actionRef', + }, + }, + }, + }); + }); + + it('rewrites the entries of a filter term record', () => { + const aggregations: AggsMap = { + myFilter: { + filter: { + term: { + 'foo.attributes.description': 'hello', + 'foo.attributes.bytes': 10, + }, + }, + }, + }; + expect(validateAndConvertAggregations(['foo'], aggregations, mockMappings)).toEqual({ + myFilter: { + filter: { + term: { 'foo.description': 'hello', 'foo.bytes': 10 }, + }, + }, + }); + }); + + it('throws an error when referencing non-allowed types', () => { + const aggregations: AggsMap = { + myFilter: { + max: { + field: 'foo.attributes.bytes', + }, + }, + }; + + expect(() => { + validateAndConvertAggregations(['alert'], aggregations, mockMappings); + }).toThrowErrorMatchingInlineSnapshot( + `"[myFilter.max.field] Invalid attribute path: foo.attributes.bytes"` + ); + }); + + it('throws an error when an attributes is not respecting its schema definition', () => { + const aggregations: AggsMap = { + someAgg: { + terms: { + missing: 'expecting a number', + }, + }, + }; + + expect(() => + validateAndConvertAggregations(['alert'], aggregations, mockMappings) + ).toThrowErrorMatchingInlineSnapshot( + `"[someAgg.terms.missing]: expected value of type [number] but got [string]"` + ); + }); + + it('throws an error when trying to validate an unknown aggregation type', () => { + const aggregations: AggsMap = { + someAgg: { + auto_date_histogram: { + field: 'foo.attributes.bytes', + }, + }, + }; + + expect(() => { + validateAndConvertAggregations(['foo'], aggregations, mockMappings); + }).toThrowErrorMatchingInlineSnapshot( + `"[someAgg.auto_date_histogram] auto_date_histogram aggregation is not valid (or not registered yet)"` + ); + }); + + it('throws an error when a child aggregation is unknown', () => { + const aggregations: AggsMap = { + someAgg: { + max: { + field: 'foo.attributes.bytes', + }, + aggs: { + unknownAgg: { + cumulative_cardinality: { + format: 'format', + }, + }, + }, + }, + }; + + expect(() => { + validateAndConvertAggregations(['foo'], aggregations, mockMappings); + }).toThrowErrorMatchingInlineSnapshot( + `"[someAgg.aggs.unknownAgg.cumulative_cardinality] cumulative_cardinality aggregation is not valid (or not registered yet)"` + ); + }); + + it('throws an error when using a script attribute', () => { + const aggregations: AggsMap = { + someAgg: { + max: { + field: 'foo.attributes.bytes', + script: 'This is a bad script', + }, + }, + }; + + expect(() => { + validateAndConvertAggregations(['foo'], aggregations, mockMappings); + }).toThrowErrorMatchingInlineSnapshot( + `"[someAgg.max.script]: definition for this key is missing"` + ); + }); + + it('throws an error when using a script attribute in a nested aggregation', () => { + const aggregations: AggsMap = { + someAgg: { + min: { + field: 'foo.attributes.bytes', + }, + aggs: { + nested: { + max: { + field: 'foo.attributes.bytes', + script: 'This is a bad script', + }, + }, + }, + }, + }; + + expect(() => { + validateAndConvertAggregations(['foo'], aggregations, mockMappings); + }).toThrowErrorMatchingInlineSnapshot( + `"[someAgg.aggs.nested.max.script]: definition for this key is missing"` + ); + }); +}); diff --git a/src/core/server/saved_objects/service/lib/aggregations/validation.ts b/src/core/server/saved_objects/service/lib/aggregations/validation.ts new file mode 100644 index 0000000000000..a2fd392183132 --- /dev/null +++ b/src/core/server/saved_objects/service/lib/aggregations/validation.ts @@ -0,0 +1,229 @@ +/* + * 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 { estypes } from '@elastic/elasticsearch'; +import { ObjectType } from '@kbn/config-schema'; +import { isPlainObject } from 'lodash'; + +import { IndexMapping } from '../../../mappings'; +import { + isObjectTypeAttribute, + rewriteObjectTypeAttribute, + isRootLevelAttribute, + rewriteRootLevelAttribute, +} from './validation_utils'; +import { aggregationSchemas } from './aggs_types'; + +const aggregationKeys = ['aggs', 'aggregations']; + +interface ValidationContext { + allowedTypes: string[]; + indexMapping: IndexMapping; + currentPath: string[]; +} + +/** + * Validate an aggregation structure against the declared mappings and + * aggregation schemas, and rewrite the attribute fields using the KQL-like syntax + * - `{type}.attributes.{attribute}` to `{type}.{attribute}` + * - `{type}.{rootField}` to `{rootField}` + * + * throws on the first validation error if any is encountered. + */ +export const validateAndConvertAggregations = ( + allowedTypes: string[], + aggs: Record, + indexMapping: IndexMapping +): Record => { + return validateAggregations(aggs, { + allowedTypes, + indexMapping, + currentPath: [], + }); +}; + +/** + * Validate a record of aggregation containers, + * Which can either be the root level aggregations (`SearchRequest.body.aggs`) + * Or a nested record of aggregation (`SearchRequest.body.aggs.myAggregation.aggs`) + */ +const validateAggregations = ( + aggregations: Record, + context: ValidationContext +) => { + return Object.entries(aggregations).reduce((memo, [aggrName, aggrContainer]) => { + memo[aggrName] = validateAggregation(aggrContainer, childContext(context, aggrName)); + return memo; + }, {} as Record); +}; + +/** + * Validate an aggregation container, e.g an entry of `SearchRequest.body.aggs`, or + * from a nested aggregation record, including its potential nested aggregations. + */ +const validateAggregation = ( + aggregation: estypes.AggregationContainer, + context: ValidationContext +) => { + const container = validateAggregationContainer(aggregation, context); + + if (aggregation.aggregations) { + container.aggregations = validateAggregations( + aggregation.aggregations, + childContext(context, 'aggregations') + ); + } + if (aggregation.aggs) { + container.aggs = validateAggregations(aggregation.aggs, childContext(context, 'aggs')); + } + + return container; +}; + +/** + * Validates root-level aggregation of given aggregation container + * (ignoring its nested aggregations) + */ +const validateAggregationContainer = ( + container: estypes.AggregationContainer, + context: ValidationContext +) => { + return Object.entries(container).reduce((memo, [aggName, aggregation]) => { + if (aggregationKeys.includes(aggName)) { + return memo; + } + return { + ...memo, + [aggName]: validateAggregationType(aggName, aggregation, childContext(context, aggName)), + }; + }, {} as estypes.AggregationContainer); +}; + +const validateAggregationType = ( + aggregationType: string, + aggregation: Record, + context: ValidationContext +) => { + const aggregationSchema = aggregationSchemas[aggregationType]; + if (!aggregationSchema) { + throw new Error( + `[${context.currentPath.join( + '.' + )}] ${aggregationType} aggregation is not valid (or not registered yet)` + ); + } + + validateAggregationStructure(aggregationSchema, aggregation, context); + return validateAndRewriteFieldAttributes(aggregation, context); +}; + +/** + * Validate an aggregation structure against its declared schema. + */ +const validateAggregationStructure = ( + schema: ObjectType, + aggObject: unknown, + context: ValidationContext +) => { + return schema.validate(aggObject, {}, context.currentPath.join('.')); +}; + +/** + * List of fields that have an attribute path as value + * + * @example + * ```ts + * avg: { + * field: 'alert.attributes.actions.group', + * }, + * ``` + */ +const attributeFields = ['field']; +/** + * List of fields that have a Record as value + * + * @example + * ```ts + * filter: { + * term: { + * 'alert.attributes.actions.group': 'value' + * }, + * }, + * ``` + */ +const attributeMaps = ['term']; + +const validateAndRewriteFieldAttributes = ( + aggregation: Record, + context: ValidationContext +) => { + return recursiveRewrite(aggregation, context, []); +}; + +const recursiveRewrite = ( + currentLevel: Record, + context: ValidationContext, + parents: string[] +): Record => { + return Object.entries(currentLevel).reduce((memo, [key, value]) => { + const rewriteKey = isAttributeKey(parents); + const rewriteValue = isAttributeValue(key, value); + + const nestedContext = childContext(context, key); + const newKey = rewriteKey ? validateAndRewriteAttributePath(key, nestedContext) : key; + const newValue = rewriteValue + ? validateAndRewriteAttributePath(value, nestedContext) + : isPlainObject(value) + ? recursiveRewrite(value, nestedContext, [...parents, key]) + : value; + + return { + ...memo, + [newKey]: newValue, + }; + }, {}); +}; + +const childContext = (context: ValidationContext, path: string): ValidationContext => { + return { + ...context, + currentPath: [...context.currentPath, path], + }; +}; + +const lastParent = (parents: string[]) => { + if (parents.length) { + return parents[parents.length - 1]; + } + return undefined; +}; + +const isAttributeKey = (parents: string[]) => { + const last = lastParent(parents); + if (last) { + return attributeMaps.includes(last); + } + return false; +}; + +const isAttributeValue = (fieldName: string, fieldValue: unknown): boolean => { + return attributeFields.includes(fieldName) && typeof fieldValue === 'string'; +}; + +const validateAndRewriteAttributePath = ( + attributePath: string, + { allowedTypes, indexMapping, currentPath }: ValidationContext +) => { + if (isRootLevelAttribute(attributePath, indexMapping, allowedTypes)) { + return rewriteRootLevelAttribute(attributePath); + } + if (isObjectTypeAttribute(attributePath, indexMapping, allowedTypes)) { + return rewriteObjectTypeAttribute(attributePath); + } + throw new Error(`[${currentPath.join('.')}] Invalid attribute path: ${attributePath}`); +}; diff --git a/src/core/server/saved_objects/service/lib/aggregations/validation_utils.test.ts b/src/core/server/saved_objects/service/lib/aggregations/validation_utils.test.ts new file mode 100644 index 0000000000000..25c3aea474ece --- /dev/null +++ b/src/core/server/saved_objects/service/lib/aggregations/validation_utils.test.ts @@ -0,0 +1,148 @@ +/* + * 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 { IndexMapping } from '../../../mappings'; +import { + isRootLevelAttribute, + rewriteRootLevelAttribute, + isObjectTypeAttribute, + rewriteObjectTypeAttribute, +} from './validation_utils'; + +const mockMappings: IndexMapping = { + properties: { + updated_at: { + type: 'date', + }, + foo: { + properties: { + title: { + type: 'text', + }, + description: { + type: 'text', + }, + bytes: { + type: 'number', + }, + }, + }, + bean: { + properties: { + canned: { + fields: { + text: { + type: 'text', + }, + }, + type: 'keyword', + }, + }, + }, + alert: { + properties: { + actions: { + type: 'nested', + properties: { + group: { + type: 'keyword', + }, + actionRef: { + type: 'keyword', + }, + actionTypeId: { + type: 'keyword', + }, + params: { + enabled: false, + type: 'object', + }, + }, + }, + params: { + type: 'flattened', + }, + }, + }, + }, +}; + +describe('isRootLevelAttribute', () => { + it('returns true when referring to a path to a valid root level field', () => { + expect(isRootLevelAttribute('foo.updated_at', mockMappings, ['foo'])).toBe(true); + }); + it('returns false when referring to a direct path to a valid root level field', () => { + expect(isRootLevelAttribute('updated_at', mockMappings, ['foo'])).toBe(false); + }); + it('returns false when referring to a path to a unknown root level field', () => { + expect(isRootLevelAttribute('foo.not_present', mockMappings, ['foo'])).toBe(false); + }); + it('returns false when referring to a path to an existing nested field', () => { + expect(isRootLevelAttribute('foo.properties.title', mockMappings, ['foo'])).toBe(false); + }); + it('returns false when referring to a path to a valid root level field of an unknown type', () => { + expect(isRootLevelAttribute('bar.updated_at', mockMappings, ['foo'])).toBe(false); + }); + it('returns false when referring to a path to a valid root level type field', () => { + expect(isRootLevelAttribute('foo.foo', mockMappings, ['foo'])).toBe(false); + }); +}); + +describe('rewriteRootLevelAttribute', () => { + it('rewrites the attribute path to strip the type', () => { + expect(rewriteRootLevelAttribute('foo.references')).toEqual('references'); + }); + it('does not handle real root level path', () => { + expect(rewriteRootLevelAttribute('references')).not.toEqual('references'); + }); +}); + +describe('isObjectTypeAttribute', () => { + it('return true if attribute path is valid', () => { + expect(isObjectTypeAttribute('foo.attributes.description', mockMappings, ['foo'])).toEqual( + true + ); + }); + + it('return true for nested attributes', () => { + expect(isObjectTypeAttribute('bean.attributes.canned.text', mockMappings, ['bean'])).toEqual( + true + ); + }); + + it('return false if attribute path points to an invalid type', () => { + expect(isObjectTypeAttribute('foo.attributes.description', mockMappings, ['bean'])).toEqual( + false + ); + }); + + it('returns false if attribute path refers to a type', () => { + expect(isObjectTypeAttribute('bean', mockMappings, ['bean'])).toEqual(false); + }); + + it('Return error if key does not match SO attribute structure', () => { + expect(isObjectTypeAttribute('bean.canned.text', mockMappings, ['bean'])).toEqual(false); + }); + + it('Return false if key matches nested type attribute parent', () => { + expect(isObjectTypeAttribute('alert.actions', mockMappings, ['alert'])).toEqual(false); + }); + + it('returns false if path refers to a non-existent attribute', () => { + expect(isObjectTypeAttribute('bean.attributes.red', mockMappings, ['bean'])).toEqual(false); + }); +}); + +describe('rewriteObjectTypeAttribute', () => { + it('rewrites the attribute path to strip the type', () => { + expect(rewriteObjectTypeAttribute('foo.attributes.prop')).toEqual('foo.prop'); + }); + it('returns invalid input unchanged', () => { + expect(rewriteObjectTypeAttribute('foo.references')).toEqual('foo.references'); + }); +}); diff --git a/src/core/server/saved_objects/service/lib/aggregations/validation_utils.ts b/src/core/server/saved_objects/service/lib/aggregations/validation_utils.ts new file mode 100644 index 0000000000000..f817497e3759e --- /dev/null +++ b/src/core/server/saved_objects/service/lib/aggregations/validation_utils.ts @@ -0,0 +1,80 @@ +/* + * 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 { IndexMapping } from '../../../mappings'; +import { fieldDefined, hasFilterKeyError } from '../filter_utils'; + +/** + * Returns true if the given attribute path is a valid root level SO attribute path + * + * @example + * ```ts + * isRootLevelAttribute('myType.updated_at', indexMapping, ['myType']}) + * // => true + * ``` + */ +export const isRootLevelAttribute = ( + attributePath: string, + indexMapping: IndexMapping, + allowedTypes: string[] +): boolean => { + const splits = attributePath.split('.'); + if (splits.length !== 2) { + return false; + } + + const [type, fieldName] = splits; + if (allowedTypes.includes(fieldName)) { + return false; + } + return allowedTypes.includes(type) && fieldDefined(indexMapping, fieldName); +}; + +/** + * Rewrites a root level attribute path to strip the type + * + * @example + * ```ts + * rewriteRootLevelAttribute('myType.updated_at') + * // => 'updated_at' + * ``` + */ +export const rewriteRootLevelAttribute = (attributePath: string) => { + return attributePath.split('.')[1]; +}; + +/** + * Returns true if the given attribute path is a valid object type level SO attribute path + * + * @example + * ```ts + * isObjectTypeAttribute('myType.attributes.someField', indexMapping, ['myType']}) + * // => true + * ``` + */ +export const isObjectTypeAttribute = ( + attributePath: string, + indexMapping: IndexMapping, + allowedTypes: string[] +): boolean => { + const error = hasFilterKeyError(attributePath, allowedTypes, indexMapping); + return error == null; +}; + +/** + * Rewrites a object type attribute path to strip the type + * + * @example + * ```ts + * rewriteObjectTypeAttribute('myType.attributes.foo') + * // => 'myType.foo' + * ``` + */ +export const rewriteObjectTypeAttribute = (attributePath: string) => { + return attributePath.replace('.attributes', ''); +}; diff --git a/src/core/server/saved_objects/service/lib/filter_utils.test.ts b/src/core/server/saved_objects/service/lib/filter_utils.test.ts index b50326627cf09..956a60b23809d 100644 --- a/src/core/server/saved_objects/service/lib/filter_utils.test.ts +++ b/src/core/server/saved_objects/service/lib/filter_utils.test.ts @@ -18,7 +18,7 @@ import { const mockMappings = { properties: { - updatedAt: { + updated_at: { type: 'date', }, foo: { @@ -123,12 +123,12 @@ describe('Filter Utils', () => { expect( validateConvertFilterToKueryNode( ['foo'], - 'foo.updatedAt: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)', + 'foo.updated_at: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)', mockMappings ) ).toEqual( esKuery.fromKueryExpression( - '(type: foo and updatedAt: 5678654567) and foo.bytes > 1000 and foo.bytes < 8000 and foo.title: "best" and (foo.description: t* or foo.description :*)' + '(type: foo and updated_at: 5678654567) and foo.bytes > 1000 and foo.bytes < 8000 and foo.title: "best" and (foo.description: t* or foo.description :*)' ) ); }); @@ -137,12 +137,12 @@ describe('Filter Utils', () => { expect( validateConvertFilterToKueryNode( ['foo', 'bar'], - 'foo.updatedAt: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)', + 'foo.updated_at: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)', mockMappings ) ).toEqual( esKuery.fromKueryExpression( - '(type: foo and updatedAt: 5678654567) and foo.bytes > 1000 and foo.bytes < 8000 and foo.title: "best" and (foo.description: t* or foo.description :*)' + '(type: foo and updated_at: 5678654567) and foo.bytes > 1000 and foo.bytes < 8000 and foo.title: "best" and (foo.description: t* or foo.description :*)' ) ); }); @@ -151,12 +151,12 @@ describe('Filter Utils', () => { expect( validateConvertFilterToKueryNode( ['foo', 'bar'], - '(bar.updatedAt: 5678654567 OR foo.updatedAt: 5678654567) and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or bar.attributes.description :*)', + '(bar.updated_at: 5678654567 OR foo.updated_at: 5678654567) and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or bar.attributes.description :*)', mockMappings ) ).toEqual( esKuery.fromKueryExpression( - '((type: bar and updatedAt: 5678654567) or (type: foo and updatedAt: 5678654567)) and foo.bytes > 1000 and foo.bytes < 8000 and foo.title: "best" and (foo.description: t* or bar.description :*)' + '((type: bar and updated_at: 5678654567) or (type: foo and updated_at: 5678654567)) and foo.bytes > 1000 and foo.bytes < 8000 and foo.title: "best" and (foo.description: t* or bar.description :*)' ) ); }); @@ -181,11 +181,11 @@ describe('Filter Utils', () => { expect(() => { validateConvertFilterToKueryNode( ['foo', 'bar'], - 'updatedAt: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)', + 'updated_at: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)', mockMappings ); }).toThrowErrorMatchingInlineSnapshot( - `"This key 'updatedAt' need to be wrapped by a saved object type like foo,bar: Bad Request"` + `"This key 'updated_at' need to be wrapped by a saved object type like foo,bar: Bad Request"` ); }); @@ -200,7 +200,7 @@ describe('Filter Utils', () => { test('Validate filter query through KueryNode - happy path', () => { const validationObject = validateFilterKueryNode({ astFilter: esKuery.fromKueryExpression( - 'foo.updatedAt: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)' + 'foo.updated_at: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)' ), types: ['foo'], indexMapping: mockMappings, @@ -211,7 +211,7 @@ describe('Filter Utils', () => { astPath: 'arguments.0', error: null, isSavedObjectAttr: true, - key: 'foo.updatedAt', + key: 'foo.updated_at', type: 'foo', }, { @@ -275,7 +275,7 @@ describe('Filter Utils', () => { test('Return Error if key is not wrapper by a saved object type', () => { const validationObject = validateFilterKueryNode({ astFilter: esKuery.fromKueryExpression( - 'updatedAt: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)' + 'updated_at: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)' ), types: ['foo'], indexMapping: mockMappings, @@ -284,9 +284,9 @@ describe('Filter Utils', () => { expect(validationObject).toEqual([ { astPath: 'arguments.0', - error: "This key 'updatedAt' need to be wrapped by a saved object type like foo", + error: "This key 'updated_at' need to be wrapped by a saved object type like foo", isSavedObjectAttr: true, - key: 'updatedAt', + key: 'updated_at', type: null, }, { @@ -330,7 +330,7 @@ describe('Filter Utils', () => { test('Return Error if key of a saved object type is not wrapped with attributes', () => { const validationObject = validateFilterKueryNode({ astFilter: esKuery.fromKueryExpression( - 'foo.updatedAt: 5678654567 and foo.attributes.bytes > 1000 and foo.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.description :*)' + 'foo.updated_at: 5678654567 and foo.attributes.bytes > 1000 and foo.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.description :*)' ), types: ['foo'], indexMapping: mockMappings, @@ -341,7 +341,7 @@ describe('Filter Utils', () => { astPath: 'arguments.0', error: null, isSavedObjectAttr: true, - key: 'foo.updatedAt', + key: 'foo.updated_at', type: 'foo', }, { @@ -387,7 +387,7 @@ describe('Filter Utils', () => { test('Return Error if filter is not using an allowed type', () => { const validationObject = validateFilterKueryNode({ astFilter: esKuery.fromKueryExpression( - 'bar.updatedAt: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)' + 'bar.updated_at: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.title: "best" and (foo.attributes.description: t* or foo.attributes.description :*)' ), types: ['foo'], indexMapping: mockMappings, @@ -398,7 +398,7 @@ describe('Filter Utils', () => { astPath: 'arguments.0', error: 'This type bar is not allowed', isSavedObjectAttr: true, - key: 'bar.updatedAt', + key: 'bar.updated_at', type: 'bar', }, { @@ -442,7 +442,7 @@ describe('Filter Utils', () => { test('Return Error if filter is using an non-existing key in the index patterns of the saved object type', () => { const validationObject = validateFilterKueryNode({ astFilter: esKuery.fromKueryExpression( - 'foo.updatedAt33: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.header: "best" and (foo.attributes.description: t* or foo.attributes.description :*)' + 'foo.updated_at33: 5678654567 and foo.attributes.bytes > 1000 and foo.attributes.bytes < 8000 and foo.attributes.header: "best" and (foo.attributes.description: t* or foo.attributes.description :*)' ), types: ['foo'], indexMapping: mockMappings, @@ -451,9 +451,9 @@ describe('Filter Utils', () => { expect(validationObject).toEqual([ { astPath: 'arguments.0', - error: "This key 'foo.updatedAt33' does NOT exist in foo saved object index patterns", + error: "This key 'foo.updated_at33' does NOT exist in foo saved object index patterns", isSavedObjectAttr: false, - key: 'foo.updatedAt33', + key: 'foo.updated_at33', type: 'foo', }, { @@ -519,6 +519,33 @@ describe('Filter Utils', () => { }, ]); }); + + test('Validate multiple items nested filter query through KueryNode', () => { + const validationObject = validateFilterKueryNode({ + astFilter: esKuery.fromKueryExpression( + 'alert.attributes.actions:{ actionTypeId: ".server-log" AND actionRef: "foo" }' + ), + types: ['alert'], + indexMapping: mockMappings, + }); + + expect(validationObject).toEqual([ + { + astPath: 'arguments.1.arguments.0', + error: null, + isSavedObjectAttr: false, + key: 'alert.attributes.actions.actionTypeId', + type: 'alert', + }, + { + astPath: 'arguments.1.arguments.1', + error: null, + isSavedObjectAttr: false, + key: 'alert.attributes.actions.actionRef', + type: 'alert', + }, + ]); + }); }); describe('#hasFilterKeyError', () => { diff --git a/src/core/server/saved_objects/service/lib/filter_utils.ts b/src/core/server/saved_objects/service/lib/filter_utils.ts index 688b7ad96e8ed..b3bcef9a62e13 100644 --- a/src/core/server/saved_objects/service/lib/filter_utils.ts +++ b/src/core/server/saved_objects/service/lib/filter_utils.ts @@ -109,7 +109,15 @@ export const validateFilterKueryNode = ({ return astFilter.arguments.reduce((kueryNode: string[], ast: KueryNode, index: number) => { if (hasNestedKey && ast.type === 'literal' && ast.value != null) { localNestedKeys = ast.value; + } else if (ast.type === 'literal' && ast.value && typeof ast.value === 'string') { + const key = ast.value.replace('.attributes', ''); + const mappingKey = 'properties.' + key.split('.').join('.properties.'); + const field = get(indexMapping, mappingKey); + if (field != null && field.type === 'nested') { + localNestedKeys = ast.value; + } } + if (ast.arguments) { const myPath = `${path}.${index}`; return [ @@ -121,7 +129,7 @@ export const validateFilterKueryNode = ({ storeValue: ast.type === 'function' && astFunctionType.includes(ast.function), path: `${myPath}.arguments`, hasNestedKey: ast.type === 'function' && ast.function === 'nested', - nestedKeys: localNestedKeys, + nestedKeys: localNestedKeys || nestedKeys, }), ]; } @@ -226,7 +234,7 @@ export const fieldDefined = (indexMappings: IndexMapping, key: string): boolean return true; } - // If the path is for a flattned type field, we'll assume the mappings are defined. + // If the path is for a flattened type field, we'll assume the mappings are defined. const keys = key.split('.'); for (let i = 0; i < keys.length; i++) { const path = `properties.${keys.slice(0, i + 1).join('.properties.')}`; diff --git a/src/core/server/saved_objects/service/lib/repository.ts b/src/core/server/saved_objects/service/lib/repository.ts index 7c719ac56a835..c0e2cdc333363 100644 --- a/src/core/server/saved_objects/service/lib/repository.ts +++ b/src/core/server/saved_objects/service/lib/repository.ts @@ -66,6 +66,7 @@ import { import { LegacyUrlAlias, LEGACY_URL_ALIAS_TYPE } from '../../object_types'; import { SavedObjectTypeRegistry } from '../../saved_objects_type_registry'; import { validateConvertFilterToKueryNode } from './filter_utils'; +import { validateAndConvertAggregations } from './aggregations'; import { ALL_NAMESPACES_STRING, FIND_DEFAULT_PAGE, @@ -748,7 +749,9 @@ export class SavedObjectsRepository { * @property {string} [options.preference] * @returns {promise} - { saved_objects: [{ id, type, version, attributes }], total, per_page, page } */ - async find(options: SavedObjectsFindOptions): Promise> { + async find( + options: SavedObjectsFindOptions + ): Promise> { const { search, defaultSearchOperator = 'OR', @@ -768,6 +771,7 @@ export class SavedObjectsRepository { typeToNamespacesMap, filter, preference, + aggs, } = options; if (!type && !typeToNamespacesMap) { @@ -799,7 +803,7 @@ export class SavedObjectsRepository { : Array.from(typeToNamespacesMap!.keys()); const allowedTypes = types.filter((t) => this._allowedTypes.includes(t)); if (allowedTypes.length === 0) { - return SavedObjectsUtils.createEmptyFindResponse(options); + return SavedObjectsUtils.createEmptyFindResponse(options); } if (searchFields && !Array.isArray(searchFields)) { @@ -811,16 +815,24 @@ export class SavedObjectsRepository { } let kueryNode; - - try { - if (filter) { + if (filter) { + try { kueryNode = validateConvertFilterToKueryNode(allowedTypes, filter, this._mappings); + } catch (e) { + if (e.name === 'KQLSyntaxError') { + throw SavedObjectsErrorHelpers.createBadRequestError(`KQLSyntaxError: ${e.message}`); + } else { + throw e; + } } - } catch (e) { - if (e.name === 'KQLSyntaxError') { - throw SavedObjectsErrorHelpers.createBadRequestError('KQLSyntaxError: ' + e.message); - } else { - throw e; + } + + let aggsObject; + if (aggs) { + try { + aggsObject = validateAndConvertAggregations(allowedTypes, aggs, this._mappings); + } catch (e) { + throw SavedObjectsErrorHelpers.createBadRequestError(`Invalid aggregation: ${e.message}`); } } @@ -838,6 +850,7 @@ export class SavedObjectsRepository { seq_no_primary_term: true, from: perPage * (page - 1), _source: includedFields(type, fields), + ...(aggsObject ? { aggs: aggsObject } : {}), ...getSearchDsl(this._mappings, this._registry, { search, defaultSearchOperator, @@ -872,6 +885,7 @@ export class SavedObjectsRepository { } return { + ...(body.aggregations ? { aggregations: (body.aggregations as unknown) as A } : {}), page, per_page: perPage, total: body.hits.total, @@ -885,7 +899,7 @@ export class SavedObjectsRepository { }) ), pit_id: body.pit_id, - } as SavedObjectsFindResponse; + } as SavedObjectsFindResponse; } /** diff --git a/src/core/server/saved_objects/service/lib/utils.ts b/src/core/server/saved_objects/service/lib/utils.ts index ebad13e5edc25..494ac6ce9fad5 100644 --- a/src/core/server/saved_objects/service/lib/utils.ts +++ b/src/core/server/saved_objects/service/lib/utils.ts @@ -51,10 +51,10 @@ export class SavedObjectsUtils { /** * Creates an empty response for a find operation. This is only intended to be used by saved objects client wrappers. */ - public static createEmptyFindResponse = ({ + public static createEmptyFindResponse = ({ page = FIND_DEFAULT_PAGE, perPage = FIND_DEFAULT_PER_PAGE, - }: SavedObjectsFindOptions): SavedObjectsFindResponse => ({ + }: SavedObjectsFindOptions): SavedObjectsFindResponse => ({ page, per_page: perPage, total: 0, diff --git a/src/core/server/saved_objects/service/saved_objects_client.ts b/src/core/server/saved_objects/service/saved_objects_client.ts index 9a0ccb88d3555..12451ace02836 100644 --- a/src/core/server/saved_objects/service/saved_objects_client.ts +++ b/src/core/server/saved_objects/service/saved_objects_client.ts @@ -173,7 +173,8 @@ export interface SavedObjectsFindResult extends SavedObject { * * @public */ -export interface SavedObjectsFindResponse { +export interface SavedObjectsFindResponse { + aggregations?: A; saved_objects: Array>; total: number; per_page: number; @@ -463,7 +464,9 @@ export class SavedObjectsClient { * * @param options */ - async find(options: SavedObjectsFindOptions): Promise> { + async find( + options: SavedObjectsFindOptions + ): Promise> { return await this._repository.find(options); } diff --git a/src/core/server/saved_objects/types.ts b/src/core/server/saved_objects/types.ts index ecda120e025d8..d3bfdcc6923dc 100644 --- a/src/core/server/saved_objects/types.ts +++ b/src/core/server/saved_objects/types.ts @@ -116,6 +116,28 @@ export interface SavedObjectsFindOptions { */ defaultSearchOperator?: 'AND' | 'OR'; filter?: string | KueryNode; + /** + * A record of aggregations to perform. + * The API currently only supports a limited set of metrics and bucket aggregation types. + * Additional aggregation types can be contributed to Core. + * + * @example + * Aggregating on SO attribute field + * ```ts + * const aggs = { latest_version: { max: { field: 'dashboard.attributes.version' } } }; + * return client.find({ type: 'dashboard', aggs }) + * ``` + * + * @example + * Aggregating on SO root field + * ```ts + * const aggs = { latest_update: { max: { field: 'dashboard.updated_at' } } }; + * return client.find({ type: 'dashboard', aggs }) + * ``` + * + * @alpha + */ + aggs?: Record; namespaces?: string[]; /** * This map defines each type to search for, and the namespace(s) to search for the type in; this is only intended to be used by a saved diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index 05af684053f39..e8f9dab435754 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -2244,7 +2244,7 @@ export class SavedObjectsClient { static errors: typeof SavedObjectsErrorHelpers; // (undocumented) errors: typeof SavedObjectsErrorHelpers; - find(options: SavedObjectsFindOptions): Promise>; + find(options: SavedObjectsFindOptions): Promise>; get(type: string, id: string, options?: SavedObjectsBaseOptions): Promise>; openPointInTimeForType(type: string | string[], options?: SavedObjectsOpenPointInTimeOptions): Promise; removeReferencesTo(type: string, id: string, options?: SavedObjectsRemoveReferencesToOptions): Promise; @@ -2501,6 +2501,8 @@ export type SavedObjectsFieldMapping = SavedObjectsCoreFieldMapping | SavedObjec // @public (undocumented) export interface SavedObjectsFindOptions { + // @alpha + aggs?: Record; defaultSearchOperator?: 'AND' | 'OR'; fields?: string[]; // Warning: (ae-forgotten-export) The symbol "KueryNode" needs to be exported by the entry point index.d.ts @@ -2539,7 +2541,9 @@ export interface SavedObjectsFindOptionsReference { } // @public -export interface SavedObjectsFindResponse { +export interface SavedObjectsFindResponse { + // (undocumented) + aggregations?: A; // (undocumented) page: number; // (undocumented) @@ -2849,7 +2853,7 @@ export class SavedObjectsRepository { deleteByNamespace(namespace: string, options?: SavedObjectsDeleteByNamespaceOptions): Promise; deleteFromNamespaces(type: string, id: string, namespaces: string[], options?: SavedObjectsDeleteFromNamespacesOptions): Promise; // (undocumented) - find(options: SavedObjectsFindOptions): Promise>; + find(options: SavedObjectsFindOptions): Promise>; get(type: string, id: string, options?: SavedObjectsBaseOptions): Promise>; incrementCounter(type: string, id: string, counterFields: Array, options?: SavedObjectsIncrementCounterOptions): Promise>; openPointInTimeForType(type: string | string[], { keepAlive, preference }?: SavedObjectsOpenPointInTimeOptions): Promise; @@ -2970,7 +2974,7 @@ export interface SavedObjectsUpdateResponse extends Omit({ page, perPage, }: SavedObjectsFindOptions) => SavedObjectsFindResponse; + static createEmptyFindResponse: ({ page, perPage, }: SavedObjectsFindOptions) => SavedObjectsFindResponse; static generateId(): string; static isRandomId(id: string | undefined): boolean; static namespaceIdToString: (namespace?: string | undefined) => string; diff --git a/src/plugins/telemetry_collection_manager/server/telemetry_saved_objects_client.ts b/src/plugins/telemetry_collection_manager/server/telemetry_saved_objects_client.ts index d639b053565d1..01d89c5731158 100644 --- a/src/plugins/telemetry_collection_manager/server/telemetry_saved_objects_client.ts +++ b/src/plugins/telemetry_collection_manager/server/telemetry_saved_objects_client.ts @@ -17,7 +17,9 @@ export class TelemetrySavedObjectsClient extends SavedObjectsClient { * Find the SavedObjects matching the search query in all the Spaces by default * @param options */ - async find(options: SavedObjectsFindOptions): Promise> { + async find( + options: SavedObjectsFindOptions + ): Promise> { return super.find({ namespaces: ['*'], ...options }); } } diff --git a/test/api_integration/apis/saved_objects/find.ts b/test/api_integration/apis/saved_objects/find.ts index 28c38ca9e0ded..a01562861e606 100644 --- a/test/api_integration/apis/saved_objects/find.ts +++ b/test/api_integration/apis/saved_objects/find.ts @@ -293,6 +293,75 @@ export default function ({ getService }: FtrProviderContext) { })); }); + describe('using aggregations', () => { + it('should return 200 with valid response for a valid aggregation', async () => + await supertest + .get( + `/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent( + JSON.stringify({ + type_count: { max: { field: 'visualization.attributes.version' } }, + }) + )}` + ) + .expect(200) + .then((resp) => { + expect(resp.body).to.eql({ + aggregations: { + type_count: { + value: 1, + }, + }, + page: 1, + per_page: 0, + saved_objects: [], + total: 1, + }); + })); + + it('should return a 400 when referencing an invalid SO attribute', async () => + await supertest + .get( + `/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent( + JSON.stringify({ + type_count: { max: { field: 'dashboard.attributes.version' } }, + }) + )}` + ) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + error: 'Bad Request', + message: + 'Invalid aggregation: [type_count.max.field] Invalid attribute path: dashboard.attributes.version: Bad Request', + statusCode: 400, + }); + })); + + it('should return a 400 when using a forbidden aggregation option', async () => + await supertest + .get( + `/api/saved_objects/_find?type=visualization&per_page=0&aggs=${encodeURIComponent( + JSON.stringify({ + type_count: { + max: { + field: 'visualization.attributes.version', + script: 'Bad script is bad', + }, + }, + }) + )}` + ) + .expect(400) + .then((resp) => { + expect(resp.body).to.eql({ + error: 'Bad Request', + message: + 'Invalid aggregation: [type_count.max.script]: definition for this key is missing: Bad Request', + statusCode: 400, + }); + })); + }); + describe('`has_reference` and `has_reference_operator` parameters', () => { before(() => esArchiver.load('saved_objects/references')); after(() => esArchiver.unload('saved_objects/references')); diff --git a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.ts b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.ts index 88a89af6be3d0..9b699d6ce007c 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.ts @@ -162,9 +162,9 @@ export class EncryptedSavedObjectsClientWrapper implements SavedObjectsClientCon return await this.options.baseClient.delete(type, id, options); } - public async find(options: SavedObjectsFindOptions) { + public async find(options: SavedObjectsFindOptions) { return await this.handleEncryptedAttributesInBulkResponse( - await this.options.baseClient.find(options), + await this.options.baseClient.find(options), undefined ); } diff --git a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts index 8378cc4d848cf..d876175a05fe8 100644 --- a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts +++ b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts @@ -213,7 +213,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra return await this.baseClient.delete(type, id, options); } - public async find(options: SavedObjectsFindOptions) { + public async find(options: SavedObjectsFindOptions) { if ( this.getSpacesService() == null && Array.isArray(options.namespaces) && @@ -245,7 +245,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra error: new Error(status), }) ); - return SavedObjectsUtils.createEmptyFindResponse(options); + return SavedObjectsUtils.createEmptyFindResponse(options); } const typeToNamespacesMap = Array.from(typeMap).reduce>( @@ -254,7 +254,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra new Map() ); - const response = await this.baseClient.find({ + const response = await this.baseClient.find({ ...options, typeToNamespacesMap: undefined, // if the user is fully authorized, use `undefined` as the typeToNamespacesMap to prevent privilege escalation ...(status === 'partially_authorized' && { typeToNamespacesMap, type: '', namespaces: [] }), // the repository requires that `type` and `namespaces` must be empty if `typeToNamespacesMap` is defined diff --git a/x-pack/plugins/spaces/server/saved_objects/spaces_saved_objects_client.ts b/x-pack/plugins/spaces/server/saved_objects/spaces_saved_objects_client.ts index c544e2f46f058..4254615ac7d5f 100644 --- a/x-pack/plugins/spaces/server/saved_objects/spaces_saved_objects_client.ts +++ b/x-pack/plugins/spaces/server/saved_objects/spaces_saved_objects_client.ts @@ -171,7 +171,7 @@ export class SpacesSavedObjectsClient implements SavedObjectsClientContract { * @property {object} [options.hasReference] - { type, id } * @returns {promise} - { saved_objects: [{ id, type, version, attributes }], total, per_page, page } */ - public async find(options: SavedObjectsFindOptions) { + public async find(options: SavedObjectsFindOptions) { throwErrorIfNamespaceSpecified(options); let namespaces = options.namespaces; @@ -187,12 +187,12 @@ export class SpacesSavedObjectsClient implements SavedObjectsClientContract { } if (namespaces.length === 0) { // return empty response, since the user is unauthorized in this space (or these spaces), but we don't return forbidden errors for `find` operations - return SavedObjectsUtils.createEmptyFindResponse(options); + return SavedObjectsUtils.createEmptyFindResponse(options); } } catch (err) { if (Boom.isBoom(err) && err.output.payload.statusCode === 403) { // return empty response, since the user is unauthorized in any space, but we don't return forbidden errors for `find` operations - return SavedObjectsUtils.createEmptyFindResponse(options); + return SavedObjectsUtils.createEmptyFindResponse(options); } throw err; } @@ -200,7 +200,7 @@ export class SpacesSavedObjectsClient implements SavedObjectsClientContract { namespaces = [this.spaceId]; } - return await this.client.find({ + return await this.client.find({ ...options, type: (options.type ? coerceToArray(options.type) : this.types).filter( (type) => type !== 'space' From c187270b5e2d90c306a55694c53614e149422d35 Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Fri, 16 Apr 2021 19:59:23 +0300 Subject: [PATCH 52/68] [Search Sessions] Client side search cache (#92439) * dev docs * sessions tutorial * title * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update dev_docs/tutorials/data/search.mdx Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Code review * client cache * mock utils * improve code * Use cacheOnClient in Lens * mock * docs and types * unit tests! * Search response cache + tests * remove cacheOnClient evict cache on error * test ts * shouldCacheOnClient + improve tests * remove unused * clear subs * dont unsubscribe on setItem * caching mess * t * fix jest * add size to bfetch response @ppisljar use it to reduce the # of stringify in response cache * ts * ts * docs * simplify abort controller logic and extract it into a class * docs * delete unused tests * use addAbortSignal * code review * Use shareReplay, fix tests * code review * bfetch test * code review * Leave the bfetch changes out * docs + isRestore * make sure to clean up properly * Make sure that aborting in cache works correctly Clearer restructuring of code * fix test * import * code review round 1 * ts * Added functional test for search request caching * test * skip before codefreeze Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- ...earchinterceptor.getserializableoptions.md | 22 + ...n-plugins-data-public.searchinterceptor.md | 1 + examples/search_examples/common/index.ts | 1 + .../search_examples/public/search/app.tsx | 67 ++- .../search_examples/server/my_strategy.ts | 1 + .../data/common/search/tabify/tabify.ts | 2 +- src/plugins/data/public/public.api.md | 2 + .../data/public/search/search_interceptor.ts | 28 +- .../public/search/session/session_service.ts | 2 +- .../search/search_abort_controller.test.ts | 22 +- .../public/search/search_abort_controller.ts | 7 +- .../public/search/search_interceptor.test.ts | 557 +++++++++++++++++- .../public/search/search_interceptor.ts | 150 ++++- .../search/search_response_cache.test.ts | 318 ++++++++++ .../public/search/search_response_cache.ts | 136 +++++ .../data_enhanced/public/search/utils.ts | 15 + x-pack/plugins/lens/public/app_plugin/app.tsx | 13 +- x-pack/test/examples/search_examples/index.ts | 1 + .../search_examples/search_sessions_cache.ts | 65 ++ 19 files changed, 1350 insertions(+), 60 deletions(-) create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.getserializableoptions.md create mode 100644 x-pack/plugins/data_enhanced/public/search/search_response_cache.test.ts create mode 100644 x-pack/plugins/data_enhanced/public/search/search_response_cache.ts create mode 100644 x-pack/plugins/data_enhanced/public/search/utils.ts create mode 100644 x-pack/test/examples/search_examples/search_sessions_cache.ts diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.getserializableoptions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.getserializableoptions.md new file mode 100644 index 0000000000000..984f99004ebe8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.getserializableoptions.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) > [getSerializableOptions](./kibana-plugin-plugins-data-public.searchinterceptor.getserializableoptions.md) + +## SearchInterceptor.getSerializableOptions() method + +Signature: + +```typescript +protected getSerializableOptions(options?: ISearchOptions): Pick; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| options | ISearchOptions | | + +Returns: + +`Pick` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md index 9d18309fc07be..653f052dd5a3a 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md @@ -26,6 +26,7 @@ export declare class SearchInterceptor | Method | Modifiers | Description | | --- | --- | --- | +| [getSerializableOptions(options)](./kibana-plugin-plugins-data-public.searchinterceptor.getserializableoptions.md) | | | | [getTimeoutMode()](./kibana-plugin-plugins-data-public.searchinterceptor.gettimeoutmode.md) | | | | [handleSearchError(e, options, isTimeout)](./kibana-plugin-plugins-data-public.searchinterceptor.handlesearcherror.md) | | | | [search(request, options)](./kibana-plugin-plugins-data-public.searchinterceptor.search.md) | | Searches using the given search method. Overrides the AbortSignal with one that will abort either when the request times out, or when the original AbortSignal is aborted. Updates pendingCount$ when the request is started/finalized. | diff --git a/examples/search_examples/common/index.ts b/examples/search_examples/common/index.ts index dd953b1ec8982..cc47c0f575973 100644 --- a/examples/search_examples/common/index.ts +++ b/examples/search_examples/common/index.ts @@ -16,6 +16,7 @@ export interface IMyStrategyRequest extends IEsSearchRequest { } export interface IMyStrategyResponse extends IEsSearchResponse { cool: string; + executed_at: number; } export const SERVER_SEARCH_ROUTE_PATH = '/api/examples/search'; diff --git a/examples/search_examples/public/search/app.tsx b/examples/search_examples/public/search/app.tsx index 3bac445581ae7..8f31d242faf5e 100644 --- a/examples/search_examples/public/search/app.tsx +++ b/examples/search_examples/public/search/app.tsx @@ -111,7 +111,7 @@ export const SearchExamplesApp = ({ setSelectedNumericField(fields?.length ? getNumeric(fields)[0] : null); }, [fields]); - const doAsyncSearch = async (strategy?: string) => { + const doAsyncSearch = async (strategy?: string, sessionId?: string) => { if (!indexPattern || !selectedNumericField) return; // Construct the query portion of the search request @@ -138,6 +138,7 @@ export const SearchExamplesApp = ({ const searchSubscription$ = data.search .search(req, { strategy, + sessionId, }) .subscribe({ next: (res) => { @@ -148,19 +149,30 @@ export const SearchExamplesApp = ({ ? // @ts-expect-error @elastic/elasticsearch no way to declare a type for aggregation in the search response res.rawResponse.aggregations[1].value : undefined; + const isCool = (res as IMyStrategyResponse).cool; + const executedAt = (res as IMyStrategyResponse).executed_at; const message = ( Searched {res.rawResponse.hits.total} documents.
The average of {selectedNumericField!.name} is{' '} {avgResult ? Math.floor(avgResult) : 0}.
- Is it Cool? {String((res as IMyStrategyResponse).cool)} + {isCool ? `Is it Cool? ${isCool}` : undefined} +
+ + {executedAt ? `Executed at? ${executedAt}` : undefined} +
); - notifications.toasts.addSuccess({ - title: 'Query result', - text: mountReactNode(message), - }); + notifications.toasts.addSuccess( + { + title: 'Query result', + text: mountReactNode(message), + }, + { + toastLifeTimeMs: 300000, + } + ); searchSubscription$.unsubscribe(); } else if (isErrorResponse(res)) { // TODO: Make response error status clearer @@ -227,6 +239,10 @@ export const SearchExamplesApp = ({ doAsyncSearch('myStrategy'); }; + const onClientSideSessionCacheClickHandler = () => { + doAsyncSearch('myStrategy', data.search.session.getSessionId()); + }; + const onServerClickHandler = async () => { if (!indexPattern || !selectedNumericField) return; try { @@ -374,6 +390,45 @@ export const SearchExamplesApp = ({ + +

Client side search session caching

+
+ + data.search.session.start()} + iconType="alert" + data-test-subj="searchExamplesStartSession" + > + + + data.search.session.clear()} + iconType="alert" + data-test-subj="searchExamplesClearSession" + > + + + + + + +

Using search on the server

diff --git a/examples/search_examples/server/my_strategy.ts b/examples/search_examples/server/my_strategy.ts index 2cf039e99f6e9..0a64788960091 100644 --- a/examples/search_examples/server/my_strategy.ts +++ b/examples/search_examples/server/my_strategy.ts @@ -20,6 +20,7 @@ export const mySearchStrategyProvider = ( map((esSearchRes) => ({ ...esSearchRes, cool: request.get_cool ? 'YES' : 'NOPE', + executed_at: new Date().getTime(), })) ), cancel: async (id, options, deps) => { diff --git a/src/plugins/data/common/search/tabify/tabify.ts b/src/plugins/data/common/search/tabify/tabify.ts index 9f096886491ad..4a8972d4384c2 100644 --- a/src/plugins/data/common/search/tabify/tabify.ts +++ b/src/plugins/data/common/search/tabify/tabify.ts @@ -139,7 +139,7 @@ export function tabifyAggResponse( const write = new TabbedAggResponseWriter(aggConfigs, respOpts || {}); const topLevelBucket: AggResponseBucket = { ...esResponse.aggregations, - doc_count: esResponse.hits.total, + doc_count: esResponse.hits?.total, }; collectBucket(aggConfigs, write, topLevelBucket, '', 1); diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index d99d754a3364d..35f13fc855e99 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -2353,6 +2353,8 @@ export class SearchInterceptor { // (undocumented) protected readonly deps: SearchInterceptorDeps; // (undocumented) + protected getSerializableOptions(options?: ISearchOptions): Pick; + // (undocumented) protected getTimeoutMode(): TimeoutErrorMode; // Warning: (ae-forgotten-export) The symbol "KibanaServerError" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "AbortError" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/data/public/search/search_interceptor.ts b/src/plugins/data/public/search/search_interceptor.ts index 3df2313f83798..e3fb31c9179fd 100644 --- a/src/plugins/data/public/search/search_interceptor.ts +++ b/src/plugins/data/public/search/search_interceptor.ts @@ -113,20 +113,14 @@ export class SearchInterceptor { } } - /** - * @internal - * @throws `AbortError` | `ErrorLike` - */ - protected runSearch( - request: IKibanaSearchRequest, - options?: ISearchOptions - ): Promise { - const { abortSignal, sessionId, ...requestOptions } = options || {}; + protected getSerializableOptions(options?: ISearchOptions) { + const { sessionId, ...requestOptions } = options || {}; + + const serializableOptions: ISearchOptionsSerializable = {}; const combined = { ...requestOptions, ...this.deps.session.getSearchOptions(sessionId), }; - const serializableOptions: ISearchOptionsSerializable = {}; if (combined.sessionId !== undefined) serializableOptions.sessionId = combined.sessionId; if (combined.isRestore !== undefined) serializableOptions.isRestore = combined.isRestore; @@ -135,10 +129,22 @@ export class SearchInterceptor { if (combined.strategy !== undefined) serializableOptions.strategy = combined.strategy; if (combined.isStored !== undefined) serializableOptions.isStored = combined.isStored; + return serializableOptions; + } + + /** + * @internal + * @throws `AbortError` | `ErrorLike` + */ + protected runSearch( + request: IKibanaSearchRequest, + options?: ISearchOptions + ): Promise { + const { abortSignal } = options || {}; return this.batchedFetch( { request, - options: serializableOptions, + options: this.getSerializableOptions(options), }, abortSignal ); diff --git a/src/plugins/data/public/search/session/session_service.ts b/src/plugins/data/public/search/session/session_service.ts index 381410574ecda..71f51b4bc8d83 100644 --- a/src/plugins/data/public/search/session/session_service.ts +++ b/src/plugins/data/public/search/session/session_service.ts @@ -73,7 +73,7 @@ export interface SearchSessionIndicatorUiConfig { } /** - * Responsible for tracking a current search session. Supports only a single session at a time. + * Responsible for tracking a current search session. Supports a single session at a time. */ export class SessionService { public readonly state$: Observable; diff --git a/x-pack/plugins/data_enhanced/public/search/search_abort_controller.test.ts b/x-pack/plugins/data_enhanced/public/search/search_abort_controller.test.ts index 68282c1e947f7..a52fdef9819b8 100644 --- a/x-pack/plugins/data_enhanced/public/search/search_abort_controller.test.ts +++ b/x-pack/plugins/data_enhanced/public/search/search_abort_controller.test.ts @@ -21,13 +21,15 @@ describe('search abort controller', () => { test('immediately aborts when passed an aborted signal in the constructor', () => { const controller = new AbortController(); controller.abort(); - const sac = new SearchAbortController(controller.signal); + const sac = new SearchAbortController(); + sac.addAbortSignal(controller.signal); expect(sac.getSignal().aborted).toBe(true); }); test('aborts when input signal is aborted', () => { const controller = new AbortController(); - const sac = new SearchAbortController(controller.signal); + const sac = new SearchAbortController(); + sac.addAbortSignal(controller.signal); expect(sac.getSignal().aborted).toBe(false); controller.abort(); expect(sac.getSignal().aborted).toBe(true); @@ -35,7 +37,8 @@ describe('search abort controller', () => { test('aborts when all input signals are aborted', () => { const controller = new AbortController(); - const sac = new SearchAbortController(controller.signal); + const sac = new SearchAbortController(); + sac.addAbortSignal(controller.signal); const controller2 = new AbortController(); sac.addAbortSignal(controller2.signal); @@ -48,7 +51,8 @@ describe('search abort controller', () => { test('aborts explicitly even if all inputs are not aborted', () => { const controller = new AbortController(); - const sac = new SearchAbortController(controller.signal); + const sac = new SearchAbortController(); + sac.addAbortSignal(controller.signal); const controller2 = new AbortController(); sac.addAbortSignal(controller2.signal); @@ -60,7 +64,8 @@ describe('search abort controller', () => { test('doesnt abort, if cleared', () => { const controller = new AbortController(); - const sac = new SearchAbortController(controller.signal); + const sac = new SearchAbortController(); + sac.addAbortSignal(controller.signal); expect(sac.getSignal().aborted).toBe(false); sac.cleanup(); controller.abort(); @@ -77,7 +82,7 @@ describe('search abort controller', () => { }); test('doesnt abort on timeout, if cleared', () => { - const sac = new SearchAbortController(undefined, 100); + const sac = new SearchAbortController(100); expect(sac.getSignal().aborted).toBe(false); sac.cleanup(); timeTravel(100); @@ -85,7 +90,7 @@ describe('search abort controller', () => { }); test('aborts on timeout, even if no signals passed in', () => { - const sac = new SearchAbortController(undefined, 100); + const sac = new SearchAbortController(100); expect(sac.getSignal().aborted).toBe(false); timeTravel(100); expect(sac.getSignal().aborted).toBe(true); @@ -94,7 +99,8 @@ describe('search abort controller', () => { test('aborts on timeout, even if there are unaborted signals', () => { const controller = new AbortController(); - const sac = new SearchAbortController(controller.signal, 100); + const sac = new SearchAbortController(100); + sac.addAbortSignal(controller.signal); expect(sac.getSignal().aborted).toBe(false); timeTravel(100); diff --git a/x-pack/plugins/data_enhanced/public/search/search_abort_controller.ts b/x-pack/plugins/data_enhanced/public/search/search_abort_controller.ts index 4482a7771dc28..7bc74b56a3903 100644 --- a/x-pack/plugins/data_enhanced/public/search/search_abort_controller.ts +++ b/x-pack/plugins/data_enhanced/public/search/search_abort_controller.ts @@ -18,11 +18,7 @@ export class SearchAbortController { private destroyed = false; private reason?: AbortReason; - constructor(abortSignal?: AbortSignal, timeout?: number) { - if (abortSignal) { - this.addAbortSignal(abortSignal); - } - + constructor(timeout?: number) { if (timeout) { this.timeoutSub = timer(timeout).subscribe(() => { this.reason = AbortReason.Timeout; @@ -41,6 +37,7 @@ export class SearchAbortController { }; public cleanup() { + if (this.destroyed) return; this.destroyed = true; this.timeoutSub?.unsubscribe(); this.inputAbortSignals.forEach((abortSignal) => { diff --git a/x-pack/plugins/data_enhanced/public/search/search_interceptor.test.ts b/x-pack/plugins/data_enhanced/public/search/search_interceptor.test.ts index 02671974e5053..0e511c545f3e2 100644 --- a/x-pack/plugins/data_enhanced/public/search/search_interceptor.test.ts +++ b/x-pack/plugins/data_enhanced/public/search/search_interceptor.test.ts @@ -23,9 +23,12 @@ import { bfetchPluginMock } from '../../../../../src/plugins/bfetch/public/mocks import { BehaviorSubject } from 'rxjs'; import * as xpackResourceNotFoundException from '../../common/search/test_data/search_phase_execution_exception.json'; -const timeTravel = (msToRun = 0) => { +const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); + +const timeTravel = async (msToRun = 0) => { + await flushPromises(); jest.advanceTimersByTime(msToRun); - return new Promise((resolve) => setImmediate(resolve)); + return flushPromises(); }; const next = jest.fn(); @@ -39,10 +42,20 @@ let fetchMock: jest.Mock; jest.useFakeTimers(); +jest.mock('./utils', () => ({ + createRequestHash: jest.fn().mockImplementation((input) => { + return Promise.resolve(JSON.stringify(input)); + }), +})); + function mockFetchImplementation(responses: any[]) { let i = 0; - fetchMock.mockImplementation(() => { + fetchMock.mockImplementation((r) => { + if (!r.request.id) i = 0; const { time = 0, value = {}, isError = false } = responses[i++]; + value.meta = { + size: 10, + }; return new Promise((resolve, reject) => setTimeout(() => { return (isError ? reject : resolve)(value); @@ -452,7 +465,7 @@ describe('EnhancedSearchInterceptor', () => { }); }); - describe('session', () => { + describe('session tracking', () => { beforeEach(() => { const responses = [ { @@ -559,4 +572,540 @@ describe('EnhancedSearchInterceptor', () => { expect(sessionService.trackSearch).toBeCalledTimes(0); }); }); + + describe('session client caching', () => { + const sessionId = 'sessionId'; + const basicReq = { + params: { + test: 1, + }, + }; + + const basicCompleteResponse = [ + { + time: 10, + value: { + isPartial: false, + isRunning: false, + id: 1, + rawResponse: { + took: 1, + }, + }, + }, + ]; + + const partialCompleteResponse = [ + { + time: 10, + value: { + isPartial: true, + isRunning: true, + id: 1, + rawResponse: { + took: 1, + }, + }, + }, + { + time: 20, + value: { + isPartial: false, + isRunning: false, + id: 1, + rawResponse: { + took: 1, + }, + }, + }, + ]; + + beforeEach(() => { + sessionService.isCurrentSession.mockImplementation((_sessionId) => _sessionId === sessionId); + sessionService.getSessionId.mockImplementation(() => sessionId); + }); + + test('should be disabled if there is no session', async () => { + mockFetchImplementation(basicCompleteResponse); + + searchInterceptor.search(basicReq, {}).subscribe({ next, error, complete }); + expect(fetchMock).toBeCalledTimes(1); + + searchInterceptor.search(basicReq, {}).subscribe({ next, error, complete }); + expect(fetchMock).toBeCalledTimes(2); + }); + + test('should fetch different requests in a single session', async () => { + mockFetchImplementation(basicCompleteResponse); + + const req2 = { + params: { + test: 2, + }, + }; + + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + + searchInterceptor.search(req2, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(2); + }); + + test('should fetch the same request for two different sessions', async () => { + mockFetchImplementation(basicCompleteResponse); + + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + + searchInterceptor + .search(basicReq, { sessionId: 'anotherSession' }) + .subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(2); + }); + + test('should track searches that come from cache', async () => { + mockFetchImplementation(partialCompleteResponse); + sessionService.isCurrentSession.mockImplementation((_sessionId) => _sessionId === sessionId); + sessionService.getSessionId.mockImplementation(() => sessionId); + + const untrack = jest.fn(); + sessionService.trackSearch.mockImplementation(() => untrack); + + const req = { + params: { + test: 200, + }, + }; + + const response = searchInterceptor.search(req, { pollInterval: 1, sessionId }); + const response2 = searchInterceptor.search(req, { pollInterval: 1, sessionId }); + response.subscribe({ next, error, complete }); + response2.subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + expect(sessionService.trackSearch).toBeCalledTimes(2); + expect(untrack).not.toBeCalled(); + await timeTravel(300); + // Should be called only 2 times (once per partial response) + expect(fetchMock).toBeCalledTimes(2); + expect(sessionService.trackSearch).toBeCalledTimes(2); + expect(untrack).toBeCalledTimes(2); + + expect(next).toBeCalledTimes(4); + expect(error).toBeCalledTimes(0); + expect(complete).toBeCalledTimes(2); + }); + + test('should cache partial responses', async () => { + const responses = [ + { + time: 10, + value: { + isPartial: true, + isRunning: true, + id: 1, + }, + }, + ]; + + mockFetchImplementation(responses); + + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + }); + + test('should not cache error responses', async () => { + const responses = [ + { + time: 10, + value: { + isPartial: true, + isRunning: false, + id: 1, + }, + }, + ]; + + mockFetchImplementation(responses); + + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(2); + }); + + test('should deliver error to all replays', async () => { + const responses = [ + { + time: 10, + value: { + isPartial: true, + isRunning: false, + id: 1, + }, + }, + ]; + + mockFetchImplementation(responses); + + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + expect(error).toBeCalledTimes(2); + expect(error.mock.calls[0][0].message).toEqual('Received partial response'); + expect(error.mock.calls[1][0].message).toEqual('Received partial response'); + }); + + test('should ignore anything outside params when hashing', async () => { + mockFetchImplementation(basicCompleteResponse); + + const req = { + something: 123, + params: { + test: 1, + }, + }; + + const req2 = { + something: 321, + params: { + test: 1, + }, + }; + + searchInterceptor.search(req, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + + searchInterceptor.search(req2, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + }); + + test('should ignore preference when hashing', async () => { + mockFetchImplementation(basicCompleteResponse); + + const req = { + params: { + test: 1, + preference: 123, + }, + }; + + const req2 = { + params: { + test: 1, + preference: 321, + }, + }; + + searchInterceptor.search(req, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + + searchInterceptor.search(req2, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + }); + + test('should return from cache for identical requests in the same session', async () => { + mockFetchImplementation(basicCompleteResponse); + + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + }); + + test('aborting a search that didnt get any response should retrigger search', async () => { + mockFetchImplementation(basicCompleteResponse); + + const abortController = new AbortController(); + + // Start a search request + searchInterceptor + .search(basicReq, { sessionId, abortSignal: abortController.signal }) + .subscribe({ next, error, complete }); + + // Abort the search request before it started + abortController.abort(); + + // Time travel to make sure nothing appens + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(0); + expect(next).toBeCalledTimes(0); + expect(error).toBeCalledTimes(1); + expect(complete).toBeCalledTimes(0); + + const error2 = jest.fn(); + const next2 = jest.fn(); + const complete2 = jest.fn(); + + // Search for the same thing again + searchInterceptor + .search(basicReq, { sessionId }) + .subscribe({ next: next2, error: error2, complete: complete2 }); + + // Should search again + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + expect(next2).toBeCalledTimes(1); + expect(error2).toBeCalledTimes(0); + expect(complete2).toBeCalledTimes(1); + }); + + test('aborting a running first search shouldnt clear cache', async () => { + mockFetchImplementation(partialCompleteResponse); + sessionService.isCurrentSession.mockImplementation((_sessionId) => _sessionId === sessionId); + sessionService.getSessionId.mockImplementation(() => sessionId); + + const untrack = jest.fn(); + sessionService.trackSearch.mockImplementation(() => untrack); + + const req = { + params: { + test: 200, + }, + }; + + const abortController = new AbortController(); + + const response = searchInterceptor.search(req, { + pollInterval: 1, + sessionId, + abortSignal: abortController.signal, + }); + response.subscribe({ next, error, complete }); + await timeTravel(10); + + expect(fetchMock).toBeCalledTimes(1); + expect(next).toBeCalledTimes(1); + expect(error).toBeCalledTimes(0); + expect(complete).toBeCalledTimes(0); + expect(sessionService.trackSearch).toBeCalledTimes(1); + expect(untrack).not.toBeCalled(); + + const next2 = jest.fn(); + const error2 = jest.fn(); + const complete2 = jest.fn(); + const response2 = searchInterceptor.search(req, { pollInterval: 1, sessionId }); + response2.subscribe({ next: next2, error: error2, complete: complete2 }); + await timeTravel(0); + + abortController.abort(); + + await timeTravel(300); + // Both searches should be tracked and untracked + expect(sessionService.trackSearch).toBeCalledTimes(2); + expect(untrack).toBeCalledTimes(2); + + // First search should error + expect(next).toBeCalledTimes(1); + expect(error).toBeCalledTimes(1); + expect(complete).toBeCalledTimes(0); + + // Second search should complete + expect(next2).toBeCalledTimes(2); + expect(error2).toBeCalledTimes(0); + expect(complete2).toBeCalledTimes(1); + + // Should be called only 2 times (once per partial response) + expect(fetchMock).toBeCalledTimes(2); + }); + + test('aborting a running second search shouldnt clear cache', async () => { + mockFetchImplementation(partialCompleteResponse); + sessionService.isCurrentSession.mockImplementation((_sessionId) => _sessionId === sessionId); + sessionService.getSessionId.mockImplementation(() => sessionId); + + const untrack = jest.fn(); + sessionService.trackSearch.mockImplementation(() => untrack); + + const req = { + params: { + test: 200, + }, + }; + + const abortController = new AbortController(); + + const response = searchInterceptor.search(req, { pollInterval: 1, sessionId }); + response.subscribe({ next, error, complete }); + await timeTravel(10); + + expect(fetchMock).toBeCalledTimes(1); + expect(next).toBeCalledTimes(1); + expect(error).toBeCalledTimes(0); + expect(complete).toBeCalledTimes(0); + expect(sessionService.trackSearch).toBeCalledTimes(1); + expect(untrack).not.toBeCalled(); + + const next2 = jest.fn(); + const error2 = jest.fn(); + const complete2 = jest.fn(); + const response2 = searchInterceptor.search(req, { + pollInterval: 0, + sessionId, + abortSignal: abortController.signal, + }); + response2.subscribe({ next: next2, error: error2, complete: complete2 }); + await timeTravel(0); + + abortController.abort(); + + await timeTravel(300); + expect(sessionService.trackSearch).toBeCalledTimes(2); + expect(untrack).toBeCalledTimes(2); + + expect(next).toBeCalledTimes(2); + expect(error).toBeCalledTimes(0); + expect(complete).toBeCalledTimes(1); + + expect(next2).toBeCalledTimes(1); + expect(error2).toBeCalledTimes(1); + expect(complete2).toBeCalledTimes(0); + + // Should be called only 2 times (once per partial response) + expect(fetchMock).toBeCalledTimes(2); + }); + + test('aborting both requests should cancel underlaying search only once', async () => { + mockFetchImplementation(partialCompleteResponse); + sessionService.isCurrentSession.mockImplementation((_sessionId) => _sessionId === sessionId); + sessionService.getSessionId.mockImplementation(() => sessionId); + sessionService.trackSearch.mockImplementation(() => jest.fn()); + + const req = { + params: { + test: 200, + }, + }; + + const abortController = new AbortController(); + + const response = searchInterceptor.search(req, { + pollInterval: 1, + sessionId, + abortSignal: abortController.signal, + }); + response.subscribe({ next, error, complete }); + + const response2 = searchInterceptor.search(req, { + pollInterval: 1, + sessionId, + abortSignal: abortController.signal, + }); + response2.subscribe({ next, error, complete }); + await timeTravel(10); + + abortController.abort(); + + await timeTravel(300); + + expect(mockCoreSetup.http.delete).toHaveBeenCalledTimes(1); + }); + + test('aborting both searches should stop searching and clear cache', async () => { + mockFetchImplementation(partialCompleteResponse); + sessionService.isCurrentSession.mockImplementation((_sessionId) => _sessionId === sessionId); + sessionService.getSessionId.mockImplementation(() => sessionId); + + const untrack = jest.fn(); + sessionService.trackSearch.mockImplementation(() => untrack); + + const req = { + params: { + test: 200, + }, + }; + + const abortController = new AbortController(); + + const response = searchInterceptor.search(req, { + pollInterval: 1, + sessionId, + abortSignal: abortController.signal, + }); + response.subscribe({ next, error, complete }); + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + + const response2 = searchInterceptor.search(req, { + pollInterval: 1, + sessionId, + abortSignal: abortController.signal, + }); + response2.subscribe({ next, error, complete }); + await timeTravel(0); + expect(fetchMock).toBeCalledTimes(1); + + abortController.abort(); + + await timeTravel(300); + + expect(next).toBeCalledTimes(2); + expect(error).toBeCalledTimes(2); + expect(complete).toBeCalledTimes(0); + expect(error.mock.calls[0][0]).toBeInstanceOf(AbortError); + expect(error.mock.calls[1][0]).toBeInstanceOf(AbortError); + + // Should be called only 1 times (one partial response) + expect(fetchMock).toBeCalledTimes(1); + + // Clear mock and research + fetchMock.mockReset(); + mockFetchImplementation(partialCompleteResponse); + // Run the search again to see that we don't hit the cache + const response3 = searchInterceptor.search(req, { pollInterval: 1, sessionId }); + response3.subscribe({ next, error, complete }); + + await timeTravel(10); + await timeTravel(10); + await timeTravel(300); + + // Should be called 2 times (two partial response) + expect(fetchMock).toBeCalledTimes(2); + expect(complete).toBeCalledTimes(1); + }); + + test('aborting a completed search shouldnt effect cache', async () => { + mockFetchImplementation(basicCompleteResponse); + + const abortController = new AbortController(); + + // Start a search request + searchInterceptor + .search(basicReq, { sessionId, abortSignal: abortController.signal }) + .subscribe({ next, error, complete }); + + // Get a final response + await timeTravel(10); + expect(fetchMock).toBeCalledTimes(1); + + // Abort the search request + abortController.abort(); + + // Search for the same thing again + searchInterceptor.search(basicReq, { sessionId }).subscribe({ next, error, complete }); + + // Get the response from cache + expect(fetchMock).toBeCalledTimes(1); + }); + }); }); diff --git a/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts b/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts index b9d8553d3dc5a..3e7564933a0c6 100644 --- a/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts +++ b/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts @@ -6,8 +6,19 @@ */ import { once } from 'lodash'; -import { throwError, Subscription } from 'rxjs'; -import { tap, finalize, catchError, filter, take, skip } from 'rxjs/operators'; +import { throwError, Subscription, from, of, fromEvent, EMPTY } from 'rxjs'; +import { + tap, + finalize, + catchError, + filter, + take, + skip, + switchMap, + shareReplay, + map, + takeUntil, +} from 'rxjs/operators'; import { TimeoutErrorMode, SearchInterceptor, @@ -16,12 +27,21 @@ import { IKibanaSearchRequest, SearchSessionState, } from '../../../../../src/plugins/data/public'; +import { AbortError } from '../../../../../src/plugins/kibana_utils/public'; import { ENHANCED_ES_SEARCH_STRATEGY, IAsyncSearchOptions, pollSearch } from '../../common'; +import { SearchResponseCache } from './search_response_cache'; +import { createRequestHash } from './utils'; import { SearchAbortController } from './search_abort_controller'; +const MAX_CACHE_ITEMS = 50; +const MAX_CACHE_SIZE_MB = 10; export class EnhancedSearchInterceptor extends SearchInterceptor { private uiSettingsSub: Subscription; private searchTimeout: number; + private readonly responseCache: SearchResponseCache = new SearchResponseCache( + MAX_CACHE_ITEMS, + MAX_CACHE_SIZE_MB + ); /** * @internal @@ -38,6 +58,7 @@ export class EnhancedSearchInterceptor extends SearchInterceptor { } public stop() { + this.responseCache.clear(); this.uiSettingsSub.unsubscribe(); } @@ -47,19 +68,31 @@ export class EnhancedSearchInterceptor extends SearchInterceptor { : TimeoutErrorMode.CONTACT; } - public search({ id, ...request }: IKibanaSearchRequest, options: IAsyncSearchOptions = {}) { - const searchOptions = { - strategy: ENHANCED_ES_SEARCH_STRATEGY, - ...options, + private createRequestHash$(request: IKibanaSearchRequest, options: IAsyncSearchOptions) { + const { sessionId, isRestore } = options; + // Preference is used to ensure all queries go to the same set of shards and it doesn't need to be hashed + // https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shard-routing.html#shard-and-node-preference + const { preference, ...params } = request.params || {}; + const hashOptions = { + ...params, + sessionId, + isRestore, }; - const { sessionId, strategy, abortSignal } = searchOptions; - const search = () => this.runSearch({ id, ...request }, searchOptions); - const searchAbortController = new SearchAbortController(abortSignal, this.searchTimeout); - this.pendingCount$.next(this.pendingCount$.getValue() + 1); - const untrackSearch = this.deps.session.isCurrentSession(options.sessionId) - ? this.deps.session.trackSearch({ abort: () => searchAbortController.abort() }) - : undefined; + return from(sessionId ? createRequestHash(hashOptions) : of(undefined)); + } + + /** + * @internal + * Creates a new pollSearch that share replays its results + */ + private runSearch$( + { id, ...request }: IKibanaSearchRequest, + options: IAsyncSearchOptions, + searchAbortController: SearchAbortController + ) { + const search = () => this.runSearch({ id, ...request }, options); + const { sessionId, strategy } = options; // track if this search's session will be send to background // if yes, then we don't need to cancel this search when it is aborted @@ -91,18 +124,97 @@ export class EnhancedSearchInterceptor extends SearchInterceptor { tap((response) => (id = response.id)), catchError((e: Error) => { cancel(); - return throwError(this.handleSearchError(e, options, searchAbortController.isTimeout())); + return throwError(e); }), finalize(() => { - this.pendingCount$.next(this.pendingCount$.getValue() - 1); searchAbortController.cleanup(); - if (untrackSearch && this.deps.session.isCurrentSession(options.sessionId)) { - // untrack if this search still belongs to current session - untrackSearch(); - } if (savedToBackgroundSub) { savedToBackgroundSub.unsubscribe(); } + }), + // This observable is cached in the responseCache. + // Using shareReplay makes sure that future subscribers will get the final response + + shareReplay(1) + ); + } + + /** + * @internal + * Creates a new search observable and a corresponding search abort controller + * If requestHash is defined, tries to return them first from cache. + */ + private getSearchResponse$( + request: IKibanaSearchRequest, + options: IAsyncSearchOptions, + requestHash?: string + ) { + const cached = requestHash ? this.responseCache.get(requestHash) : undefined; + + const searchAbortController = + cached?.searchAbortController || new SearchAbortController(this.searchTimeout); + + // Create a new abort signal if one was not passed. This fake signal will never be aborted, + // So the underlaying search will not be aborted, even if the other consumers abort. + searchAbortController.addAbortSignal(options.abortSignal ?? new AbortController().signal); + const response$ = cached?.response$ || this.runSearch$(request, options, searchAbortController); + + if (requestHash && !this.responseCache.has(requestHash)) { + this.responseCache.set(requestHash, { + response$, + searchAbortController, + }); + } + + return { + response$, + searchAbortController, + }; + } + + public search({ id, ...request }: IKibanaSearchRequest, options: IAsyncSearchOptions = {}) { + const searchOptions = { + strategy: ENHANCED_ES_SEARCH_STRATEGY, + ...options, + }; + const { sessionId, abortSignal } = searchOptions; + + return this.createRequestHash$(request, searchOptions).pipe( + switchMap((requestHash) => { + const { searchAbortController, response$ } = this.getSearchResponse$( + request, + searchOptions, + requestHash + ); + + this.pendingCount$.next(this.pendingCount$.getValue() + 1); + const untrackSearch = this.deps.session.isCurrentSession(sessionId) + ? this.deps.session.trackSearch({ abort: () => searchAbortController.abort() }) + : undefined; + + // Abort the replay if the abortSignal is aborted. + // The underlaying search will not abort unless searchAbortController fires. + const aborted$ = (abortSignal ? fromEvent(abortSignal, 'abort') : EMPTY).pipe( + map(() => { + throw new AbortError(); + }) + ); + + return response$.pipe( + takeUntil(aborted$), + catchError((e) => { + return throwError( + this.handleSearchError(e, searchOptions, searchAbortController.isTimeout()) + ); + }), + finalize(() => { + this.pendingCount$.next(this.pendingCount$.getValue() - 1); + if (untrackSearch && this.deps.session.isCurrentSession(sessionId)) { + // untrack if this search still belongs to current session + untrackSearch(); + } + }) + ); }) ); } diff --git a/x-pack/plugins/data_enhanced/public/search/search_response_cache.test.ts b/x-pack/plugins/data_enhanced/public/search/search_response_cache.test.ts new file mode 100644 index 0000000000000..e985de5e23f7d --- /dev/null +++ b/x-pack/plugins/data_enhanced/public/search/search_response_cache.test.ts @@ -0,0 +1,318 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { interval, Observable, of, throwError } from 'rxjs'; +import { shareReplay, switchMap, take } from 'rxjs/operators'; +import { IKibanaSearchResponse } from 'src/plugins/data/public'; +import { SearchAbortController } from './search_abort_controller'; +import { SearchResponseCache } from './search_response_cache'; + +describe('SearchResponseCache', () => { + let cache: SearchResponseCache; + let searchAbortController: SearchAbortController; + const r: Array> = [ + { + isPartial: true, + isRunning: true, + rawResponse: { + t: 1, + }, + }, + { + isPartial: true, + isRunning: true, + rawResponse: { + t: 2, + }, + }, + { + isPartial: true, + isRunning: true, + rawResponse: { + t: 3, + }, + }, + { + isPartial: false, + isRunning: false, + rawResponse: { + t: 4, + }, + }, + ]; + + function getSearchObservable$(responses: Array> = r) { + return interval(100).pipe( + take(responses.length), + switchMap((value: number, i: number) => { + if (responses[i].rawResponse.throw === true) { + return throwError('nooo'); + } else { + return of(responses[i]); + } + }), + shareReplay(1) + ); + } + + function wrapWithAbortController(response$: Observable>) { + return { + response$, + searchAbortController, + }; + } + + beforeEach(() => { + cache = new SearchResponseCache(3, 0.1); + searchAbortController = new SearchAbortController(); + }); + + describe('Cache eviction', () => { + test('clear evicts all', () => { + const finalResult = r[r.length - 1]; + cache.set('123', wrapWithAbortController(of(finalResult))); + cache.set('234', wrapWithAbortController(of(finalResult))); + + cache.clear(); + + expect(cache.get('123')).toBeUndefined(); + expect(cache.get('234')).toBeUndefined(); + }); + + test('evicts searches that threw an exception', async () => { + const res$ = getSearchObservable$(); + const err$ = getSearchObservable$([ + { + isPartial: true, + isRunning: true, + rawResponse: { + t: 'a'.repeat(1000), + }, + }, + { + isPartial: true, + isRunning: true, + rawResponse: { + throw: true, + }, + }, + ]); + cache.set('123', wrapWithAbortController(err$)); + cache.set('234', wrapWithAbortController(res$)); + + const errHandler = jest.fn(); + await err$.toPromise().catch(errHandler); + await res$.toPromise().catch(errHandler); + + expect(errHandler).toBeCalledTimes(1); + expect(cache.get('123')).toBeUndefined(); + expect(cache.get('234')).not.toBeUndefined(); + }); + + test('evicts searches that returned an error response', async () => { + const err$ = getSearchObservable$([ + { + isPartial: true, + isRunning: true, + rawResponse: { + t: 1, + }, + }, + { + isPartial: true, + isRunning: false, + rawResponse: { + t: 2, + }, + }, + ]); + cache.set('123', wrapWithAbortController(err$)); + + const errHandler = jest.fn(); + await err$.toPromise().catch(errHandler); + + expect(errHandler).toBeCalledTimes(0); + expect(cache.get('123')).toBeUndefined(); + }); + + test('evicts oldest item if has too many cached items', async () => { + const finalResult = r[r.length - 1]; + cache.set('123', wrapWithAbortController(of(finalResult))); + cache.set('234', wrapWithAbortController(of(finalResult))); + cache.set('345', wrapWithAbortController(of(finalResult))); + cache.set('456', wrapWithAbortController(of(finalResult))); + + expect(cache.get('123')).toBeUndefined(); + expect(cache.get('234')).not.toBeUndefined(); + expect(cache.get('345')).not.toBeUndefined(); + expect(cache.get('456')).not.toBeUndefined(); + }); + + test('evicts oldest item if cache gets bigger than max size', async () => { + const largeResult$ = getSearchObservable$([ + { + isPartial: true, + isRunning: true, + rawResponse: { + t: 'a'.repeat(1000), + }, + }, + { + isPartial: false, + isRunning: false, + rawResponse: { + t: 'a'.repeat(50000), + }, + }, + ]); + + cache.set('123', wrapWithAbortController(largeResult$)); + cache.set('234', wrapWithAbortController(largeResult$)); + cache.set('345', wrapWithAbortController(largeResult$)); + + await largeResult$.toPromise(); + + expect(cache.get('123')).toBeUndefined(); + expect(cache.get('234')).not.toBeUndefined(); + expect(cache.get('345')).not.toBeUndefined(); + }); + + test('evicts from cache any single item that gets bigger than max size', async () => { + const largeResult$ = getSearchObservable$([ + { + isPartial: true, + isRunning: true, + rawResponse: { + t: 'a'.repeat(500), + }, + }, + { + isPartial: false, + isRunning: false, + rawResponse: { + t: 'a'.repeat(500000), + }, + }, + ]); + + cache.set('234', wrapWithAbortController(largeResult$)); + await largeResult$.toPromise(); + expect(cache.get('234')).toBeUndefined(); + }); + + test('get updates the insertion time of an item', async () => { + const finalResult = r[r.length - 1]; + cache.set('123', wrapWithAbortController(of(finalResult))); + cache.set('234', wrapWithAbortController(of(finalResult))); + cache.set('345', wrapWithAbortController(of(finalResult))); + + cache.get('123'); + cache.get('234'); + + cache.set('456', wrapWithAbortController(of(finalResult))); + + expect(cache.get('123')).not.toBeUndefined(); + expect(cache.get('234')).not.toBeUndefined(); + expect(cache.get('345')).toBeUndefined(); + expect(cache.get('456')).not.toBeUndefined(); + }); + }); + + describe('Observable behavior', () => { + test('caches a response and re-emits it', async () => { + const s$ = getSearchObservable$(); + cache.set('123', wrapWithAbortController(s$)); + const finalRes = await cache.get('123')!.response$.toPromise(); + expect(finalRes).toStrictEqual(r[r.length - 1]); + }); + + test('cached$ should emit same as original search$', async () => { + const s$ = getSearchObservable$(); + cache.set('123', wrapWithAbortController(s$)); + + const next = jest.fn(); + const cached$ = cache.get('123'); + + cached$!.response$.subscribe({ + next, + }); + + // wait for original search to complete + await s$!.toPromise(); + + // get final response from cached$ + const finalRes = await cached$!.response$.toPromise(); + expect(finalRes).toStrictEqual(r[r.length - 1]); + expect(next).toHaveBeenCalledTimes(4); + }); + + test('cached$ should emit only current value and keep emitting if subscribed while search$ is running', async () => { + const s$ = getSearchObservable$(); + cache.set('123', wrapWithAbortController(s$)); + + const next = jest.fn(); + let cached$: Observable> | undefined; + s$.subscribe({ + next: (res) => { + if (res.rawResponse.t === 3) { + cached$ = cache.get('123')!.response$; + cached$!.subscribe({ + next, + }); + } + }, + }); + + // wait for original search to complete + await s$!.toPromise(); + + const finalRes = await cached$!.toPromise(); + + expect(finalRes).toStrictEqual(r[r.length - 1]); + expect(next).toHaveBeenCalledTimes(2); + }); + + test('cached$ should emit only last value if subscribed after search$ was complete 1', async () => { + const finalResult = r[r.length - 1]; + const s$ = wrapWithAbortController(of(finalResult)); + cache.set('123', s$); + + // wait for original search to complete + await s$!.response$.toPromise(); + + const next = jest.fn(); + const cached$ = cache.get('123'); + cached$!.response$.subscribe({ + next, + }); + + const finalRes = await cached$!.response$.toPromise(); + + expect(finalRes).toStrictEqual(r[r.length - 1]); + expect(next).toHaveBeenCalledTimes(1); + }); + + test('cached$ should emit only last value if subscribed after search$ was complete', async () => { + const s$ = getSearchObservable$(); + cache.set('123', wrapWithAbortController(s$)); + + // wait for original search to complete + await s$!.toPromise(); + + const next = jest.fn(); + const cached$ = cache.get('123'); + cached$!.response$.subscribe({ + next, + }); + + const finalRes = await cached$!.response$.toPromise(); + + expect(finalRes).toStrictEqual(r[r.length - 1]); + expect(next).toHaveBeenCalledTimes(1); + }); + }); +}); diff --git a/x-pack/plugins/data_enhanced/public/search/search_response_cache.ts b/x-pack/plugins/data_enhanced/public/search/search_response_cache.ts new file mode 100644 index 0000000000000..1467e5bf234ff --- /dev/null +++ b/x-pack/plugins/data_enhanced/public/search/search_response_cache.ts @@ -0,0 +1,136 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Observable, Subscription } from 'rxjs'; +import { IKibanaSearchResponse, isErrorResponse } from '../../../../../src/plugins/data/public'; +import { SearchAbortController } from './search_abort_controller'; + +interface ResponseCacheItem { + response$: Observable>; + searchAbortController: SearchAbortController; +} + +interface ResponseCacheItemInternal { + response$: Observable>; + searchAbortController: SearchAbortController; + size: number; + subs: Subscription; +} + +export class SearchResponseCache { + private responseCache: Map; + private cacheSize = 0; + + constructor(private maxItems: number, private maxCacheSizeMB: number) { + this.responseCache = new Map(); + } + + private byteToMb(size: number) { + return size / (1024 * 1024); + } + + private deleteItem(key: string, clearSubs = true) { + const item = this.responseCache.get(key); + if (item) { + if (clearSubs) { + item.subs.unsubscribe(); + } + this.cacheSize -= item.size; + this.responseCache.delete(key); + } + } + + private setItem(key: string, item: ResponseCacheItemInternal) { + // The deletion of the key will move it to the end of the Map's entries. + this.deleteItem(key, false); + this.cacheSize += item.size; + this.responseCache.set(key, item); + } + + public clear() { + this.cacheSize = 0; + this.responseCache.forEach((item) => { + item.subs.unsubscribe(); + }); + this.responseCache.clear(); + } + + private shrink() { + while ( + this.responseCache.size > this.maxItems || + this.byteToMb(this.cacheSize) > this.maxCacheSizeMB + ) { + const [key] = [...this.responseCache.keys()]; + this.deleteItem(key); + } + } + + public has(key: string) { + return this.responseCache.has(key); + } + + /** + * + * @param key key to cache + * @param response$ + * @returns A ReplaySubject that mimics the behavior of the original observable + * @throws error if key already exists + */ + public set(key: string, item: ResponseCacheItem) { + if (this.responseCache.has(key)) { + throw new Error('duplicate key'); + } + + const { response$, searchAbortController } = item; + + const cacheItem: ResponseCacheItemInternal = { + response$, + searchAbortController, + subs: new Subscription(), + size: 0, + }; + + this.setItem(key, cacheItem); + + cacheItem.subs.add( + response$.subscribe({ + next: (r) => { + // TODO: avoid stringiying. Get the size some other way! + const newSize = new Blob([JSON.stringify(r)]).size; + if (this.byteToMb(newSize) < this.maxCacheSizeMB && !isErrorResponse(r)) { + this.setItem(key, { + ...cacheItem, + size: newSize, + }); + this.shrink(); + } else { + // Single item is too large to be cached, or an error response returned. + // Evict and ignore. + this.deleteItem(key); + } + }, + error: (e) => { + // Evict item on error + this.deleteItem(key); + }, + }) + ); + this.shrink(); + } + + public get(key: string): ResponseCacheItem | undefined { + const item = this.responseCache.get(key); + if (item) { + // touch the item, and move it to the end of the map's entries + this.setItem(key, item); + return { + response$: item.response$, + searchAbortController: item.searchAbortController, + }; + } + } +} diff --git a/x-pack/plugins/data_enhanced/public/search/utils.ts b/x-pack/plugins/data_enhanced/public/search/utils.ts new file mode 100644 index 0000000000000..c6c648dbb5488 --- /dev/null +++ b/x-pack/plugins/data_enhanced/public/search/utils.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import stringify from 'json-stable-stringify'; + +export async function createRequestHash(keys: Record) { + const msgBuffer = new TextEncoder().encode(stringify(keys)); + const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer); + const hashArray = Array.from(new Uint8Array(hashBuffer)); + return hashArray.map((b) => ('00' + b.toString(16)).slice(-2)).join(''); +} diff --git a/x-pack/plugins/lens/public/app_plugin/app.tsx b/x-pack/plugins/lens/public/app_plugin/app.tsx index 39163101fc7bd..8caa1737c00ad 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.tsx @@ -82,6 +82,8 @@ export function App({ dashboardFeatureFlag, } = useKibana().services; + const startSession = useCallback(() => data.search.session.start(), [data]); + const [state, setState] = useState(() => { return { query: data.query.queryString.getQuery(), @@ -96,7 +98,7 @@ export function App({ isSaveModalVisible: false, indicateNoData: false, isSaveable: false, - searchSessionId: data.search.session.start(), + searchSessionId: startSession(), }; }); @@ -178,7 +180,7 @@ export function App({ setState((s) => ({ ...s, filters: data.query.filterManager.getFilters(), - searchSessionId: data.search.session.start(), + searchSessionId: startSession(), })); trackUiEvent('app_filters_updated'); }, @@ -188,7 +190,7 @@ export function App({ next: () => { setState((s) => ({ ...s, - searchSessionId: data.search.session.start(), + searchSessionId: startSession(), })); }, }); @@ -199,7 +201,7 @@ export function App({ tap(() => { setState((s) => ({ ...s, - searchSessionId: data.search.session.start(), + searchSessionId: startSession(), })); }), switchMap((done) => @@ -234,6 +236,7 @@ export function App({ data.query, history, initialContext, + startSession, ]); useEffect(() => { @@ -652,7 +655,7 @@ export function App({ // Time change will be picked up by the time subscription setState((s) => ({ ...s, - searchSessionId: data.search.session.start(), + searchSessionId: startSession(), })); trackUiEvent('app_query_change'); } diff --git a/x-pack/test/examples/search_examples/index.ts b/x-pack/test/examples/search_examples/index.ts index 2cac0d1b60de7..13eac7566525e 100644 --- a/x-pack/test/examples/search_examples/index.ts +++ b/x-pack/test/examples/search_examples/index.ts @@ -23,6 +23,7 @@ export default function ({ getService, loadTestFile }: PluginFunctionalProviderC await esArchiver.unload('lens/basic'); }); + loadTestFile(require.resolve('./search_sessions_cache')); loadTestFile(require.resolve('./search_session_example')); }); } diff --git a/x-pack/test/examples/search_examples/search_sessions_cache.ts b/x-pack/test/examples/search_examples/search_sessions_cache.ts new file mode 100644 index 0000000000000..57b2d1665d901 --- /dev/null +++ b/x-pack/test/examples/search_examples/search_sessions_cache.ts @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../functional/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const testSubjects = getService('testSubjects'); + const PageObjects = getPageObjects(['common']); + const toasts = getService('toasts'); + const retry = getService('retry'); + + async function getExecutedAt() { + const toast = await toasts.getToastElement(1); + const timeElem = await testSubjects.findDescendant('requestExecutedAt', toast); + const text = await timeElem.getVisibleText(); + await toasts.dismissAllToasts(); + await retry.waitFor('toasts gone', async () => { + return (await toasts.getToastCount()) === 0; + }); + return text; + } + + describe.skip('Search session client side cache', () => { + const appId = 'searchExamples'; + + before(async function () { + await PageObjects.common.navigateToApp(appId, { insertTimestamp: false }); + }); + + it('should cache responses by search session id', async () => { + await testSubjects.click('searchExamplesCacheSearch'); + const noSessionExecutedAt = await getExecutedAt(); + + // Expect searches executed in a session to share a response + await testSubjects.click('searchExamplesStartSession'); + await testSubjects.click('searchExamplesCacheSearch'); + const withSessionExecutedAt = await getExecutedAt(); + await testSubjects.click('searchExamplesCacheSearch'); + const withSessionExecutedAt2 = await getExecutedAt(); + expect(withSessionExecutedAt2).to.equal(withSessionExecutedAt); + expect(withSessionExecutedAt).not.to.equal(noSessionExecutedAt); + + // Expect new session to run search again + await testSubjects.click('searchExamplesStartSession'); + await testSubjects.click('searchExamplesCacheSearch'); + const secondSessionExecutedAt = await getExecutedAt(); + expect(secondSessionExecutedAt).not.to.equal(withSessionExecutedAt); + + // Clear session + await testSubjects.click('searchExamplesClearSession'); + await testSubjects.click('searchExamplesCacheSearch'); + const afterClearSession1 = await getExecutedAt(); + await testSubjects.click('searchExamplesCacheSearch'); + const afterClearSession2 = await getExecutedAt(); + expect(secondSessionExecutedAt).not.to.equal(afterClearSession1); + expect(afterClearSession2).not.to.equal(afterClearSession1); + }); + }); +} From 6c7d776fc103a305433ef0bca019aaf7882fb4c6 Mon Sep 17 00:00:00 2001 From: Mikhail Shustov Date: Fri, 16 Apr 2021 19:55:16 +0200 Subject: [PATCH 53/68] minimize number of so fild asserted in tests. it creates flakines when implementation details change (#97374) --- .../apis/saved_objects/find.ts | 165 +++--------------- .../apis/saved_objects_management/find.ts | 41 +---- .../saved_objects_management/find.ts | 40 ++--- 3 files changed, 36 insertions(+), 210 deletions(-) diff --git a/test/api_integration/apis/saved_objects/find.ts b/test/api_integration/apis/saved_objects/find.ts index a01562861e606..a4862707e2d0e 100644 --- a/test/api_integration/apis/saved_objects/find.ts +++ b/test/api_integration/apis/saved_objects/find.ts @@ -9,7 +9,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; import { SavedObject } from '../../../../src/core/server'; -import { getKibanaVersion } from './lib/saved_objects_test_utils'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); @@ -17,12 +16,6 @@ export default function ({ getService }: FtrProviderContext) { const esDeleteAllIndices = getService('esDeleteAllIndices'); describe('find', () => { - let KIBANA_VERSION: string; - - before(async () => { - KIBANA_VERSION = await getKibanaVersion(getService); - }); - describe('with kibana index', () => { before(() => esArchiver.load('saved_objects/basic')); after(() => esArchiver.unload('saved_objects/basic')); @@ -32,33 +25,9 @@ export default function ({ getService }: FtrProviderContext) { .get('/api/saved_objects/_find?type=visualization&fields=title') .expect(200) .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 1, - saved_objects: [ - { - type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - version: 'WzE4LDJd', - attributes: { - title: 'Count of requests', - }, - score: 0, - migrationVersion: resp.body.saved_objects[0].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - namespaces: ['default'], - references: [ - { - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - type: 'index-pattern', - }, - ], - updated_at: '2017-09-21T18:51:23.794Z', - }, - ], - }); + expect(resp.body.saved_objects.map((so: { id: string }) => so.id)).to.eql([ + 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + ]); expect(resp.body.saved_objects[0].migrationVersion).to.be.ok(); })); @@ -129,33 +98,12 @@ export default function ({ getService }: FtrProviderContext) { .get('/api/saved_objects/_find?type=visualization&fields=title&namespaces=default') .expect(200) .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 1, - saved_objects: [ - { - type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - version: 'WzE4LDJd', - attributes: { - title: 'Count of requests', - }, - migrationVersion: resp.body.saved_objects[0].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - namespaces: ['default'], - score: 0, - references: [ - { - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - type: 'index-pattern', - }, - ], - updated_at: '2017-09-21T18:51:23.794Z', - }, - ], - }); + expect( + resp.body.saved_objects.map((so: { id: string; namespaces: string[] }) => ({ + id: so.id, + namespaces: so.namespaces, + })) + ).to.eql([{ id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: ['default'] }]); expect(resp.body.saved_objects[0].migrationVersion).to.be.ok(); })); }); @@ -166,53 +114,15 @@ export default function ({ getService }: FtrProviderContext) { .get('/api/saved_objects/_find?type=visualization&fields=title&namespaces=*') .expect(200) .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 2, - saved_objects: [ - { - type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - version: 'WzE4LDJd', - attributes: { - title: 'Count of requests', - }, - migrationVersion: resp.body.saved_objects[0].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - namespaces: ['default'], - score: 0, - references: [ - { - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - type: 'index-pattern', - }, - ], - updated_at: '2017-09-21T18:51:23.794Z', - }, - { - attributes: { - title: 'Count of requests', - }, - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - migrationVersion: resp.body.saved_objects[0].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - namespaces: ['foo-ns'], - references: [ - { - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - type: 'index-pattern', - }, - ], - score: 0, - type: 'visualization', - updated_at: '2017-09-21T18:51:23.794Z', - version: 'WzIyLDJd', - }, - ], - }); + expect( + resp.body.saved_objects.map((so: { id: string; namespaces: string[] }) => ({ + id: so.id, + namespaces: so.namespaces, + })) + ).to.eql([ + { id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: ['default'] }, + { id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', namespaces: ['foo-ns'] }, + ]); })); }); @@ -224,42 +134,9 @@ export default function ({ getService }: FtrProviderContext) { ) .expect(200) .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 1, - saved_objects: [ - { - type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - attributes: { - title: 'Count of requests', - visState: resp.body.saved_objects[0].attributes.visState, - uiStateJSON: '{"spy":{"mode":{"name":null,"fill":false}}}', - description: '', - version: 1, - kibanaSavedObjectMeta: { - searchSourceJSON: - resp.body.saved_objects[0].attributes.kibanaSavedObjectMeta - .searchSourceJSON, - }, - }, - namespaces: ['default'], - score: 0, - references: [ - { - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - type: 'index-pattern', - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - }, - ], - migrationVersion: resp.body.saved_objects[0].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - updated_at: '2017-09-21T18:51:23.794Z', - version: 'WzE4LDJd', - }, - ], - }); + expect(resp.body.saved_objects.map((so: { id: string }) => so.id)).to.eql([ + 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + ]); })); it('wrong type should return 400 with Bad Request', async () => diff --git a/test/api_integration/apis/saved_objects_management/find.ts b/test/api_integration/apis/saved_objects_management/find.ts index 6ab2352ebb05f..8fb3884a5b37b 100644 --- a/test/api_integration/apis/saved_objects_management/find.ts +++ b/test/api_integration/apis/saved_objects_management/find.ts @@ -34,44 +34,9 @@ export default function ({ getService }: FtrProviderContext) { .get('/api/kibana/management/saved_objects/_find?type=visualization&fields=title') .expect(200) .then((resp: Response) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 1, - saved_objects: [ - { - type: 'visualization', - id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab', - version: 'WzE4LDJd', - attributes: { - title: 'Count of requests', - }, - migrationVersion: resp.body.saved_objects[0].migrationVersion, - coreMigrationVersion: KIBANA_VERSION, - namespaces: ['default'], - references: [ - { - id: '91200a00-9efd-11e7-acb3-3dab96693fab', - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - type: 'index-pattern', - }, - ], - score: 0, - updated_at: '2017-09-21T18:51:23.794Z', - meta: { - editUrl: - '/management/kibana/objects/savedVisualizations/dd7caf20-9efd-11e7-acb3-3dab96693fab', - icon: 'visualizeApp', - inAppUrl: { - path: '/app/visualize#/edit/dd7caf20-9efd-11e7-acb3-3dab96693fab', - uiCapabilitiesPath: 'visualize.show', - }, - title: 'Count of requests', - namespaceType: 'single', - }, - }, - ], - }); + expect(resp.body.saved_objects.map((so: { id: string }) => so.id)).to.eql([ + 'dd7caf20-9efd-11e7-acb3-3dab96693fab', + ]); })); describe('unknown type', () => { diff --git a/test/plugin_functional/test_suites/saved_objects_management/find.ts b/test/plugin_functional/test_suites/saved_objects_management/find.ts index 5dce8f43339a1..e5a5d69c7e4d4 100644 --- a/test/plugin_functional/test_suites/saved_objects_management/find.ts +++ b/test/plugin_functional/test_suites/saved_objects_management/find.ts @@ -33,28 +33,17 @@ export default function ({ getService }: PluginFunctionalProviderContext) { .set('kbn-xsrf', 'true') .expect(200) .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 1, - saved_objects: [ - { - type: 'test-hidden-importable-exportable', - id: 'ff3733a0-9fty-11e7-ahb3-3dcb94193fab', - attributes: { - title: 'Hidden Saved object type that is importable/exportable.', - }, - references: [], - updated_at: '2021-02-11T18:51:23.794Z', - version: 'WzIsMl0=', - namespaces: ['default'], - score: 0, - meta: { - namespaceType: 'single', - }, - }, - ], - }); + expect( + resp.body.saved_objects.map((so: { id: string; type: string }) => ({ + id: so.id, + type: so.type, + })) + ).to.eql([ + { + type: 'test-hidden-importable-exportable', + id: 'ff3733a0-9fty-11e7-ahb3-3dcb94193fab', + }, + ]); })); it('returns empty response for non importableAndExportable types', async () => @@ -65,12 +54,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) { .set('kbn-xsrf', 'true') .expect(200) .then((resp) => { - expect(resp.body).to.eql({ - page: 1, - per_page: 20, - total: 0, - saved_objects: [], - }); + expect(resp.body.saved_objects).to.eql([]); })); }); }); From 194355fdd3969f567f43ad4b7f63d72dcf7974a9 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Fri, 16 Apr 2021 10:57:29 -0700 Subject: [PATCH 54/68] Skip test to try and stabilize master https://github.com/elastic/kibana/issues/97378 Signed-off-by: Tyler Smalley --- .../apis/security_solution/matrix_dns_histogram.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts b/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts index 69beb65dec670..27a7a5a539607 100644 --- a/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts +++ b/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts @@ -33,7 +33,8 @@ export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const retry = getService('retry'); - describe('Matrix DNS Histogram', () => { + // FIX: https://github.com/elastic/kibana/issues/97378 + describe.skip('Matrix DNS Histogram', () => { describe('Large data set', () => { before(() => esArchiver.load('security_solution/matrix_dns_histogram/large_dns_query')); after(() => esArchiver.unload('security_solution/matrix_dns_histogram/large_dns_query')); From 1cbdb26ceacb47f87adc3a83ae516c08f6fa1d0e Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 16 Apr 2021 12:11:12 -0700 Subject: [PATCH 55/68] skip flaky suite (#97355) --- .../api_integration/apis/security_solution/feature_controls.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/api_integration/apis/security_solution/feature_controls.ts b/x-pack/test/api_integration/apis/security_solution/feature_controls.ts index 1e43fd473a38d..da28e28dae769 100644 --- a/x-pack/test/api_integration/apis/security_solution/feature_controls.ts +++ b/x-pack/test/api_integration/apis/security_solution/feature_controls.ts @@ -58,7 +58,8 @@ export default function ({ getService }: FtrProviderContext) { }; }; - describe('feature controls', () => { + // FLAKY: https://github.com/elastic/kibana/issues/97355 + describe.skip('feature controls', () => { it(`APIs can't be accessed by user with no privileges`, async () => { const username = 'logstash_read'; const roleName = 'logstash_read'; From 721f4b55f506d48cad34fe38afb351dda3367a25 Mon Sep 17 00:00:00 2001 From: Frank Hassanabad Date: Fri, 16 Apr 2021 13:52:35 -0600 Subject: [PATCH 56/68] [Security Solutions] Fixes flake with cypress tests (#97329) ## Summary Fixes some recent flakeyness with Cypress tests * Adds cypress.pipe() on button clicks around the area of flakes * Adds an alerting threshold to the utilities so we can wait for when an exact number of alerts are available on a page * Changes the alerts to not run again with 10 seconds, because if a test takes longer than 10 seconds, the rule can run a second time which can invalidate some of the text when running checks when timeline or other components update on their button clicks. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --- .../detection_alerts/attach_to_case.spec.ts | 2 +- .../detection_alerts/closing.spec.ts | 4 ++-- .../detection_alerts/in_progress.spec.ts | 2 +- .../investigate_in_timeline.spec.ts | 2 +- .../detection_alerts/opening.spec.ts | 2 +- .../integration/exceptions/from_alert.spec.ts | 2 +- .../integration/exceptions/from_rule.spec.ts | 2 +- .../security_solution/cypress/objects/rule.ts | 4 ++-- .../security_solution/cypress/tasks/alerts.ts | 20 +++++++++++++++---- .../cypress/tasks/api_calls/rules.ts | 15 +++++++++----- .../cypress/tasks/create_new_rule.ts | 4 ++-- 11 files changed, 38 insertions(+), 21 deletions(-) diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts index e63ef513cc638..bdf2ab96600ea 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts @@ -32,7 +32,7 @@ describe('Alerts timeline', () => { waitForAlertsIndexToBeCreated(); createCustomRuleActivated(newRule); refreshPage(); - waitForAlertsToPopulate(); + waitForAlertsToPopulate(500); // Then we login as read-only user to test. login(ROLES.reader); diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/closing.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/closing.spec.ts index b7c0e1c6fcd6e..741f05129f9c4 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/closing.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/closing.spec.ts @@ -39,9 +39,9 @@ describe('Closing alerts', () => { loginAndWaitForPage(DETECTIONS_URL); waitForAlertsPanelToBeLoaded(); waitForAlertsIndexToBeCreated(); - createCustomRuleActivated(newRule); + createCustomRuleActivated(newRule, '1', '100m', 100); refreshPage(); - waitForAlertsToPopulate(); + waitForAlertsToPopulate(100); deleteCustomRule(); }); diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/in_progress.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/in_progress.spec.ts index 8efdbe82c3492..b4f890e4d8dbf 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/in_progress.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/in_progress.spec.ts @@ -38,7 +38,7 @@ describe('Marking alerts as in-progress', () => { waitForAlertsIndexToBeCreated(); createCustomRuleActivated(newRule); refreshPage(); - waitForAlertsToPopulate(); + waitForAlertsToPopulate(500); }); it('Mark one alert in progress when more than one open alerts are selected', () => { diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/investigate_in_timeline.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/investigate_in_timeline.spec.ts index bc4929cd1341d..d705cb652d2ea 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/investigate_in_timeline.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/investigate_in_timeline.spec.ts @@ -29,7 +29,7 @@ describe('Alerts timeline', () => { waitForAlertsIndexToBeCreated(); createCustomRuleActivated(newRule); refreshPage(); - waitForAlertsToPopulate(); + waitForAlertsToPopulate(500); }); it('Investigate alert in default timeline', () => { diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/opening.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/opening.spec.ts index ec0923beb4c40..bc907dccd0a04 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/opening.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/opening.spec.ts @@ -39,7 +39,7 @@ describe('Opening alerts', () => { waitForAlertsIndexToBeCreated(); createCustomRuleActivated(newRule); refreshPage(); - waitForAlertsToPopulate(); + waitForAlertsToPopulate(500); selectNumberOfAlerts(5); cy.get(SELECTED_ALERTS).should('have.text', `Selected 5 alerts`); diff --git a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts index d5e0b56b8e267..e36809380df86 100644 --- a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts @@ -43,7 +43,7 @@ describe('From alert', () => { cleanKibana(); loginAndWaitForPageWithoutDateRange(DETECTIONS_URL); waitForAlertsIndexToBeCreated(); - createCustomRule(newRule); + createCustomRule(newRule, 'rule_testing', '10s'); goToManageAlertsDetectionRules(); goToRuleDetails(); diff --git a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts index 148254a813b56..e0d7e5a32edfd 100644 --- a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts @@ -41,7 +41,7 @@ describe('From rule', () => { cleanKibana(); loginAndWaitForPageWithoutDateRange(DETECTIONS_URL); waitForAlertsIndexToBeCreated(); - createCustomRule(newRule); + createCustomRule(newRule, 'rule_testing', '10s'); goToManageAlertsDetectionRules(); goToRuleDetails(); diff --git a/x-pack/plugins/security_solution/cypress/objects/rule.ts b/x-pack/plugins/security_solution/cypress/objects/rule.ts index f083cc5da6f53..099cd39ba2d7b 100644 --- a/x-pack/plugins/security_solution/cypress/objects/rule.ts +++ b/x-pack/plugins/security_solution/cypress/objects/rule.ts @@ -185,7 +185,7 @@ export const existingRule: CustomRule = { name: 'Rule 1', description: 'Description for Rule 1', index: ['auditbeat-*'], - interval: '10s', + interval: '100m', severity: 'High', riskScore: '19', tags: ['rule1'], @@ -332,5 +332,5 @@ export const editedRule = { export const expectedExportedRule = (ruleResponse: Cypress.Response) => { const jsonrule = ruleResponse.body; - return `{"id":"${jsonrule.id}","updated_at":"${jsonrule.updated_at}","updated_by":"elastic","created_at":"${jsonrule.created_at}","created_by":"elastic","name":"${jsonrule.name}","tags":[],"interval":"10s","enabled":false,"description":"${jsonrule.description}","risk_score":${jsonrule.risk_score},"severity":"${jsonrule.severity}","output_index":".siem-signals-default","author":[],"false_positives":[],"from":"now-17520h","rule_id":"rule_testing","max_signals":100,"risk_score_mapping":[],"severity_mapping":[],"threat":[],"to":"now","references":[],"version":1,"exceptions_list":[],"immutable":false,"type":"query","language":"kuery","index":["exceptions-*"],"query":"${jsonrule.query}","throttle":"no_actions","actions":[]}\n{"exported_count":1,"missing_rules":[],"missing_rules_count":0}\n`; + return `{"id":"${jsonrule.id}","updated_at":"${jsonrule.updated_at}","updated_by":"elastic","created_at":"${jsonrule.created_at}","created_by":"elastic","name":"${jsonrule.name}","tags":[],"interval":"100m","enabled":false,"description":"${jsonrule.description}","risk_score":${jsonrule.risk_score},"severity":"${jsonrule.severity}","output_index":".siem-signals-default","author":[],"false_positives":[],"from":"now-17520h","rule_id":"rule_testing","max_signals":100,"risk_score_mapping":[],"severity_mapping":[],"threat":[],"to":"now","references":[],"version":1,"exceptions_list":[],"immutable":false,"type":"query","language":"kuery","index":["exceptions-*"],"query":"${jsonrule.query}","throttle":"no_actions","actions":[]}\n{"exported_count":1,"missing_rules":[],"missing_rules_count":0}\n`; }; diff --git a/x-pack/plugins/security_solution/cypress/tasks/alerts.ts b/x-pack/plugins/security_solution/cypress/tasks/alerts.ts index dd7a163d00753..b677e36ab3918 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/alerts.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/alerts.ts @@ -35,13 +35,25 @@ export const addExceptionFromFirstAlert = () => { }; export const closeFirstAlert = () => { - cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click({ force: true }); - cy.get(CLOSE_ALERT_BTN).click(); + cy.get(TIMELINE_CONTEXT_MENU_BTN) + .first() + .pipe(($el) => $el.trigger('click')) + .should('be.visible'); + + cy.get(CLOSE_ALERT_BTN) + .pipe(($el) => $el.trigger('click')) + .should('not.be.visible'); }; export const closeAlerts = () => { - cy.get(TAKE_ACTION_POPOVER_BTN).click({ force: true }); - cy.get(CLOSE_SELECTED_ALERTS_BTN).click(); + cy.get(TAKE_ACTION_POPOVER_BTN) + .first() + .pipe(($el) => $el.trigger('click')) + .should('be.visible'); + + cy.get(CLOSE_SELECTED_ALERTS_BTN) + .pipe(($el) => $el.trigger('click')) + .should('not.be.visible'); }; export const expandFirstAlert = () => { diff --git a/x-pack/plugins/security_solution/cypress/tasks/api_calls/rules.ts b/x-pack/plugins/security_solution/cypress/tasks/api_calls/rules.ts index 0b051f3a26581..5a816a71744cb 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/api_calls/rules.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/api_calls/rules.ts @@ -7,7 +7,7 @@ import { CustomRule, ThreatIndicatorRule } from '../../objects/rule'; -export const createCustomRule = (rule: CustomRule, ruleId = 'rule_testing') => +export const createCustomRule = (rule: CustomRule, ruleId = 'rule_testing', interval = '100m') => cy.request({ method: 'POST', url: 'api/detection_engine/rules', @@ -15,7 +15,7 @@ export const createCustomRule = (rule: CustomRule, ruleId = 'rule_testing') => rule_id: ruleId, risk_score: parseInt(rule.riskScore, 10), description: rule.description, - interval: '10s', + interval, name: rule.name, severity: rule.severity.toLocaleLowerCase(), type: 'query', @@ -67,7 +67,12 @@ export const createCustomIndicatorRule = (rule: ThreatIndicatorRule, ruleId = 'r failOnStatusCode: false, }); -export const createCustomRuleActivated = (rule: CustomRule, ruleId = '1') => +export const createCustomRuleActivated = ( + rule: CustomRule, + ruleId = '1', + interval = '100m', + maxSignals = 500 +) => cy.request({ method: 'POST', url: 'api/detection_engine/rules', @@ -75,7 +80,7 @@ export const createCustomRuleActivated = (rule: CustomRule, ruleId = '1') => rule_id: ruleId, risk_score: parseInt(rule.riskScore, 10), description: rule.description, - interval: '10s', + interval, name: rule.name, severity: rule.severity.toLocaleLowerCase(), type: 'query', @@ -85,7 +90,7 @@ export const createCustomRuleActivated = (rule: CustomRule, ruleId = '1') => language: 'kuery', enabled: true, tags: ['rule1'], - max_signals: 500, + max_signals: maxSignals, }, headers: { 'kbn-xsrf': 'cypress-creds' }, failOnStatusCode: false, diff --git a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts index 2b7308757f9f4..9f957a0cb9a95 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts @@ -479,7 +479,7 @@ export const selectThresholdRuleType = () => { cy.get(THRESHOLD_TYPE).click({ force: true }); }; -export const waitForAlertsToPopulate = async () => { +export const waitForAlertsToPopulate = async (alertCountThreshold = 1) => { cy.waitUntil( () => { refreshPage(); @@ -488,7 +488,7 @@ export const waitForAlertsToPopulate = async () => { .invoke('text') .then((countText) => { const alertCount = parseInt(countText, 10) || 0; - return alertCount > 0; + return alertCount >= alertCountThreshold; }); }, { interval: 500, timeout: 12000 } From e321f57f64657ffff91df8ed96f4e9fdbe5dcde7 Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 16 Apr 2021 22:28:19 -0700 Subject: [PATCH 57/68] skip flaky suite (#97382) --- .../test/api_integration/apis/short_urls/feature_controls.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/api_integration/apis/short_urls/feature_controls.ts b/x-pack/test/api_integration/apis/short_urls/feature_controls.ts index a2596e9eaedaf..e55fcf10b7fac 100644 --- a/x-pack/test/api_integration/apis/short_urls/feature_controls.ts +++ b/x-pack/test/api_integration/apis/short_urls/feature_controls.ts @@ -12,7 +12,8 @@ export default function featureControlsTests({ getService }: FtrProviderContext) const supertest = getService('supertestWithoutAuth'); const security = getService('security'); - describe('feature controls', () => { + // FLAKY: https://github.com/elastic/kibana/issues/97382 + describe.skip('feature controls', () => { const kibanaUsername = 'kibana_admin'; const kibanaUserRoleName = 'kibana_admin'; From e0da8b2e961793b6df66086769a0b2f830186d2d Mon Sep 17 00:00:00 2001 From: Bryan Clement Date: Sat, 17 Apr 2021 03:42:49 -0700 Subject: [PATCH 58/68] [Asset Management] Agent picker follow up (#97357) --- .../osquery/public/agents/agent_grouper.ts | 118 ++++++++++ .../osquery/public/agents/agents_table.tsx | 217 ++++++------------ .../osquery/public/agents/helpers.test.ts | 6 + .../plugins/osquery/public/agents/helpers.ts | 65 +++++- .../osquery/public/agents/translations.ts | 2 +- x-pack/plugins/osquery/public/agents/types.ts | 13 +- .../osquery/public/agents/use_agent_groups.ts | 14 +- .../public/agents/use_agent_policies.ts | 38 +++ .../osquery/public/agents/use_all_agents.ts | 24 +- .../live_query/form/agents_table_field.tsx | 5 +- 10 files changed, 344 insertions(+), 158 deletions(-) create mode 100644 x-pack/plugins/osquery/public/agents/agent_grouper.ts create mode 100644 x-pack/plugins/osquery/public/agents/use_agent_policies.ts diff --git a/x-pack/plugins/osquery/public/agents/agent_grouper.ts b/x-pack/plugins/osquery/public/agents/agent_grouper.ts new file mode 100644 index 0000000000000..419a3b9e733a4 --- /dev/null +++ b/x-pack/plugins/osquery/public/agents/agent_grouper.ts @@ -0,0 +1,118 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Agent } from '../../common/shared_imports'; +import { generateColorPicker } from './helpers'; +import { + ALL_AGENTS_LABEL, + AGENT_PLATFORMS_LABEL, + AGENT_POLICY_LABEL, + AGENT_SELECTION_LABEL, +} from './translations'; +import { AGENT_GROUP_KEY, Group, GroupOption } from './types'; + +const getColor = generateColorPicker(); + +const generateGroup = (label: string, groupType: AGENT_GROUP_KEY) => { + return { + label, + groupType, + color: getColor(groupType), + size: 0, + data: [] as T[], + }; +}; + +export class AgentGrouper { + groupOrder = [ + AGENT_GROUP_KEY.All, + AGENT_GROUP_KEY.Platform, + AGENT_GROUP_KEY.Policy, + AGENT_GROUP_KEY.Agent, + ]; + groups = { + [AGENT_GROUP_KEY.All]: generateGroup(ALL_AGENTS_LABEL, AGENT_GROUP_KEY.All), + [AGENT_GROUP_KEY.Platform]: generateGroup(AGENT_PLATFORMS_LABEL, AGENT_GROUP_KEY.Platform), + [AGENT_GROUP_KEY.Policy]: generateGroup(AGENT_POLICY_LABEL, AGENT_GROUP_KEY.Policy), + [AGENT_GROUP_KEY.Agent]: generateGroup(AGENT_SELECTION_LABEL, AGENT_GROUP_KEY.Agent), + }; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + updateGroup(key: AGENT_GROUP_KEY, data: any[], append = false) { + if (!data?.length) { + return; + } + const group = this.groups[key]; + if (append) { + group.data.push(...data); + } else { + group.data = data; + } + group.size = data.length; + } + + setTotalAgents(total: number): void { + this.groups[AGENT_GROUP_KEY.All].size = total; + } + + generateOptions(): GroupOption[] { + const opts: GroupOption[] = []; + for (const key of this.groupOrder) { + const { label, size, groupType, data, color } = this.groups[key]; + if (size === 0) { + continue; + } + + switch (key) { + case AGENT_GROUP_KEY.All: + opts.push({ + label, + options: [ + { + label, + value: { groupType, size }, + color, + }, + ], + }); + break; + case AGENT_GROUP_KEY.Platform: + case AGENT_GROUP_KEY.Policy: + opts.push({ + label, + options: (data as Group[]).map(({ name, id, size: groupSize }) => ({ + label: name !== id ? `${name} (${id})` : name, + key: id, + color: getColor(groupType), + value: { groupType, id, size: groupSize }, + })), + }); + break; + case AGENT_GROUP_KEY.Agent: + opts.push({ + label, + options: (data as Agent[]).map((agent: Agent) => ({ + label: `${agent.local_metadata.host.hostname} (${agent.local_metadata.elastic.agent.id})`, + key: agent.local_metadata.elastic.agent.id, + color, + value: { + groupType, + groups: { + policy: agent.policy_id ?? '', + platform: agent.local_metadata.os.platform, + }, + id: agent.local_metadata.elastic.agent.id, + online: agent.active, + }, + })), + }); + break; + } + } + return opts; + } +} diff --git a/x-pack/plugins/osquery/public/agents/agents_table.tsx b/x-pack/plugins/osquery/public/agents/agents_table.tsx index 5f1b6a0d2f0b1..38132957c341f 100644 --- a/x-pack/plugins/osquery/public/agents/agents_table.tsx +++ b/x-pack/plugins/osquery/public/agents/agents_table.tsx @@ -5,179 +5,98 @@ * 2.0. */ -import React, { useCallback, useEffect, useState } from 'react'; -import { EuiComboBox, EuiComboBoxOptionOption, EuiHealth, EuiHighlight } from '@elastic/eui'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { EuiComboBox, EuiHealth, EuiHighlight } from '@elastic/eui'; +import { useDebounce } from 'react-use'; import { useAllAgents } from './use_all_agents'; import { useAgentGroups } from './use_agent_groups'; import { useOsqueryPolicies } from './use_osquery_policies'; -import { Agent } from '../../common/shared_imports'; +import { AgentGrouper } from './agent_grouper'; import { getNumAgentsInGrouping, generateAgentCheck, getNumOverlapped, - generateColorPicker, + generateAgentSelection, } from './helpers'; -import { - ALL_AGENTS_LABEL, - AGENT_PLATFORMS_LABEL, - AGENT_POLICY_LABEL, - SELECT_AGENT_LABEL, - AGENT_SELECTION_LABEL, - generateSelectedAgentsMessage, -} from './translations'; - -import { AGENT_GROUP_KEY, SelectedGroups, AgentOptionValue, GroupOptionValue } from './types'; +import { SELECT_AGENT_LABEL, generateSelectedAgentsMessage } from './translations'; -export interface AgentsSelection { - agents: string[]; - allAgentsSelected: boolean; - platformsSelected: string[]; - policiesSelected: string[]; -} +import { + AGENT_GROUP_KEY, + SelectedGroups, + AgentOptionValue, + GroupOption, + AgentSelection, +} from './types'; interface AgentsTableProps { - agentSelection: AgentsSelection; - onChange: (payload: AgentsSelection) => void; + agentSelection: AgentSelection; + onChange: (payload: AgentSelection) => void; } -type GroupOption = EuiComboBoxOptionOption; - -const getColor = generateColorPicker(); +const perPage = 10; +const DEBOUNCE_DELAY = 100; // ms const AgentsTableComponent: React.FC = ({ onChange }) => { + // search related + const [searchValue, setSearchValue] = useState(''); + const [modifyingSearch, setModifyingSearch] = useState(false); + const [debouncedSearchValue, setDebouncedSearchValue] = useState(''); + useDebounce( + () => { + // update the real search value, set the typing flag + setDebouncedSearchValue(searchValue); + setModifyingSearch(false); + }, + DEBOUNCE_DELAY, + [searchValue] + ); + + // grouping related const osqueryPolicyData = useOsqueryPolicies(); const { loading: groupsLoading, totalCount: totalNumAgents, groups } = useAgentGroups( osqueryPolicyData ); - const { agents } = useAllAgents(osqueryPolicyData); - const [loading, setLoading] = useState(true); + const grouper = useMemo(() => new AgentGrouper(), []); + const { agentsLoading, agents } = useAllAgents(osqueryPolicyData, debouncedSearchValue, { + perPage, + }); + + // option related const [options, setOptions] = useState([]); const [selectedOptions, setSelectedOptions] = useState([]); const [numAgentsSelected, setNumAgentsSelected] = useState(0); useEffect(() => { - const allAgentsLabel = ALL_AGENTS_LABEL; - const opts: GroupOption[] = [ - { - label: allAgentsLabel, - options: [ - { - label: allAgentsLabel, - value: { groupType: AGENT_GROUP_KEY.All, size: totalNumAgents }, - color: getColor(AGENT_GROUP_KEY.All), - }, - ], - }, - ]; - - if (groups.platforms.length > 0) { - const groupType = AGENT_GROUP_KEY.Platform; - opts.push({ - label: AGENT_PLATFORMS_LABEL, - options: groups.platforms.map(({ name, size }) => ({ - label: name, - color: getColor(groupType), - value: { groupType, size }, - })), - }); - } - - if (groups.policies.length > 0) { - const groupType = AGENT_GROUP_KEY.Policy; - opts.push({ - label: AGENT_POLICY_LABEL, - options: groups.policies.map(({ name, size }) => ({ - label: name, - color: getColor(groupType), - value: { groupType, size }, - })), - }); - } - - if (agents && agents.length > 0) { - const groupType = AGENT_GROUP_KEY.Agent; - opts.push({ - label: AGENT_SELECTION_LABEL, - options: (agents as Agent[]).map((agent: Agent) => ({ - label: agent.local_metadata.host.hostname, - color: getColor(groupType), - value: { - groupType, - groups: { policy: agent.policy_id ?? '', platform: agent.local_metadata.os.platform }, - id: agent.local_metadata.elastic.agent.id, - online: agent.active, - }, - })), - }); - } - setLoading(false); - setOptions(opts); - }, [groups.platforms, groups.policies, totalNumAgents, groupsLoading, agents]); + // update the groups when groups or agents have changed + grouper.setTotalAgents(totalNumAgents); + grouper.updateGroup(AGENT_GROUP_KEY.Platform, groups.platforms); + grouper.updateGroup(AGENT_GROUP_KEY.Policy, groups.policies); + grouper.updateGroup(AGENT_GROUP_KEY.Agent, agents); + const newOptions = grouper.generateOptions(); + setOptions(newOptions); + }, [groups.platforms, groups.policies, totalNumAgents, groupsLoading, agents, grouper]); const onSelection = useCallback( (selection: GroupOption[]) => { - // TODO?: optimize this by making it incremental - const newAgentSelection: AgentsSelection = { - agents: [], - allAgentsSelected: false, - platformsSelected: [], - policiesSelected: [], - }; - // parse through the selections to be able to determine how many are actually selected - const selectedAgents = []; - const selectedGroups: SelectedGroups = { - policy: {}, - platform: {}, - }; - - // TODO: clean this up, make it less awkward - for (const opt of selection) { - const groupType = opt.value?.groupType; - let value; - switch (groupType) { - case AGENT_GROUP_KEY.All: - newAgentSelection.allAgentsSelected = true; - break; - case AGENT_GROUP_KEY.Platform: - value = opt.value as GroupOptionValue; - if (!newAgentSelection.allAgentsSelected) { - // we don't need to calculate diffs when all agents are selected - selectedGroups.platform[opt.label] = value.size; - } - newAgentSelection.platformsSelected.push(opt.label); - break; - case AGENT_GROUP_KEY.Policy: - value = opt.value as GroupOptionValue; - if (!newAgentSelection.allAgentsSelected) { - // we don't need to calculate diffs when all agents are selected - selectedGroups.policy[opt.label] = value.size ?? 0; - } - newAgentSelection.policiesSelected.push(opt.label); - break; - case AGENT_GROUP_KEY.Agent: - value = opt.value as AgentOptionValue; - if (!newAgentSelection.allAgentsSelected) { - // we don't need to count how many agents are selected if they are all selected - selectedAgents.push(opt.value); - } - // TODO: fix this casting by updating the opt type to be a union - newAgentSelection.agents.push(value.id as string); - break; - default: - // this should never happen! - // eslint-disable-next-line no-console - console.error(`unknown group type ${groupType}`); - } - } + // TODO?: optimize this by making the selection computation incremental + const { + newAgentSelection, + selectedAgents, + selectedGroups, + }: { + newAgentSelection: AgentSelection; + selectedAgents: AgentOptionValue[]; + selectedGroups: SelectedGroups; + } = generateAgentSelection(selection); if (newAgentSelection.allAgentsSelected) { setNumAgentsSelected(totalNumAgents); } else { const checkAgent = generateAgentCheck(selectedGroups); setNumAgentsSelected( // filter out all the agents counted by selected policies and platforms - selectedAgents.filter((a) => checkAgent(a as AgentOptionValue)).length + + selectedAgents.filter(checkAgent).length + // add the number of agents added via policy and platform groups getNumAgentsInGrouping(selectedGroups) - // subtract the number of agents double counted by policy/platform selections @@ -190,32 +109,40 @@ const AgentsTableComponent: React.FC = ({ onChange }) => { [groups, onChange, totalNumAgents] ); - const renderOption = useCallback((option, searchValue, contentClassName) => { + const renderOption = useCallback((option, searchVal, contentClassName) => { const { label, value } = option; return value?.groupType === AGENT_GROUP_KEY.Agent ? ( - {label} + {label} ) : ( - {label} + [{value?.size ?? 0}]   - ({value?.size}) + {label} ); }, []); + + const onSearchChange = useCallback((v: string) => { + // set the typing flag and update the search value + setModifyingSearch(v !== ''); + setSearchValue(v); + }, []); + return (
-

{SELECT_AGENT_LABEL}

{numAgentsSelected > 0 ? {generateSelectedAgentsMessage(numAgentsSelected)} : ''}   { const { platforms, policies, overlap } = processAggregations(input); expect(platforms).toEqual([ { + id: 'darwin', name: 'darwin', size: 200, }, @@ -59,10 +60,12 @@ describe('processAggregations', () => { expect(platforms).toEqual([]); expect(policies).toEqual([ { + id: '8cd01a60-8a74-11eb-86cb-c58693443a4f', name: '8cd01a60-8a74-11eb-86cb-c58693443a4f', size: 100, }, { + id: '8cd06880-8a74-11eb-86cb-c58693443a4f', name: '8cd06880-8a74-11eb-86cb-c58693443a4f', size: 100, }, @@ -107,16 +110,19 @@ describe('processAggregations', () => { const { platforms, policies, overlap } = processAggregations(input); expect(platforms).toEqual([ { + id: 'darwin', name: 'darwin', size: 200, }, ]); expect(policies).toEqual([ { + id: '8cd01a60-8a74-11eb-86cb-c58693443a4f', name: '8cd01a60-8a74-11eb-86cb-c58693443a4f', size: 100, }, { + id: '8cd06880-8a74-11eb-86cb-c58693443a4f', name: '8cd06880-8a74-11eb-86cb-c58693443a4f', size: 100, }, diff --git a/x-pack/plugins/osquery/public/agents/helpers.ts b/x-pack/plugins/osquery/public/agents/helpers.ts index 830fca5f57caa..14a8dd64fb4da 100644 --- a/x-pack/plugins/osquery/public/agents/helpers.ts +++ b/x-pack/plugins/osquery/public/agents/helpers.ts @@ -20,6 +20,9 @@ import { Group, AgentOptionValue, AggregationDataPoint, + AgentSelection, + GroupOptionValue, + GroupOption, } from './types'; export type InspectResponse = Inspect & { response: string[] }; @@ -43,11 +46,12 @@ export const processAggregations = (aggs: Record) => { const platformTerms = aggs.platforms as TermsAggregate; const policyTerms = aggs.policies as TermsAggregate; - const policies = policyTerms?.buckets.map((o) => ({ name: o.key, size: o.doc_count })) ?? []; + const policies = + policyTerms?.buckets.map((o) => ({ name: o.key, id: o.key, size: o.doc_count })) ?? []; if (platformTerms?.buckets) { for (const { key, doc_count: size, policies: platformPolicies } of platformTerms.buckets) { - platforms.push({ name: key, size }); + platforms.push({ name: key, id: key, size }); if (platformPolicies?.buckets && policies.length > 0) { overlap[key] = platformPolicies.buckets.reduce((acc: { [key: string]: number }, pol) => { acc[pol.key] = pol.doc_count; @@ -96,6 +100,63 @@ export const generateAgentCheck = (selectedGroups: SelectedGroups) => { }; }; +export const generateAgentSelection = (selection: GroupOption[]) => { + const newAgentSelection: AgentSelection = { + agents: [], + allAgentsSelected: false, + platformsSelected: [], + policiesSelected: [], + }; + // parse through the selections to be able to determine how many are actually selected + const selectedAgents: AgentOptionValue[] = []; + const selectedGroups: SelectedGroups = { + policy: {}, + platform: {}, + }; + + // TODO: clean this up, make it less awkward + for (const opt of selection) { + const groupType = opt.value?.groupType; + let value; + switch (groupType) { + case AGENT_GROUP_KEY.All: + newAgentSelection.allAgentsSelected = true; + break; + case AGENT_GROUP_KEY.Platform: + value = opt.value as GroupOptionValue; + if (!newAgentSelection.allAgentsSelected) { + // we don't need to calculate diffs when all agents are selected + selectedGroups.platform[opt.value?.id ?? opt.label] = value.size; + } + newAgentSelection.platformsSelected.push(opt.label); + break; + case AGENT_GROUP_KEY.Policy: + value = opt.value as GroupOptionValue; + if (!newAgentSelection.allAgentsSelected) { + // we don't need to calculate diffs when all agents are selected + selectedGroups.policy[opt.value?.id ?? opt.label] = value.size; + } + newAgentSelection.policiesSelected.push(opt.label); + break; + case AGENT_GROUP_KEY.Agent: + value = opt.value as AgentOptionValue; + if (!newAgentSelection.allAgentsSelected) { + // we don't need to count how many agents are selected if they are all selected + selectedAgents.push(value); + } + if (value?.id) { + newAgentSelection.agents.push(value.id); + } + break; + default: + // this should never happen! + // eslint-disable-next-line no-console + console.error(`unknown group type ${groupType}`); + } + } + return { newAgentSelection, selectedGroups, selectedAgents }; +}; + export const generateTablePaginationOptions = ( activePage: number, limit: number, diff --git a/x-pack/plugins/osquery/public/agents/translations.ts b/x-pack/plugins/osquery/public/agents/translations.ts index af99a73d63de2..209761b4c8bdf 100644 --- a/x-pack/plugins/osquery/public/agents/translations.ts +++ b/x-pack/plugins/osquery/public/agents/translations.ts @@ -40,7 +40,7 @@ export const AGENT_SELECTION_LABEL = i18n.translate('xpack.osquery.agents.select }); export const SELECT_AGENT_LABEL = i18n.translate('xpack.osquery.agents.selectAgentLabel', { - defaultMessage: `Select Agents`, + defaultMessage: `Select agents or groups`, }); export const ERROR_ALL_AGENTS = i18n.translate('xpack.osquery.agents.errorSearchDescription', { diff --git a/x-pack/plugins/osquery/public/agents/types.ts b/x-pack/plugins/osquery/public/agents/types.ts index 2fa8ddaf345cd..b26404f9c5e70 100644 --- a/x-pack/plugins/osquery/public/agents/types.ts +++ b/x-pack/plugins/osquery/public/agents/types.ts @@ -6,6 +6,7 @@ */ import { TermsAggregate } from '@elastic/elasticsearch/api/types'; +import { EuiComboBoxOptionOption } from '@elastic/eui'; interface BaseDataPoint { key: string; @@ -17,6 +18,7 @@ export type AggregationDataPoint = BaseDataPoint & { }; export interface Group { + id: string; name: string; size: number; } @@ -28,14 +30,23 @@ export interface SelectedGroups { [groupType: string]: { [groupName: string]: number }; } +export type GroupOption = EuiComboBoxOptionOption; + +export interface AgentSelection { + agents: string[]; + allAgentsSelected: boolean; + platformsSelected: string[]; + policiesSelected: string[]; +} + interface BaseGroupOption { + id?: string; groupType: AGENT_GROUP_KEY; } export type AgentOptionValue = BaseGroupOption & { groups: { [groupType: string]: string }; online: boolean; - id: string; }; export type GroupOptionValue = BaseGroupOption & { diff --git a/x-pack/plugins/osquery/public/agents/use_agent_groups.ts b/x-pack/plugins/osquery/public/agents/use_agent_groups.ts index 0eaca65d02d4b..0853891f1919d 100644 --- a/x-pack/plugins/osquery/public/agents/use_agent_groups.ts +++ b/x-pack/plugins/osquery/public/agents/use_agent_groups.ts @@ -7,6 +7,7 @@ import { useState } from 'react'; import { useQuery } from 'react-query'; import { useKibana } from '../common/lib/kibana'; +import { useAgentPolicies } from './use_agent_policies'; import { OsqueryQueries, @@ -25,6 +26,7 @@ interface UseAgentGroups { export const useAgentGroups = ({ osqueryPolicies, osqueryPoliciesLoading }: UseAgentGroups) => { const { data } = useKibana().services; + const { agentPoliciesLoading, agentPolicyById } = useAgentPolicies(osqueryPolicies); const [platforms, setPlatforms] = useState([]); const [policies, setPolicies] = useState([]); const [loading, setLoading] = useState(true); @@ -78,14 +80,22 @@ export const useAgentGroups = ({ osqueryPolicies, osqueryPoliciesLoading }: UseA setPlatforms(newPlatforms); setOverlap(newOverlap); - setPolicies(newPolicies); + setPolicies( + newPolicies.map((p) => { + const name = agentPolicyById[p.id]?.name ?? p.name; + return { + ...p, + name, + }; + }) + ); } setLoading(false); setTotalCount(responseData.totalCount); }, { - enabled: !osqueryPoliciesLoading, + enabled: !osqueryPoliciesLoading && !agentPoliciesLoading, } ); diff --git a/x-pack/plugins/osquery/public/agents/use_agent_policies.ts b/x-pack/plugins/osquery/public/agents/use_agent_policies.ts new file mode 100644 index 0000000000000..3045423ccbe2d --- /dev/null +++ b/x-pack/plugins/osquery/public/agents/use_agent_policies.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useQueries, UseQueryResult } from 'react-query'; +import { useKibana } from '../common/lib/kibana'; +import { + AgentPolicy, + agentPolicyRouteService, + GetOneAgentPolicyResponse, +} from '../../../fleet/common'; + +export const useAgentPolicies = (policyIds: string[] = []) => { + const { http } = useKibana().services; + + const agentResponse = useQueries( + policyIds.map((policyId) => ({ + queryKey: ['agentPolicy', policyId], + queryFn: () => http.get(agentPolicyRouteService.getInfoPath(policyId)), + enabled: policyIds.length > 0, + })) + ) as Array>; + + const agentPoliciesLoading = agentResponse.some((p) => p.isLoading); + const agentPolicies = agentResponse.map((p) => p.data?.item); + const agentPolicyById = agentPolicies.reduce((acc, p) => { + if (!p) { + return acc; + } + acc[p.id] = p; + return acc; + }, {} as { [key: string]: AgentPolicy }); + + return { agentPoliciesLoading, agentPolicies, agentPolicyById }; +}; diff --git a/x-pack/plugins/osquery/public/agents/use_all_agents.ts b/x-pack/plugins/osquery/public/agents/use_all_agents.ts index 607f9ae007692..bd9b1c32412e6 100644 --- a/x-pack/plugins/osquery/public/agents/use_all_agents.ts +++ b/x-pack/plugins/osquery/public/agents/use_all_agents.ts @@ -14,16 +14,30 @@ interface UseAllAgents { osqueryPoliciesLoading: boolean; } -export const useAllAgents = ({ osqueryPolicies, osqueryPoliciesLoading }: UseAllAgents) => { - // TODO: properly fetch these in an async manner +interface RequestOptions { + perPage?: number; + page?: number; +} + +// TODO: break out the paginated vs all cases into separate hooks +export const useAllAgents = ( + { osqueryPolicies, osqueryPoliciesLoading }: UseAllAgents, + searchValue = '', + opts: RequestOptions = { perPage: 9000 } +) => { + const { perPage } = opts; const { http } = useKibana().services; const { isLoading: agentsLoading, data: agentData } = useQuery( - ['agents', osqueryPolicies], + ['agents', osqueryPolicies, searchValue, perPage], async () => { + let kuery = `(${osqueryPolicies.map((p) => `policy_id:${p}`).join(' or ')})`; + if (searchValue) { + kuery += ` and (local_metadata.host.hostname:/${searchValue}/ or local_metadata.elastic.agent.id:/${searchValue}/)`; + } return await http.get('/api/fleet/agents', { query: { - kuery: osqueryPolicies.map((p) => `policy_id:${p}`).join(' or '), - perPage: 9000, + kuery, + perPage, }, }); }, diff --git a/x-pack/plugins/osquery/public/live_query/form/agents_table_field.tsx b/x-pack/plugins/osquery/public/live_query/form/agents_table_field.tsx index 4bc9262af7613..ccde0fd8305f9 100644 --- a/x-pack/plugins/osquery/public/live_query/form/agents_table_field.tsx +++ b/x-pack/plugins/osquery/public/live_query/form/agents_table_field.tsx @@ -7,10 +7,11 @@ import React, { useCallback } from 'react'; import { FieldHook } from '../../shared_imports'; -import { AgentsTable, AgentsSelection } from '../../agents/agents_table'; +import { AgentsTable } from '../../agents/agents_table'; +import { AgentSelection } from '../../agents/types'; interface AgentsTableFieldProps { - field: FieldHook; + field: FieldHook; } const AgentsTableFieldComponent: React.FC = ({ field }) => { From a89b75671000d6c8431ff150b4f555e1f00f361e Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Sat, 17 Apr 2021 15:52:32 +0100 Subject: [PATCH 59/68] skip flaky suite (#97387) --- x-pack/test/api_integration/apis/lens/existing_fields.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/api_integration/apis/lens/existing_fields.ts b/x-pack/test/api_integration/apis/lens/existing_fields.ts index 88949401f102a..0358786993919 100644 --- a/x-pack/test/api_integration/apis/lens/existing_fields.ts +++ b/x-pack/test/api_integration/apis/lens/existing_fields.ts @@ -160,7 +160,8 @@ export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const supertest = getService('supertest'); - describe('existing_fields apis', () => { + // FLAKY: https://github.com/elastic/kibana/issues/97387 + describe.skip('existing_fields apis', () => { before(async () => { await esArchiver.loadIfNeeded('logstash_functional'); await esArchiver.loadIfNeeded('visualize/default'); From 3b31d81196799a9ced9acd5f30082b0f7aed1ce7 Mon Sep 17 00:00:00 2001 From: Catherine Liu Date: Sat, 17 Apr 2021 22:29:27 -0700 Subject: [PATCH 60/68] [Dashboard] Makes lens default editor for creating new panels (#96181) * Makes lens default editor in dashboard Added all editors menu to dashboard panel toolbar Fixed toggle on editor menu Removed unnecessary comments Added data test subjects to editor menu buttons Populated editor menu with vis types Removed unused imports Fixed imports Adds showCreateNewMenu prop to AddPanelFlyout Rearranged order of editor menu options Fixed ts errors Added groupnig to embeddable factory Use embeddable state transfer service to redirect to editors Added showGroups to TypeSelectionState Fixed add panel flyout test Fixed data test subjects Fixed factory groupings Removed unused import Fixed page object Added telemtry to dashboard toolbar Added telemtry to editor menu Fix ml embeddable functional tests Fix lens dashboard test Fix empty dashboard test Fixed ts errors Fixed time to visualize security test Fixed empty dashboard test Fixed clickAddNewEmbeddableLink in dashboardAddPanel service Fixed agg based vis functional tests Revert test changes Fixed typo Fix tests Fix more tests Fix ts errors Fixed more tests Fixed toolbar sizes and margins to align with lens Fix tests Fixed callbacks Fixed button prop type New vis modal copy updates Added savedObjectMetaData to log stream embeddable factory Addressed feedback Fixed ts error Fix more tests Fixed ts errors Updated dashboard empty prompt copy Adds tooltip to log stream embeddable factory saved object meta data Made icons monochrome in toolbar Fixed icon colors in dark mode Cleaned up css Fixed ts errors Updated snapshot Fixed map icon color * Added tooltips for ML embeddables * Restored test * Added empty dashboard panel test * Fixed i18n id * Fix dashboard_embedding test * Removed unused service * Fixed i18n error * Added icon and description properties to embeddable factory definition * Fixed ts errors * Fixed expected value Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- ...public.embeddablefactory.getdescription.md | 17 ++ ...le-public.embeddablefactory.geticontype.md | 17 ++ ...dable-public.embeddablefactory.grouping.md | 13 + ...ins-embeddable-public.embeddablefactory.md | 3 + ...able-public.embeddablefactorydefinition.md | 2 +- ...ns-embeddable-public.openaddpanelflyout.md | 3 +- src/plugins/dashboard/kibana.json | 3 +- .../public/application/_dashboard_app.scss | 15 +- .../public/application/dashboard_router.tsx | 2 + .../dashboard_container_factory.tsx | 2 +- .../dashboard_empty_screen.test.tsx.snap | 2 +- .../listing/dashboard_listing.test.tsx | 2 + .../application/top_nav/dashboard_top_nav.tsx | 127 ++++++--- .../application/top_nav/editor_menu.tsx | 255 ++++++++++++++++++ .../dashboard/public/application/types.ts | 2 + .../dashboard/public/dashboard_strings.ts | 2 +- src/plugins/dashboard/public/plugin.tsx | 2 + .../default_embeddable_factory_provider.ts | 3 + .../lib/embeddables/embeddable_factory.ts | 17 ++ .../embeddable_factory_definition.ts | 3 + .../add_panel/add_panel_flyout.test.tsx | 2 + .../add_panel/add_panel_flyout.tsx | 5 +- .../add_panel/open_add_panel_flyout.tsx | 3 + src/plugins/embeddable/public/public.api.md | 7 +- .../solution_toolbar/items/button.scss | 1 - .../solution_toolbar/items/button.tsx | 10 +- .../solution_toolbar/items/popover.tsx | 10 +- .../items/primary_button.scss | 20 ++ .../solution_toolbar/items/primary_button.tsx | 18 +- .../solution_toolbar/items/quick_group.scss | 13 + .../solution_toolbar/items/quick_group.tsx | 12 +- .../solution_toolbar/solution_toolbar.scss | 15 +- .../solution_toolbar/solution_toolbar.tsx | 9 +- src/plugins/presentation_util/public/index.ts | 1 + .../visualize_embeddable_factory.tsx | 2 +- src/plugins/visualizations/public/index.ts | 2 +- .../public/wizard/dialog_navigation.tsx | 2 +- .../public/wizard/new_vis_modal.tsx | 7 +- .../public/wizard/show_new_vis.tsx | 7 + test/examples/embeddables/adding_children.ts | 23 +- .../dashboard/create_and_add_embeddables.ts | 26 +- .../dashboard/dashboard_unsaved_listing.ts | 8 +- .../apps/dashboard/dashboard_unsaved_state.ts | 4 +- .../dashboard/edit_embeddable_redirects.ts | 8 +- .../apps/dashboard/edit_visualizations.js | 3 +- .../apps/dashboard/empty_dashboard.ts | 9 +- test/functional/apps/dashboard/view_edit.ts | 6 +- .../functional/page_objects/dashboard_page.ts | 10 - .../services/dashboard/add_panel.ts | 30 ++- .../services/dashboard/visualizations.ts | 45 +--- .../new_visualize_flow/dashboard_embedding.ts | 5 - .../log_stream_embeddable_factory.ts | 10 + .../anomaly_charts_embeddable_factory.ts | 17 +- .../anomaly_swimlane_embeddable_factory.ts | 17 +- .../apps/ml_embeddables_in_dashboard.ts | 4 +- .../apps/dashboard/dashboard_lens_by_value.ts | 2 - .../apps/dashboard/dashboard_maps_by_value.ts | 9 +- .../time_to_visualize_security.ts | 7 +- .../functional/apps/dashboard/sync_colors.ts | 2 - .../dashboard_mode/dashboard_empty_screen.js | 7 - x-pack/test/functional/apps/lens/dashboard.ts | 2 - .../test/functional/apps/lens/lens_tagging.ts | 5 +- .../maps/embeddable/embeddable_library.js | 4 +- .../apps/maps/embeddable/save_and_return.js | 6 +- .../anomaly_charts_dashboard_embeddables.ts | 4 +- .../test/functional/page_objects/lens_page.ts | 3 +- 66 files changed, 684 insertions(+), 230 deletions(-) create mode 100644 docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.getdescription.md create mode 100644 docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.geticontype.md create mode 100644 docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.grouping.md create mode 100644 src/plugins/dashboard/public/application/top_nav/editor_menu.tsx create mode 100644 src/plugins/presentation_util/public/components/solution_toolbar/items/primary_button.scss diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.getdescription.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.getdescription.md new file mode 100644 index 0000000000000..1699351349bf8 --- /dev/null +++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.getdescription.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) > [EmbeddableFactory](./kibana-plugin-plugins-embeddable-public.embeddablefactory.md) > [getDescription](./kibana-plugin-plugins-embeddable-public.embeddablefactory.getdescription.md) + +## EmbeddableFactory.getDescription() method + +Returns a description about the embeddable. + +Signature: + +```typescript +getDescription(): string; +``` +Returns: + +`string` + diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.geticontype.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.geticontype.md new file mode 100644 index 0000000000000..58b987e5630c4 --- /dev/null +++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.geticontype.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) > [EmbeddableFactory](./kibana-plugin-plugins-embeddable-public.embeddablefactory.md) > [getIconType](./kibana-plugin-plugins-embeddable-public.embeddablefactory.geticontype.md) + +## EmbeddableFactory.getIconType() method + +Returns an EUI Icon type to be displayed in a menu. + +Signature: + +```typescript +getIconType(): string; +``` +Returns: + +`string` + diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.grouping.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.grouping.md new file mode 100644 index 0000000000000..c4dbe739ddfcb --- /dev/null +++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.grouping.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) > [EmbeddableFactory](./kibana-plugin-plugins-embeddable-public.embeddablefactory.md) > [grouping](./kibana-plugin-plugins-embeddable-public.embeddablefactory.grouping.md) + +## EmbeddableFactory.grouping property + +Indicates the grouping this factory should appear in a sub-menu. Example, this is used for grouping options in the editors menu in Dashboard for creating new embeddables + +Signature: + +```typescript +readonly grouping?: UiActionsPresentableGrouping; +``` diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.md index b355acd0567a8..8ee60e1f58a2b 100644 --- a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.md +++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactory.md @@ -16,6 +16,7 @@ export interface EmbeddableFactoryUiActionsPresentableGrouping | Indicates the grouping this factory should appear in a sub-menu. Example, this is used for grouping options in the editors menu in Dashboard for creating new embeddables | | [isContainerType](./kibana-plugin-plugins-embeddable-public.embeddablefactory.iscontainertype.md) | boolean | True if is this factory create embeddables that are Containers. Used in the add panel to conditionally show whether these can be added to another container. It's just not supported right now, but once nested containers are officially supported we can probably get rid of this interface. | | [isEditable](./kibana-plugin-plugins-embeddable-public.embeddablefactory.iseditable.md) | () => Promise<boolean> | Returns whether the current user should be allowed to edit this type of embeddable. Most of the time this should be based off the capabilities service, hence it's async. | | [savedObjectMetaData](./kibana-plugin-plugins-embeddable-public.embeddablefactory.savedobjectmetadata.md) | SavedObjectMetaData<TSavedObjectAttributes> | | @@ -29,6 +30,8 @@ export interface EmbeddableFactoryThis will likely change in future iterations when we improve in place editing capabilities. | | [createFromSavedObject(savedObjectId, input, parent)](./kibana-plugin-plugins-embeddable-public.embeddablefactory.createfromsavedobject.md) | Creates a new embeddable instance based off the saved object id. | | [getDefaultInput(partial)](./kibana-plugin-plugins-embeddable-public.embeddablefactory.getdefaultinput.md) | Can be used to get any default input, to be passed in to during the creation process. Default input will not be stored in a parent container, so any inherited input from a container will trump default input parameters. | +| [getDescription()](./kibana-plugin-plugins-embeddable-public.embeddablefactory.getdescription.md) | Returns a description about the embeddable. | | [getDisplayName()](./kibana-plugin-plugins-embeddable-public.embeddablefactory.getdisplayname.md) | Returns a display name for this type of embeddable. Used in "Create new... " options in the add panel for containers. | | [getExplicitInput()](./kibana-plugin-plugins-embeddable-public.embeddablefactory.getexplicitinput.md) | Can be used to request explicit input from the user, to be passed in to EmbeddableFactory:create. Explicit input is stored on the parent container for this embeddable. It overrides any inherited input passed down from the parent container. | +| [getIconType()](./kibana-plugin-plugins-embeddable-public.embeddablefactory.geticontype.md) | Returns an EUI Icon type to be displayed in a menu. | diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactorydefinition.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactorydefinition.md index 6ecb88e7c017e..dd61272625160 100644 --- a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactorydefinition.md +++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablefactorydefinition.md @@ -7,5 +7,5 @@ Signature: ```typescript -export declare type EmbeddableFactoryDefinition = IEmbeddable, T extends SavedObjectAttributes = SavedObjectAttributes> = Pick, 'create' | 'type' | 'isEditable' | 'getDisplayName'> & Partial, 'createFromSavedObject' | 'isContainerType' | 'getExplicitInput' | 'savedObjectMetaData' | 'canCreateNew' | 'getDefaultInput' | 'telemetry' | 'extract' | 'inject' | 'migrations'>>; +export declare type EmbeddableFactoryDefinition = IEmbeddable, T extends SavedObjectAttributes = SavedObjectAttributes> = Pick, 'create' | 'type' | 'isEditable' | 'getDisplayName'> & Partial, 'createFromSavedObject' | 'isContainerType' | 'getExplicitInput' | 'savedObjectMetaData' | 'canCreateNew' | 'getDefaultInput' | 'telemetry' | 'extract' | 'inject' | 'migrations' | 'grouping' | 'getIconType' | 'getDescription'>>; ``` diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.openaddpanelflyout.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.openaddpanelflyout.md index add4646375359..90caaa3035b34 100644 --- a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.openaddpanelflyout.md +++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.openaddpanelflyout.md @@ -14,6 +14,7 @@ export declare function openAddPanelFlyout(options: { overlays: OverlayStart; notifications: NotificationsStart; SavedObjectFinder: React.ComponentType; + showCreateNewMenu?: boolean; }): OverlayRef; ``` @@ -21,7 +22,7 @@ export declare function openAddPanelFlyout(options: { | Parameter | Type | Description | | --- | --- | --- | -| options | {
embeddable: IContainer;
getFactory: EmbeddableStart['getEmbeddableFactory'];
getAllFactories: EmbeddableStart['getEmbeddableFactories'];
overlays: OverlayStart;
notifications: NotificationsStart;
SavedObjectFinder: React.ComponentType<any>;
} | | +| options | {
embeddable: IContainer;
getFactory: EmbeddableStart['getEmbeddableFactory'];
getAllFactories: EmbeddableStart['getEmbeddableFactories'];
overlays: OverlayStart;
notifications: NotificationsStart;
SavedObjectFinder: React.ComponentType<any>;
showCreateNewMenu?: boolean;
} | | Returns: diff --git a/src/plugins/dashboard/kibana.json b/src/plugins/dashboard/kibana.json index 41335069461fa..54eaf461b73d7 100644 --- a/src/plugins/dashboard/kibana.json +++ b/src/plugins/dashboard/kibana.json @@ -11,7 +11,8 @@ "share", "uiActions", "urlForwarding", - "presentationUtil" + "presentationUtil", + "visualizations" ], "optionalPlugins": [ "home", diff --git a/src/plugins/dashboard/public/application/_dashboard_app.scss b/src/plugins/dashboard/public/application/_dashboard_app.scss index 30253afff391f..f6525377cce70 100644 --- a/src/plugins/dashboard/public/application/_dashboard_app.scss +++ b/src/plugins/dashboard/public/application/_dashboard_app.scss @@ -66,4 +66,17 @@ .dshUnsavedListingItem__actions { flex-direction: column; } -} \ No newline at end of file +} + +// Temporary fix for two tone icons to make them monochrome +.dshSolutionToolbar__editorContextMenu--dark { + .euiIcon path { + fill: $euiColorGhost; + } +} + +.dshSolutionToolbar__editorContextMenu--light { + .euiIcon path { + fill: $euiColorInk; + } +} diff --git a/src/plugins/dashboard/public/application/dashboard_router.tsx b/src/plugins/dashboard/public/application/dashboard_router.tsx index e5281a257ee13..ed68afc5e97b1 100644 --- a/src/plugins/dashboard/public/application/dashboard_router.tsx +++ b/src/plugins/dashboard/public/application/dashboard_router.tsx @@ -80,6 +80,7 @@ export async function mountApp({ embeddable: embeddableStart, kibanaLegacy: { dashboardConfig }, savedObjectsTaggingOss, + visualizations, } = pluginsStart; const spacesApi = pluginsStart.spacesOss?.isSpacesAvailable ? pluginsStart.spacesOss : undefined; @@ -123,6 +124,7 @@ export async function mountApp({ visualizeCapabilities: { save: Boolean(coreStart.application.capabilities.visualize?.save) }, storeSearchSession: Boolean(coreStart.application.capabilities.dashboard.storeSearchSession), }, + visualizations, }; const getUrlStateStorage = (history: RouteComponentProps['history']) => diff --git a/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx b/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx index 9b93f0bbd0711..ff592742488f5 100644 --- a/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx +++ b/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx @@ -49,7 +49,7 @@ export class DashboardContainerFactoryDefinition public readonly getDisplayName = () => { return i18n.translate('dashboard.factory.displayName', { - defaultMessage: 'dashboard', + defaultMessage: 'Dashboard', }); }; diff --git a/src/plugins/dashboard/public/application/embeddable/empty_screen/__snapshots__/dashboard_empty_screen.test.tsx.snap b/src/plugins/dashboard/public/application/embeddable/empty_screen/__snapshots__/dashboard_empty_screen.test.tsx.snap index 4cd3eb13f3609..138d665866af0 100644 --- a/src/plugins/dashboard/public/application/embeddable/empty_screen/__snapshots__/dashboard_empty_screen.test.tsx.snap +++ b/src/plugins/dashboard/public/application/embeddable/empty_screen/__snapshots__/dashboard_empty_screen.test.tsx.snap @@ -287,7 +287,7 @@ exports[`DashboardEmptyScreen renders correctly with edit mode 1`] = `

- Add your first panel + Add your first visualization

().services; const [state, setState] = useState({ chromeIsVisible: false }); const [isSaveInProgress, setIsSaveInProgress] = useState(false); + const lensAlias = visualizations.getAliases().find(({ name }) => name === 'lens'); + const quickButtonVisTypes = ['markdown', 'maps']; const stateTransferService = embeddable.getStateTransfer(); + const IS_DARK_THEME = uiSettings.get('theme:darkMode'); + + const trackUiMetric = usageCollection?.reportUiCounter.bind( + usageCollection, + DashboardConstants.DASHBOARDS_ID + ); useEffect(() => { const visibleSubscription = chrome.getIsVisible$().subscribe((chromeIsVisible) => { @@ -152,27 +161,36 @@ export function DashboardTopNav({ uiSettings, ]); - const createNew = useCallback(async () => { - const type = 'visualization'; - const factory = embeddable.getEmbeddableFactory(type); + const createNewVisType = useCallback( + (visType?: BaseVisType | VisTypeAlias) => () => { + let path = ''; + let appId = ''; - if (!factory) { - throw new EmbeddableFactoryNotFoundError(type); - } + if (visType) { + if (trackUiMetric) { + trackUiMetric(METRIC_TYPE.CLICK, visType.name); + } - await factory.create({} as EmbeddableInput, dashboardContainer); - }, [dashboardContainer, embeddable]); + if ('aliasPath' in visType) { + appId = visType.aliasApp; + path = visType.aliasPath; + } else { + appId = 'visualize'; + path = `#/create?type=${encodeURIComponent(visType.name)}`; + } + } else { + appId = 'visualize'; + path = '#/create?'; + } - const createNewVisType = useCallback( - (newVisType: string) => async () => { - stateTransferService.navigateToEditor('visualize', { - path: `#/create?type=${encodeURIComponent(newVisType)}`, + stateTransferService.navigateToEditor(appId, { + path, state: { originatingApp: DashboardConstants.DASHBOARDS_ID, }, }); }, - [stateTransferService] + [trackUiMetric, stateTransferService] ); const clearAddPanel = useCallback(() => { @@ -563,38 +581,57 @@ export function DashboardTopNav({ const { TopNavMenu } = navigation.ui; - const quickButtons = [ - { - iconType: 'visText', - createType: i18n.translate('dashboard.solutionToolbar.markdownQuickButtonLabel', { - defaultMessage: 'Markdown', - }), - onClick: createNewVisType('markdown'), - 'data-test-subj': 'dashboardMarkdownQuickButton', - }, - { - iconType: 'controlsHorizontal', - createType: i18n.translate('dashboard.solutionToolbar.inputControlsQuickButtonLabel', { - defaultMessage: 'Input control', - }), - onClick: createNewVisType('input_control_vis'), - 'data-test-subj': 'dashboardInputControlsQuickButton', - }, - ]; + const getVisTypeQuickButton = (visTypeName: string) => { + const visType = + visualizations.get(visTypeName) || + visualizations.getAliases().find(({ name }) => name === visTypeName); + + if (visType) { + if ('aliasPath' in visType) { + const { name, icon, title } = visType as VisTypeAlias; + + return { + iconType: icon, + createType: title, + onClick: createNewVisType(visType as VisTypeAlias), + 'data-test-subj': `dashboardQuickButton${name}`, + isDarkModeEnabled: IS_DARK_THEME, + }; + } else { + const { name, icon, title, titleInWizard } = visType as BaseVisType; + + return { + iconType: icon, + createType: titleInWizard || title, + onClick: createNewVisType(visType as BaseVisType), + 'data-test-subj': `dashboardQuickButton${name}`, + isDarkModeEnabled: IS_DARK_THEME, + }; + } + } + + return; + }; + + const quickButtons = quickButtonVisTypes + .map(getVisTypeQuickButton) + .filter((button) => button) as QuickButtonProps[]; return ( <> + {viewMode !== ViewMode.VIEW ? ( - + {{ primaryActionButton: ( ), @@ -605,6 +642,12 @@ export function DashboardTopNav({ data-test-subj="dashboardAddPanelButton" /> ), + extraButtons: [ + , + ], }} ) : null} diff --git a/src/plugins/dashboard/public/application/top_nav/editor_menu.tsx b/src/plugins/dashboard/public/application/top_nav/editor_menu.tsx new file mode 100644 index 0000000000000..5205f5b294c4f --- /dev/null +++ b/src/plugins/dashboard/public/application/top_nav/editor_menu.tsx @@ -0,0 +1,255 @@ +/* + * 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, { useCallback } from 'react'; +import { + EuiContextMenu, + EuiContextMenuPanelItemDescriptor, + EuiContextMenuItemIcon, +} from '@elastic/eui'; +import { METRIC_TYPE } from '@kbn/analytics'; +import { i18n } from '@kbn/i18n'; +import { BaseVisType, VisGroups, VisTypeAlias } from '../../../../visualizations/public'; +import { SolutionToolbarPopover } from '../../../../presentation_util/public'; +import { EmbeddableFactoryDefinition, EmbeddableInput } from '../../services/embeddable'; +import { useKibana } from '../../services/kibana_react'; +import { DashboardAppServices } from '../types'; +import { DashboardContainer } from '..'; +import { DashboardConstants } from '../../dashboard_constants'; +import { dashboardReplacePanelAction } from '../../dashboard_strings'; + +interface Props { + /** Dashboard container */ + dashboardContainer: DashboardContainer; + /** Handler for creating new visualization of a specified type */ + createNewVisType: (visType: BaseVisType | VisTypeAlias) => () => void; +} + +interface FactoryGroup { + id: string; + appName: string; + icon: EuiContextMenuItemIcon; + panelId: number; + factories: EmbeddableFactoryDefinition[]; +} + +export const EditorMenu = ({ dashboardContainer, createNewVisType }: Props) => { + const { + core, + embeddable, + visualizations, + usageCollection, + uiSettings, + } = useKibana().services; + + const IS_DARK_THEME = uiSettings.get('theme:darkMode'); + + const trackUiMetric = usageCollection?.reportUiCounter.bind( + usageCollection, + DashboardConstants.DASHBOARDS_ID + ); + + const createNewAggsBasedVis = useCallback( + (visType?: BaseVisType) => () => + visualizations.showNewVisModal({ + originatingApp: DashboardConstants.DASHBOARDS_ID, + outsideVisualizeApp: true, + showAggsSelection: true, + selectedVisType: visType, + }), + [visualizations] + ); + + const getVisTypesByGroup = (group: VisGroups) => + visualizations + .getByGroup(group) + .sort(({ name: a }: BaseVisType | VisTypeAlias, { name: b }: BaseVisType | VisTypeAlias) => { + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + }) + .filter(({ hidden }: BaseVisType) => !hidden); + + const promotedVisTypes = getVisTypesByGroup(VisGroups.PROMOTED); + const aggsBasedVisTypes = getVisTypesByGroup(VisGroups.AGGBASED); + const toolVisTypes = getVisTypesByGroup(VisGroups.TOOLS); + const visTypeAliases = visualizations + .getAliases() + .sort(({ promotion: a = false }: VisTypeAlias, { promotion: b = false }: VisTypeAlias) => + a === b ? 0 : a ? -1 : 1 + ); + + const factories = embeddable + ? Array.from(embeddable.getEmbeddableFactories()).filter( + ({ type, isEditable, canCreateNew, isContainerType }) => + isEditable() && !isContainerType && canCreateNew() && type !== 'visualization' + ) + : []; + + const factoryGroupMap: Record = {}; + const ungroupedFactories: EmbeddableFactoryDefinition[] = []; + const aggBasedPanelID = 1; + + let panelCount = 1 + aggBasedPanelID; + + factories.forEach((factory: EmbeddableFactoryDefinition, index) => { + const { grouping } = factory; + + if (grouping) { + grouping.forEach((group) => { + if (factoryGroupMap[group.id]) { + factoryGroupMap[group.id].factories.push(factory); + } else { + factoryGroupMap[group.id] = { + id: group.id, + appName: group.getDisplayName ? group.getDisplayName({ embeddable }) : group.id, + icon: (group.getIconType + ? group.getIconType({ embeddable }) + : 'empty') as EuiContextMenuItemIcon, + factories: [factory], + panelId: panelCount, + }; + + panelCount++; + } + }); + } else { + ungroupedFactories.push(factory); + } + }); + + const getVisTypeMenuItem = (visType: BaseVisType): EuiContextMenuPanelItemDescriptor => { + const { name, title, titleInWizard, description, icon = 'empty', group } = visType; + return { + name: titleInWizard || title, + icon: icon as string, + onClick: + group === VisGroups.AGGBASED ? createNewAggsBasedVis(visType) : createNewVisType(visType), + 'data-test-subj': `visType-${name}`, + toolTipContent: description, + }; + }; + + const getVisTypeAliasMenuItem = ( + visTypeAlias: VisTypeAlias + ): EuiContextMenuPanelItemDescriptor => { + const { name, title, description, icon = 'empty' } = visTypeAlias; + + return { + name: title, + icon, + onClick: createNewVisType(visTypeAlias), + 'data-test-subj': `visType-${name}`, + toolTipContent: description, + }; + }; + + const getEmbeddableFactoryMenuItem = ( + factory: EmbeddableFactoryDefinition + ): EuiContextMenuPanelItemDescriptor => { + const icon = factory?.getIconType ? factory.getIconType() : 'empty'; + + const toolTipContent = factory?.getDescription ? factory.getDescription() : undefined; + + return { + name: factory.getDisplayName(), + icon, + toolTipContent, + onClick: async () => { + if (trackUiMetric) { + trackUiMetric(METRIC_TYPE.CLICK, factory.type); + } + let newEmbeddable; + if (factory.getExplicitInput) { + const explicitInput = await factory.getExplicitInput(); + newEmbeddable = await dashboardContainer.addNewEmbeddable(factory.type, explicitInput); + } else { + newEmbeddable = await factory.create({} as EmbeddableInput, dashboardContainer); + } + + if (newEmbeddable) { + core.notifications.toasts.addSuccess({ + title: dashboardReplacePanelAction.getSuccessMessage( + `'${newEmbeddable.getInput().title}'` || '' + ), + 'data-test-subj': 'addEmbeddableToDashboardSuccess', + }); + } + }, + 'data-test-subj': `createNew-${factory.type}`, + }; + }; + + const aggsPanelTitle = i18n.translate('dashboard.editorMenu.aggBasedGroupTitle', { + defaultMessage: 'Aggregation based', + }); + + const editorMenuPanels = [ + { + id: 0, + items: [ + ...visTypeAliases.map(getVisTypeAliasMenuItem), + ...Object.values(factoryGroupMap).map(({ id, appName, icon, panelId }) => ({ + name: appName, + icon, + panel: panelId, + 'data-test-subj': `dashboardEditorMenu-${id}Group`, + })), + ...ungroupedFactories.map(getEmbeddableFactoryMenuItem), + ...promotedVisTypes.map(getVisTypeMenuItem), + { + name: aggsPanelTitle, + icon: 'visualizeApp', + panel: aggBasedPanelID, + 'data-test-subj': `dashboardEditorAggBasedMenuItem`, + }, + ...toolVisTypes.map(getVisTypeMenuItem), + ], + }, + { + id: aggBasedPanelID, + title: aggsPanelTitle, + items: aggsBasedVisTypes.map(getVisTypeMenuItem), + }, + ...Object.values(factoryGroupMap).map( + ({ appName, panelId, factories: groupFactories }: FactoryGroup) => ({ + id: panelId, + title: appName, + items: groupFactories.map(getEmbeddableFactoryMenuItem), + }) + ), + ]; + + return ( + + + + ); +}; diff --git a/src/plugins/dashboard/public/application/types.ts b/src/plugins/dashboard/public/application/types.ts index 6415fdfd73ee8..dd291291ce9d6 100644 --- a/src/plugins/dashboard/public/application/types.ts +++ b/src/plugins/dashboard/public/application/types.ts @@ -25,6 +25,7 @@ import { DataPublicPluginStart, IndexPatternsContract } from '../services/data'; import { SavedObjectLoader, SavedObjectsStart } from '../services/saved_objects'; import { DashboardPanelStorage } from './lib'; import { UrlForwardingStart } from '../../../url_forwarding/public'; +import { VisualizationsStart } from '../../../visualizations/public'; export type DashboardRedirect = (props: RedirectToProps) => void; export type RedirectToProps = @@ -83,4 +84,5 @@ export interface DashboardAppServices { savedObjectsClient: SavedObjectsClientContract; setHeaderActionMenu: AppMountParameters['setHeaderActionMenu']; savedQueryService: DataPublicPluginStart['query']['savedQueries']; + visualizations: VisualizationsStart; } diff --git a/src/plugins/dashboard/public/dashboard_strings.ts b/src/plugins/dashboard/public/dashboard_strings.ts index 79a59d0cfa605..531ff815312cf 100644 --- a/src/plugins/dashboard/public/dashboard_strings.ts +++ b/src/plugins/dashboard/public/dashboard_strings.ts @@ -377,7 +377,7 @@ export const emptyScreenStrings = { }), getEmptyWidgetTitle: () => i18n.translate('dashboard.emptyWidget.addPanelTitle', { - defaultMessage: 'Add your first panel', + defaultMessage: 'Add your first visualization', }), getEmptyWidgetDescription: () => i18n.translate('dashboard.emptyWidget.addPanelDescription', { diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index e2f52a47455b3..0fad1c51f433a 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -24,6 +24,7 @@ import { PluginInitializerContext, SavedObjectsClientContract, } from '../../../core/public'; +import { VisualizationsStart } from '../../visualizations/public'; import { createKbnUrlTracker } from './services/kibana_utils'; import { UsageCollectionSetup } from './services/usage_collection'; @@ -115,6 +116,7 @@ export interface DashboardStartDependencies { presentationUtil: PresentationUtilPluginStart; savedObjectsTaggingOss?: SavedObjectTaggingOssPluginStart; spacesOss?: SpacesOssPluginStart; + visualizations: VisualizationsStart; } export type DashboardSetup = void; diff --git a/src/plugins/embeddable/public/lib/embeddables/default_embeddable_factory_provider.ts b/src/plugins/embeddable/public/lib/embeddables/default_embeddable_factory_provider.ts index 27164b3cddbc2..b260c594591fa 100644 --- a/src/plugins/embeddable/public/lib/embeddables/default_embeddable_factory_provider.ts +++ b/src/plugins/embeddable/public/lib/embeddables/default_embeddable_factory_provider.ts @@ -37,11 +37,14 @@ export const defaultEmbeddableFactoryProvider = < type: def.type, isEditable: def.isEditable.bind(def), getDisplayName: def.getDisplayName.bind(def), + getDescription: def.getDescription ? def.getDescription.bind(def) : () => '', + getIconType: def.getIconType ? def.getIconType.bind(def) : () => 'empty', savedObjectMetaData: def.savedObjectMetaData, telemetry: def.telemetry || (() => ({})), inject: def.inject || ((state: EmbeddableStateWithType) => state), extract: def.extract || ((state: EmbeddableStateWithType) => ({ state, references: [] })), migrations: def.migrations || {}, + grouping: def.grouping, }; return factory; }; diff --git a/src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts b/src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts index 7f3277130f90f..6ec035f442dd2 100644 --- a/src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts +++ b/src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts @@ -14,6 +14,7 @@ import { IContainer } from '../containers/i_container'; import { PropertySpec } from '../types'; import { PersistableState } from '../../../../kibana_utils/common'; import { EmbeddableStateWithType } from '../../../common/types'; +import { UiActionsPresentableGrouping } from '../../../../ui_actions/public'; export interface EmbeddableInstanceConfiguration { id: string; @@ -48,6 +49,12 @@ export interface EmbeddableFactory< readonly savedObjectMetaData?: SavedObjectMetaData; + /** + * Indicates the grouping this factory should appear in a sub-menu. Example, this is used for grouping + * options in the editors menu in Dashboard for creating new embeddables + */ + readonly grouping?: UiActionsPresentableGrouping; + /** * True if is this factory create embeddables that are Containers. Used in the add panel to * conditionally show whether these can be added to another container. It's just not @@ -62,6 +69,16 @@ export interface EmbeddableFactory< */ getDisplayName(): string; + /** + * Returns an EUI Icon type to be displayed in a menu. + */ + getIconType(): string; + + /** + * Returns a description about the embeddable. + */ + getDescription(): string; + /** * If false, this type of embeddable can't be created with the "createNew" functionality. Instead, * use createFromSavedObject, where an existing saved object must first exist. diff --git a/src/plugins/embeddable/public/lib/embeddables/embeddable_factory_definition.ts b/src/plugins/embeddable/public/lib/embeddables/embeddable_factory_definition.ts index a64aa32c6e7c4..f2819f2a2e664 100644 --- a/src/plugins/embeddable/public/lib/embeddables/embeddable_factory_definition.ts +++ b/src/plugins/embeddable/public/lib/embeddables/embeddable_factory_definition.ts @@ -33,5 +33,8 @@ export type EmbeddableFactoryDefinition< | 'extract' | 'inject' | 'migrations' + | 'grouping' + | 'getIconType' + | 'getDescription' > >; diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx index 432897763aa04..1c96945f014c8 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx @@ -61,6 +61,7 @@ test('createNewEmbeddable() add embeddable to container', async () => { getAllFactories={start.getEmbeddableFactories} notifications={core.notifications} SavedObjectFinder={() => null} + showCreateNewMenu /> ) as ReactWrapper; @@ -112,6 +113,7 @@ test('selecting embeddable in "Create new ..." list calls createNewEmbeddable()' getAllFactories={start.getEmbeddableFactories} notifications={core.notifications} SavedObjectFinder={(props) => } + showCreateNewMenu /> ) as ReactWrapper; diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx index 8caec4a4428c3..6d6a68d7e5e2a 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx @@ -26,6 +26,7 @@ interface Props { getAllFactories: EmbeddableStart['getEmbeddableFactories']; notifications: CoreSetup['notifications']; SavedObjectFinder: React.ComponentType; + showCreateNewMenu?: boolean; } interface State { @@ -134,7 +135,9 @@ export class AddPanelFlyout extends React.Component { defaultMessage: 'No matching objects found.', })} > - + {this.props.showCreateNewMenu ? ( + + ) : null} ); diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/open_add_panel_flyout.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/open_add_panel_flyout.tsx index bed97c82095c7..f0c6e81644b3d 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/open_add_panel_flyout.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/open_add_panel_flyout.tsx @@ -20,6 +20,7 @@ export function openAddPanelFlyout(options: { overlays: OverlayStart; notifications: NotificationsStart; SavedObjectFinder: React.ComponentType; + showCreateNewMenu?: boolean; }): OverlayRef { const { embeddable, @@ -28,6 +29,7 @@ export function openAddPanelFlyout(options: { overlays, notifications, SavedObjectFinder, + showCreateNewMenu, } = options; const flyoutSession = overlays.openFlyout( toMountPoint( @@ -42,6 +44,7 @@ export function openAddPanelFlyout(options: { getAllFactories={getAllFactories} notifications={notifications} SavedObjectFinder={SavedObjectFinder} + showCreateNewMenu={showCreateNewMenu} /> ), { diff --git a/src/plugins/embeddable/public/public.api.md b/src/plugins/embeddable/public/public.api.md index 220039de2f34e..d522a4e5fa8e8 100644 --- a/src/plugins/embeddable/public/public.api.md +++ b/src/plugins/embeddable/public/public.api.md @@ -378,8 +378,12 @@ export interface EmbeddableFactory; createFromSavedObject(savedObjectId: string, input: Partial, parent?: IContainer): Promise; getDefaultInput(partial: Partial): Partial; + getDescription(): string; getDisplayName(): string; getExplicitInput(): Promise>; + getIconType(): string; + // Warning: (ae-forgotten-export) The symbol "PresentableGrouping" needs to be exported by the entry point index.d.ts + readonly grouping?: PresentableGrouping; readonly isContainerType: boolean; readonly isEditable: () => Promise; // Warning: (ae-forgotten-export) The symbol "SavedObjectMetaData" needs to be exported by the entry point index.d.ts @@ -393,7 +397,7 @@ export interface EmbeddableFactory = IEmbeddable, T extends SavedObjectAttributes = SavedObjectAttributes> = Pick, 'create' | 'type' | 'isEditable' | 'getDisplayName'> & Partial, 'createFromSavedObject' | 'isContainerType' | 'getExplicitInput' | 'savedObjectMetaData' | 'canCreateNew' | 'getDefaultInput' | 'telemetry' | 'extract' | 'inject' | 'migrations'>>; +export type EmbeddableFactoryDefinition = IEmbeddable, T extends SavedObjectAttributes = SavedObjectAttributes> = Pick, 'create' | 'type' | 'isEditable' | 'getDisplayName'> & Partial, 'createFromSavedObject' | 'isContainerType' | 'getExplicitInput' | 'savedObjectMetaData' | 'canCreateNew' | 'getDefaultInput' | 'telemetry' | 'extract' | 'inject' | 'migrations' | 'grouping' | 'getIconType' | 'getDescription'>>; // Warning: (ae-missing-release-tag) "EmbeddableFactoryNotFoundError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -724,6 +728,7 @@ export function openAddPanelFlyout(options: { overlays: OverlayStart_2; notifications: NotificationsStart_2; SavedObjectFinder: React.ComponentType; + showCreateNewMenu?: boolean; }): OverlayRef_2; // Warning: (ae-missing-release-tag) "OutputSpec" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) diff --git a/src/plugins/presentation_util/public/components/solution_toolbar/items/button.scss b/src/plugins/presentation_util/public/components/solution_toolbar/items/button.scss index 79c3d4cca7ace..b8022201acf59 100644 --- a/src/plugins/presentation_util/public/components/solution_toolbar/items/button.scss +++ b/src/plugins/presentation_util/public/components/solution_toolbar/items/button.scss @@ -1,4 +1,3 @@ - .solutionToolbarButton { line-height: $euiButtonHeight; // Keeps alignment of text and chart icon background-color: $euiColorEmptyShade; diff --git a/src/plugins/presentation_util/public/components/solution_toolbar/items/button.tsx b/src/plugins/presentation_util/public/components/solution_toolbar/items/button.tsx index 5de8e24ef5f0d..ee1bbd64b5f87 100644 --- a/src/plugins/presentation_util/public/components/solution_toolbar/items/button.tsx +++ b/src/plugins/presentation_util/public/components/solution_toolbar/items/button.tsx @@ -12,17 +12,19 @@ import { EuiButtonPropsForButton } from '@elastic/eui/src/components/button/butt import './button.scss'; -export interface Props extends Pick { +export interface Props + extends Pick { label: string; primary?: boolean; + isDarkModeEnabled?: boolean; } -export const SolutionToolbarButton = ({ label, primary, ...rest }: Props) => ( +export const SolutionToolbarButton = ({ label, primary, className, ...rest }: Props) => ( {label} diff --git a/src/plugins/presentation_util/public/components/solution_toolbar/items/popover.tsx b/src/plugins/presentation_util/public/components/solution_toolbar/items/popover.tsx index fbb34e165190d..33850005b498b 100644 --- a/src/plugins/presentation_util/public/components/solution_toolbar/items/popover.tsx +++ b/src/plugins/presentation_util/public/components/solution_toolbar/items/popover.tsx @@ -20,14 +20,20 @@ type AllowedPopoverProps = Omit< export type Props = AllowedButtonProps & AllowedPopoverProps; -export const SolutionToolbarPopover = ({ label, iconType, primary, ...popover }: Props) => { +export const SolutionToolbarPopover = ({ + label, + iconType, + primary, + iconSide, + ...popover +}: Props) => { const [isOpen, setIsOpen] = useState(false); const onButtonClick = () => setIsOpen((status) => !status); const closePopover = () => setIsOpen(false); const button = ( - + ); return ( diff --git a/src/plugins/presentation_util/public/components/solution_toolbar/items/primary_button.scss b/src/plugins/presentation_util/public/components/solution_toolbar/items/primary_button.scss new file mode 100644 index 0000000000000..c3d89f430d70c --- /dev/null +++ b/src/plugins/presentation_util/public/components/solution_toolbar/items/primary_button.scss @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 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. + */ + +// Temporary fix for lensApp icon not support ghost color +.solutionToolbar__primaryButton--dark { + .euiIcon path { + fill: $euiColorInk; + } +} + +.solutionToolbar__primaryButton--light { + .euiIcon path { + fill: $euiColorGhost; + } +} diff --git a/src/plugins/presentation_util/public/components/solution_toolbar/items/primary_button.tsx b/src/plugins/presentation_util/public/components/solution_toolbar/items/primary_button.tsx index e2ef75e45a404..dcf16228ac63b 100644 --- a/src/plugins/presentation_util/public/components/solution_toolbar/items/primary_button.tsx +++ b/src/plugins/presentation_util/public/components/solution_toolbar/items/primary_button.tsx @@ -10,6 +10,20 @@ import React from 'react'; import { SolutionToolbarButton, Props as SolutionToolbarButtonProps } from './button'; -export const PrimaryActionButton = (props: Omit) => ( - +import './primary_button.scss'; + +export interface Props extends Omit { + isDarkModeEnabled?: boolean; +} + +export const PrimaryActionButton = ({ isDarkModeEnabled, ...props }: Props) => ( + ); diff --git a/src/plugins/presentation_util/public/components/solution_toolbar/items/quick_group.scss b/src/plugins/presentation_util/public/components/solution_toolbar/items/quick_group.scss index 639ff5bf2a117..870a9a945ed5d 100644 --- a/src/plugins/presentation_util/public/components/solution_toolbar/items/quick_group.scss +++ b/src/plugins/presentation_util/public/components/solution_toolbar/items/quick_group.scss @@ -2,4 +2,17 @@ .quickButtonGroup__button { background-color: $euiColorEmptyShade; } + + // Temporary fix for two tone icons to make them monochrome + .quickButtonGroup__button--dark { + .euiIcon path { + fill: $euiColorGhost; + } + } + // Temporary fix for two tone icons to make them monochrome + .quickButtonGroup__button--light { + .euiIcon path { + fill: $euiColorInk; + } + } } diff --git a/src/plugins/presentation_util/public/components/solution_toolbar/items/quick_group.tsx b/src/plugins/presentation_util/public/components/solution_toolbar/items/quick_group.tsx index 58f8bd803b636..eb0a395548cd9 100644 --- a/src/plugins/presentation_util/public/components/solution_toolbar/items/quick_group.tsx +++ b/src/plugins/presentation_util/public/components/solution_toolbar/items/quick_group.tsx @@ -17,23 +17,27 @@ import './quick_group.scss'; export interface QuickButtonProps extends Pick { createType: string; onClick: () => void; + isDarkModeEnabled?: boolean; } export interface Props { buttons: QuickButtonProps[]; } -type Option = EuiButtonGroupOptionProps & Omit; +type Option = EuiButtonGroupOptionProps & + Omit; export const QuickButtonGroup = ({ buttons }: Props) => { const buttonGroupOptions: Option[] = buttons.map((button: QuickButtonProps, index) => { - const { createType: label, ...rest } = button; + const { createType: label, isDarkModeEnabled, ...rest } = button; const title = strings.getAriaButtonLabel(label); return { ...rest, 'aria-label': title, - className: 'quickButtonGroup__button', + className: `quickButtonGroup__button ${ + isDarkModeEnabled ? 'quickButtonGroup__button--dark' : 'quickButtonGroup__button--light' + }`, id: `${htmlIdGenerator()()}${index}`, label, title, @@ -46,7 +50,7 @@ export const QuickButtonGroup = ({ buttons }: Props) => { return ( { +export const SolutionToolbar = ({ isDarkModeEnabled, children }: Props) => { const { primaryActionButton, quickButtonGroup, @@ -49,8 +50,10 @@ export const SolutionToolbar = ({ children }: Props) => { return ( {primaryActionButton} diff --git a/src/plugins/presentation_util/public/index.ts b/src/plugins/presentation_util/public/index.ts index 9c5f65de40955..fd3ae89419297 100644 --- a/src/plugins/presentation_util/public/index.ts +++ b/src/plugins/presentation_util/public/index.ts @@ -19,6 +19,7 @@ export { LazySavedObjectSaveModalDashboard, withSuspense, } from './components'; + export { AddFromLibraryButton, PrimaryActionButton, diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx b/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx index 2b5a611cd946e..48bff8d203ebd 100644 --- a/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx @@ -113,7 +113,7 @@ export class VisualizeEmbeddableFactory public getDisplayName() { return i18n.translate('visualizations.displayName', { - defaultMessage: 'visualization', + defaultMessage: 'Visualization', }); } diff --git a/src/plugins/visualizations/public/index.ts b/src/plugins/visualizations/public/index.ts index e5b1ba73d9d1c..dbcbb864d2316 100644 --- a/src/plugins/visualizations/public/index.ts +++ b/src/plugins/visualizations/public/index.ts @@ -25,7 +25,7 @@ export { getVisSchemas } from './vis_schemas'; /** @public types */ export { VisualizationsSetup, VisualizationsStart }; export { VisGroups } from './vis_types'; -export type { VisTypeAlias, VisTypeDefinition, Schema, ISchemas } from './vis_types'; +export type { BaseVisType, VisTypeAlias, VisTypeDefinition, Schema, ISchemas } from './vis_types'; export { SerializedVis, SerializedVisData, VisData } from './vis'; export type VisualizeEmbeddableFactoryContract = PublicContract; export type VisualizeEmbeddableContract = PublicContract; diff --git a/src/plugins/visualizations/public/wizard/dialog_navigation.tsx b/src/plugins/visualizations/public/wizard/dialog_navigation.tsx index 1de177e12f40d..c92514d54166f 100644 --- a/src/plugins/visualizations/public/wizard/dialog_navigation.tsx +++ b/src/plugins/visualizations/public/wizard/dialog_navigation.tsx @@ -24,7 +24,7 @@ function DialogNavigation(props: DialogNavigationProps) { {i18n.translate('visualizations.newVisWizard.goBackLink', { - defaultMessage: 'Go back', + defaultMessage: 'Select a different visualization', })} diff --git a/src/plugins/visualizations/public/wizard/new_vis_modal.tsx b/src/plugins/visualizations/public/wizard/new_vis_modal.tsx index d36b734f75be2..317f9d1bb363d 100644 --- a/src/plugins/visualizations/public/wizard/new_vis_modal.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.tsx @@ -41,6 +41,8 @@ interface TypeSelectionProps { outsideVisualizeApp?: boolean; stateTransfer?: EmbeddableStateTransfer; originatingApp?: string; + showAggsSelection?: boolean; + selectedVisType?: BaseVisType; } interface TypeSelectionState { @@ -69,8 +71,9 @@ class NewVisModal extends React.Component import('./new_vis_modal')); @@ -29,6 +30,8 @@ export interface ShowNewVisModalParams { originatingApp?: string; outsideVisualizeApp?: boolean; createByValue?: boolean; + showAggsSelection?: boolean; + selectedVisType?: BaseVisType; } /** @@ -41,6 +44,8 @@ export function showNewVisModal({ onClose, originatingApp, outsideVisualizeApp, + showAggsSelection, + selectedVisType, }: ShowNewVisModalParams = {}) { const container = document.createElement('div'); let isClosed = false; @@ -78,6 +83,8 @@ export function showNewVisModal({ usageCollection={getUsageCollector()} application={getApplication()} docLinks={getDocLinks()} + showAggsSelection={showAggsSelection} + selectedVisType={selectedVisType} /> diff --git a/test/examples/embeddables/adding_children.ts b/test/examples/embeddables/adding_children.ts index 8b59012bf9825..ee06622a33f51 100644 --- a/test/examples/embeddables/adding_children.ts +++ b/test/examples/embeddables/adding_children.ts @@ -13,31 +13,12 @@ import { PluginFunctionalProviderContext } from 'test/plugin_functional/services export default function ({ getService }: PluginFunctionalProviderContext) { const testSubjects = getService('testSubjects'); const flyout = getService('flyout'); - const retry = getService('retry'); - describe('creating and adding children', () => { + describe('adding children', () => { before(async () => { await testSubjects.click('embeddablePanelExample'); }); - it('Can create a new child', async () => { - await testSubjects.click('embeddablePanelToggleMenuIcon'); - await testSubjects.click('embeddablePanelAction-ACTION_ADD_PANEL'); - - // this seem like an overkill, but clicking this button which opens context menu was flaky - await testSubjects.waitForEnabled('createNew'); - await retry.waitFor('createNew popover opened', async () => { - await testSubjects.click('createNew'); - return await testSubjects.exists('createNew-TODO_EMBEDDABLE'); - }); - await testSubjects.click('createNew-TODO_EMBEDDABLE'); - - await testSubjects.setValue('taskInputField', 'new task'); - await testSubjects.click('createTodoEmbeddable'); - const tasks = await testSubjects.getVisibleTextAll('todoEmbeddableTask'); - expect(tasks).to.eql(['Goes out on Wednesdays!', 'new task']); - }); - it('Can add a child backed off a saved object', async () => { await testSubjects.click('embeddablePanelToggleMenuIcon'); await testSubjects.click('embeddablePanelAction-ACTION_ADD_PANEL'); @@ -46,7 +27,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) { await testSubjects.moveMouseTo('euiFlyoutCloseButton'); await flyout.ensureClosed('dashboardAddPanel'); const tasks = await testSubjects.getVisibleTextAll('todoEmbeddableTask'); - expect(tasks).to.eql(['Goes out on Wednesdays!', 'new task', 'Take the garbage out']); + expect(tasks).to.eql(['Goes out on Wednesdays!', 'Take the garbage out']); }); }); } diff --git a/test/functional/apps/dashboard/create_and_add_embeddables.ts b/test/functional/apps/dashboard/create_and_add_embeddables.ts index 9b8fc4785a671..3de3b2f843f55 100644 --- a/test/functional/apps/dashboard/create_and_add_embeddables.ts +++ b/test/functional/apps/dashboard/create_and_add_embeddables.ts @@ -35,8 +35,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('adds new visualization via the top nav link', async () => { const originalPanelCount = await PageObjects.dashboard.getPanelCount(); await PageObjects.dashboard.switchToEditMode(); - await dashboardAddPanel.clickCreateNewLink(); - await PageObjects.visualize.clickAggBasedVisualizations(); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationExpectSuccess( @@ -52,9 +52,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('adds a new visualization', async () => { const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - await dashboardAddPanel.ensureAddPanelIsShowing(); - await dashboardAddPanel.clickAddNewEmbeddableLink('visualization'); - await PageObjects.visualize.clickAggBasedVisualizations(); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationExpectSuccess( @@ -71,7 +70,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('adds a markdown visualization via the quick button', async () => { const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - await PageObjects.dashboard.clickMarkdownQuickButton(); + await dashboardAddPanel.clickMarkdownQuickButton(); await PageObjects.visualize.saveVisualizationExpectSuccess( 'visualization from markdown quick button', { redirectToOrigin: true } @@ -84,21 +83,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.waitForRenderComplete(); }); - it('adds an input control visualization via the quick button', async () => { - const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - await PageObjects.dashboard.clickInputControlsQuickButton(); - await PageObjects.visualize.saveVisualizationExpectSuccess( - 'visualization from input control quick button', - { redirectToOrigin: true } - ); - - await retry.try(async () => { - const panelCount = await PageObjects.dashboard.getPanelCount(); - expect(panelCount).to.eql(originalPanelCount + 1); - }); - await PageObjects.dashboard.waitForRenderComplete(); - }); - it('saves the listing page instead of the visualization to the app link', async () => { await PageObjects.header.clickVisualize(true); const currentUrl = await browser.getCurrentUrl(); diff --git a/test/functional/apps/dashboard/dashboard_unsaved_listing.ts b/test/functional/apps/dashboard/dashboard_unsaved_listing.ts index 233d2e91467fe..1cdc4bbff2c53 100644 --- a/test/functional/apps/dashboard/dashboard_unsaved_listing.ts +++ b/test/functional/apps/dashboard/dashboard_unsaved_listing.ts @@ -25,8 +25,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('dashboard unsaved listing', () => { const addSomePanels = async () => { // add an area chart by value - await dashboardAddPanel.clickCreateNewLink(); - await PageObjects.visualize.clickAggBasedVisualizations(); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationAndReturn(); @@ -132,8 +132,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.switchToEditMode(); // add another panel so we can delete it later - await dashboardAddPanel.clickCreateNewLink(); - await PageObjects.visualize.clickAggBasedVisualizations(); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationExpectSuccess('Wildvis', { diff --git a/test/functional/apps/dashboard/dashboard_unsaved_state.ts b/test/functional/apps/dashboard/dashboard_unsaved_state.ts index e6cc91880010a..fd203cd8c1356 100644 --- a/test/functional/apps/dashboard/dashboard_unsaved_state.ts +++ b/test/functional/apps/dashboard/dashboard_unsaved_state.ts @@ -41,8 +41,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('shows the unsaved changes badge after adding panels', async () => { await PageObjects.dashboard.switchToEditMode(); // add an area chart by value - await dashboardAddPanel.clickCreateNewLink(); - await PageObjects.visualize.clickAggBasedVisualizations(); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationAndReturn(); diff --git a/test/functional/apps/dashboard/edit_embeddable_redirects.ts b/test/functional/apps/dashboard/edit_embeddable_redirects.ts index 8b7b98a59aa12..be540e18a503f 100644 --- a/test/functional/apps/dashboard/edit_embeddable_redirects.ts +++ b/test/functional/apps/dashboard/edit_embeddable_redirects.ts @@ -13,10 +13,9 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); const esArchiver = getService('esArchiver'); - const testSubjects = getService('testSubjects'); const kibanaServer = getService('kibanaServer'); const dashboardPanelActions = getService('dashboardPanelActions'); - const dashboardVisualizations = getService('dashboardVisualizations'); + const dashboardAddPanel = getService('dashboardAddPanel'); describe('edit embeddable redirects', () => { before(async () => { @@ -88,10 +87,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const newTitle = 'test create panel originatingApp'; await PageObjects.dashboard.loadSavedDashboard('few panels'); await PageObjects.dashboard.switchToEditMode(); - await testSubjects.exists('dashboardAddNewPanelButton'); - await testSubjects.click('dashboardAddNewPanelButton'); - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); - await PageObjects.visualize.clickMarkdownWidget(); + await dashboardAddPanel.clickMarkdownQuickButton(); await PageObjects.visualize.saveVisualizationExpectSuccess(newTitle, { saveAsNew: true, redirectToOrigin: false, diff --git a/test/functional/apps/dashboard/edit_visualizations.js b/test/functional/apps/dashboard/edit_visualizations.js index ce32f53587e74..b2f21aefcf79c 100644 --- a/test/functional/apps/dashboard/edit_visualizations.js +++ b/test/functional/apps/dashboard/edit_visualizations.js @@ -14,13 +14,14 @@ export default function ({ getService, getPageObjects }) { const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); const kibanaServer = getService('kibanaServer'); + const dashboardAddPanel = getService('dashboardAddPanel'); const dashboardPanelActions = getService('dashboardPanelActions'); const originalMarkdownText = 'Original markdown text'; const modifiedMarkdownText = 'Modified markdown text'; const createMarkdownVis = async (title) => { - await PageObjects.dashboard.clickMarkdownQuickButton(); + await dashboardAddPanel.clickMarkdownQuickButton(); await PageObjects.visEditor.setMarkdownTxt(originalMarkdownText); await PageObjects.visEditor.clickGo(); if (title) { diff --git a/test/functional/apps/dashboard/empty_dashboard.ts b/test/functional/apps/dashboard/empty_dashboard.ts index c096d90aa3595..2cfa6d73dcb72 100644 --- a/test/functional/apps/dashboard/empty_dashboard.ts +++ b/test/functional/apps/dashboard/empty_dashboard.ts @@ -41,15 +41,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should open add panel when add button is clicked', async () => { - await testSubjects.click('dashboardAddPanelButton'); + await dashboardAddPanel.clickOpenAddPanel(); const isAddPanelOpen = await dashboardAddPanel.isAddPanelOpen(); expect(isAddPanelOpen).to.be(true); await testSubjects.click('euiFlyoutCloseButton'); }); it('should add new visualization from dashboard', async () => { - await testSubjects.exists('dashboardAddNewPanelButton'); - await testSubjects.click('dashboardAddNewPanelButton'); await dashboardVisualizations.createAndAddMarkdown({ name: 'Dashboard Test Markdown', markdown: 'Markdown text', @@ -57,5 +55,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.waitForRenderComplete(); await dashboardExpect.markdownWithValuesExists(['Markdown text']); }); + + it('should open editor menu when editor button is clicked', async () => { + await dashboardAddPanel.clickEditorMenuButton(); + await testSubjects.existOrFail('dashboardEditorContextMenu'); + }); }); } diff --git a/test/functional/apps/dashboard/view_edit.ts b/test/functional/apps/dashboard/view_edit.ts index c5c7daab27ff1..99a78ebd069c5 100644 --- a/test/functional/apps/dashboard/view_edit.ts +++ b/test/functional/apps/dashboard/view_edit.ts @@ -113,10 +113,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('when a new vis is added', async function () { const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - - await dashboardAddPanel.ensureAddPanelIsShowing(); - await dashboardAddPanel.clickAddNewEmbeddableLink('visualization'); - await PageObjects.visualize.clickAggBasedVisualizations(); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationExpectSuccess('new viz panel', { diff --git a/test/functional/page_objects/dashboard_page.ts b/test/functional/page_objects/dashboard_page.ts index 34559afdf6ae1..9c12296db138c 100644 --- a/test/functional/page_objects/dashboard_page.ts +++ b/test/functional/page_objects/dashboard_page.ts @@ -413,16 +413,6 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide await testSubjects.click('confirmSaveSavedObjectButton'); } - public async clickMarkdownQuickButton() { - log.debug('Click markdown quick button'); - await testSubjects.click('dashboardMarkdownQuickButton'); - } - - public async clickInputControlsQuickButton() { - log.debug('Click input controls quick button'); - await testSubjects.click('dashboardInputControlsQuickButton'); - } - /** * * @param dashboardTitle {String} diff --git a/test/functional/services/dashboard/add_panel.ts b/test/functional/services/dashboard/add_panel.ts index 7bb1603e0193f..a4e0c8b2647dd 100644 --- a/test/functional/services/dashboard/add_panel.ts +++ b/test/functional/services/dashboard/add_panel.ts @@ -30,15 +30,41 @@ export function DashboardAddPanelProvider({ getService, getPageObjects }: FtrPro await PageObjects.common.sleep(500); } + async clickQuickButton(visType: string) { + log.debug(`DashboardAddPanel.clickQuickButton${visType}`); + await testSubjects.click(`dashboardQuickButton${visType}`); + } + + async clickMarkdownQuickButton() { + await this.clickQuickButton('markdown'); + } + + async clickMapQuickButton() { + await this.clickQuickButton('map'); + } + + async clickEditorMenuButton() { + log.debug('DashboardAddPanel.clickEditorMenuButton'); + await testSubjects.click('dashboardEditorMenuButton'); + } + + async clickAggBasedVisualizations() { + log.debug('DashboardAddPanel.clickEditorMenuAggBasedMenuItem'); + await testSubjects.click('dashboardEditorAggBasedMenuItem'); + } + async clickVisType(visType: string) { log.debug('DashboardAddPanel.clickVisType'); await testSubjects.click(`visType-${visType}`); } + async clickEmbeddableFactoryGroupButton(groupId: string) { + log.debug('DashboardAddPanel.clickEmbeddableFactoryGroupButton'); + await testSubjects.click(`dashboardEditorMenu-${groupId}Group`); + } + async clickAddNewEmbeddableLink(type: string) { - await testSubjects.click('createNew'); await testSubjects.click(`createNew-${type}`); - await testSubjects.missingOrFail(`createNew-${type}`); } async toggleFilterPopover() { diff --git a/test/functional/services/dashboard/visualizations.ts b/test/functional/services/dashboard/visualizations.ts index d1aaa6aa1bd70..2bf7458ff9c5f 100644 --- a/test/functional/services/dashboard/visualizations.ts +++ b/test/functional/services/dashboard/visualizations.ts @@ -10,8 +10,6 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export function DashboardVisualizationProvider({ getService, getPageObjects }: FtrProviderContext) { const log = getService('log'); - const find = getService('find'); - const retry = getService('retry'); const queryBar = getService('queryBar'); const testSubjects = getService('testSubjects'); const dashboardAddPanel = getService('dashboardAddPanel'); @@ -31,8 +29,8 @@ export function DashboardVisualizationProvider({ getService, getPageObjects }: F if (inViewMode) { await PageObjects.dashboard.switchToEditMode(); } - await dashboardAddPanel.ensureAddPanelIsShowing(); - await dashboardAddPanel.clickAddNewEmbeddableLink('visualization'); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAddNewEmbeddableLink('metrics'); await PageObjects.visualize.clickVisualBuilder(); await PageObjects.visualize.saveVisualizationExpectSuccess(name); } @@ -87,39 +85,13 @@ export function DashboardVisualizationProvider({ getService, getPageObjects }: F await dashboardAddPanel.addSavedSearch(name); } - async clickAddVisualizationButton() { - log.debug('DashboardVisualizations.clickAddVisualizationButton'); - await testSubjects.click('dashboardAddNewPanelButton'); - } - - async isNewVisDialogShowing() { - log.debug('DashboardVisualizations.isNewVisDialogShowing'); - return await find.existsByCssSelector('.visNewVisDialog'); - } - - async ensureNewVisualizationDialogIsShowing() { - let isShowing = await this.isNewVisDialogShowing(); - log.debug(`DashboardVisualizations.ensureNewVisualizationDialogIsShowing:${isShowing}`); - if (!isShowing) { - await retry.try(async () => { - await this.clickAddVisualizationButton(); - isShowing = await this.isNewVisDialogShowing(); - log.debug(`DashboardVisualizations.ensureNewVisualizationDialogIsShowing:${isShowing}`); - if (!isShowing) { - throw new Error('New Vis Dialog still not open, trying again.'); - } - }); - } - } - async createAndAddMarkdown({ name, markdown }: { name: string; markdown: string }) { log.debug(`createAndAddMarkdown(${markdown})`); const inViewMode = await PageObjects.dashboard.getIsInViewMode(); if (inViewMode) { await PageObjects.dashboard.switchToEditMode(); } - await this.ensureNewVisualizationDialogIsShowing(); - await PageObjects.visualize.clickMarkdownWidget(); + await dashboardAddPanel.clickMarkdownQuickButton(); await PageObjects.visEditor.setMarkdownTxt(markdown); await PageObjects.visEditor.clickGo(); await PageObjects.visualize.saveVisualizationExpectSuccess(name, { @@ -134,10 +106,10 @@ export function DashboardVisualizationProvider({ getService, getPageObjects }: F if (inViewMode) { await PageObjects.dashboard.switchToEditMode(); } - await this.ensureNewVisualizationDialogIsShowing(); - await PageObjects.visualize.clickAggBasedVisualizations(); - await PageObjects.visualize.clickMetric(); - await find.clickByCssSelector('li.euiListGroupItem:nth-of-type(2)'); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickAggBasedVisualizations(); + await dashboardAddPanel.clickVisType('metric'); + await testSubjects.click('savedObjectTitlelogstash-*'); await testSubjects.exists('visualizesaveAndReturnButton'); await testSubjects.click('visualizesaveAndReturnButton'); } @@ -148,8 +120,7 @@ export function DashboardVisualizationProvider({ getService, getPageObjects }: F if (inViewMode) { await PageObjects.dashboard.switchToEditMode(); } - await this.ensureNewVisualizationDialogIsShowing(); - await PageObjects.visualize.clickMarkdownWidget(); + await dashboardAddPanel.clickMarkdownQuickButton(); await PageObjects.visEditor.setMarkdownTxt(markdown); await PageObjects.visEditor.clickGo(); await testSubjects.click('visualizesaveAndReturnButton'); diff --git a/test/new_visualize_flow/dashboard_embedding.ts b/test/new_visualize_flow/dashboard_embedding.ts index 6a1315dbfc91e..04b91542223ba 100644 --- a/test/new_visualize_flow/dashboard_embedding.ts +++ b/test/new_visualize_flow/dashboard_embedding.ts @@ -22,7 +22,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardExpect = getService('dashboardExpect'); - const testSubjects = getService('testSubjects'); const dashboardVisualizations = getService('dashboardVisualizations'); const PageObjects = getPageObjects([ 'common', @@ -47,8 +46,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('adding a metric visualization', async function () { const originalPanelCount = await PageObjects.dashboard.getPanelCount(); expect(originalPanelCount).to.eql(0); - await testSubjects.exists('dashboardAddNewPanelButton'); - await testSubjects.click('dashboardAddNewPanelButton'); await dashboardVisualizations.createAndEmbedMetric('Embedding Vis Test'); await PageObjects.dashboard.waitForRenderComplete(); await dashboardExpect.metricValuesExist(['0']); @@ -59,8 +56,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('adding a markdown', async function () { const originalPanelCount = await PageObjects.dashboard.getPanelCount(); expect(originalPanelCount).to.eql(1); - await testSubjects.exists('dashboardAddNewPanelButton'); - await testSubjects.click('dashboardAddNewPanelButton'); await dashboardVisualizations.createAndEmbedMarkdown({ name: 'Embedding Markdown Test', markdown: 'Nice to meet you, markdown is my name', diff --git a/x-pack/plugins/infra/public/components/log_stream/log_stream_embeddable_factory.ts b/x-pack/plugins/infra/public/components/log_stream/log_stream_embeddable_factory.ts index 4b9b2f99215b7..1c7e8ceb28fb4 100644 --- a/x-pack/plugins/infra/public/components/log_stream/log_stream_embeddable_factory.ts +++ b/x-pack/plugins/infra/public/components/log_stream/log_stream_embeddable_factory.ts @@ -40,6 +40,16 @@ export class LogStreamEmbeddableFactoryDefinition }); } + public getDescription() { + return i18n.translate('xpack.infra.logStreamEmbeddable.description', { + defaultMessage: 'Add a table of live streaming logs.', + }); + } + + public getIconType() { + return 'logsApp'; + } + public async getExplicitInput() { return { title: i18n.translate('xpack.infra.logStreamEmbeddable.title', { diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_charts/anomaly_charts_embeddable_factory.ts b/x-pack/plugins/ml/public/embeddables/anomaly_charts/anomaly_charts_embeddable_factory.ts index ac5ff2094e22b..4788d809f016f 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_charts/anomaly_charts_embeddable_factory.ts +++ b/x-pack/plugins/ml/public/embeddables/anomaly_charts/anomaly_charts_embeddable_factory.ts @@ -9,6 +9,7 @@ import { i18n } from '@kbn/i18n'; import type { StartServicesAccessor } from 'kibana/public'; +import { PLUGIN_ICON, PLUGIN_ID, ML_APP_NAME } from '../../../common/constants/app'; import type { EmbeddableFactoryDefinition, IContainer, @@ -27,6 +28,14 @@ export class AnomalyChartsEmbeddableFactory implements EmbeddableFactoryDefinition { public readonly type = ANOMALY_EXPLORER_CHARTS_EMBEDDABLE_TYPE; + public readonly grouping = [ + { + id: PLUGIN_ID, + getDisplayName: () => ML_APP_NAME, + getIconType: () => PLUGIN_ICON, + }, + ]; + constructor( private getStartServices: StartServicesAccessor ) {} @@ -37,7 +46,13 @@ export class AnomalyChartsEmbeddableFactory public getDisplayName() { return i18n.translate('xpack.ml.components.mlAnomalyExplorerEmbeddable.displayName', { - defaultMessage: 'ML anomaly chart', + defaultMessage: 'Anomaly chart', + }); + } + + public getDescription() { + return i18n.translate('xpack.ml.components.mlAnomalyExplorerEmbeddable.description', { + defaultMessage: 'View anomaly detection results in a chart.', }); } diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable_factory.ts b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable_factory.ts index fdb2ef8527923..bc45e075710c5 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable_factory.ts +++ b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable_factory.ts @@ -9,6 +9,7 @@ import { i18n } from '@kbn/i18n'; import type { StartServicesAccessor } from 'kibana/public'; +import { PLUGIN_ID, PLUGIN_ICON, ML_APP_NAME } from '../../../common/constants/app'; import type { EmbeddableFactoryDefinition, IContainer, @@ -26,6 +27,14 @@ export class AnomalySwimlaneEmbeddableFactory implements EmbeddableFactoryDefinition { public readonly type = ANOMALY_SWIMLANE_EMBEDDABLE_TYPE; + public readonly grouping = [ + { + id: PLUGIN_ID, + getDisplayName: () => ML_APP_NAME, + getIconType: () => PLUGIN_ICON, + }, + ]; + constructor( private getStartServices: StartServicesAccessor ) {} @@ -36,7 +45,13 @@ export class AnomalySwimlaneEmbeddableFactory public getDisplayName() { return i18n.translate('xpack.ml.components.jobAnomalyScoreEmbeddable.displayName', { - defaultMessage: 'ML anomaly swim lane', + defaultMessage: 'Anomaly swim lane', + }); + } + + public getDescription() { + return i18n.translate('xpack.ml.components.jobAnomalyScoreEmbeddable.description', { + defaultMessage: 'View anomaly detection results in a timeline.', }); } diff --git a/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts b/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts index deb91f6b9b1ef..51875c683346e 100644 --- a/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts +++ b/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts @@ -96,8 +96,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('can open job selection flyout', async () => { await PageObjects.dashboard.clickCreateDashboardPrompt(); await ml.dashboardEmbeddables.assertDashboardIsEmpty(); - await dashboardAddPanel.clickOpenAddPanel(); - await dashboardAddPanel.ensureAddPanelIsShowing(); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickEmbeddableFactoryGroupButton('ml'); await dashboardAddPanel.clickAddNewEmbeddableLink('ml_anomaly_charts'); await ml.dashboardJobSelectionTable.assertJobSelectionTableExists(); await a11y.testAppSnapshot(); diff --git a/x-pack/test/functional/apps/dashboard/dashboard_lens_by_value.ts b/x-pack/test/functional/apps/dashboard/dashboard_lens_by_value.ts index 56a8ab46a57da..87ecfe0dcada9 100644 --- a/x-pack/test/functional/apps/dashboard/dashboard_lens_by_value.ts +++ b/x-pack/test/functional/apps/dashboard/dashboard_lens_by_value.ts @@ -15,7 +15,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const testSubjects = getService('testSubjects'); const dashboardPanelActions = getService('dashboardPanelActions'); - const dashboardVisualizations = getService('dashboardVisualizations'); describe('dashboard lens by value', function () { before(async () => { @@ -27,7 +26,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it('can add a lens panel by value', async () => { - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); await PageObjects.lens.createAndAddLensFromDashboard({}); const newPanelCount = await PageObjects.dashboard.getPanelCount(); expect(newPanelCount).to.eql(1); diff --git a/x-pack/test/functional/apps/dashboard/dashboard_maps_by_value.ts b/x-pack/test/functional/apps/dashboard/dashboard_maps_by_value.ts index 15c76c3367a86..487dc90e1877e 100644 --- a/x-pack/test/functional/apps/dashboard/dashboard_maps_by_value.ts +++ b/x-pack/test/functional/apps/dashboard/dashboard_maps_by_value.ts @@ -19,10 +19,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const log = getService('log'); const esArchiver = getService('esArchiver'); - const dashboardVisualizations = getService('dashboardVisualizations'); const dashboardPanelActions = getService('dashboardPanelActions'); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); + const dashboardAddPanel = getService('dashboardAddPanel'); const LAYER_NAME = 'World Countries'; let mapCounter = 0; @@ -33,7 +33,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { if (inViewMode) { await PageObjects.dashboard.switchToEditMode(); } - await PageObjects.visualize.clickMapsApp(); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickVisType('maps'); await PageObjects.maps.clickSaveAndReturnButton(); } @@ -82,8 +83,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('adding a map by value', () => { it('can add a map by value', async () => { await createNewDashboard(); - - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); await createAndAddMapByValue(); const newPanelCount = await PageObjects.dashboard.getPanelCount(); expect(newPanelCount).to.eql(1); @@ -93,7 +92,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('editing a map by value', () => { before(async () => { await createNewDashboard(); - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); await createAndAddMapByValue(); await editByValueMap(); }); @@ -112,7 +110,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('editing a map and adding to map library', () => { beforeEach(async () => { await createNewDashboard(); - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); await createAndAddMapByValue(); }); diff --git a/x-pack/test/functional/apps/dashboard/feature_controls/time_to_visualize_security.ts b/x-pack/test/functional/apps/dashboard/feature_controls/time_to_visualize_security.ts index 3ebc53cc7cf27..730c00a8d5e4f 100644 --- a/x-pack/test/functional/apps/dashboard/feature_controls/time_to_visualize_security.ts +++ b/x-pack/test/functional/apps/dashboard/feature_controls/time_to_visualize_security.ts @@ -21,7 +21,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { 'lens', ]); - const dashboardVisualizations = getService('dashboardVisualizations'); + const dashboardAddPanel = getService('dashboardAddPanel'); const dashboardPanelActions = getService('dashboardPanelActions'); const dashboardExpect = getService('dashboardExpect'); const testSubjects = getService('testSubjects'); @@ -85,7 +85,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it('can add a lens panel by value', async () => { - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); await PageObjects.lens.createAndAddLensFromDashboard({}); const newPanelCount = await PageObjects.dashboard.getPanelCount(); expect(newPanelCount).to.eql(1); @@ -171,9 +170,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.dashboard.clickNewDashboard(); await PageObjects.dashboard.waitForRenderComplete(); - await testSubjects.click('dashboardAddNewPanelButton'); - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); - await PageObjects.visualize.clickMarkdownWidget(); + await dashboardAddPanel.clickMarkdownQuickButton(); await PageObjects.visEditor.setMarkdownTxt(originalMarkdownText); await PageObjects.visEditor.clickGo(); diff --git a/x-pack/test/functional/apps/dashboard/sync_colors.ts b/x-pack/test/functional/apps/dashboard/sync_colors.ts index 7e54f966870c3..09575c355913e 100644 --- a/x-pack/test/functional/apps/dashboard/sync_colors.ts +++ b/x-pack/test/functional/apps/dashboard/sync_colors.ts @@ -49,7 +49,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await elasticChart.setNewChartUiDebugFlag(true); await PageObjects.dashboard.clickCreateDashboardPrompt(); await dashboardAddPanel.clickCreateNewLink(); - await dashboardAddPanel.clickVisType('lens'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.lens.goToTimeRange(); @@ -68,7 +67,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.lens.save('vis1', false, true); await PageObjects.header.waitUntilLoadingHasFinished(); await dashboardAddPanel.clickCreateNewLink(); - await dashboardAddPanel.clickVisType('lens'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.lens.configureDimension({ diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js index 57925ad50d155..37311de534195 100644 --- a/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js +++ b/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js @@ -10,7 +10,6 @@ import expect from '@kbn/expect'; export default function ({ getPageObjects, getService }) { const testSubjects = getService('testSubjects'); const esArchiver = getService('esArchiver'); - const dashboardVisualizations = getService('dashboardVisualizations'); const dashboardPanelActions = getService('dashboardPanelActions'); const PageObjects = getPageObjects(['common', 'dashboard', 'visualize', 'lens']); @@ -29,9 +28,6 @@ export default function ({ getPageObjects, getService }) { it('adds Lens visualization to empty dashboard', async () => { const title = 'Dashboard Test Lens'; - await testSubjects.exists('dashboardAddNewPanelButton'); - await testSubjects.click('dashboardAddNewPanelButton'); - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); await PageObjects.lens.createAndAddLensFromDashboard({ title, redirectToOrigin: true }); await PageObjects.dashboard.waitForRenderComplete(); await testSubjects.exists(`embeddablePanelHeading-${title}`); @@ -87,9 +83,6 @@ export default function ({ getPageObjects, getService }) { const title = 'non-dashboard Test Lens'; await PageObjects.dashboard.loadSavedDashboard('empty dashboard test'); await PageObjects.dashboard.switchToEditMode(); - await testSubjects.exists('dashboardAddNewPanelButton'); - await testSubjects.click('dashboardAddNewPanelButton'); - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); await PageObjects.lens.createAndAddLensFromDashboard({ title }); await PageObjects.lens.notLinkedToOriginatingApp(); await PageObjects.common.navigateToApp('dashboard'); diff --git a/x-pack/test/functional/apps/lens/dashboard.ts b/x-pack/test/functional/apps/lens/dashboard.ts index a15176d76f953..1490abb320ca6 100644 --- a/x-pack/test/functional/apps/lens/dashboard.ts +++ b/x-pack/test/functional/apps/lens/dashboard.ts @@ -134,7 +134,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await filterBar.addFilter('geo.dest', 'is', 'LS'); await dashboardAddPanel.clickCreateNewLink(); - await dashboardAddPanel.clickVisType('lens'); await PageObjects.header.waitUntilLoadingHasFinished(); const hasGeoDestFilter = await filterBar.hasFilter('geo.dest', 'LS'); expect(hasGeoDestFilter).to.be(false); @@ -200,7 +199,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.clickNewDashboard(); await dashboardAddPanel.clickCreateNewLink(); - await dashboardAddPanel.clickVisType('lens'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.lens.goToTimeRange(); diff --git a/x-pack/test/functional/apps/lens/lens_tagging.ts b/x-pack/test/functional/apps/lens/lens_tagging.ts index 7ce31709498fc..6fff2baa2d0cc 100644 --- a/x-pack/test/functional/apps/lens/lens_tagging.ts +++ b/x-pack/test/functional/apps/lens/lens_tagging.ts @@ -14,7 +14,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const retry = getService('retry'); const find = getService('find'); - const dashboardVisualizations = getService('dashboardVisualizations'); + const dashboardAddPanel = getService('dashboardAddPanel'); const dashboardPanelActions = getService('dashboardPanelActions'); const PageObjects = getPageObjects([ 'common', @@ -39,8 +39,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('adds a new tag to a Lens visualization', async () => { // create lens - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); - await PageObjects.visualize.clickLensWidget(); + await dashboardAddPanel.clickCreateNewLink(); await PageObjects.lens.goToTimeRange(); await PageObjects.lens.configureDimension({ dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension', diff --git a/x-pack/test/functional/apps/maps/embeddable/embeddable_library.js b/x-pack/test/functional/apps/maps/embeddable/embeddable_library.js index 40e73f0d8a763..9bff4e56c6c5b 100644 --- a/x-pack/test/functional/apps/maps/embeddable/embeddable_library.js +++ b/x-pack/test/functional/apps/maps/embeddable/embeddable_library.js @@ -15,7 +15,6 @@ export default function ({ getPageObjects, getService }) { const security = getService('security'); const dashboardAddPanel = getService('dashboardAddPanel'); const dashboardPanelActions = getService('dashboardPanelActions'); - const dashboardVisualizations = getService('dashboardVisualizations'); describe('maps in embeddable library', () => { before(async () => { @@ -34,8 +33,7 @@ export default function ({ getPageObjects, getService }) { }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.clickNewDashboard(); - await dashboardAddPanel.clickCreateNewLink(); - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); + await dashboardAddPanel.clickEditorMenuButton(); await PageObjects.visualize.clickMapsApp(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.maps.waitForLayersToLoad(); diff --git a/x-pack/test/functional/apps/maps/embeddable/save_and_return.js b/x-pack/test/functional/apps/maps/embeddable/save_and_return.js index a3abb01b4cf9f..a7e649548306b 100644 --- a/x-pack/test/functional/apps/maps/embeddable/save_and_return.js +++ b/x-pack/test/functional/apps/maps/embeddable/save_and_return.js @@ -11,7 +11,6 @@ export default function ({ getPageObjects, getService }) { const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'maps', 'visualize']); const dashboardAddPanel = getService('dashboardAddPanel'); const dashboardPanelActions = getService('dashboardPanelActions'); - const dashboardVisualizations = getService('dashboardVisualizations'); const testSubjects = getService('testSubjects'); const security = getService('security'); @@ -37,9 +36,8 @@ export default function ({ getPageObjects, getService }) { beforeEach(async () => { await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.clickNewDashboard(); - await dashboardAddPanel.clickCreateNewLink(); - await await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); - await PageObjects.visualize.clickMapsApp(); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickVisType('maps'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.maps.waitForLayersToLoad(); }); diff --git a/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts b/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts index f7bfd7f7a4c62..0aee183c1a4a5 100644 --- a/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts +++ b/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts @@ -87,8 +87,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('can open job selection flyout', async () => { await PageObjects.dashboard.clickCreateDashboardPrompt(); await ml.dashboardEmbeddables.assertDashboardIsEmpty(); - await dashboardAddPanel.clickOpenAddPanel(); - await dashboardAddPanel.ensureAddPanelIsShowing(); + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickEmbeddableFactoryGroupButton('ml'); await dashboardAddPanel.clickAddNewEmbeddableLink('ml_anomaly_charts'); await ml.dashboardJobSelectionTable.assertJobSelectionTableExists(); }); diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts index 65020be390f9d..100ed8e079d37 100644 --- a/x-pack/test/functional/page_objects/lens_page.ts +++ b/x-pack/test/functional/page_objects/lens_page.ts @@ -18,6 +18,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont const find = getService('find'); const comboBox = getService('comboBox'); const browser = getService('browser'); + const dashboardAddPanel = getService('dashboardAddPanel'); const PageObjects = getPageObjects([ 'common', @@ -753,7 +754,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont if (inViewMode) { await PageObjects.dashboard.switchToEditMode(); } - await PageObjects.visualize.clickLensWidget(); + await dashboardAddPanel.clickCreateNewLink(); await this.goToTimeRange(); await this.configureDimension({ dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension', From 1a3e033c90eb9217168073abddcca2e11220009a Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Sun, 18 Apr 2021 12:50:02 +0300 Subject: [PATCH 61/68] [Partial Results] Move other bucket into Search Source (#96384) * Move inspector adapter integration into search source * docs and ts * Move other bucket to search source * test ts + delete unused tabilfy function * hierarchical param in aggconfig. ts improvements more inspector tests * fix jest * separate inspect more tests * jest * inspector * Error handling and more tests * put the fun in functional tests * code review * Add functional test for other bucket in search example app * test * test * ts * test * test * ts Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- ...ins-data-public.aggconfigs.hierarchical.md | 11 + ...a-plugin-plugins-data-public.aggconfigs.md | 3 +- ...in-plugins-data-public.aggconfigs.todsl.md | 9 +- ...s-data-public.isearchoptions.inspector.md} | 8 +- ...ugin-plugins-data-public.isearchoptions.md | 2 +- ...-plugins-data-public.searchsource.fetch.md | 4 +- ...plugins-data-public.searchsource.fetch_.md | 4 +- ...ins-data-public.searchsourcefields.aggs.md | 2 +- ...-plugins-data-public.searchsourcefields.md | 2 +- ...s-data-server.isearchoptions.inspector.md} | 8 +- ...ugin-plugins-data-server.isearchoptions.md | 2 +- examples/search_examples/public/index.scss | 6 + .../search_examples/public/search/app.tsx | 274 ++++++---- .../common/search/aggs/agg_configs.test.ts | 8 +- .../data/common/search/aggs/agg_configs.ts | 8 +- .../data/common/search/aggs/agg_type.ts | 31 +- .../_terms_other_bucket_helper.test.ts | 6 +- .../buckets/_terms_other_bucket_helper.ts | 13 +- .../data/common/search/aggs/buckets/terms.ts | 26 +- .../esaggs/request_handler.test.ts | 43 +- .../expressions/esaggs/request_handler.ts | 62 +-- .../search_source/inspect/inspector_stats.ts | 2 +- .../search_source/search_source.test.ts | 482 +++++++++++++++--- .../search/search_source/search_source.ts | 179 ++++++- .../data/common/search/search_source/types.ts | 3 +- .../data/common/search/tabify/index.ts | 23 +- src/plugins/data/common/search/types.ts | 15 +- src/plugins/data/public/public.api.md | 17 +- .../public/search/expressions/esaggs.test.ts | 7 +- .../data/public/search/expressions/esaggs.ts | 7 +- .../server/search/expressions/esaggs.test.ts | 6 +- .../data/server/search/expressions/esaggs.ts | 8 +- src/plugins/data/server/server.api.md | 8 +- .../public/application/angular/discover.js | 22 +- .../embeddable/search_embeddable.ts | 22 +- .../classes/sources/es_source/es_source.ts | 13 +- x-pack/test/examples/search_examples/index.ts | 3 +- .../search_examples/search_example.ts | 38 ++ 38 files changed, 964 insertions(+), 423 deletions(-) create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.hierarchical.md rename docs/development/plugins/data/public/{kibana-plugin-plugins-data-public.isearchoptions.requestresponder.md => kibana-plugin-plugins-data-public.isearchoptions.inspector.md} (52%) rename docs/development/plugins/data/server/{kibana-plugin-plugins-data-server.isearchoptions.requestresponder.md => kibana-plugin-plugins-data-server.isearchoptions.inspector.md} (52%) create mode 100644 x-pack/test/examples/search_examples/search_example.ts diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.hierarchical.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.hierarchical.md new file mode 100644 index 0000000000000..66d540c48c3bc --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.hierarchical.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [AggConfigs](./kibana-plugin-plugins-data-public.aggconfigs.md) > [hierarchical](./kibana-plugin-plugins-data-public.aggconfigs.hierarchical.md) + +## AggConfigs.hierarchical property + +Signature: + +```typescript +hierarchical?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.md index 22f8994747aa2..02e9a63d95ba3 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.md @@ -22,6 +22,7 @@ export declare class AggConfigs | --- | --- | --- | --- | | [aggs](./kibana-plugin-plugins-data-public.aggconfigs.aggs.md) | | IAggConfig[] | | | [createAggConfig](./kibana-plugin-plugins-data-public.aggconfigs.createaggconfig.md) | | <T extends AggConfig = AggConfig>(params: CreateAggConfigParams, { addToAggConfigs }?: {
addToAggConfigs?: boolean | undefined;
}) => T | | +| [hierarchical](./kibana-plugin-plugins-data-public.aggconfigs.hierarchical.md) | | boolean | | | [indexPattern](./kibana-plugin-plugins-data-public.aggconfigs.indexpattern.md) | | IndexPattern | | | [timeFields](./kibana-plugin-plugins-data-public.aggconfigs.timefields.md) | | string[] | | | [timeRange](./kibana-plugin-plugins-data-public.aggconfigs.timerange.md) | | TimeRange | | @@ -46,5 +47,5 @@ export declare class AggConfigs | [onSearchRequestStart(searchSource, options)](./kibana-plugin-plugins-data-public.aggconfigs.onsearchrequeststart.md) | | | | [setTimeFields(timeFields)](./kibana-plugin-plugins-data-public.aggconfigs.settimefields.md) | | | | [setTimeRange(timeRange)](./kibana-plugin-plugins-data-public.aggconfigs.settimerange.md) | | | -| [toDsl(hierarchical)](./kibana-plugin-plugins-data-public.aggconfigs.todsl.md) | | | +| [toDsl()](./kibana-plugin-plugins-data-public.aggconfigs.todsl.md) | | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.todsl.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.todsl.md index 055c4113ca3e4..1327e976db0ce 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.todsl.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.todsl.md @@ -7,15 +7,8 @@ Signature: ```typescript -toDsl(hierarchical?: boolean): Record; +toDsl(): Record; ``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| hierarchical | boolean | | - Returns: `Record` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.requestresponder.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.inspector.md similarity index 52% rename from docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.requestresponder.md rename to docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.inspector.md index b4431b9467b71..9961292aaf217 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.requestresponder.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.inspector.md @@ -1,11 +1,13 @@ -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) > [requestResponder](./kibana-plugin-plugins-data-public.isearchoptions.requestresponder.md) +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) > [inspector](./kibana-plugin-plugins-data-public.isearchoptions.inspector.md) -## ISearchOptions.requestResponder property +## ISearchOptions.inspector property + +Inspector integration options Signature: ```typescript -requestResponder?: RequestResponder; +inspector?: IInspectorInfo; ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md index cc0cb538be611..21fb7e3dfc7e8 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md @@ -16,10 +16,10 @@ export interface ISearchOptions | --- | --- | --- | | [abortSignal](./kibana-plugin-plugins-data-public.isearchoptions.abortsignal.md) | AbortSignal | An AbortSignal that allows the caller of search to abort a search request. | | [indexPattern](./kibana-plugin-plugins-data-public.isearchoptions.indexpattern.md) | IndexPattern | Index pattern reference is used for better error messages | +| [inspector](./kibana-plugin-plugins-data-public.isearchoptions.inspector.md) | IInspectorInfo | Inspector integration options | | [isRestore](./kibana-plugin-plugins-data-public.isearchoptions.isrestore.md) | boolean | Whether the session is restored (i.e. search requests should re-use the stored search IDs, rather than starting from scratch) | | [isStored](./kibana-plugin-plugins-data-public.isearchoptions.isstored.md) | boolean | Whether the session is already saved (i.e. sent to background) | | [legacyHitsTotal](./kibana-plugin-plugins-data-public.isearchoptions.legacyhitstotal.md) | boolean | Request the legacy format for the total number of hits. If sending rest_total_hits_as_int to something other than true, this should be set to false. | -| [requestResponder](./kibana-plugin-plugins-data-public.isearchoptions.requestresponder.md) | RequestResponder | | | [sessionId](./kibana-plugin-plugins-data-public.isearchoptions.sessionid.md) | string | A session ID, grouping multiple search requests into a single session. | | [strategy](./kibana-plugin-plugins-data-public.isearchoptions.strategy.md) | string | Use this option to force using a specific server side search strategy. Leave empty to use the default strategy. | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md index 623d6366d4d13..e6ba1a51a867d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md @@ -14,7 +14,7 @@ Fetch this source and reject the returned Promise on error Signature: ```typescript -fetch(options?: ISearchOptions): Promise>; +fetch(options?: ISearchOptions): Promise>; ``` ## Parameters @@ -25,5 +25,5 @@ fetch(options?: ISearchOptions): PromiseReturns: -`Promise>` +`Promise>` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch_.md index d5641107a88aa..4369cf7c087da 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch_.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch_.md @@ -9,7 +9,7 @@ Fetch this source from Elasticsearch, returning an observable over the response( Signature: ```typescript -fetch$(options?: ISearchOptions): import("rxjs").Observable>; +fetch$(options?: ISearchOptions): Observable>; ``` ## Parameters @@ -20,5 +20,5 @@ fetch$(options?: ISearchOptions): import("rxjs").ObservableReturns: -`import("rxjs").Observable>` +`Observable>` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.aggs.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.aggs.md index f6bab8e424857..12011f8242996 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.aggs.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.aggs.md @@ -9,5 +9,5 @@ Signature: ```typescript -aggs?: any; +aggs?: object | IAggConfigs | (() => object); ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md index d0f53936eb56a..981d956a9e89b 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md @@ -16,7 +16,7 @@ export interface SearchSourceFields | Property | Type | Description | | --- | --- | --- | -| [aggs](./kibana-plugin-plugins-data-public.searchsourcefields.aggs.md) | any | [AggConfigs](./kibana-plugin-plugins-data-public.aggconfigs.md) | +| [aggs](./kibana-plugin-plugins-data-public.searchsourcefields.aggs.md) | object | IAggConfigs | (() => object) | [AggConfigs](./kibana-plugin-plugins-data-public.aggconfigs.md) | | [fields](./kibana-plugin-plugins-data-public.searchsourcefields.fields.md) | SearchFieldValue[] | Retrieve fields via the search Fields API | | [fieldsFromSource](./kibana-plugin-plugins-data-public.searchsourcefields.fieldsfromsource.md) | NameList | Retreive fields directly from \_source (legacy behavior) | | [filter](./kibana-plugin-plugins-data-public.searchsourcefields.filter.md) | Filter[] | Filter | (() => Filter[] | Filter | undefined) | [Filter](./kibana-plugin-plugins-data-public.filter.md) | diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.requestresponder.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.inspector.md similarity index 52% rename from docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.requestresponder.md rename to docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.inspector.md index 7440f5a9d26cf..ab755334643aa 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.requestresponder.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.inspector.md @@ -1,11 +1,13 @@ -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchOptions](./kibana-plugin-plugins-data-server.isearchoptions.md) > [requestResponder](./kibana-plugin-plugins-data-server.isearchoptions.requestresponder.md) +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchOptions](./kibana-plugin-plugins-data-server.isearchoptions.md) > [inspector](./kibana-plugin-plugins-data-server.isearchoptions.inspector.md) -## ISearchOptions.requestResponder property +## ISearchOptions.inspector property + +Inspector integration options Signature: ```typescript -requestResponder?: RequestResponder; +inspector?: IInspectorInfo; ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md index 413a59be3d427..cdb5664f96cdd 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md @@ -16,10 +16,10 @@ export interface ISearchOptions | --- | --- | --- | | [abortSignal](./kibana-plugin-plugins-data-server.isearchoptions.abortsignal.md) | AbortSignal | An AbortSignal that allows the caller of search to abort a search request. | | [indexPattern](./kibana-plugin-plugins-data-server.isearchoptions.indexpattern.md) | IndexPattern | Index pattern reference is used for better error messages | +| [inspector](./kibana-plugin-plugins-data-server.isearchoptions.inspector.md) | IInspectorInfo | Inspector integration options | | [isRestore](./kibana-plugin-plugins-data-server.isearchoptions.isrestore.md) | boolean | Whether the session is restored (i.e. search requests should re-use the stored search IDs, rather than starting from scratch) | | [isStored](./kibana-plugin-plugins-data-server.isearchoptions.isstored.md) | boolean | Whether the session is already saved (i.e. sent to background) | | [legacyHitsTotal](./kibana-plugin-plugins-data-server.isearchoptions.legacyhitstotal.md) | boolean | Request the legacy format for the total number of hits. If sending rest_total_hits_as_int to something other than true, this should be set to false. | -| [requestResponder](./kibana-plugin-plugins-data-server.isearchoptions.requestresponder.md) | RequestResponder | | | [sessionId](./kibana-plugin-plugins-data-server.isearchoptions.sessionid.md) | string | A session ID, grouping multiple search requests into a single session. | | [strategy](./kibana-plugin-plugins-data-server.isearchoptions.strategy.md) | string | Use this option to force using a specific server side search strategy. Leave empty to use the default strategy. | diff --git a/examples/search_examples/public/index.scss b/examples/search_examples/public/index.scss index e69de29bb2d1d..b623fecf78640 100644 --- a/examples/search_examples/public/index.scss +++ b/examples/search_examples/public/index.scss @@ -0,0 +1,6 @@ +@import '@elastic/eui/src/global_styling/variables/header'; + +.searchExampleStepDsc { + padding-left: $euiSizeXL; + font-style: italic; +} diff --git a/examples/search_examples/public/search/app.tsx b/examples/search_examples/public/search/app.tsx index 8f31d242faf5e..b2a4991d0717b 100644 --- a/examples/search_examples/public/search/app.tsx +++ b/examples/search_examples/public/search/app.tsx @@ -20,13 +20,13 @@ import { EuiTitle, EuiText, EuiFlexGrid, - EuiFlexGroup, EuiFlexItem, EuiCheckbox, EuiSpacer, EuiCode, EuiComboBox, EuiFormLabel, + EuiTabbedContent, } from '@elastic/eui'; import { CoreStart } from '../../../../src/core/public'; @@ -60,6 +60,11 @@ function getNumeric(fields?: IndexPatternField[]) { return fields?.filter((f) => f.type === 'number' && f.aggregatable); } +function getAggregatableStrings(fields?: IndexPatternField[]) { + if (!fields) return []; + return fields?.filter((f) => f.type === 'string' && f.aggregatable); +} + function formatFieldToComboBox(field?: IndexPatternField | null) { if (!field) return []; return formatFieldsToComboBox([field]); @@ -90,6 +95,9 @@ export const SearchExamplesApp = ({ const [selectedNumericField, setSelectedNumericField] = useState< IndexPatternField | null | undefined >(); + const [selectedBucketField, setSelectedBucketField] = useState< + IndexPatternField | null | undefined + >(); const [request, setRequest] = useState>({}); const [response, setResponse] = useState>({}); @@ -108,6 +116,7 @@ export const SearchExamplesApp = ({ setFields(indexPattern?.fields); }, [indexPattern]); useEffect(() => { + setSelectedBucketField(fields?.length ? getAggregatableStrings(fields)[0] : null); setSelectedNumericField(fields?.length ? getNumeric(fields)[0] : null); }, [fields]); @@ -203,28 +212,40 @@ export const SearchExamplesApp = ({ .setField('index', indexPattern) .setField('filter', filters) .setField('query', query) - .setField('fields', selectedFields.length ? selectedFields.map((f) => f.name) : ['*']) + .setField('fields', selectedFields.length ? selectedFields.map((f) => f.name) : ['']) + .setField('size', selectedFields.length ? 100 : 0) .setField('trackTotalHits', 100); - if (selectedNumericField) { - searchSource.setField('aggs', () => { - return data.search.aggs - .createAggConfigs(indexPattern, [ - { type: 'avg', params: { field: selectedNumericField.name } }, - ]) - .toDsl(); + const aggDef = []; + if (selectedBucketField) { + aggDef.push({ + type: 'terms', + schema: 'split', + params: { field: selectedBucketField.name, size: 2, otherBucket: true }, }); } + if (selectedNumericField) { + aggDef.push({ type: 'avg', params: { field: selectedNumericField.name } }); + } + if (aggDef.length > 0) { + const ac = data.search.aggs.createAggConfigs(indexPattern, aggDef); + searchSource.setField('aggs', ac); + } setRequest(searchSource.getSearchRequestBody()); const res = await searchSource.fetch$().toPromise(); setResponse(res); const message = Searched {res.hits.total} documents.; - notifications.toasts.addSuccess({ - title: 'Query result', - text: mountReactNode(message), - }); + notifications.toasts.addSuccess( + { + title: 'Query result', + text: mountReactNode(message), + }, + { + toastLifeTimeMs: 300000, + } + ); } catch (e) { setResponse(e.body); notifications.toasts.addWarning(`An error has occurred: ${e.message}`); @@ -263,6 +284,55 @@ export const SearchExamplesApp = ({ doSearchSourceSearch(); }; + const reqTabs = [ + { + id: 'request', + name: Request, + content: ( + <> + + Search body sent to ES + + {JSON.stringify(request, null, 2)} + + + ), + }, + { + id: 'response', + name: Response, + content: ( + <> + + + + + + {JSON.stringify(response, null, 2)} + + + ), + }, + ]; + return ( @@ -284,59 +354,75 @@ export const SearchExamplesApp = ({ useDefaultBehaviors={true} indexPatterns={indexPattern ? [indexPattern] : undefined} /> - + + + Index Pattern + { + const newIndexPattern = await data.indexPatterns.get(newIndexPatternId); + setIndexPattern(newIndexPattern); + }} + isClearable={false} + /> + + + Field (bucket) + { + if (option.length) { + const fld = indexPattern?.getFieldByName(option[0].label); + setSelectedBucketField(fld || null); + } else { + setSelectedBucketField(null); + } + }} + sortMatchesBy="startsWith" + data-test-subj="searchBucketField" + /> + + + Numeric Field (metric) + { + if (option.length) { + const fld = indexPattern?.getFieldByName(option[0].label); + setSelectedNumericField(fld || null); + } else { + setSelectedNumericField(null); + } + }} + sortMatchesBy="startsWith" + data-test-subj="searchMetricField" + /> + + + Fields to queryString + { + const flds = option + .map((opt) => indexPattern?.getFieldByName(opt?.label)) + .filter((f) => f); + setSelectedFields(flds.length ? (flds as IndexPatternField[]) : []); + }} + sortMatchesBy="startsWith" + /> + + + - - - - Index Pattern - { - const newIndexPattern = await data.indexPatterns.get(newIndexPatternId); - setIndexPattern(newIndexPattern); - }} - isClearable={false} - /> - - - Numeric Field to Aggregate - { - const fld = indexPattern?.getFieldByName(option[0].label); - setSelectedNumericField(fld || null); - }} - sortMatchesBy="startsWith" - /> - - - - - Fields to query (leave blank to include all fields) - { - const flds = option - .map((opt) => indexPattern?.getFieldByName(opt?.label)) - .filter((f) => f); - setSelectedFields(flds.length ? (flds as IndexPatternField[]) : []); - }} - sortMatchesBy="startsWith" - /> - - -

@@ -352,15 +438,32 @@ export const SearchExamplesApp = ({ - + + + + + + + @@ -446,41 +549,8 @@ export const SearchExamplesApp = ({ - - -

Request

-
- Search body sent to ES - - {JSON.stringify(request, null, 2)} - -
- - -

Response

-
- - - - - {JSON.stringify(response, null, 2)} - + + diff --git a/src/plugins/data/common/search/aggs/agg_configs.test.ts b/src/plugins/data/common/search/aggs/agg_configs.test.ts index 3ce528e6ed893..28102544ae055 100644 --- a/src/plugins/data/common/search/aggs/agg_configs.test.ts +++ b/src/plugins/data/common/search/aggs/agg_configs.test.ts @@ -342,8 +342,8 @@ describe('AggConfigs', () => { { enabled: true, type: 'max', schema: 'metric', params: { field: 'bytes' } }, ]; - const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); - const topLevelDsl = ac.toDsl(true); + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry, hierarchical: true }); + const topLevelDsl = ac.toDsl(); const buckets = ac.bySchemaName('buckets'); const metrics = ac.bySchemaName('metrics'); @@ -412,8 +412,8 @@ describe('AggConfigs', () => { }, ]; - const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); - const topLevelDsl = ac.toDsl(true)['2']; + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry, hierarchical: true }); + const topLevelDsl = ac.toDsl()['2']; expect(Object.keys(topLevelDsl.aggs)).toContain('1'); expect(Object.keys(topLevelDsl.aggs)).toContain('1-bucket'); diff --git a/src/plugins/data/common/search/aggs/agg_configs.ts b/src/plugins/data/common/search/aggs/agg_configs.ts index 4d5d49754387d..2932ef7325aed 100644 --- a/src/plugins/data/common/search/aggs/agg_configs.ts +++ b/src/plugins/data/common/search/aggs/agg_configs.ts @@ -43,6 +43,7 @@ function parseParentAggs(dslLvlCursor: any, dsl: any) { export interface AggConfigsOptions { typesRegistry: AggTypesRegistryStart; + hierarchical?: boolean; } export type CreateAggConfigParams = Assign; @@ -65,6 +66,8 @@ export class AggConfigs { public indexPattern: IndexPattern; public timeRange?: TimeRange; public timeFields?: string[]; + public hierarchical?: boolean = false; + private readonly typesRegistry: AggTypesRegistryStart; aggs: IAggConfig[]; @@ -80,6 +83,7 @@ export class AggConfigs { this.aggs = []; this.indexPattern = indexPattern; + this.hierarchical = opts.hierarchical; configStates.forEach((params: any) => this.createAggConfig(params)); } @@ -174,12 +178,12 @@ export class AggConfigs { return true; } - toDsl(hierarchical: boolean = false): Record { + toDsl(): Record { const dslTopLvl = {}; let dslLvlCursor: Record; let nestedMetrics: Array<{ config: AggConfig; dsl: Record }> | []; - if (hierarchical) { + if (this.hierarchical) { // collect all metrics, and filter out the ones that we won't be copying nestedMetrics = this.aggs .filter(function (agg) { diff --git a/src/plugins/data/common/search/aggs/agg_type.ts b/src/plugins/data/common/search/aggs/agg_type.ts index 33fdc45a605b7..f0f3912bf64fe 100644 --- a/src/plugins/data/common/search/aggs/agg_type.ts +++ b/src/plugins/data/common/search/aggs/agg_type.ts @@ -13,12 +13,23 @@ import { ISearchSource } from 'src/plugins/data/public'; import { DatatableColumnType, SerializedFieldFormat } from 'src/plugins/expressions/common'; import type { RequestAdapter } from 'src/plugins/inspector/common'; +import { estypes } from '@elastic/elasticsearch'; import { initParams } from './agg_params'; import { AggConfig } from './agg_config'; import { IAggConfigs } from './agg_configs'; import { BaseParamType } from './param_types/base'; import { AggParamType } from './param_types/agg'; +type PostFlightRequestFn = ( + resp: estypes.SearchResponse, + aggConfigs: IAggConfigs, + aggConfig: TAggConfig, + searchSource: ISearchSource, + inspectorRequestAdapter?: RequestAdapter, + abortSignal?: AbortSignal, + searchSessionId?: string +) => Promise>; + export interface AggTypeConfig< TAggConfig extends AggConfig = AggConfig, TParam extends AggParamType = AggParamType @@ -40,15 +51,7 @@ export interface AggTypeConfig< customLabels?: boolean; json?: boolean; decorateAggConfig?: () => any; - postFlightRequest?: ( - resp: any, - aggConfigs: IAggConfigs, - aggConfig: TAggConfig, - searchSource: ISearchSource, - inspectorRequestAdapter?: RequestAdapter, - abortSignal?: AbortSignal, - searchSessionId?: string - ) => Promise; + postFlightRequest?: PostFlightRequestFn; getSerializedFormat?: (agg: TAggConfig) => SerializedFieldFormat; getValue?: (agg: TAggConfig, bucket: any) => any; getKey?: (bucket: any, key: any, agg: TAggConfig) => any; @@ -188,15 +191,7 @@ export class AggType< * @param searchSessionId - searchSessionId to be used for grouping requests into a single search session * @return {Promise} */ - postFlightRequest: ( - resp: any, - aggConfigs: IAggConfigs, - aggConfig: TAggConfig, - searchSource: ISearchSource, - inspectorRequestAdapter?: RequestAdapter, - abortSignal?: AbortSignal, - searchSessionId?: string - ) => Promise; + postFlightRequest: PostFlightRequestFn; /** * Get the serialized format for the values produced by this agg type, * overridden by several metrics that always output a simple number. diff --git a/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.test.ts b/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.test.ts index 56e720d237c45..2aa0d346afe34 100644 --- a/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.test.ts @@ -433,7 +433,7 @@ describe('Terms Agg Other bucket helper', () => { aggConfigs.aggs[0] as IBucketAggConfig, otherAggConfig() ); - expect(mergedResponse.aggregations['1'].buckets[3].key).toEqual('__other__'); + expect((mergedResponse!.aggregations!['1'] as any).buckets[3].key).toEqual('__other__'); } }); @@ -455,7 +455,7 @@ describe('Terms Agg Other bucket helper', () => { otherAggConfig() ); - expect(mergedResponse.aggregations['1'].buckets[1]['2'].buckets[3].key).toEqual( + expect((mergedResponse!.aggregations!['1'] as any).buckets[1]['2'].buckets[3].key).toEqual( '__other__' ); } @@ -471,7 +471,7 @@ describe('Terms Agg Other bucket helper', () => { aggConfigs.aggs[0] as IBucketAggConfig ); expect( - updatedResponse.aggregations['1'].buckets.find( + (updatedResponse!.aggregations!['1'] as any).buckets.find( (bucket: Record) => bucket.key === '__missing__' ) ).toBeDefined(); diff --git a/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.ts b/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.ts index 742615bc49d8f..6230ae897b170 100644 --- a/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.ts +++ b/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.ts @@ -7,6 +7,7 @@ */ import { isNumber, keys, values, find, each, cloneDeep, flatten } from 'lodash'; +import { estypes } from '@elastic/elasticsearch'; import { buildExistsFilter, buildPhrasesFilter, buildQueryFromFilters } from '../../../../common'; import { AggGroupNames } from '../agg_groups'; import { IAggConfigs } from '../agg_configs'; @@ -42,7 +43,7 @@ const getNestedAggDSL = (aggNestedDsl: Record, startFromAggId: stri */ const getAggResultBuckets = ( aggConfigs: IAggConfigs, - response: any, + response: estypes.SearchResponse['aggregations'], aggWithOtherBucket: IBucketAggConfig, key: string ) => { @@ -72,8 +73,8 @@ const getAggResultBuckets = ( } } } - if (responseAgg[aggWithOtherBucket.id]) { - return responseAgg[aggWithOtherBucket.id].buckets; + if (responseAgg?.[aggWithOtherBucket.id]) { + return (responseAgg[aggWithOtherBucket.id] as any).buckets; } return []; }; @@ -235,11 +236,11 @@ export const buildOtherBucketAgg = ( export const mergeOtherBucketAggResponse = ( aggsConfig: IAggConfigs, - response: any, + response: estypes.SearchResponse, otherResponse: any, otherAgg: IBucketAggConfig, requestAgg: Record -) => { +): estypes.SearchResponse => { const updatedResponse = cloneDeep(response); each(otherResponse.aggregations['other-filter'].buckets, (bucket, key) => { if (!bucket.doc_count || key === undefined) return; @@ -276,7 +277,7 @@ export const mergeOtherBucketAggResponse = ( }; export const updateMissingBucket = ( - response: any, + response: estypes.SearchResponse, aggConfigs: IAggConfigs, agg: IBucketAggConfig ) => { diff --git a/src/plugins/data/common/search/aggs/buckets/terms.ts b/src/plugins/data/common/search/aggs/buckets/terms.ts index 77c9c6e391c0a..03cf14a577a50 100644 --- a/src/plugins/data/common/search/aggs/buckets/terms.ts +++ b/src/plugins/data/common/search/aggs/buckets/terms.ts @@ -101,25 +101,21 @@ export const getTermsBucketAgg = () => nestedSearchSource.setField('aggs', filterAgg); - const requestResponder = inspectorRequestAdapter?.start( - i18n.translate('data.search.aggs.buckets.terms.otherBucketTitle', { - defaultMessage: 'Other bucket', - }), - { - description: i18n.translate('data.search.aggs.buckets.terms.otherBucketDescription', { - defaultMessage: - 'This request counts the number of documents that fall ' + - 'outside the criterion of the data buckets.', - }), - searchSessionId, - } - ); - const response = await nestedSearchSource .fetch$({ abortSignal, sessionId: searchSessionId, - requestResponder, + inspector: { + adapter: inspectorRequestAdapter, + title: i18n.translate('data.search.aggs.buckets.terms.otherBucketTitle', { + defaultMessage: 'Other bucket', + }), + description: i18n.translate('data.search.aggs.buckets.terms.otherBucketDescription', { + defaultMessage: + 'This request counts the number of documents that fall ' + + 'outside the criterion of the data buckets.', + }), + }, }) .toPromise(); diff --git a/src/plugins/data/common/search/expressions/esaggs/request_handler.test.ts b/src/plugins/data/common/search/expressions/esaggs/request_handler.test.ts index c2566535916a8..b30e5740fa3fb 100644 --- a/src/plugins/data/common/search/expressions/esaggs/request_handler.test.ts +++ b/src/plugins/data/common/search/expressions/esaggs/request_handler.test.ts @@ -9,7 +9,7 @@ import type { MockedKeys } from '@kbn/utility-types/jest'; import type { Filter } from '../../../es_query'; import type { IndexPattern } from '../../../index_patterns'; -import type { IAggConfig, IAggConfigs } from '../../aggs'; +import type { IAggConfigs } from '../../aggs'; import type { ISearchSource } from '../../search_source'; import { searchSourceCommonMock } from '../../search_source/mocks'; @@ -38,7 +38,6 @@ describe('esaggs expression function - public', () => { filters: undefined, indexPattern: ({ id: 'logstash-*' } as unknown) as jest.Mocked, inspectorAdapters: {}, - metricsAtAllLevels: false, partialRows: false, query: undefined, searchSessionId: 'abc123', @@ -76,21 +75,7 @@ describe('esaggs expression function - public', () => { test('setField(aggs)', async () => { expect(searchSource.setField).toHaveBeenCalledTimes(5); - expect(typeof (searchSource.setField as jest.Mock).mock.calls[2][1]).toBe('function'); - expect((searchSource.setField as jest.Mock).mock.calls[2][1]()).toEqual( - mockParams.aggs.toDsl() - ); - expect(mockParams.aggs.toDsl).toHaveBeenCalledWith(mockParams.metricsAtAllLevels); - - // make sure param is passed through - jest.clearAllMocks(); - await handleRequest({ - ...mockParams, - metricsAtAllLevels: true, - }); - searchSource = await mockParams.searchSourceService.create(); - (searchSource.setField as jest.Mock).mock.calls[2][1](); - expect(mockParams.aggs.toDsl).toHaveBeenCalledWith(true); + expect((searchSource.setField as jest.Mock).mock.calls[2][1]).toEqual(mockParams.aggs); }); test('setField(filter)', async () => { @@ -133,36 +118,24 @@ describe('esaggs expression function - public', () => { test('calls searchSource.fetch', async () => { await handleRequest(mockParams); const searchSource = await mockParams.searchSourceService.create(); + expect(searchSource.fetch$).toHaveBeenCalledWith({ abortSignal: mockParams.abortSignal, sessionId: mockParams.searchSessionId, + inspector: { + title: 'Data', + description: 'This request queries Elasticsearch to fetch the data for the visualization.', + adapter: undefined, + }, }); }); - test('calls agg.postFlightRequest if it exiests and agg is enabled', async () => { - mockParams.aggs.aggs[0].enabled = true; - await handleRequest(mockParams); - expect(mockParams.aggs.aggs[0].type.postFlightRequest).toHaveBeenCalledTimes(1); - - // ensure it works if the function doesn't exist - jest.clearAllMocks(); - mockParams.aggs.aggs[0] = ({ type: { name: 'count' } } as unknown) as IAggConfig; - expect(async () => await handleRequest(mockParams)).not.toThrowError(); - }); - - test('should skip agg.postFlightRequest call if the agg is disabled', async () => { - mockParams.aggs.aggs[0].enabled = false; - await handleRequest(mockParams); - expect(mockParams.aggs.aggs[0].type.postFlightRequest).toHaveBeenCalledTimes(0); - }); - test('tabifies response data', async () => { await handleRequest(mockParams); expect(tabifyAggResponse).toHaveBeenCalledWith( mockParams.aggs, {}, { - metricsAtAllLevels: mockParams.metricsAtAllLevels, partialRows: mockParams.partialRows, timeRange: mockParams.timeRange, } diff --git a/src/plugins/data/common/search/expressions/esaggs/request_handler.ts b/src/plugins/data/common/search/expressions/esaggs/request_handler.ts index 5620698a47538..173b2067cad6b 100644 --- a/src/plugins/data/common/search/expressions/esaggs/request_handler.ts +++ b/src/plugins/data/common/search/expressions/esaggs/request_handler.ts @@ -40,28 +40,12 @@ export interface RequestHandlerParams { getNow?: () => Date; } -function getRequestMainResponder(inspectorAdapters: Adapters, searchSessionId?: string) { - return inspectorAdapters.requests?.start( - i18n.translate('data.functions.esaggs.inspector.dataRequest.title', { - defaultMessage: 'Data', - }), - { - description: i18n.translate('data.functions.esaggs.inspector.dataRequest.description', { - defaultMessage: - 'This request queries Elasticsearch to fetch the data for the visualization.', - }), - searchSessionId, - } - ); -} - export const handleRequest = async ({ abortSignal, aggs, filters, indexPattern, inspectorAdapters, - metricsAtAllLevels, partialRows, query, searchSessionId, @@ -100,9 +84,7 @@ export const handleRequest = async ({ }, }); - requestSearchSource.setField('aggs', function () { - return aggs.toDsl(metricsAtAllLevels); - }); + requestSearchSource.setField('aggs', aggs); requestSearchSource.onRequestStart((paramSearchSource, options) => { return aggs.onSearchRequestStart(paramSearchSource, options); @@ -128,35 +110,27 @@ export const handleRequest = async ({ requestSearchSource.setField('query', query); inspectorAdapters.requests?.reset(); - const requestResponder = getRequestMainResponder(inspectorAdapters, searchSessionId); - const response$ = await requestSearchSource.fetch$({ - abortSignal, - sessionId: searchSessionId, - requestResponder, - }); - - // Note that rawResponse is not deeply cloned here, so downstream applications using courier - // must take care not to mutate it, or it could have unintended side effects, e.g. displaying - // response data incorrectly in the inspector. - let response = await response$.toPromise(); - for (const agg of aggs.aggs) { - if (agg.enabled && typeof agg.type.postFlightRequest === 'function') { - response = await agg.type.postFlightRequest( - response, - aggs, - agg, - requestSearchSource, - inspectorAdapters.requests, - abortSignal, - searchSessionId - ); - } - } + const response = await requestSearchSource + .fetch$({ + abortSignal, + sessionId: searchSessionId, + inspector: { + adapter: inspectorAdapters.requests, + title: i18n.translate('data.functions.esaggs.inspector.dataRequest.title', { + defaultMessage: 'Data', + }), + description: i18n.translate('data.functions.esaggs.inspector.dataRequest.description', { + defaultMessage: + 'This request queries Elasticsearch to fetch the data for the visualization.', + }), + }, + }) + .toPromise(); const parsedTimeRange = timeRange ? calculateBounds(timeRange, { forceNow }) : null; const tabifyParams = { - metricsAtAllLevels, + metricsAtAllLevels: aggs.hierarchical, partialRows, timeRange: parsedTimeRange ? { from: parsedTimeRange.min, to: parsedTimeRange.max, timeFields: allTimeFields } diff --git a/src/plugins/data/common/search/search_source/inspect/inspector_stats.ts b/src/plugins/data/common/search/search_source/inspect/inspector_stats.ts index 24507a7e13058..e5a3acc23eee8 100644 --- a/src/plugins/data/common/search/search_source/inspect/inspector_stats.ts +++ b/src/plugins/data/common/search/search_source/inspect/inspector_stats.ts @@ -50,7 +50,7 @@ export function getRequestInspectorStats(searchSource: ISearchSource) { /** @public */ export function getResponseInspectorStats( - resp: estypes.SearchResponse, + resp?: estypes.SearchResponse, searchSource?: ISearchSource ) { const lastRequest = diff --git a/src/plugins/data/common/search/search_source/search_source.test.ts b/src/plugins/data/common/search/search_source/search_source.test.ts index 3726e5d0c33e8..7f8a4fceff05d 100644 --- a/src/plugins/data/common/search/search_source/search_source.test.ts +++ b/src/plugins/data/common/search/search_source/search_source.test.ts @@ -11,6 +11,10 @@ import { IndexPattern } from '../../index_patterns'; import { GetConfigFn } from '../../types'; import { fetchSoon } from './legacy'; import { SearchSource, SearchSourceDependencies, SortDirection } from './'; +import { AggConfigs, AggTypesRegistryStart } from '../../'; +import { mockAggTypesRegistry } from '../aggs/test_helpers'; +import { RequestResponder } from 'src/plugins/inspector/common'; +import { switchMap } from 'rxjs/operators'; jest.mock('./legacy', () => ({ fetchSoon: jest.fn().mockResolvedValue({}), @@ -39,6 +43,21 @@ const indexPattern2 = ({ getSourceFiltering: () => mockSource2, } as unknown) as IndexPattern; +const fields3 = [{ name: 'foo-bar' }, { name: 'field1' }, { name: 'field2' }]; +const indexPattern3 = ({ + title: 'foo', + fields: { + getByName: (name: string) => { + return fields3.find((field) => field.name === name); + }, + filter: () => { + return fields3; + }, + }, + getComputedFields, + getSourceFiltering: () => mockSource, +} as unknown) as IndexPattern; + const runtimeFieldDef = { type: 'keyword', script: { @@ -61,8 +80,8 @@ describe('SearchSource', () => { .fn() .mockReturnValue( of( - { rawResponse: { isPartial: true, isRunning: true } }, - { rawResponse: { isPartial: false, isRunning: false } } + { rawResponse: { test: 1 }, isPartial: true, isRunning: true }, + { rawResponse: { test: 2 }, isPartial: false, isRunning: false } ) ); @@ -81,17 +100,19 @@ describe('SearchSource', () => { describe('#getField()', () => { test('gets the value for the property', () => { - searchSource.setField('aggs', 5); - expect(searchSource.getField('aggs')).toBe(5); + searchSource.setField('aggs', { i: 5 }); + expect(searchSource.getField('aggs')).toStrictEqual({ i: 5 }); }); }); describe('#getFields()', () => { test('gets the value for the property', () => { - searchSource.setField('aggs', 5); + searchSource.setField('aggs', { i: 5 }); expect(searchSource.getFields()).toMatchInlineSnapshot(` Object { - "aggs": 5, + "aggs": Object { + "i": 5, + }, } `); }); @@ -100,7 +121,7 @@ describe('SearchSource', () => { describe('#removeField()', () => { test('remove property', () => { searchSource = new SearchSource({}, searchSourceDependencies); - searchSource.setField('aggs', 5); + searchSource.setField('aggs', { i: 5 }); searchSource.removeField('aggs'); expect(searchSource.getField('aggs')).toBeFalsy(); }); @@ -108,8 +129,20 @@ describe('SearchSource', () => { describe('#setField() / #flatten', () => { test('sets the value for the property', () => { - searchSource.setField('aggs', 5); - expect(searchSource.getField('aggs')).toBe(5); + searchSource.setField('aggs', { i: 5 }); + expect(searchSource.getField('aggs')).toStrictEqual({ i: 5 }); + }); + + test('sets the value for the property with AggConfigs', () => { + const typesRegistry = mockAggTypesRegistry(); + + const ac = new AggConfigs(indexPattern3, [{ type: 'avg', params: { field: 'field1' } }], { + typesRegistry, + }); + + searchSource.setField('aggs', ac); + const request = searchSource.getSearchRequestBody(); + expect(request.aggs).toStrictEqual({ '1': { avg: { field: 'field1' } } }); }); describe('computed fields handling', () => { @@ -631,7 +664,7 @@ describe('SearchSource', () => { const fn = jest.fn(); searchSource.onRequestStart(fn); const options = {}; - await searchSource.fetch(options); + await searchSource.fetch$(options).toPromise(); expect(fn).toBeCalledWith(searchSource, options); }); @@ -644,7 +677,7 @@ describe('SearchSource', () => { const parentFn = jest.fn(); parent.onRequestStart(parentFn); const options = {}; - await searchSource.fetch(options); + await searchSource.fetch$(options).toPromise(); expect(fn).toBeCalledWith(searchSource, options); expect(parentFn).not.toBeCalled(); @@ -664,69 +697,13 @@ describe('SearchSource', () => { const parentFn = jest.fn(); parent.onRequestStart(parentFn); const options = {}; - await searchSource.fetch(options); + await searchSource.fetch$(options).toPromise(); expect(fn).toBeCalledWith(searchSource, options); expect(parentFn).toBeCalledWith(searchSource, options); }); }); - describe('#legacy fetch()', () => { - beforeEach(() => { - searchSourceDependencies = { - ...searchSourceDependencies, - getConfig: jest.fn(() => { - return true; // batchSearches = true - }) as GetConfigFn, - }; - }); - - test('should call msearch', async () => { - searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies); - const options = {}; - await searchSource.fetch(options); - expect(fetchSoon).toBeCalledTimes(1); - }); - }); - - describe('#search service fetch()', () => { - test('should call msearch', async () => { - searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies); - const options = {}; - - await searchSource.fetch(options); - expect(mockSearchMethod).toBeCalledTimes(1); - }); - - test('should return partial results', (done) => { - searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies); - const options = {}; - - const next = jest.fn(); - const complete = () => { - expect(next).toBeCalledTimes(2); - expect(next.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "isPartial": true, - "isRunning": true, - }, - ] - `); - expect(next.mock.calls[1]).toMatchInlineSnapshot(` - Array [ - Object { - "isPartial": false, - "isRunning": false, - }, - ] - `); - done(); - }; - searchSource.fetch$(options).subscribe({ next, complete }); - }); - }); - describe('#serialize', () => { test('should reference index patterns', () => { const indexPattern123 = { id: '123' } as IndexPattern; @@ -884,4 +861,373 @@ describe('SearchSource', () => { ); }); }); + + describe('fetch$', () => { + describe('#legacy fetch()', () => { + beforeEach(() => { + searchSourceDependencies = { + ...searchSourceDependencies, + getConfig: jest.fn(() => { + return true; // batchSearches = true + }) as GetConfigFn, + }; + }); + + test('should call msearch', async () => { + searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies); + const options = {}; + await searchSource.fetch$(options).toPromise(); + expect(fetchSoon).toBeCalledTimes(1); + }); + }); + + describe('responses', () => { + test('should return partial results', async () => { + searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies); + const options = {}; + + const next = jest.fn(); + const complete = jest.fn(); + const res$ = searchSource.fetch$(options); + res$.subscribe({ next, complete }); + await res$.toPromise(); + + expect(next).toBeCalledTimes(2); + expect(complete).toBeCalledTimes(1); + expect(next.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + Object { + "test": 1, + }, + ] + `); + expect(next.mock.calls[1]).toMatchInlineSnapshot(` + Array [ + Object { + "test": 2, + }, + ] + `); + }); + + test('shareReplays result', async () => { + searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies); + const options = {}; + + const next = jest.fn(); + const complete = jest.fn(); + const next2 = jest.fn(); + const complete2 = jest.fn(); + const res$ = searchSource.fetch$(options); + res$.subscribe({ next, complete }); + res$.subscribe({ next: next2, complete: complete2 }); + await res$.toPromise(); + + expect(next).toBeCalledTimes(2); + expect(next2).toBeCalledTimes(2); + expect(complete).toBeCalledTimes(1); + expect(complete2).toBeCalledTimes(1); + expect(searchSourceDependencies.search).toHaveBeenCalledTimes(1); + }); + + test('should emit error on empty response', async () => { + searchSourceDependencies.search = mockSearchMethod = jest + .fn() + .mockReturnValue( + of({ rawResponse: { test: 1 }, isPartial: true, isRunning: true }, undefined) + ); + + searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies); + const options = {}; + + const next = jest.fn(); + const error = jest.fn(); + const complete = jest.fn(); + const res$ = searchSource.fetch$(options); + res$.subscribe({ next, error, complete }); + await res$.toPromise().catch((e) => {}); + + expect(next).toBeCalledTimes(1); + expect(error).toBeCalledTimes(1); + expect(complete).toBeCalledTimes(0); + expect(next.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + Object { + "test": 1, + }, + ] + `); + expect(error.mock.calls[0][0]).toBe(undefined); + }); + }); + + describe('inspector', () => { + let requestResponder: RequestResponder; + beforeEach(() => { + requestResponder = ({ + stats: jest.fn(), + ok: jest.fn(), + error: jest.fn(), + json: jest.fn(), + } as unknown) as RequestResponder; + }); + + test('calls inspector if provided', async () => { + const options = { + inspector: { + title: 'a', + adapter: { + start: jest.fn().mockReturnValue(requestResponder), + } as any, + }, + }; + + searchSource = new SearchSource({}, searchSourceDependencies); + searchSource.setField('index', indexPattern); + await searchSource.fetch$(options).toPromise(); + + expect(options.inspector.adapter.start).toBeCalledTimes(1); + expect(requestResponder.error).not.toBeCalled(); + expect(requestResponder.json).toBeCalledTimes(1); + expect(requestResponder.ok).toBeCalledTimes(1); + // First and last + expect(requestResponder.stats).toBeCalledTimes(2); + }); + + test('calls inspector only once, with multiple subs (shareReplay)', async () => { + const options = { + inspector: { + title: 'a', + adapter: { + start: jest.fn().mockReturnValue(requestResponder), + } as any, + }, + }; + + searchSource = new SearchSource({}, searchSourceDependencies); + searchSource.setField('index', indexPattern); + const res$ = searchSource.fetch$(options); + + const complete1 = jest.fn(); + const complete2 = jest.fn(); + + res$.subscribe({ + complete: complete1, + }); + res$.subscribe({ + complete: complete2, + }); + + await res$.toPromise(); + + expect(complete1).toBeCalledTimes(1); + expect(complete2).toBeCalledTimes(1); + expect(options.inspector.adapter.start).toBeCalledTimes(1); + }); + + test('calls error on inspector', async () => { + const options = { + inspector: { + title: 'a', + adapter: { + start: jest.fn().mockReturnValue(requestResponder), + } as any, + }, + }; + + searchSourceDependencies.search = jest.fn().mockReturnValue(of(Promise.reject('aaaaa'))); + + searchSource = new SearchSource({}, searchSourceDependencies); + searchSource.setField('index', indexPattern); + await searchSource + .fetch$(options) + .toPromise() + .catch(() => {}); + + expect(options.inspector.adapter.start).toBeCalledTimes(1); + expect(requestResponder.json).toBeCalledTimes(1); + expect(requestResponder.error).toBeCalledTimes(1); + expect(requestResponder.ok).toBeCalledTimes(0); + expect(requestResponder.stats).toBeCalledTimes(0); + }); + }); + + describe('postFlightRequest', () => { + let fetchSub: any; + + function getAggConfigs(typesRegistry: AggTypesRegistryStart, enabled: boolean) { + return new AggConfigs( + indexPattern3, + [ + { + type: 'avg', + enabled, + params: { field: 'field1' }, + }, + ], + { + typesRegistry, + } + ); + } + + beforeEach(() => { + fetchSub = { + next: jest.fn(), + complete: jest.fn(), + error: jest.fn(), + }; + }); + + test('doesnt call any post flight requests if disabled', async () => { + const typesRegistry = mockAggTypesRegistry(); + typesRegistry.get('avg').postFlightRequest = jest.fn(); + const ac = getAggConfigs(typesRegistry, false); + + searchSource = new SearchSource({}, searchSourceDependencies); + searchSource.setField('index', indexPattern); + searchSource.setField('aggs', ac); + const fetch$ = searchSource.fetch$({}); + fetch$.subscribe(fetchSub); + await fetch$.toPromise(); + + expect(fetchSub.next).toHaveBeenCalledTimes(2); + expect(fetchSub.complete).toHaveBeenCalledTimes(1); + expect(fetchSub.error).toHaveBeenCalledTimes(0); + + expect(typesRegistry.get('avg').postFlightRequest).toHaveBeenCalledTimes(0); + }); + + test('doesnt call any post flight if searchsource has error', async () => { + const typesRegistry = mockAggTypesRegistry(); + typesRegistry.get('avg').postFlightRequest = jest.fn(); + const ac = getAggConfigs(typesRegistry, true); + + searchSourceDependencies.search = jest.fn().mockImplementation(() => + of(1).pipe( + switchMap((r) => { + throw r; + }) + ) + ); + + searchSource = new SearchSource({}, searchSourceDependencies); + searchSource.setField('index', indexPattern); + searchSource.setField('aggs', ac); + const fetch$ = searchSource.fetch$({}); + fetch$.subscribe(fetchSub); + await fetch$.toPromise().catch((e) => {}); + + expect(fetchSub.next).toHaveBeenCalledTimes(0); + expect(fetchSub.complete).toHaveBeenCalledTimes(0); + expect(fetchSub.error).toHaveBeenNthCalledWith(1, 1); + + expect(typesRegistry.get('avg').postFlightRequest).toHaveBeenCalledTimes(0); + }); + + test('calls post flight requests, fires 1 extra response, returns last response', async () => { + const typesRegistry = mockAggTypesRegistry(); + typesRegistry.get('avg').postFlightRequest = jest.fn().mockResolvedValue({ + other: 5, + }); + + const allac = new AggConfigs( + indexPattern3, + [ + { + type: 'avg', + enabled: true, + params: { field: 'field1' }, + }, + { + type: 'avg', + enabled: true, + params: { field: 'field2' }, + }, + { + type: 'avg', + enabled: true, + params: { field: 'foo-bar' }, + }, + ], + { + typesRegistry, + } + ); + + searchSource = new SearchSource({}, searchSourceDependencies); + searchSource.setField('index', indexPattern); + searchSource.setField('aggs', allac); + const fetch$ = searchSource.fetch$({}); + fetch$.subscribe(fetchSub); + + const resp = await fetch$.toPromise(); + + expect(fetchSub.next).toHaveBeenCalledTimes(3); + expect(fetchSub.complete).toHaveBeenCalledTimes(1); + expect(fetchSub.error).toHaveBeenCalledTimes(0); + expect(resp).toStrictEqual({ other: 5 }); + expect(typesRegistry.get('avg').postFlightRequest).toHaveBeenCalledTimes(3); + }); + + test('calls post flight requests only once, with multiple subs (shareReplay)', async () => { + const typesRegistry = mockAggTypesRegistry(); + typesRegistry.get('avg').postFlightRequest = jest.fn().mockResolvedValue({ + other: 5, + }); + + const allac = new AggConfigs( + indexPattern3, + [ + { + type: 'avg', + enabled: true, + params: { field: 'field1' }, + }, + ], + { + typesRegistry, + } + ); + + searchSource = new SearchSource({}, searchSourceDependencies); + searchSource.setField('index', indexPattern); + searchSource.setField('aggs', allac); + const fetch$ = searchSource.fetch$({}); + fetch$.subscribe(fetchSub); + + const fetchSub2 = { + next: jest.fn(), + complete: jest.fn(), + error: jest.fn(), + }; + fetch$.subscribe(fetchSub2); + + await fetch$.toPromise(); + + expect(fetchSub.next).toHaveBeenCalledTimes(3); + expect(fetchSub.complete).toHaveBeenCalledTimes(1); + expect(typesRegistry.get('avg').postFlightRequest).toHaveBeenCalledTimes(1); + }); + + test('calls post flight requests, handles error', async () => { + const typesRegistry = mockAggTypesRegistry(); + typesRegistry.get('avg').postFlightRequest = jest.fn().mockRejectedValue(undefined); + const ac = getAggConfigs(typesRegistry, true); + + searchSource = new SearchSource({}, searchSourceDependencies); + searchSource.setField('index', indexPattern); + searchSource.setField('aggs', ac); + const fetch$ = searchSource.fetch$({}); + fetch$.subscribe(fetchSub); + + await fetch$.toPromise().catch(() => {}); + + expect(fetchSub.next).toHaveBeenCalledTimes(2); + expect(fetchSub.complete).toHaveBeenCalledTimes(0); + expect(fetchSub.error).toHaveBeenCalledTimes(1); + expect(typesRegistry.get('avg').postFlightRequest).toHaveBeenCalledTimes(1); + }); + }); + }); }); diff --git a/src/plugins/data/common/search/search_source/search_source.ts b/src/plugins/data/common/search/search_source/search_source.ts index e1e7a8292d677..1c1c32228703f 100644 --- a/src/plugins/data/common/search/search_source/search_source.ts +++ b/src/plugins/data/common/search/search_source/search_source.ts @@ -60,12 +60,22 @@ import { setWith } from '@elastic/safer-lodash-set'; import { uniqueId, keyBy, pick, difference, isFunction, isEqual, uniqWith, isObject } from 'lodash'; -import { catchError, finalize, map, switchMap, tap } from 'rxjs/operators'; -import { defer, from } from 'rxjs'; +import { + catchError, + finalize, + first, + last, + map, + shareReplay, + switchMap, + tap, +} from 'rxjs/operators'; +import { defer, EMPTY, from, Observable } from 'rxjs'; +import { estypes } from '@elastic/elasticsearch'; import { normalizeSortRequest } from './normalize_sort_request'; import { fieldWildcardFilter } from '../../../../kibana_utils/common'; import { IIndexPattern, IndexPattern, IndexPatternField } from '../../index_patterns'; -import { ISearchGeneric, ISearchOptions } from '../..'; +import { AggConfigs, ISearchGeneric, ISearchOptions } from '../..'; import type { ISearchSource, SearchFieldValue, @@ -75,7 +85,15 @@ import type { import { FetchHandlers, RequestFailure, getSearchParamsFromRequest, SearchRequest } from './fetch'; import { getRequestInspectorStats, getResponseInspectorStats } from './inspect'; -import { getEsQueryConfig, buildEsQuery, Filter, UI_SETTINGS } from '../../../common'; +import { + getEsQueryConfig, + buildEsQuery, + Filter, + UI_SETTINGS, + isErrorResponse, + isPartialResponse, + IKibanaSearchResponse, +} from '../../../common'; import { getHighlightRequest } from '../../../common/field_formats'; import { fetchSoon } from './legacy'; import { extractReferences } from './extract_references'; @@ -256,10 +274,8 @@ export class SearchSource { */ fetch$(options: ISearchOptions = {}) { const { getConfig } = this.dependencies; - return defer(() => this.requestIsStarting(options)).pipe( - tap(() => { - options.requestResponder?.stats(getRequestInspectorStats(this)); - }), + + const s$ = defer(() => this.requestIsStarting(options)).pipe( switchMap(() => { const searchRequest = this.flatten(); this.history = [searchRequest]; @@ -273,21 +289,14 @@ export class SearchSource { }), tap((response) => { // TODO: Remove casting when https://github.com/elastic/elasticsearch-js/issues/1287 is resolved - if ((response as any).error) { + if (!response || (response as any).error) { throw new RequestFailure(null, response); - } else { - options.requestResponder?.stats(getResponseInspectorStats(response, this)); - options.requestResponder?.ok({ json: response }); } }), - catchError((e) => { - options.requestResponder?.error({ json: e }); - throw e; - }), - finalize(() => { - options.requestResponder?.json(this.getSearchRequestBody()); - }) + shareReplay() ); + + return this.inspectSearch(s$, options); } /** @@ -328,9 +337,96 @@ export class SearchSource { * PRIVATE APIS ******/ + private inspectSearch(s$: Observable>, options: ISearchOptions) { + const { id, title, description, adapter } = options.inspector || { title: '' }; + + const requestResponder = adapter?.start(title, { + id, + description, + searchSessionId: options.sessionId, + }); + + const trackRequestBody = () => { + try { + requestResponder?.json(this.getSearchRequestBody()); + } catch (e) {} // eslint-disable-line no-empty + }; + + // Track request stats on first emit, swallow errors + const first$ = s$ + .pipe( + first(undefined, null), + tap(() => { + requestResponder?.stats(getRequestInspectorStats(this)); + trackRequestBody(); + }), + catchError(() => { + trackRequestBody(); + return EMPTY; + }), + finalize(() => { + first$.unsubscribe(); + }) + ) + .subscribe(); + + // Track response stats on last emit, as well as errors + const last$ = s$ + .pipe( + catchError((e) => { + requestResponder?.error({ json: e }); + return EMPTY; + }), + last(undefined, null), + tap((finalResponse) => { + if (finalResponse) { + requestResponder?.stats(getResponseInspectorStats(finalResponse, this)); + requestResponder?.ok({ json: finalResponse }); + } + }), + finalize(() => { + last$.unsubscribe(); + }) + ) + .subscribe(); + + return s$; + } + + private hasPostFlightRequests() { + const aggs = this.getField('aggs'); + if (aggs instanceof AggConfigs) { + return aggs.aggs.some( + (agg) => agg.enabled && typeof agg.type.postFlightRequest === 'function' + ); + } else { + return false; + } + } + + private async fetchOthers(response: estypes.SearchResponse, options: ISearchOptions) { + const aggs = this.getField('aggs'); + if (aggs instanceof AggConfigs) { + for (const agg of aggs.aggs) { + if (agg.enabled && typeof agg.type.postFlightRequest === 'function') { + response = await agg.type.postFlightRequest( + response, + aggs, + agg, + this, + options.inspector?.adapter, + options.abortSignal, + options.sessionId + ); + } + } + return response; + } + } + /** * Run a search using the search service - * @return {Promise>} + * @return {Observable>} */ private fetchSearch$(searchRequest: SearchRequest, options: ISearchOptions) { const { search, getConfig, onResponse } = this.dependencies; @@ -340,6 +436,43 @@ export class SearchSource { }); return search({ params, indexType: searchRequest.indexType }, options).pipe( + switchMap((response) => { + return new Observable>((obs) => { + if (isErrorResponse(response)) { + obs.error(response); + } else if (isPartialResponse(response)) { + obs.next(response); + } else { + if (!this.hasPostFlightRequests()) { + obs.next(response); + obs.complete(); + } else { + // Treat the complete response as partial, then run the postFlightRequests. + obs.next({ + ...response, + isPartial: true, + isRunning: true, + }); + const sub = from(this.fetchOthers(response.rawResponse, options)).subscribe({ + next: (responseWithOther) => { + obs.next({ + ...response, + rawResponse: responseWithOther, + }); + }, + error: (e) => { + obs.error(e); + sub.unsubscribe(); + }, + complete: () => { + obs.complete(); + sub.unsubscribe(); + }, + }); + } + } + }); + }), map(({ rawResponse }) => onResponse(searchRequest, rawResponse)) ); } @@ -452,6 +585,12 @@ export class SearchSource { getConfig(UI_SETTINGS.SORT_OPTIONS) ); return addToBody(key, sort); + case 'aggs': + if ((val as any) instanceof AggConfigs) { + return addToBody('aggs', val.toDsl()); + } else { + return addToBody('aggs', val); + } default: return addToBody(key, val); } diff --git a/src/plugins/data/common/search/search_source/types.ts b/src/plugins/data/common/search/search_source/types.ts index a178b38693d92..99f3f67a5e257 100644 --- a/src/plugins/data/common/search/search_source/types.ts +++ b/src/plugins/data/common/search/search_source/types.ts @@ -7,6 +7,7 @@ */ import { NameList } from 'elasticsearch'; +import { IAggConfigs } from 'src/plugins/data/public'; import { Query } from '../..'; import { Filter } from '../../es_query'; import { IndexPattern } from '../../index_patterns'; @@ -78,7 +79,7 @@ export interface SearchSourceFields { /** * {@link AggConfigs} */ - aggs?: any; + aggs?: object | IAggConfigs | (() => object); from?: number; size?: number; source?: NameList; diff --git a/src/plugins/data/common/search/tabify/index.ts b/src/plugins/data/common/search/tabify/index.ts index 168d4cf9d4c37..74fbc7ba4cfa4 100644 --- a/src/plugins/data/common/search/tabify/index.ts +++ b/src/plugins/data/common/search/tabify/index.ts @@ -6,27 +6,6 @@ * Side Public License, v 1. */ -import { SearchResponse } from 'elasticsearch'; -import { SearchSource } from '../search_source'; -import { tabifyAggResponse } from './tabify'; -import { tabifyDocs, TabifyDocsOptions } from './tabify_docs'; -import { TabbedResponseWriterOptions } from './types'; - -export const tabify = ( - searchSource: SearchSource, - esResponse: SearchResponse, - opts: Partial | TabifyDocsOptions -) => { - return !esResponse.aggregations - ? tabifyDocs(esResponse, searchSource.getField('index'), opts as TabifyDocsOptions) - : tabifyAggResponse( - searchSource.getField('aggs'), - esResponse, - opts as Partial - ); -}; - -export { tabifyDocs }; - +export { tabifyDocs } from './tabify_docs'; export { tabifyAggResponse } from './tabify'; export { tabifyGetColumns } from './get_columns'; diff --git a/src/plugins/data/common/search/types.ts b/src/plugins/data/common/search/types.ts index 37de8dc49d3c6..e3ec499a0020d 100644 --- a/src/plugins/data/common/search/types.ts +++ b/src/plugins/data/common/search/types.ts @@ -9,7 +9,7 @@ import { Observable } from 'rxjs'; import { IEsSearchRequest, IEsSearchResponse } from './es_search'; import { IndexPattern } from '..'; -import type { RequestResponder } from '../../../inspector/common'; +import type { RequestAdapter } from '../../../inspector/common'; export type ISearchGeneric = < SearchStrategyRequest extends IKibanaSearchRequest = IEsSearchRequest, @@ -81,6 +81,13 @@ export interface IKibanaSearchRequest { params?: Params; } +export interface IInspectorInfo { + adapter?: RequestAdapter; + title: string; + id?: string; + description?: string; +} + export interface ISearchOptions { /** * An `AbortSignal` that allows the caller of `search` to abort a search request. @@ -117,10 +124,12 @@ export interface ISearchOptions { /** * Index pattern reference is used for better error messages */ - indexPattern?: IndexPattern; - requestResponder?: RequestResponder; + /** + * Inspector integration options + */ + inspector?: IInspectorInfo; } /** diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index 35f13fc855e99..0dd06691d68bb 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -46,6 +46,7 @@ import { FormatFactory as FormatFactory_2 } from 'src/plugins/data/common/field_ import { History } from 'history'; import { Href } from 'history'; import { HttpSetup } from 'kibana/public'; +import { IAggConfigs as IAggConfigs_2 } from 'src/plugins/data/public'; import { IconType } from '@elastic/eui'; import { IncomingHttpHeaders } from 'http'; import { InjectedIntl } from '@kbn/i18n/react'; @@ -254,6 +255,8 @@ export class AggConfigs { getResponseAggById(id: string): AggConfig | undefined; getResponseAggs(): AggConfig[]; // (undocumented) + hierarchical?: boolean; + // (undocumented) indexPattern: IndexPattern; jsonDataEquals(aggConfigs: AggConfig[]): boolean; // (undocumented) @@ -267,7 +270,7 @@ export class AggConfigs { // (undocumented) timeRange?: TimeRange; // (undocumented) - toDsl(hierarchical?: boolean): Record; + toDsl(): Record; } // @internal (undocumented) @@ -1672,13 +1675,11 @@ export type ISearchGeneric = >; + fetch$(options?: ISearchOptions): Observable>; // @deprecated - fetch(options?: ISearchOptions): Promise>; + fetch(options?: ISearchOptions): Promise>; getField(field: K, recurse?: boolean): SearchSourceFields[K]; getFields(): SearchSourceFields; getId(): string; @@ -2462,7 +2463,7 @@ export class SearchSource { // @public export interface SearchSourceFields { // (undocumented) - aggs?: any; + aggs?: object | IAggConfigs_2 | (() => object); // Warning: (ae-forgotten-export) The symbol "SearchFieldValue" needs to be exported by the entry point index.d.ts fields?: SearchFieldValue[]; // @deprecated diff --git a/src/plugins/data/public/search/expressions/esaggs.test.ts b/src/plugins/data/public/search/expressions/esaggs.test.ts index d7a6446781c43..e75bd7be219de 100644 --- a/src/plugins/data/public/search/expressions/esaggs.test.ts +++ b/src/plugins/data/public/search/expressions/esaggs.test.ts @@ -100,17 +100,20 @@ describe('esaggs expression function - public', () => { expect(handleEsaggsRequest).toHaveBeenCalledWith({ abortSignal: mockHandlers.abortSignal, - aggs: { foo: 'bar' }, + aggs: { + foo: 'bar', + hierarchical: true, + }, filters: undefined, indexPattern: {}, inspectorAdapters: mockHandlers.inspectorAdapters, - metricsAtAllLevels: args.metricsAtAllLevels, partialRows: args.partialRows, query: undefined, searchSessionId: 'abc123', searchSourceService: startDependencies.searchSource, timeFields: args.timeFields, timeRange: undefined, + getNow: undefined, }); }); diff --git a/src/plugins/data/public/search/expressions/esaggs.ts b/src/plugins/data/public/search/expressions/esaggs.ts index 45d24af3a6ebb..1e3d56c71e423 100644 --- a/src/plugins/data/public/search/expressions/esaggs.ts +++ b/src/plugins/data/public/search/expressions/esaggs.ts @@ -8,7 +8,6 @@ import { get } from 'lodash'; import { StartServicesAccessor } from 'src/core/public'; -import { Adapters } from 'src/plugins/inspector/common'; import { EsaggsExpressionFunctionDefinition, EsaggsStartDependencies, @@ -44,14 +43,14 @@ export function getFunctionDefinition({ indexPattern, args.aggs!.map((agg) => agg.value) ); + aggConfigs.hierarchical = args.metricsAtAllLevels; return await handleEsaggsRequest({ - abortSignal: (abortSignal as unknown) as AbortSignal, + abortSignal, aggs: aggConfigs, filters: get(input, 'filters', undefined), indexPattern, - inspectorAdapters: inspectorAdapters as Adapters, - metricsAtAllLevels: args.metricsAtAllLevels, + inspectorAdapters, partialRows: args.partialRows, query: get(input, 'query', undefined) as any, searchSessionId: getSearchSessionId(), diff --git a/src/plugins/data/server/search/expressions/esaggs.test.ts b/src/plugins/data/server/search/expressions/esaggs.test.ts index 124a171de6378..15287e9d8cf5b 100644 --- a/src/plugins/data/server/search/expressions/esaggs.test.ts +++ b/src/plugins/data/server/search/expressions/esaggs.test.ts @@ -108,11 +108,13 @@ describe('esaggs expression function - server', () => { expect(handleEsaggsRequest).toHaveBeenCalledWith({ abortSignal: mockHandlers.abortSignal, - aggs: { foo: 'bar' }, + aggs: { + foo: 'bar', + hierarchical: args.metricsAtAllLevels, + }, filters: undefined, indexPattern: {}, inspectorAdapters: mockHandlers.inspectorAdapters, - metricsAtAllLevels: args.metricsAtAllLevels, partialRows: args.partialRows, query: undefined, searchSessionId: 'abc123', diff --git a/src/plugins/data/server/search/expressions/esaggs.ts b/src/plugins/data/server/search/expressions/esaggs.ts index 61fd320d89b95..bb22a491b157e 100644 --- a/src/plugins/data/server/search/expressions/esaggs.ts +++ b/src/plugins/data/server/search/expressions/esaggs.ts @@ -9,7 +9,6 @@ import { get } from 'lodash'; import { i18n } from '@kbn/i18n'; import { KibanaRequest, StartServicesAccessor } from 'src/core/server'; -import { Adapters } from 'src/plugins/inspector/common'; import { EsaggsExpressionFunctionDefinition, EsaggsStartDependencies, @@ -61,13 +60,14 @@ export function getFunctionDefinition({ args.aggs!.map((agg) => agg.value) ); + aggConfigs.hierarchical = args.metricsAtAllLevels; + return await handleEsaggsRequest({ - abortSignal: (abortSignal as unknown) as AbortSignal, + abortSignal, aggs: aggConfigs, filters: get(input, 'filters', undefined), indexPattern, - inspectorAdapters: inspectorAdapters as Adapters, - metricsAtAllLevels: args.metricsAtAllLevels, + inspectorAdapters, partialRows: args.partialRows, query: get(input, 'query', undefined) as any, searchSessionId: getSearchSessionId(), diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 622356c4441ac..3316e8102e50a 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -26,12 +26,14 @@ import { Ensure } from '@kbn/utility-types'; import { EnvironmentMode } from '@kbn/config'; import { ErrorToastOptions } from 'src/core/public/notifications'; import { estypes } from '@elastic/elasticsearch'; +import { EventEmitter } from 'events'; import { ExecutionContext } from 'src/plugins/expressions/common'; import { ExpressionAstExpression } from 'src/plugins/expressions/common'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { ExpressionsServerSetup } from 'src/plugins/expressions/server'; import { ExpressionValueBoxed } from 'src/plugins/expressions/common'; import { FormatFactory as FormatFactory_2 } from 'src/plugins/data/common/field_formats/utils'; +import { IAggConfigs as IAggConfigs_2 } from 'src/plugins/data/public'; import { ISavedObjectsRepository } from 'src/core/server'; import { IScopedClusterClient } from 'src/core/server'; import { ISearchOptions as ISearchOptions_2 } from 'src/plugins/data/public'; @@ -999,13 +1001,11 @@ export interface IScopedSearchClient extends ISearchClient { export interface ISearchOptions { abortSignal?: AbortSignal; indexPattern?: IndexPattern; + // Warning: (ae-forgotten-export) The symbol "IInspectorInfo" needs to be exported by the entry point index.d.ts + inspector?: IInspectorInfo; isRestore?: boolean; isStored?: boolean; legacyHitsTotal?: boolean; - // Warning: (ae-forgotten-export) The symbol "RequestResponder" needs to be exported by the entry point index.d.ts - // - // (undocumented) - requestResponder?: RequestResponder; sessionId?: string; strategy?: string; } diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index 35a89eb45f35e..4099d5e8ef7e2 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -415,11 +415,20 @@ function discoverController($route, $scope) { $scope.fetchStatus = fetchStatuses.LOADING; $scope.resultState = getResultState($scope.fetchStatus, $scope.rows); + inspectorAdapters.requests.reset(); return $scope.volatileSearchSource .fetch$({ abortSignal: abortController.signal, sessionId: searchSessionId, - requestResponder: getRequestResponder({ searchSessionId }), + inspector: { + adapter: inspectorAdapters.requests, + title: i18n.translate('discover.inspectorRequestDataTitle', { + defaultMessage: 'data', + }), + description: i18n.translate('discover.inspectorRequestDescription', { + defaultMessage: 'This request queries Elasticsearch to fetch the data for the search.', + }), + }, }) .toPromise() .then(onResults) @@ -465,17 +474,6 @@ function discoverController($route, $scope) { await refetch$.next(); }; - function getRequestResponder({ searchSessionId = null } = { searchSessionId: null }) { - inspectorAdapters.requests.reset(); - const title = i18n.translate('discover.inspectorRequestDataTitle', { - defaultMessage: 'data', - }); - const description = i18n.translate('discover.inspectorRequestDescription', { - defaultMessage: 'This request queries Elasticsearch to fetch the data for the search.', - }); - return inspectorAdapters.requests.start(title, { description, searchSessionId }); - } - $scope.resetQuery = function () { history.push( $route.current.params.id ? `/view/${encodeURIComponent($route.current.params.id)}` : '/' diff --git a/src/plugins/discover/public/application/embeddable/search_embeddable.ts b/src/plugins/discover/public/application/embeddable/search_embeddable.ts index 237da72ae3a52..dbaf07fed18c2 100644 --- a/src/plugins/discover/public/application/embeddable/search_embeddable.ts +++ b/src/plugins/discover/public/application/embeddable/search_embeddable.ts @@ -317,17 +317,6 @@ export class SearchEmbeddable // Log request to inspector this.inspectorAdapters.requests!.reset(); - const title = i18n.translate('discover.embeddable.inspectorRequestDataTitle', { - defaultMessage: 'Data', - }); - const description = i18n.translate('discover.embeddable.inspectorRequestDescription', { - defaultMessage: 'This request queries Elasticsearch to fetch the data for the search.', - }); - - const requestResponder = this.inspectorAdapters.requests!.start(title, { - description, - searchSessionId, - }); this.searchScope.$apply(() => { this.searchScope!.isLoading = true; @@ -340,7 +329,16 @@ export class SearchEmbeddable .fetch$({ abortSignal: this.abortController.signal, sessionId: searchSessionId, - requestResponder, + inspector: { + adapter: this.inspectorAdapters.requests, + title: i18n.translate('discover.embeddable.inspectorRequestDataTitle', { + defaultMessage: 'Data', + }), + description: i18n.translate('discover.embeddable.inspectorRequestDescription', { + defaultMessage: + 'This request queries Elasticsearch to fetch the data for the search.', + }), + }, }) .toPromise(); this.updateOutput({ loading: false, error: undefined }); diff --git a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts index 2915eaec8ac77..50043772af95b 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts +++ b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts @@ -167,12 +167,6 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource const abortController = new AbortController(); registerCancelCallback(() => abortController.abort()); - const requestResponder = this.getInspectorAdapters()?.requests?.start(requestName, { - id: requestId, - description: requestDescription, - searchSessionId, - }); - let resp; try { resp = await searchSource @@ -180,7 +174,12 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource abortSignal: abortController.signal, sessionId: searchSessionId, legacyHitsTotal: false, - requestResponder, + inspector: { + adapter: this.getInspectorAdapters()?.requests, + id: requestId, + title: requestName, + description: requestDescription, + }, }) .toPromise(); } catch (error) { diff --git a/x-pack/test/examples/search_examples/index.ts b/x-pack/test/examples/search_examples/index.ts index 13eac7566525e..65e214cda4cf8 100644 --- a/x-pack/test/examples/search_examples/index.ts +++ b/x-pack/test/examples/search_examples/index.ts @@ -23,7 +23,8 @@ export default function ({ getService, loadTestFile }: PluginFunctionalProviderC await esArchiver.unload('lens/basic'); }); - loadTestFile(require.resolve('./search_sessions_cache')); loadTestFile(require.resolve('./search_session_example')); + loadTestFile(require.resolve('./search_example')); + loadTestFile(require.resolve('./search_sessions_cache')); }); } diff --git a/x-pack/test/examples/search_examples/search_example.ts b/x-pack/test/examples/search_examples/search_example.ts new file mode 100644 index 0000000000000..19a9535ebb951 --- /dev/null +++ b/x-pack/test/examples/search_examples/search_example.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../../functional/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const testSubjects = getService('testSubjects'); + const PageObjects = getPageObjects(['common', 'timePicker']); + const retry = getService('retry'); + + describe.skip('Search session example', () => { + const appId = 'searchExamples'; + + before(async function () { + await PageObjects.common.navigateToApp(appId, { insertTimestamp: false }); + }); + + it('should have an other bucket', async () => { + await PageObjects.timePicker.setAbsoluteRange( + 'Jan 1, 2014 @ 00:00:00.000', + 'Jan 1, 2016 @ 00:00:00.000' + ); + await testSubjects.click('searchSourceWithOther'); + + await retry.waitFor('has other bucket', async () => { + await testSubjects.click('responseTab'); + const codeBlock = await testSubjects.find('responseCodeBlock'); + const visibleText = await codeBlock.getVisibleText(); + return visibleText.indexOf('__other__') > -1; + }); + }); + }); +} From fed17c2b6e71deefb4ff30a1eabff1cb485de283 Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Sun, 18 Apr 2021 16:40:54 +0200 Subject: [PATCH 62/68] Rule registry bundle size (#97251) --- x-pack/plugins/apm/common/alert_types.ts | 6 +-- .../plugins/apm/common/anomaly_detection.ts | 2 +- x-pack/plugins/apm/common/ml_constants.ts | 24 ++++++++++++ x-pack/plugins/apm/common/rules.ts | 25 ------------ .../apm/common/rules/apm_rule_field_map.ts | 20 ++++++++++ .../rules/apm_rule_registry_settings.ts | 10 +++++ .../apm/common/service_health_status.ts | 2 +- .../alerting/register_apm_alerts.ts | 19 +++++++--- .../index.tsx | 2 +- .../select_anomaly_severity.test.tsx | 2 +- x-pack/plugins/apm/public/plugin.ts | 38 ++++++++++--------- ...action_duration_anomaly_alert_type.test.ts | 2 +- ...transaction_duration_anomaly_alert_type.ts | 2 +- .../transactions/get_anomaly_data/index.ts | 2 +- x-pack/plugins/apm/server/plugin.ts | 10 +++-- .../common/observability_rule_registry.ts | 22 ----------- .../rules/observability_rule_field_map.ts | 22 +++++++++++ .../observability_rule_registry_settings.ts | 10 +++++ .../public/pages/alerts/index.tsx | 3 +- x-pack/plugins/observability/public/plugin.ts | 24 ++++++------ .../public/rules/formatter_rule_registry.ts | 5 +++ x-pack/plugins/observability/server/plugin.ts | 10 +++-- x-pack/plugins/rule_registry/kibana.json | 5 +-- x-pack/plugins/rule_registry/public/index.ts | 4 +- x-pack/plugins/rule_registry/public/plugin.ts | 4 +- .../public/rule_registry/types.ts | 4 +- 26 files changed, 169 insertions(+), 110 deletions(-) create mode 100644 x-pack/plugins/apm/common/ml_constants.ts delete mode 100644 x-pack/plugins/apm/common/rules.ts create mode 100644 x-pack/plugins/apm/common/rules/apm_rule_field_map.ts create mode 100644 x-pack/plugins/apm/common/rules/apm_rule_registry_settings.ts delete mode 100644 x-pack/plugins/observability/common/observability_rule_registry.ts create mode 100644 x-pack/plugins/observability/common/rules/observability_rule_field_map.ts create mode 100644 x-pack/plugins/observability/common/rules/observability_rule_registry_settings.ts diff --git a/x-pack/plugins/apm/common/alert_types.ts b/x-pack/plugins/apm/common/alert_types.ts index 62bd07ce6f500..12df93d54b296 100644 --- a/x-pack/plugins/apm/common/alert_types.ts +++ b/x-pack/plugins/apm/common/alert_types.ts @@ -6,9 +6,9 @@ */ import { i18n } from '@kbn/i18n'; -import { ValuesType } from 'utility-types'; -import { ActionGroup } from '../../alerting/common'; -import { ANOMALY_SEVERITY, ANOMALY_THRESHOLD } from '../../ml/common'; +import type { ValuesType } from 'utility-types'; +import type { ActionGroup } from '../../alerting/common'; +import { ANOMALY_SEVERITY, ANOMALY_THRESHOLD } from './ml_constants'; export enum AlertType { ErrorCount = 'apm.error_rate', // ErrorRate was renamed to ErrorCount but the key is kept as `error_rate` for backwards-compat. diff --git a/x-pack/plugins/apm/common/anomaly_detection.ts b/x-pack/plugins/apm/common/anomaly_detection.ts index b9cc3de8bb5d0..43a779407d2a4 100644 --- a/x-pack/plugins/apm/common/anomaly_detection.ts +++ b/x-pack/plugins/apm/common/anomaly_detection.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { ANOMALY_SEVERITY } from '../../ml/common'; +import { ANOMALY_SEVERITY } from './ml_constants'; import { getSeverityType, getSeverityColor as mlGetSeverityColor, diff --git a/x-pack/plugins/apm/common/ml_constants.ts b/x-pack/plugins/apm/common/ml_constants.ts new file mode 100644 index 0000000000000..7818299d9d883 --- /dev/null +++ b/x-pack/plugins/apm/common/ml_constants.ts @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +// copied from ml/common, to keep the bundle size small +export enum ANOMALY_SEVERITY { + CRITICAL = 'critical', + MAJOR = 'major', + MINOR = 'minor', + WARNING = 'warning', + LOW = 'low', + UNKNOWN = 'unknown', +} + +export enum ANOMALY_THRESHOLD { + CRITICAL = 75, + MAJOR = 50, + MINOR = 25, + WARNING = 3, + LOW = 0, +} diff --git a/x-pack/plugins/apm/common/rules.ts b/x-pack/plugins/apm/common/rules.ts deleted file mode 100644 index a3b60a785f5c7..0000000000000 --- a/x-pack/plugins/apm/common/rules.ts +++ /dev/null @@ -1,25 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -const plainApmRuleRegistrySettings = { - name: 'apm', - fieldMap: { - 'service.environment': { - type: 'keyword', - }, - 'transaction.type': { - type: 'keyword', - }, - 'processor.event': { - type: 'keyword', - }, - }, -} as const; - -type APMRuleRegistrySettings = typeof plainApmRuleRegistrySettings; - -export const apmRuleRegistrySettings: APMRuleRegistrySettings = plainApmRuleRegistrySettings; diff --git a/x-pack/plugins/apm/common/rules/apm_rule_field_map.ts b/x-pack/plugins/apm/common/rules/apm_rule_field_map.ts new file mode 100644 index 0000000000000..9bbd9381c2319 --- /dev/null +++ b/x-pack/plugins/apm/common/rules/apm_rule_field_map.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const apmRuleFieldMap = { + 'service.environment': { + type: 'keyword', + }, + 'transaction.type': { + type: 'keyword', + }, + 'processor.event': { + type: 'keyword', + }, +} as const; + +export type APMRuleFieldMap = typeof apmRuleFieldMap; diff --git a/x-pack/plugins/apm/common/rules/apm_rule_registry_settings.ts b/x-pack/plugins/apm/common/rules/apm_rule_registry_settings.ts new file mode 100644 index 0000000000000..1257db4e6a4d3 --- /dev/null +++ b/x-pack/plugins/apm/common/rules/apm_rule_registry_settings.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const apmRuleRegistrySettings = { + name: 'apm', +}; diff --git a/x-pack/plugins/apm/common/service_health_status.ts b/x-pack/plugins/apm/common/service_health_status.ts index 71c373a48c9d5..b5318f9333e4f 100644 --- a/x-pack/plugins/apm/common/service_health_status.ts +++ b/x-pack/plugins/apm/common/service_health_status.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { EuiTheme } from '../../../../src/plugins/kibana_react/common'; -import { ANOMALY_SEVERITY } from '../../ml/common'; +import { ANOMALY_SEVERITY } from './ml_constants'; export enum ServiceHealthStatus { healthy = 'healthy', diff --git a/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts b/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts index 8834cbc70e0b1..583be94c30a34 100644 --- a/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts +++ b/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts @@ -7,11 +7,20 @@ import { i18n } from '@kbn/i18n'; import { lazy } from 'react'; -import { format } from 'url'; +import { stringify } from 'querystring'; import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values'; -import { asDuration, asPercent } from '../../../common/utils/formatters'; import { AlertType } from '../../../common/alert_types'; -import { ApmRuleRegistry } from '../../plugin'; +import type { ApmRuleRegistry } from '../../plugin'; + +const format = ({ + pathname, + query, +}: { + pathname: string; + query: Record; +}): string => { + return `${pathname}?${stringify(query)}`; +}; export function registerApmAlerts(apmRuleRegistry: ApmRuleRegistry) { apmRuleRegistry.registerType({ @@ -71,7 +80,7 @@ export function registerApmAlerts(apmRuleRegistry: ApmRuleRegistry) { 'Alert when the latency of a specific transaction type in a service exceeds a defined threshold.', } ), - format: ({ alert }) => ({ + format: ({ alert, formatters: { asDuration } }) => ({ reason: i18n.translate( 'xpack.apm.alertTypes.transactionDuration.reason', { @@ -131,7 +140,7 @@ export function registerApmAlerts(apmRuleRegistry: ApmRuleRegistry) { 'Alert when the rate of transaction errors in a service exceeds a defined threshold.', } ), - format: ({ alert }) => ({ + format: ({ alert, formatters: { asPercent } }) => ({ reason: i18n.translate( 'xpack.apm.alertTypes.transactionErrorRate.reason', { diff --git a/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/index.tsx b/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/index.tsx index 62926796cafb4..10d139f6ccea3 100644 --- a/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/index.tsx +++ b/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/index.tsx @@ -8,7 +8,7 @@ import { useParams } from 'react-router-dom'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import { ANOMALY_SEVERITY } from '../../../../../ml/common'; +import { ANOMALY_SEVERITY } from '../../../../common/ml_constants'; import { useEnvironmentsFetcher } from '../../../hooks/use_environments_fetcher'; import { useUrlParams } from '../../../context/url_params_context/use_url_params'; import { ServiceAlertTrigger } from '../service_alert_trigger'; diff --git a/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/select_anomaly_severity.test.tsx b/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/select_anomaly_severity.test.tsx index 85f48ae151e10..7b56eaa4721de 100644 --- a/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/select_anomaly_severity.test.tsx +++ b/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/select_anomaly_severity.test.tsx @@ -8,7 +8,7 @@ import { render } from '@testing-library/react'; import React, { ReactNode } from 'react'; import { IntlProvider } from 'react-intl'; -import { ANOMALY_SEVERITY } from '../../../../../ml/common'; +import { ANOMALY_SEVERITY } from '../../../../common/ml_constants'; import { SelectAnomalySeverity } from './select_anomaly_severity'; function Wrapper({ children }: { children?: ReactNode }) { diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts index 391c54c1e2497..143076e56c831 100644 --- a/x-pack/plugins/apm/public/plugin.ts +++ b/x-pack/plugins/apm/public/plugin.ts @@ -5,13 +5,7 @@ * 2.0. */ -import { ConfigSchema } from '.'; -import { - FetchDataParams, - FormatterRuleRegistry, - HasDataParams, - ObservabilityPublicSetup, -} from '../../observability/public'; +import type { ConfigSchema } from '.'; import { AppMountParameters, CoreSetup, @@ -20,28 +14,35 @@ import { Plugin, PluginInitializerContext, } from '../../../../src/core/public'; -import { +import type { DataPublicPluginSetup, DataPublicPluginStart, } from '../../../../src/plugins/data/public'; -import { HomePublicPluginSetup } from '../../../../src/plugins/home/public'; -import { +import type { EmbeddableStart } from '../../../../src/plugins/embeddable/public'; +import type { HomePublicPluginSetup } from '../../../../src/plugins/home/public'; +import type { PluginSetupContract as AlertingPluginPublicSetup, PluginStartContract as AlertingPluginPublicStart, } from '../../alerting/public'; -import { FeaturesPluginSetup } from '../../features/public'; -import { LicensingPluginSetup } from '../../licensing/public'; -import { +import type { FeaturesPluginSetup } from '../../features/public'; +import type { LicensingPluginSetup } from '../../licensing/public'; +import type { MapsStartApi } from '../../maps/public'; +import type { MlPluginSetup, MlPluginStart } from '../../ml/public'; +import type { + FetchDataParams, + HasDataParams, + ObservabilityPublicSetup, +} from '../../observability/public'; +import { FormatterRuleRegistry } from '../../observability/public'; +import type { TriggersAndActionsUIPublicPluginSetup, TriggersAndActionsUIPublicPluginStart, } from '../../triggers_actions_ui/public'; +import { apmRuleRegistrySettings } from '../common/rules/apm_rule_registry_settings'; +import type { APMRuleFieldMap } from '../common/rules/apm_rule_field_map'; +import { registerApmAlerts } from './components/alerting/register_apm_alerts'; import { featureCatalogueEntry } from './featureCatalogueEntry'; import { toggleAppLinkInNav } from './toggleAppLinkInNav'; -import { EmbeddableStart } from '../../../../src/plugins/embeddable/public'; -import { registerApmAlerts } from './components/alerting/register_apm_alerts'; -import { MlPluginSetup, MlPluginStart } from '../../ml/public'; -import { MapsStartApi } from '../../maps/public'; -import { apmRuleRegistrySettings } from '../common/rules'; export type ApmPluginSetup = ReturnType; export type ApmRuleRegistry = ApmPluginSetup['ruleRegistry']; @@ -162,6 +163,7 @@ export class ApmPlugin implements Plugin { const apmRuleRegistry = plugins.observability.ruleRegistry.create({ ...apmRuleRegistrySettings, + fieldMap: {} as APMRuleFieldMap, ctor: FormatterRuleRegistry, }); diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.test.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.test.ts index b9346b2bf4649..ad1a8fcbf6e55 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.test.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.test.ts @@ -5,7 +5,7 @@ * 2.0. */ import { registerTransactionDurationAnomalyAlertType } from './register_transaction_duration_anomaly_alert_type'; -import { ANOMALY_SEVERITY } from '../../../../ml/common'; +import { ANOMALY_SEVERITY } from '../../../common/ml_constants'; import { Job, MlPluginSetup } from '../../../../ml/server'; import * as GetServiceAnomalies from '../service_map/get_service_anomalies'; import { createRuleTypeMocks } from './test_utils'; diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts index 66eb7125b0370..67ff7cdb8e4e0 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts @@ -18,7 +18,7 @@ import { TRANSACTION_TYPE, } from '../../../common/elasticsearch_fieldnames'; import { asMutableArray } from '../../../common/utils/as_mutable_array'; -import { ANOMALY_SEVERITY } from '../../../../ml/common'; +import { ANOMALY_SEVERITY } from '../../../common/ml_constants'; import { KibanaRequest } from '../../../../../../src/core/server'; import { AlertType, diff --git a/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/index.ts b/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/index.ts index a03b1ac82e90a..bcd279c57f4a5 100644 --- a/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/index.ts +++ b/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/index.ts @@ -14,7 +14,7 @@ import { getBucketSize } from '../../helpers/get_bucket_size'; import { Setup, SetupTimeRange } from '../../helpers/setup_request'; import { anomalySeriesFetcher } from './fetcher'; import { getMLJobIds } from '../../service_map/get_service_anomalies'; -import { ANOMALY_THRESHOLD } from '../../../../../ml/common'; +import { ANOMALY_THRESHOLD } from '../../../../common/ml_constants'; import { withApmSpan } from '../../../utils/with_apm_span'; export async function getAnomalySeries({ diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index 714b887a4008b..d62a3e6a5d5d7 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -42,7 +42,8 @@ import { } from './types'; import { registerRoutes } from './routes/register_routes'; import { getGlobalApmServerRouteRepository } from './routes/get_global_apm_server_route_repository'; -import { apmRuleRegistrySettings } from '../common/rules'; +import { apmRuleRegistrySettings } from '../common/rules/apm_rule_registry_settings'; +import { apmRuleFieldMap } from '../common/rules/apm_rule_field_map'; export type APMRuleRegistry = ReturnType['ruleRegistry']; @@ -151,9 +152,10 @@ export class APMPlugin config: await mergedConfig$.pipe(take(1)).toPromise(), }); - const apmRuleRegistry = plugins.observability.ruleRegistry.create( - apmRuleRegistrySettings - ); + const apmRuleRegistry = plugins.observability.ruleRegistry.create({ + ...apmRuleRegistrySettings, + fieldMap: apmRuleFieldMap, + }); registerApmAlerts({ registry: apmRuleRegistry, diff --git a/x-pack/plugins/observability/common/observability_rule_registry.ts b/x-pack/plugins/observability/common/observability_rule_registry.ts deleted file mode 100644 index 9254401fc19c4..0000000000000 --- a/x-pack/plugins/observability/common/observability_rule_registry.ts +++ /dev/null @@ -1,22 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { ecsFieldMap, pickWithPatterns } from '../../rule_registry/common'; - -export const observabilityRuleRegistrySettings = { - name: 'observability', - fieldMap: { - ...pickWithPatterns(ecsFieldMap, 'host.name', 'service.name'), - 'kibana.observability.evaluation.value': { - type: 'scaled_float' as const, - scaling_factor: 1000, - }, - 'kibana.observability.evaluation.threshold': { - type: 'scaled_float' as const, - scaling_factor: 1000, - }, - }, -}; diff --git a/x-pack/plugins/observability/common/rules/observability_rule_field_map.ts b/x-pack/plugins/observability/common/rules/observability_rule_field_map.ts new file mode 100644 index 0000000000000..370f5d4ef79f2 --- /dev/null +++ b/x-pack/plugins/observability/common/rules/observability_rule_field_map.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ecsFieldMap, pickWithPatterns } from '../../../rule_registry/common'; + +export const observabilityRuleFieldMap = { + ...pickWithPatterns(ecsFieldMap, 'host.name', 'service.name'), + 'kibana.observability.evaluation.value': { + type: 'scaled_float' as const, + scaling_factor: 1000, + }, + 'kibana.observability.evaluation.threshold': { + type: 'scaled_float' as const, + scaling_factor: 1000, + }, +}; + +export type ObservabilityRuleFieldMap = typeof observabilityRuleFieldMap; diff --git a/x-pack/plugins/observability/common/rules/observability_rule_registry_settings.ts b/x-pack/plugins/observability/common/rules/observability_rule_registry_settings.ts new file mode 100644 index 0000000000000..c901d912eb70f --- /dev/null +++ b/x-pack/plugins/observability/common/rules/observability_rule_registry_settings.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const observabilityRuleRegistrySettings = { + name: 'observability', +}; diff --git a/x-pack/plugins/observability/public/pages/alerts/index.tsx b/x-pack/plugins/observability/public/pages/alerts/index.tsx index 0089465003393..aa5fb2c32ea11 100644 --- a/x-pack/plugins/observability/public/pages/alerts/index.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/index.tsx @@ -24,6 +24,7 @@ import { usePluginContext } from '../../hooks/use_plugin_context'; import { RouteParams } from '../../routes'; import { callObservabilityApi } from '../../services/call_observability_api'; import { getAbsoluteDateRange } from '../../utils/date'; +import { asDuration, asPercent } from '../../../common/utils/formatters'; import { AlertsSearchBar } from './alerts_search_bar'; import { AlertsTable } from './alerts_table'; @@ -68,7 +69,7 @@ export function AlertsPage({ routeParams }: AlertsPageProps) { const formatted = { link: undefined, reason: alert['rule.name'], - ...(ruleType?.format?.({ alert }) ?? {}), + ...(ruleType?.format?.({ alert, formatters: { asDuration, asPercent } }) ?? {}), }; const parsedLink = formatted.link ? parse(formatted.link, true) : undefined; diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts index 491eb36d01ac0..1f56bdebbbb9b 100644 --- a/x-pack/plugins/observability/public/plugin.ts +++ b/x-pack/plugins/observability/public/plugin.ts @@ -5,32 +5,33 @@ * 2.0. */ -import { BehaviorSubject } from 'rxjs'; import { i18n } from '@kbn/i18n'; -import type { RuleRegistryPublicPluginSetupContract } from '../../rule_registry/public'; -import type { - DataPublicPluginSetup, - DataPublicPluginStart, -} from '../../../../src/plugins/data/public'; +import { BehaviorSubject } from 'rxjs'; import { AppMountParameters, AppUpdater, CoreSetup, + CoreStart, DEFAULT_APP_CATEGORIES, Plugin as PluginClass, PluginInitializerContext, - CoreStart, } from '../../../../src/core/public'; +import type { + DataPublicPluginSetup, + DataPublicPluginStart, +} from '../../../../src/plugins/data/public'; import type { HomePublicPluginSetup, HomePublicPluginStart, } from '../../../../src/plugins/home/public'; -import { registerDataHandler } from './data_handler'; -import { toggleOverviewLinkInNav } from './toggle_overview_link_in_nav'; import type { LensPublicStart } from '../../lens/public'; -import { createCallObservabilityApi } from './services/call_observability_api'; -import { observabilityRuleRegistrySettings } from '../common/observability_rule_registry'; +import type { RuleRegistryPublicPluginSetupContract } from '../../rule_registry/public'; +import type { ObservabilityRuleFieldMap } from '../common/rules/observability_rule_field_map'; +import { observabilityRuleRegistrySettings } from '../common/rules/observability_rule_registry_settings'; +import { registerDataHandler } from './data_handler'; import { FormatterRuleRegistry } from './rules/formatter_rule_registry'; +import { createCallObservabilityApi } from './services/call_observability_api'; +import { toggleOverviewLinkInNav } from './toggle_overview_link_in_nav'; export type ObservabilityPublicSetup = ReturnType; export type ObservabilityRuleRegistry = ObservabilityPublicSetup['ruleRegistry']; @@ -72,6 +73,7 @@ export class Plugin const observabilityRuleRegistry = pluginsSetup.ruleRegistry.registry.create({ ...observabilityRuleRegistrySettings, + fieldMap: {} as ObservabilityRuleFieldMap, ctor: FormatterRuleRegistry, }); diff --git a/x-pack/plugins/observability/public/rules/formatter_rule_registry.ts b/x-pack/plugins/observability/public/rules/formatter_rule_registry.ts index 87e6b3c324634..0d0d22cf750fb 100644 --- a/x-pack/plugins/observability/public/rules/formatter_rule_registry.ts +++ b/x-pack/plugins/observability/public/rules/formatter_rule_registry.ts @@ -7,12 +7,17 @@ import type { RuleType } from '../../../rule_registry/public'; import type { BaseRuleFieldMap, OutputOfFieldMap } from '../../../rule_registry/common'; import { RuleRegistry } from '../../../rule_registry/public'; +import type { asDuration, asPercent } from '../../common/utils/formatters'; type AlertTypeOf = OutputOfFieldMap; type FormattableRuleType = RuleType & { format?: (options: { alert: AlertTypeOf; + formatters: { + asDuration: typeof asDuration; + asPercent: typeof asPercent; + }; }) => { reason?: string; link?: string; diff --git a/x-pack/plugins/observability/server/plugin.ts b/x-pack/plugins/observability/server/plugin.ts index b167600e788a4..b5208260297d0 100644 --- a/x-pack/plugins/observability/server/plugin.ts +++ b/x-pack/plugins/observability/server/plugin.ts @@ -16,7 +16,8 @@ import type { RuleRegistryPluginSetupContract } from '../../rule_registry/server import { uiSettings } from './ui_settings'; import { registerRoutes } from './routes/register_routes'; import { getGlobalObservabilityServerRouteRepository } from './routes/get_global_observability_server_route_repository'; -import { observabilityRuleRegistrySettings } from '../common/observability_rule_registry'; +import { observabilityRuleRegistrySettings } from '../common/rules/observability_rule_registry_settings'; +import { observabilityRuleFieldMap } from '../common/rules/observability_rule_field_map'; export type ObservabilityPluginSetup = ReturnType; export type ObservabilityRuleRegistry = ObservabilityPluginSetup['ruleRegistry']; @@ -50,9 +51,10 @@ export class ObservabilityPlugin implements Plugin { }); } - const observabilityRuleRegistry = plugins.ruleRegistry.create( - observabilityRuleRegistrySettings - ); + const observabilityRuleRegistry = plugins.ruleRegistry.create({ + ...observabilityRuleRegistrySettings, + fieldMap: observabilityRuleFieldMap, + }); registerRoutes({ core: { diff --git a/x-pack/plugins/rule_registry/kibana.json b/x-pack/plugins/rule_registry/kibana.json index 1636f88a21a61..ec2b366f739e6 100644 --- a/x-pack/plugins/rule_registry/kibana.json +++ b/x-pack/plugins/rule_registry/kibana.json @@ -11,8 +11,5 @@ "triggersActionsUi" ], "server": true, - "ui": true, - "extraPublicDirs": [ - "common" - ] + "ui": true } diff --git a/x-pack/plugins/rule_registry/public/index.ts b/x-pack/plugins/rule_registry/public/index.ts index 55662dbcc8bfc..59697261ff20b 100644 --- a/x-pack/plugins/rule_registry/public/index.ts +++ b/x-pack/plugins/rule_registry/public/index.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { PluginInitializerContext } from 'kibana/public'; +import type { PluginInitializerContext } from 'kibana/public'; import { Plugin } from './plugin'; -export { RuleRegistryPublicPluginSetupContract } from './plugin'; +export type { RuleRegistryPublicPluginSetupContract } from './plugin'; export { RuleRegistry } from './rule_registry'; export type { IRuleRegistry, RuleType } from './rule_registry/types'; diff --git a/x-pack/plugins/rule_registry/public/plugin.ts b/x-pack/plugins/rule_registry/public/plugin.ts index 66c9a4fa224a5..7f0bceefb6797 100644 --- a/x-pack/plugins/rule_registry/public/plugin.ts +++ b/x-pack/plugins/rule_registry/public/plugin.ts @@ -19,7 +19,7 @@ import type { TriggersAndActionsUIPublicPluginSetup, TriggersAndActionsUIPublicPluginStart, } from '../../triggers_actions_ui/public'; -import { baseRuleFieldMap } from '../common'; +import type { BaseRuleFieldMap } from '../common'; import { RuleRegistry } from './rule_registry'; interface RuleRegistrySetupPlugins { @@ -40,7 +40,7 @@ export class Plugin public setup(core: CoreSetup, plugins: RuleRegistrySetupPlugins) { const rootRegistry = new RuleRegistry({ - fieldMap: baseRuleFieldMap, + fieldMap: {} as BaseRuleFieldMap, alertTypeRegistry: plugins.triggersActionsUi.alertTypeRegistry, }); return { diff --git a/x-pack/plugins/rule_registry/public/rule_registry/types.ts b/x-pack/plugins/rule_registry/public/rule_registry/types.ts index bb16227cbab5f..7c186385ebd35 100644 --- a/x-pack/plugins/rule_registry/public/rule_registry/types.ts +++ b/x-pack/plugins/rule_registry/public/rule_registry/types.ts @@ -4,8 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { AlertTypeRegistryContract } from '../../../triggers_actions_ui/public'; -import { BaseRuleFieldMap, FieldMap } from '../../common'; +import type { AlertTypeRegistryContract } from '../../../triggers_actions_ui/public'; +import type { BaseRuleFieldMap, FieldMap } from '../../common'; export interface RuleRegistryConstructorOptions { fieldMap: TFieldMap; From 05bd1c0cdbed2f2b5586af517a5c2d42ae5a366b Mon Sep 17 00:00:00 2001 From: Sonja Krause-Harder Date: Sun, 18 Apr 2021 16:47:24 +0200 Subject: [PATCH 63/68] [Fleet] Finer-grained error information from install/upgrade API (#95649) * Intercept installation errors and add meta info. * Adjust mock. * Catch errors in all steps of install/upgrade. * Adjust handler for direct package upload. * Don't throw not-found errors on assets during rollback. * Correctly catch errors from _installPackage() * Propagate error from installResult in bulk install case. * Add tests for rollback. * Remove unused code. * Skipping test that doesn't test what it says. * Fix and reenable test. --- .../plugins/fleet/common/types/models/epm.ts | 2 +- .../fleet/common/types/rest_spec/epm.ts | 7 +- .../fleet/server/routes/epm/handlers.ts | 46 ++-- .../epm/packages/bulk_install_packages.ts | 50 +++-- .../ensure_installed_default_packages.test.ts | 10 +- .../server/services/epm/packages/install.ts | 208 ++++++++++-------- .../server/services/epm/packages/remove.ts | 7 +- .../fleet_api_integration/apis/epm/index.js | 1 + .../apis/epm/install_error_rollback.ts | 61 +++++ .../error_handling/0.1.0/docs/README.md | 3 + .../visualization/sample_visualization.json | 14 ++ .../error_handling/0.1.0/manifest.yml | 20 ++ .../error_handling/0.2.0/docs/README.md | 5 + .../visualization/sample_visualization.json | 14 ++ .../error_handling/0.2.0/manifest.yml | 19 ++ 15 files changed, 327 insertions(+), 140 deletions(-) create mode 100644 x-pack/test/fleet_api_integration/apis/epm/install_error_rollback.ts create mode 100644 x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/docs/README.md create mode 100644 x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/kibana/visualization/sample_visualization.json create mode 100644 x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/manifest.yml create mode 100644 x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/docs/README.md create mode 100644 x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/kibana/visualization/sample_visualization.json create mode 100644 x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/manifest.yml diff --git a/x-pack/plugins/fleet/common/types/models/epm.ts b/x-pack/plugins/fleet/common/types/models/epm.ts index 3bc0d97d64646..1a594e77f4857 100644 --- a/x-pack/plugins/fleet/common/types/models/epm.ts +++ b/x-pack/plugins/fleet/common/types/models/epm.ts @@ -30,7 +30,7 @@ export enum InstallStatus { uninstalling = 'uninstalling', } -export type InstallType = 'reinstall' | 'reupdate' | 'rollback' | 'update' | 'install'; +export type InstallType = 'reinstall' | 'reupdate' | 'rollback' | 'update' | 'install' | 'unknown'; export type InstallSource = 'registry' | 'upload'; export type EpmPackageInstallStatus = 'installed' | 'installing'; diff --git a/x-pack/plugins/fleet/common/types/rest_spec/epm.ts b/x-pack/plugins/fleet/common/types/rest_spec/epm.ts index 3c7a32265d20a..e5c7ace420c73 100644 --- a/x-pack/plugins/fleet/common/types/rest_spec/epm.ts +++ b/x-pack/plugins/fleet/common/types/rest_spec/epm.ts @@ -12,6 +12,7 @@ import type { RegistrySearchResult, PackageInfo, PackageUsageStats, + InstallType, } from '../models/epm'; export interface GetCategoriesRequest { @@ -83,8 +84,10 @@ export interface IBulkInstallPackageHTTPError { } export interface InstallResult { - assets: AssetReference[]; - status: 'installed' | 'already_installed'; + assets?: AssetReference[]; + status?: 'installed' | 'already_installed'; + error?: Error; + installType: InstallType; } export interface BulkInstallPackageInfo { diff --git a/x-pack/plugins/fleet/server/routes/epm/handlers.ts b/x-pack/plugins/fleet/server/routes/epm/handlers.ts index f0d6e68427361..16d583f8a8d1f 100644 --- a/x-pack/plugins/fleet/server/routes/epm/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/epm/handlers.ts @@ -226,20 +226,21 @@ export const installPackageFromRegistryHandler: RequestHandler< const savedObjectsClient = context.core.savedObjects.client; const esClient = context.core.elasticsearch.client.asCurrentUser; const { pkgkey } = request.params; - try { - const res = await installPackage({ - installSource: 'registry', - savedObjectsClient, - pkgkey, - esClient, - force: request.body?.force, - }); + + const res = await installPackage({ + installSource: 'registry', + savedObjectsClient, + pkgkey, + esClient, + force: request.body?.force, + }); + if (!res.error) { const body: InstallPackageResponse = { - response: res.assets, + response: res.assets || [], }; return response.ok({ body }); - } catch (e) { - return await defaultIngestErrorHandler({ error: e, response }); + } else { + return await defaultIngestErrorHandler({ error: res.error, response }); } }; @@ -292,20 +293,21 @@ export const installPackageByUploadHandler: RequestHandler< const esClient = context.core.elasticsearch.client.asCurrentUser; const contentType = request.headers['content-type'] as string; // from types it could also be string[] or undefined but this is checked later const archiveBuffer = Buffer.from(request.body); - try { - const res = await installPackage({ - installSource: 'upload', - savedObjectsClient, - esClient, - archiveBuffer, - contentType, - }); + + const res = await installPackage({ + installSource: 'upload', + savedObjectsClient, + esClient, + archiveBuffer, + contentType, + }); + if (!res.error) { const body: InstallPackageResponse = { - response: res.assets, + response: res.assets || [], }; return response.ok({ body }); - } catch (error) { - return defaultIngestErrorHandler({ error, response }); + } else { + return defaultIngestErrorHandler({ error: res.error, response }); } }; diff --git a/x-pack/plugins/fleet/server/services/epm/packages/bulk_install_packages.ts b/x-pack/plugins/fleet/server/services/epm/packages/bulk_install_packages.ts index 7323263d4a70f..baaaaf6c6b0cf 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/bulk_install_packages.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/bulk_install_packages.ts @@ -32,22 +32,27 @@ export async function bulkInstallPackages({ ); logger.debug(`kicking off bulk install of ${packagesToInstall.join(', ')} from registry`); - const installResults = await Promise.allSettled( + const bulkInstallResults = await Promise.allSettled( latestPackagesResults.map(async (result, index) => { const packageName = packagesToInstall[index]; if (result.status === 'fulfilled') { const latestPackage = result.value; - return { - name: packageName, - version: latestPackage.version, - result: await installPackage({ - savedObjectsClient, - esClient, - pkgkey: Registry.pkgToPkgKey(latestPackage), - installSource, - skipPostInstall: true, - }), - }; + const installResult = await installPackage({ + savedObjectsClient, + esClient, + pkgkey: Registry.pkgToPkgKey(latestPackage), + installSource, + skipPostInstall: true, + }); + if (installResult.error) { + return { name: packageName, error: installResult.error }; + } else { + return { + name: packageName, + version: latestPackage.version, + result: installResult, + }; + } } return { name: packageName, error: result.reason }; }) @@ -56,18 +61,27 @@ export async function bulkInstallPackages({ // only install index patterns if we completed install for any package-version for the // first time, aka fresh installs or upgrades if ( - installResults.find( - (result) => result.status === 'fulfilled' && result.value.result?.status === 'installed' + bulkInstallResults.find( + (result) => + result.status === 'fulfilled' && + !result.value.result?.error && + result.value.result?.status === 'installed' ) ) { await installIndexPatterns({ savedObjectsClient, esClient, installSource }); } - return installResults.map((result, index) => { + return bulkInstallResults.map((result, index) => { const packageName = packagesToInstall[index]; - return result.status === 'fulfilled' - ? result.value - : { name: packageName, error: result.reason }; + if (result.status === 'fulfilled') { + if (result.value && result.value.error) { + return { name: packageName, error: result.value.error }; + } else { + return result.value; + } + } else { + return { name: packageName, error: result.reason }; + } }); } diff --git a/x-pack/plugins/fleet/server/services/epm/packages/ensure_installed_default_packages.test.ts b/x-pack/plugins/fleet/server/services/epm/packages/ensure_installed_default_packages.test.ts index fa2ea9e2209ed..f8c91e55fbbb6 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/ensure_installed_default_packages.test.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/ensure_installed_default_packages.test.ts @@ -77,7 +77,7 @@ describe('ensureInstalledDefaultPackages', () => { return [ { name: mockInstallation.attributes.name, - result: { assets: [], status: 'installed' }, + result: { assets: [], status: 'installed', installType: 'install' }, version: '', statusCode: 200, }, @@ -95,13 +95,13 @@ describe('ensureInstalledDefaultPackages', () => { return [ { name: 'success one', - result: { assets: [], status: 'installed' }, + result: { assets: [], status: 'installed', installType: 'install' }, version: '', statusCode: 200, }, { name: 'success two', - result: { assets: [], status: 'installed' }, + result: { assets: [], status: 'installed', installType: 'install' }, version: '', statusCode: 200, }, @@ -111,7 +111,7 @@ describe('ensureInstalledDefaultPackages', () => { }, { name: 'success three', - result: { assets: [], status: 'installed' }, + result: { assets: [], status: 'installed', installType: 'install' }, version: '', statusCode: 200, }, @@ -134,7 +134,7 @@ describe('ensureInstalledDefaultPackages', () => { return [ { name: 'undefined package', - result: { assets: [], status: 'installed' }, + result: { assets: [], status: 'installed', installType: 'install' }, version: '', statusCode: 200, }, diff --git a/x-pack/plugins/fleet/server/services/epm/packages/install.ts b/x-pack/plugins/fleet/server/services/epm/packages/install.ts index 4373251a969bc..31d0732096790 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/install.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/install.ts @@ -201,54 +201,62 @@ async function installPackageFromRegistry({ // TODO: change epm API to /packageName/version so we don't need to do this const { pkgName, pkgVersion } = Registry.splitPkgKey(pkgkey); - // get the currently installed package - const installedPkg = await getInstallationObject({ savedObjectsClient, pkgName }); - const installType = getInstallType({ pkgVersion, installedPkg }); - - // get latest package version - const latestPackage = await Registry.fetchFindLatestPackage(pkgName); - - // let the user install if using the force flag or needing to reinstall or install a previous version due to failed update - const installOutOfDateVersionOk = - force || ['reinstall', 'reupdate', 'rollback'].includes(installType); + // if an error happens during getInstallType, report that we don't know + let installType: InstallType = 'unknown'; - // if the requested version is the same as installed version, check if we allow it based on - // current installed package status and force flag, if we don't allow it, - // just return the asset references from the existing installation - if ( - installedPkg?.attributes.version === pkgVersion && - installedPkg?.attributes.install_status === 'installed' - ) { - if (!force) { - logger.debug(`${pkgkey} is already installed, skipping installation`); - return { - assets: [ - ...installedPkg.attributes.installed_es, - ...installedPkg.attributes.installed_kibana, - ], - status: 'already_installed', - }; + try { + // get the currently installed package + const installedPkg = await getInstallationObject({ savedObjectsClient, pkgName }); + installType = getInstallType({ pkgVersion, installedPkg }); + + // get latest package version + const latestPackage = await Registry.fetchFindLatestPackage(pkgName); + + // let the user install if using the force flag or needing to reinstall or install a previous version due to failed update + const installOutOfDateVersionOk = + force || ['reinstall', 'reupdate', 'rollback'].includes(installType); + + // if the requested version is the same as installed version, check if we allow it based on + // current installed package status and force flag, if we don't allow it, + // just return the asset references from the existing installation + if ( + installedPkg?.attributes.version === pkgVersion && + installedPkg?.attributes.install_status === 'installed' + ) { + if (!force) { + logger.debug(`${pkgkey} is already installed, skipping installation`); + return { + assets: [ + ...installedPkg.attributes.installed_es, + ...installedPkg.attributes.installed_kibana, + ], + status: 'already_installed', + installType, + }; + } } - } - // if the requested version is out-of-date of the latest package version, check if we allow it - // if we don't allow it, return an error - if (semverLt(pkgVersion, latestPackage.version)) { - if (!installOutOfDateVersionOk) { - throw new PackageOutdatedError(`${pkgkey} is out-of-date and cannot be installed or updated`); + // if the requested version is out-of-date of the latest package version, check if we allow it + // if we don't allow it, return an error + if (semverLt(pkgVersion, latestPackage.version)) { + if (!installOutOfDateVersionOk) { + throw new PackageOutdatedError( + `${pkgkey} is out-of-date and cannot be installed or updated` + ); + } + logger.debug( + `${pkgkey} is out-of-date, installing anyway due to ${ + force ? 'force flag' : `install type ${installType}` + }` + ); } - logger.debug( - `${pkgkey} is out-of-date, installing anyway due to ${ - force ? 'force flag' : `install type ${installType}` - }` - ); - } - // get package info - const { paths, packageInfo } = await Registry.getRegistryPackage(pkgName, pkgVersion); + // get package info + const { paths, packageInfo } = await Registry.getRegistryPackage(pkgName, pkgVersion); - // try installing the package, if there was an error, call error handler and rethrow - try { + // try installing the package, if there was an error, call error handler and rethrow + // TODO: without the ts-ignore, TS complains about the type of the value of the returned InstallResult.status + // @ts-ignore return _installPackage({ savedObjectsClient, esClient, @@ -257,19 +265,26 @@ async function installPackageFromRegistry({ packageInfo, installType, installSource: 'registry', - }).then((assets) => { - return { assets, status: 'installed' }; - }); + }) + .then((assets) => { + return { assets, status: 'installed', installType }; + }) + .catch(async (err: Error) => { + await handleInstallPackageFailure({ + savedObjectsClient, + error: err, + pkgName, + pkgVersion, + installedPkg, + esClient, + }); + return { error: err, installType }; + }); } catch (e) { - await handleInstallPackageFailure({ - savedObjectsClient, + return { error: e, - pkgName, - pkgVersion, - installedPkg, - esClient, - }); - throw e; + installType, + }; } } @@ -286,46 +301,57 @@ async function installPackageByUpload({ archiveBuffer, contentType, }: InstallUploadedArchiveParams): Promise { - const { packageInfo } = await parseAndVerifyArchiveEntries(archiveBuffer, contentType); - - const installedPkg = await getInstallationObject({ - savedObjectsClient, - pkgName: packageInfo.name, - }); + // if an error happens during getInstallType, report that we don't know + let installType: InstallType = 'unknown'; + try { + const { packageInfo } = await parseAndVerifyArchiveEntries(archiveBuffer, contentType); - const installType = getInstallType({ pkgVersion: packageInfo.version, installedPkg }); - if (installType !== 'install') { - throw new PackageOperationNotSupportedError( - `Package upload only supports fresh installations. Package ${packageInfo.name} is already installed, please uninstall first.` - ); - } + const installedPkg = await getInstallationObject({ + savedObjectsClient, + pkgName: packageInfo.name, + }); - const installSource = 'upload'; - const paths = await unpackBufferToCache({ - name: packageInfo.name, - version: packageInfo.version, - installSource, - archiveBuffer, - contentType, - }); + installType = getInstallType({ pkgVersion: packageInfo.version, installedPkg }); + if (installType !== 'install') { + throw new PackageOperationNotSupportedError( + `Package upload only supports fresh installations. Package ${packageInfo.name} is already installed, please uninstall first.` + ); + } - setPackageInfo({ - name: packageInfo.name, - version: packageInfo.version, - packageInfo, - }); + const installSource = 'upload'; + const paths = await unpackBufferToCache({ + name: packageInfo.name, + version: packageInfo.version, + installSource, + archiveBuffer, + contentType, + }); - return _installPackage({ - savedObjectsClient, - esClient, - installedPkg, - paths, - packageInfo, - installType, - installSource, - }).then((assets) => { - return { assets, status: 'installed' }; - }); + setPackageInfo({ + name: packageInfo.name, + version: packageInfo.version, + packageInfo, + }); + // TODO: without the ts-ignore, TS complains about the type of the value of the returned InstallResult.status + // @ts-ignore + return _installPackage({ + savedObjectsClient, + esClient, + installedPkg, + paths, + packageInfo, + installType, + installSource, + }) + .then((assets) => { + return { assets, status: 'installed', installType }; + }) + .catch(async (err: Error) => { + return { error: err, installType }; + }); + } catch (e) { + return { error: e, installType }; + } } export type InstallPackageParams = { @@ -352,7 +378,7 @@ export async function installPackage(args: InstallPackageParams) { esClient, force, }).then(async (installResult) => { - if (skipPostInstall) { + if (skipPostInstall || installResult.error) { return installResult; } logger.debug(`install of ${pkgkey} finished, running post-install`); @@ -374,7 +400,7 @@ export async function installPackage(args: InstallPackageParams) { archiveBuffer, contentType, }).then(async (installResult) => { - if (skipPostInstall) { + if (skipPostInstall || installResult.error) { return installResult; } logger.debug(`install of uploaded package finished, running post-install`); diff --git a/x-pack/plugins/fleet/server/services/epm/packages/remove.ts b/x-pack/plugins/fleet/server/services/epm/packages/remove.ts index de798e822b029..706f1bbbaaf35 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/remove.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/remove.ts @@ -79,6 +79,7 @@ export async function removeInstallation(options: { return installedAssets; } +// TODO: this is very much like deleteKibanaSavedObjectsAssets below function deleteKibanaAssets( installedObjects: KibanaAssetReference[], savedObjectsClient: SavedObjectsClientContract @@ -136,6 +137,7 @@ async function deleteTemplate(esClient: ElasticsearchClient, name: string): Prom } } +// TODO: this is very much like deleteKibanaAssets above export async function deleteKibanaSavedObjectsAssets( savedObjectsClient: SavedObjectsClientContract, installedRefs: AssetReference[] @@ -153,6 +155,9 @@ export async function deleteKibanaSavedObjectsAssets( try { await Promise.all(deletePromises); } catch (err) { - logger.warn(err); + // in the rollback case, partial installs are likely, so missing assets are not an error + if (!savedObjectsClient.errors.isNotFoundError(err)) { + logger.error(err); + } } } diff --git a/x-pack/test/fleet_api_integration/apis/epm/index.js b/x-pack/test/fleet_api_integration/apis/epm/index.js index 009e1a2dad5f1..445d9706bb9a9 100644 --- a/x-pack/test/fleet_api_integration/apis/epm/index.js +++ b/x-pack/test/fleet_api_integration/apis/epm/index.js @@ -24,5 +24,6 @@ export default function loadTests({ loadTestFile }) { loadTestFile(require.resolve('./update_assets')); loadTestFile(require.resolve('./data_stream')); loadTestFile(require.resolve('./package_install_complete')); + loadTestFile(require.resolve('./install_error_rollback')); }); } diff --git a/x-pack/test/fleet_api_integration/apis/epm/install_error_rollback.ts b/x-pack/test/fleet_api_integration/apis/epm/install_error_rollback.ts new file mode 100644 index 0000000000000..6e2ea3b96aa58 --- /dev/null +++ b/x-pack/test/fleet_api_integration/apis/epm/install_error_rollback.ts @@ -0,0 +1,61 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; +import { skipIfNoDockerRegistry } from '../../helpers'; + +export default function (providerContext: FtrProviderContext) { + const { getService } = providerContext; + const supertest = getService('supertest'); + const esArchiver = getService('esArchiver'); + const goodPackage = 'error_handling-0.1.0'; + const badPackage = 'error_handling-0.2.0'; + + const installPackage = async (pkgkey: string) => { + await supertest + .post(`/api/fleet/epm/packages/${pkgkey}`) + .set('kbn-xsrf', 'xxxx') + .send({ force: true }); + }; + + const getPackageInfo = async (pkgkey: string) => { + return await supertest.get(`/api/fleet/epm/packages/${pkgkey}`).set('kbn-xsrf', 'xxxx'); + }; + + describe('package installation error handling and rollback', async () => { + skipIfNoDockerRegistry(providerContext); + beforeEach(async () => { + await esArchiver.load('empty_kibana'); + }); + afterEach(async () => { + await esArchiver.unload('empty_kibana'); + }); + + it('on a fresh install, it should uninstall a broken package during rollback', async function () { + await supertest + .post(`/api/fleet/epm/packages/${badPackage}`) + .set('kbn-xsrf', 'xxxx') + .expect(422); // the broken package contains a broken visualization triggering a 422 from Kibana + + const pkgInfoResponse = await getPackageInfo(badPackage); + expect(JSON.parse(pkgInfoResponse.text).response.status).to.be('not_installed'); + }); + + it('on an upgrade, it should fall back to the previous good version during rollback', async function () { + await installPackage(goodPackage); + await supertest + .post(`/api/fleet/epm/packages/${badPackage}`) + .set('kbn-xsrf', 'xxxx') + .expect(422); // the broken package contains a broken visualization triggering a 422 from Kibana + + const goodPkgInfoResponse = await getPackageInfo(goodPackage); + expect(JSON.parse(goodPkgInfoResponse.text).response.status).to.be('installed'); + expect(JSON.parse(goodPkgInfoResponse.text).response.version).to.be('0.1.0'); + }); + }); +} diff --git a/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/docs/README.md b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/docs/README.md new file mode 100644 index 0000000000000..260499f4b0078 --- /dev/null +++ b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/docs/README.md @@ -0,0 +1,3 @@ +This package should install without errors. + +Version 0.2.0 of this package should fail during installation. We need this good version to test rollback. \ No newline at end of file diff --git a/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/kibana/visualization/sample_visualization.json b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/kibana/visualization/sample_visualization.json new file mode 100644 index 0000000000000..01afe600853ef --- /dev/null +++ b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/kibana/visualization/sample_visualization.json @@ -0,0 +1,14 @@ +{ + "attributes": { + "description": "sample visualization", + "title": "sample vis title", + "uiStateJSON": "{}", + "version": 1, + "visState": "{\"aggs\":[{\"enabled\":true,\"id\":\"1\",\"params\":{},\"schema\":\"metric\",\"type\":\"count\"},{\"enabled\":true,\"id\":\"2\",\"params\":{\"extended_bounds\":{},\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1},\"schema\":\"segment\",\"type\":\"date_histogram\"},{\"enabled\":true,\"id\":\"3\",\"params\":{\"customLabel\":\"Log Level\",\"field\":\"log.level\",\"order\":\"desc\",\"orderBy\":\"1\",\"size\":5},\"schema\":\"group\",\"type\":\"terms\"}],\"params\":{\"addLegend\":true,\"addTimeMarker\":false,\"addTooltip\":true,\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"labels\":{\"show\":true,\"truncate\":100},\"position\":\"bottom\",\"scale\":{\"type\":\"linear\"},\"show\":true,\"style\":{},\"title\":{\"text\":\"@timestamp per day\"},\"type\":\"category\"}],\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"legendPosition\":\"right\",\"seriesParams\":[{\"data\":{\"id\":\"1\",\"label\":\"Count\"},\"drawLinesBetweenPoints\":true,\"mode\":\"stacked\",\"show\":\"true\",\"showCircles\":true,\"type\":\"histogram\",\"valueAxis\":\"ValueAxis-1\"}],\"times\":[],\"type\":\"histogram\",\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"labels\":{\"filter\":false,\"rotate\":0,\"show\":true,\"truncate\":100},\"name\":\"LeftAxis-1\",\"position\":\"left\",\"scale\":{\"mode\":\"normal\",\"type\":\"linear\"},\"show\":true,\"style\":{},\"title\":{\"text\":\"Count\"},\"type\":\"value\"}]},\"title\":\"Log levels over time [Logs Kafka] ECS\",\"type\":\"histogram\"}" + }, + "id": "sample_visualization", + "type": "visualization", + "migrationVersion": { + "visualization": "7.7.0" + } +} diff --git a/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/manifest.yml b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/manifest.yml new file mode 100644 index 0000000000000..bba1a6a4c347d --- /dev/null +++ b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.1.0/manifest.yml @@ -0,0 +1,20 @@ +format_version: 1.0.0 +name: error_handling +title: Error handling +description: tests error handling and rollback +version: 0.1.0 +categories: [] +release: beta +type: integration +license: basic + +requirement: + elasticsearch: + versions: '>7.7.0' + kibana: + versions: '>7.7.0' + +icons: + - src: '/img/logo_overrides_64_color.svg' + size: '16x16' + type: 'image/svg+xml' \ No newline at end of file diff --git a/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/docs/README.md b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/docs/README.md new file mode 100644 index 0000000000000..c348f801b1780 --- /dev/null +++ b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/docs/README.md @@ -0,0 +1,5 @@ +This package should fail during installation. + +Version 0.1.0 of this package should install without errors, and be rolled back to without errors. + +This package contains one Kibana visualization that requires a non-existent version of Kibana in order to trigger an error during installation. \ No newline at end of file diff --git a/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/kibana/visualization/sample_visualization.json b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/kibana/visualization/sample_visualization.json new file mode 100644 index 0000000000000..0a4867cfe1c11 --- /dev/null +++ b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/kibana/visualization/sample_visualization.json @@ -0,0 +1,14 @@ +{ + "attributes": { + "description": "sample visualization", + "title": "sample vis title", + "uiStateJSON": "{}", + "version": 1, + "visState": "{\"aggs\":[{\"enabled\":true,\"id\":\"1\",\"params\":{},\"schema\":\"metric\",\"type\":\"count\"},{\"enabled\":true,\"id\":\"2\",\"params\":{\"extended_bounds\":{},\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1},\"schema\":\"segment\",\"type\":\"date_histogram\"},{\"enabled\":true,\"id\":\"3\",\"params\":{\"customLabel\":\"Log Level\",\"field\":\"log.level\",\"order\":\"desc\",\"orderBy\":\"1\",\"size\":5},\"schema\":\"group\",\"type\":\"terms\"}],\"params\":{\"addLegend\":true,\"addTimeMarker\":false,\"addTooltip\":true,\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"labels\":{\"show\":true,\"truncate\":100},\"position\":\"bottom\",\"scale\":{\"type\":\"linear\"},\"show\":true,\"style\":{},\"title\":{\"text\":\"@timestamp per day\"},\"type\":\"category\"}],\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"legendPosition\":\"right\",\"seriesParams\":[{\"data\":{\"id\":\"1\",\"label\":\"Count\"},\"drawLinesBetweenPoints\":true,\"mode\":\"stacked\",\"show\":\"true\",\"showCircles\":true,\"type\":\"histogram\",\"valueAxis\":\"ValueAxis-1\"}],\"times\":[],\"type\":\"histogram\",\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"labels\":{\"filter\":false,\"rotate\":0,\"show\":true,\"truncate\":100},\"name\":\"LeftAxis-1\",\"position\":\"left\",\"scale\":{\"mode\":\"normal\",\"type\":\"linear\"},\"show\":true,\"style\":{},\"title\":{\"text\":\"Count\"},\"type\":\"value\"}]},\"title\":\"Log levels over time [Logs Kafka] ECS\",\"type\":\"histogram\"}" + }, + "id": "sample_visualization", + "type": "visualization", + "migrationVersion": { + "visualization": "12.7.0" + } +} \ No newline at end of file diff --git a/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/manifest.yml b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/manifest.yml new file mode 100644 index 0000000000000..2eb6a41a77ede --- /dev/null +++ b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/error_handling/0.2.0/manifest.yml @@ -0,0 +1,19 @@ +format_version: 1.0.0 +name: error_handling +title: Error handling +description: tests error handling and rollback +version: 0.2.0 +categories: [] +release: beta +type: integration +license: basic + +requirement: + elasticsearch: + versions: '>7.7.0' + kibana: + versions: '>7.7.0' + +icons: + - src: '/img/logo_overrides_64_color.svg' + size: '16x16' \ No newline at end of file From f8838e3b89abbcf155c9a2381ad631af69cc4864 Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Sun, 18 Apr 2021 20:42:07 +0200 Subject: [PATCH 64/68] Remove legacy ES client usages in `home` and `xpack_legacy` (#97359) * Home plugin: remove usages of the legacy ES client * remove legacy es client usage in xpack_legacy --- .../services/sample_data/routes/install.ts | 20 +++++++++---------- .../services/sample_data/routes/list.ts | 20 +++++++++---------- .../services/sample_data/routes/uninstall.ts | 10 ++++------ .../services/sample_data/usage/collector.ts | 17 ++++++---------- .../server/routes/settings.test.ts | 14 ++----------- .../xpack_legacy/server/routes/settings.ts | 2 -- 6 files changed, 30 insertions(+), 53 deletions(-) diff --git a/src/plugins/home/server/services/sample_data/routes/install.ts b/src/plugins/home/server/services/sample_data/routes/install.ts index a20c3e350222f..e5ff33d5c199d 100644 --- a/src/plugins/home/server/services/sample_data/routes/install.ts +++ b/src/plugins/home/server/services/sample_data/routes/install.ts @@ -7,7 +7,7 @@ */ import { schema } from '@kbn/config-schema'; -import { IRouter, Logger, RequestHandlerContext } from 'src/core/server'; +import { IRouter, Logger, IScopedClusterClient } from 'src/core/server'; import { SampleDatasetSchema } from '../lib/sample_dataset_registry_types'; import { createIndexName } from '../lib/create_index_name'; import { @@ -22,7 +22,7 @@ const insertDataIntoIndex = ( dataIndexConfig: any, index: string, nowReference: string, - context: RequestHandlerContext, + esClient: IScopedClusterClient, logger: Logger ) => { function updateTimestamps(doc: any) { @@ -51,9 +51,11 @@ const insertDataIntoIndex = ( bulk.push(insertCmd); bulk.push(updateTimestamps(doc)); }); - const resp = await context.core.elasticsearch.legacy.client.callAsCurrentUser('bulk', { + + const { body: resp } = await esClient.asCurrentUser.bulk({ body: bulk, }); + if (resp.errors) { const errMsg = `sample_data install errors while bulk inserting. Elasticsearch response: ${JSON.stringify( resp, @@ -100,7 +102,7 @@ export function createInstallRoute( // clean up any old installation of dataset try { - await context.core.elasticsearch.legacy.client.callAsCurrentUser('indices.delete', { + await context.core.elasticsearch.client.asCurrentUser.indices.delete({ index, }); } catch (err) { @@ -108,17 +110,13 @@ export function createInstallRoute( } try { - const createIndexParams = { + await context.core.elasticsearch.client.asCurrentUser.indices.create({ index, body: { settings: { index: { number_of_shards: 1, auto_expand_replicas: '0-1' } }, mappings: { properties: dataIndexConfig.fields }, }, - }; - await context.core.elasticsearch.legacy.client.callAsCurrentUser( - 'indices.create', - createIndexParams - ); + }); } catch (err) { const errMsg = `Unable to create sample data index "${index}", error: ${err.message}`; logger.warn(errMsg); @@ -130,7 +128,7 @@ export function createInstallRoute( dataIndexConfig, index, nowReference, - context, + context.core.elasticsearch.client, logger ); (counts as any)[index] = count; diff --git a/src/plugins/home/server/services/sample_data/routes/list.ts b/src/plugins/home/server/services/sample_data/routes/list.ts index 86e286644f936..72d8c31cbafd7 100644 --- a/src/plugins/home/server/services/sample_data/routes/list.ts +++ b/src/plugins/home/server/services/sample_data/routes/list.ts @@ -36,22 +36,20 @@ export const createListRoute = (router: IRouter, sampleDatasets: SampleDatasetSc const dataIndexConfig = sampleDataset.dataIndices[i]; const index = createIndexName(sampleDataset.id, dataIndexConfig.id); try { - const indexExists = await context.core.elasticsearch.legacy.client.callAsCurrentUser( - 'indices.exists', - { index } - ); + const { + body: indexExists, + } = await context.core.elasticsearch.client.asCurrentUser.indices.exists({ + index, + }); if (!indexExists) { sampleDataset.status = NOT_INSTALLED; return; } - const { count } = await context.core.elasticsearch.legacy.client.callAsCurrentUser( - 'count', - { - index, - } - ); - if (count === 0) { + const { body: count } = await context.core.elasticsearch.client.asCurrentUser.count({ + index, + }); + if (count.count === 0) { sampleDataset.status = NOT_INSTALLED; return; } diff --git a/src/plugins/home/server/services/sample_data/routes/uninstall.ts b/src/plugins/home/server/services/sample_data/routes/uninstall.ts index aa8ed67cf840a..3108c06492dd8 100644 --- a/src/plugins/home/server/services/sample_data/routes/uninstall.ts +++ b/src/plugins/home/server/services/sample_data/routes/uninstall.ts @@ -28,11 +28,7 @@ export function createUninstallRoute( async ( { core: { - elasticsearch: { - legacy: { - client: { callAsCurrentUser }, - }, - }, + elasticsearch: { client: esClient }, savedObjects: { getClient: getSavedObjectsClient, typeRegistry }, }, }, @@ -50,7 +46,9 @@ export function createUninstallRoute( const index = createIndexName(sampleDataset.id, dataIndexConfig.id); try { - await callAsCurrentUser('indices.delete', { index }); + await esClient.asCurrentUser.indices.delete({ + index, + }); } catch (err) { return response.customError({ statusCode: err.status, diff --git a/src/plugins/home/server/services/sample_data/usage/collector.ts b/src/plugins/home/server/services/sample_data/usage/collector.ts index 81958a2e3c878..df7d485c1f6fa 100644 --- a/src/plugins/home/server/services/sample_data/usage/collector.ts +++ b/src/plugins/home/server/services/sample_data/usage/collector.ts @@ -6,22 +6,17 @@ * Side Public License, v 1. */ -import { PluginInitializerContext } from 'kibana/server'; -import { first } from 'rxjs/operators'; +import type { PluginInitializerContext } from 'kibana/server'; +import type { UsageCollectionSetup } from '../../../../../usage_collection/server'; import { fetchProvider, TelemetryResponse } from './collector_fetch'; -import { UsageCollectionSetup } from '../../../../../usage_collection/server'; -export async function makeSampleDataUsageCollector( +export function makeSampleDataUsageCollector( usageCollection: UsageCollectionSetup, context: PluginInitializerContext ) { - let index: string; - try { - const config = await context.config.legacy.globalConfig$.pipe(first()).toPromise(); - index = config.kibana.index; - } catch (err) { - return; // kibana plugin is not enabled (test environment) - } + const config = context.config.legacy.get(); + const index = config.kibana.index; + const collector = usageCollection.makeUsageCollector({ type: 'sample-data', fetch: fetchProvider(index), diff --git a/x-pack/plugins/xpack_legacy/server/routes/settings.test.ts b/x-pack/plugins/xpack_legacy/server/routes/settings.test.ts index 08b5a0f60521c..2034a4e5b74ba 100644 --- a/x-pack/plugins/xpack_legacy/server/routes/settings.test.ts +++ b/x-pack/plugins/xpack_legacy/server/routes/settings.test.ts @@ -9,11 +9,7 @@ import { BehaviorSubject } from 'rxjs'; import { UnwrapPromise } from '@kbn/utility-types'; import supertest from 'supertest'; -import { - LegacyAPICaller, - ServiceStatus, - ServiceStatusLevels, -} from '../../../../../src/core/server'; +import { ServiceStatus, ServiceStatusLevels } from '../../../../../src/core/server'; import { contextServiceMock, elasticsearchServiceMock, @@ -31,24 +27,18 @@ export function mockGetClusterInfo(clusterInfo: any) { esClient.info.mockResolvedValue({ body: { ...clusterInfo } }); return esClient; } + describe('/api/settings', () => { let server: HttpService; let httpSetup: HttpSetup; let overallStatus$: BehaviorSubject; - let mockApiCaller: jest.Mocked; beforeEach(async () => { - mockApiCaller = jest.fn(); server = createHttpServer(); httpSetup = await server.setup({ context: contextServiceMock.createSetupContract({ core: { elasticsearch: { - legacy: { - client: { - callAsCurrentUser: mockApiCaller, - }, - }, client: { asCurrentUser: mockGetClusterInfo({ cluster_uuid: 'yyy-yyyyy' }), }, diff --git a/x-pack/plugins/xpack_legacy/server/routes/settings.ts b/x-pack/plugins/xpack_legacy/server/routes/settings.ts index 9117637b70bee..b9052ca0c84e3 100644 --- a/x-pack/plugins/xpack_legacy/server/routes/settings.ts +++ b/x-pack/plugins/xpack_legacy/server/routes/settings.ts @@ -42,9 +42,7 @@ export function registerSettingsRoute({ validate: false, }, async (context, req, res) => { - const { callAsCurrentUser } = context.core.elasticsearch.legacy.client; const collectorFetchContext = { - callCluster: callAsCurrentUser, esClient: context.core.elasticsearch.client.asCurrentUser, soClient: context.core.savedObjects.client, }; From cb2cf67609f54a6e43a08b24f11694217255cdc3 Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Sun, 18 Apr 2021 20:49:35 +0200 Subject: [PATCH 65/68] Add description as title on tag badge (#97109) --- .../public/components/base/tag_badge.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/saved_objects_tagging/public/components/base/tag_badge.tsx b/x-pack/plugins/saved_objects_tagging/public/components/base/tag_badge.tsx index 6bc9e659d9346..e8af661d6921d 100644 --- a/x-pack/plugins/saved_objects_tagging/public/components/base/tag_badge.tsx +++ b/x-pack/plugins/saved_objects_tagging/public/components/base/tag_badge.tsx @@ -17,5 +17,9 @@ export interface TagBadgeProps { * The badge representation of a Tag, which is the default display to be used for them. */ export const TagBadge: FC = ({ tag }) => { - return {tag.name}; + return ( + + {tag.name} + + ); }; From 787b4934032b6989195aedf3aac4c871bf7ca11f Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Sun, 18 Apr 2021 23:07:36 +0200 Subject: [PATCH 66/68] Avoid mutating KQL query when validating it (#97081) --- .../service/lib/filter_utils.test.ts | 17 +++++++++++++++++ .../saved_objects/service/lib/filter_utils.ts | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/core/server/saved_objects/service/lib/filter_utils.test.ts b/src/core/server/saved_objects/service/lib/filter_utils.test.ts index 956a60b23809d..2ef5219ccfff1 100644 --- a/src/core/server/saved_objects/service/lib/filter_utils.test.ts +++ b/src/core/server/saved_objects/service/lib/filter_utils.test.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { cloneDeep } from 'lodash'; // @ts-expect-error no ts import { esKuery } from '../../es_query'; @@ -105,6 +106,22 @@ describe('Filter Utils', () => { ) ).toEqual(esKuery.fromKueryExpression('foo.title: "best"')); }); + + test('does not mutate the input KueryNode', () => { + const input = esKuery.nodeTypes.function.buildNode( + 'is', + `foo.attributes.title`, + 'best', + true + ); + + const inputCopy = cloneDeep(input); + + validateConvertFilterToKueryNode(['foo'], input, mockMappings); + + expect(input).toEqual(inputCopy); + }); + test('Validate a simple KQL expression filter', () => { expect( validateConvertFilterToKueryNode(['foo'], 'foo.attributes.title: "best"', mockMappings) diff --git a/src/core/server/saved_objects/service/lib/filter_utils.ts b/src/core/server/saved_objects/service/lib/filter_utils.ts index b3bcef9a62e13..a41a25a27b70d 100644 --- a/src/core/server/saved_objects/service/lib/filter_utils.ts +++ b/src/core/server/saved_objects/service/lib/filter_utils.ts @@ -7,11 +7,12 @@ */ import { set } from '@elastic/safer-lodash-set'; -import { get } from 'lodash'; +import { get, cloneDeep } from 'lodash'; import { SavedObjectsErrorHelpers } from './errors'; import { IndexMapping } from '../../mappings'; // @ts-expect-error no ts import { esKuery } from '../../es_query'; + type KueryNode = any; const astFunctionType = ['is', 'range', 'nested']; @@ -23,7 +24,7 @@ export const validateConvertFilterToKueryNode = ( ): KueryNode | undefined => { if (filter && indexMapping) { const filterKueryNode = - typeof filter === 'string' ? esKuery.fromKueryExpression(filter) : filter; + typeof filter === 'string' ? esKuery.fromKueryExpression(filter) : cloneDeep(filter); const validationFilterKuery = validateFilterKueryNode({ astFilter: filterKueryNode, From 681bd642fb54396b2ee27c982b8dc128e98bfb02 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Sun, 18 Apr 2021 20:28:13 -0700 Subject: [PATCH 67/68] Fix typo in license_api_guard README name and import http server mocks from public interface (#97334) * Reject basic minimum licenses. --- docs/developer/plugin-list.asciidoc | 4 +- x-pack/plugins/license_api_guard/READM.md | 3 - x-pack/plugins/license_api_guard/README.md | 3 + .../license_api_guard/server/license.test.ts | 135 +++++++++++------- .../license_api_guard/server/license.ts | 6 + 5 files changed, 96 insertions(+), 55 deletions(-) delete mode 100644 x-pack/plugins/license_api_guard/READM.md create mode 100644 x-pack/plugins/license_api_guard/README.md diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index de7253e34d103..c7fffb09248e9 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -444,8 +444,8 @@ the infrastructure monitoring use-case within Kibana. |Visualization editor allowing to quickly and easily configure compelling visualizations to use on dashboards and canvas workpads. -|{kib-repo}blob/{branch}/x-pack/plugins/license_api_guard[licenseApiGuard] -|WARNING: Missing README. +|{kib-repo}blob/{branch}/x-pack/plugins/license_api_guard/README.md[licenseApiGuard] +|This plugin is used by ES UI plugins to reject API requests when the plugin is unsupported by the user's license. |{kib-repo}blob/{branch}/x-pack/plugins/license_management/README.md[licenseManagement] diff --git a/x-pack/plugins/license_api_guard/READM.md b/x-pack/plugins/license_api_guard/READM.md deleted file mode 100644 index 767223125b12c..0000000000000 --- a/x-pack/plugins/license_api_guard/READM.md +++ /dev/null @@ -1,3 +0,0 @@ -# License API guard plugin - -This plugin is used by ES UI plugins to reject API requests to plugins that are unsupported by the user's license. \ No newline at end of file diff --git a/x-pack/plugins/license_api_guard/README.md b/x-pack/plugins/license_api_guard/README.md new file mode 100644 index 0000000000000..bf2a9fdff7122 --- /dev/null +++ b/x-pack/plugins/license_api_guard/README.md @@ -0,0 +1,3 @@ +# License API guard plugin + +This plugin is used by ES UI plugins to reject API requests when the plugin is unsupported by the user's license. \ No newline at end of file diff --git a/x-pack/plugins/license_api_guard/server/license.test.ts b/x-pack/plugins/license_api_guard/server/license.test.ts index e9da393f53478..400af7261ff87 100644 --- a/x-pack/plugins/license_api_guard/server/license.test.ts +++ b/x-pack/plugins/license_api_guard/server/license.test.ts @@ -6,18 +6,38 @@ */ import { of } from 'rxjs'; -import type { KibanaRequest, RequestHandlerContext } from 'src/core/server'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { httpServerMock } from 'src/core/server/http/http_server.mocks'; - +import type { Logger, KibanaRequest, RequestHandlerContext } from 'src/core/server'; +import { httpServerMock } from 'src/core/server/mocks'; import { License } from './license'; -import { LicenseCheckState, licensingMock } from './shared_imports'; +import { LicenseCheckState, licensingMock, LicenseType } from './shared_imports'; describe('License API guard', () => { const pluginName = 'testPlugin'; - const currentLicenseType = 'basic'; - const testRoute = ({ licenseState }: { licenseState: string }) => { + const mockLicensingService = ({ + licenseType, + licenseState, + }: { + licenseType: LicenseType; + licenseState: LicenseCheckState; + }) => { + const licenseMock = licensingMock.createLicenseMock(); + licenseMock.type = licenseType; + licenseMock.check('test', 'gold'); // Flush default mocked state + licenseMock.check.mockReturnValue({ state: licenseState }); // Replace with new mocked state + + return { + license$: of(licenseMock), + }; + }; + + const testRoute = ({ + licenseType, + licenseState, + }: { + licenseType: LicenseType; + licenseState: LicenseCheckState; + }) => { const license = new License(); const logger = { @@ -25,19 +45,11 @@ describe('License API guard', () => { }; license.setup({ pluginName, logger }); - - const licenseMock = licensingMock.createLicenseMock(); - licenseMock.type = currentLicenseType; - licenseMock.check('test', 'basic'); // Flush default mocked state - licenseMock.check.mockReturnValue({ state: licenseState as LicenseCheckState }); // Replace with new mocked state - - const licensing = { - license$: of(licenseMock), - }; + const licensing = mockLicensingService({ licenseType, licenseState }); license.start({ pluginId: 'id', - minimumLicenseType: 'basic', + minimumLicenseType: 'gold', licensing, }); @@ -61,44 +73,67 @@ describe('License API guard', () => { }; }; - describe('valid license', () => { - it('the original route is called and nothing is logged', () => { - const { errorResponse, logMesssage, route } = testRoute({ licenseState: 'valid' }); - - expect(errorResponse).toBeUndefined(); - expect(logMesssage).toBeUndefined(); - expect(route).toHaveBeenCalled(); + describe('basic minimum license', () => { + it('is rejected', () => { + const license = new License(); + license.setup({ pluginName, logger: {} as Logger }); + expect(() => { + license.start({ + pluginId: pluginName, + minimumLicenseType: 'basic', + licensing: mockLicensingService({ licenseType: 'gold', licenseState: 'valid' }), + }); + }).toThrowError( + `Basic licenses don't restrict the use of plugins. Please don't use license_api_guard in the ${pluginName} plugin, or provide a more restrictive minimumLicenseType.` + ); }); }); - [ - { - licenseState: 'invalid', - expectedMessage: `Your ${currentLicenseType} license does not support ${pluginName}. Please upgrade your license.`, - }, - { - licenseState: 'expired', - expectedMessage: `You cannot use ${pluginName} because your ${currentLicenseType} license has expired.`, - }, - { - licenseState: 'unavailable', - expectedMessage: `You cannot use ${pluginName} because license information is not available at this time.`, - }, - ].forEach(({ licenseState, expectedMessage }) => { - describe(`${licenseState} license`, () => { - it('replies with and logs the error message', () => { - const { errorResponse, logMesssage, route } = testRoute({ licenseState }); - - // We depend on the call to `response.forbidden()` to generate the 403 status code, - // so we can't assert for it here. - expect(errorResponse).toEqual({ - body: { - message: expectedMessage, - }, + describe('non-basic minimum license', () => { + const licenseType = 'gold'; + + describe('when valid', () => { + it('the original route is called and nothing is logged', () => { + const { errorResponse, logMesssage, route } = testRoute({ + licenseType, + licenseState: 'valid', }); - expect(logMesssage).toBe(expectedMessage); - expect(route).not.toHaveBeenCalled(); + expect(errorResponse).toBeUndefined(); + expect(logMesssage).toBeUndefined(); + expect(route).toHaveBeenCalled(); + }); + }); + + [ + { + licenseState: 'invalid' as LicenseCheckState, + expectedMessage: `Your ${licenseType} license does not support ${pluginName}. Please upgrade your license.`, + }, + { + licenseState: 'expired' as LicenseCheckState, + expectedMessage: `You cannot use ${pluginName} because your ${licenseType} license has expired.`, + }, + { + licenseState: 'unavailable' as LicenseCheckState, + expectedMessage: `You cannot use ${pluginName} because license information is not available at this time.`, + }, + ].forEach(({ licenseState, expectedMessage }) => { + describe(`when ${licenseState}`, () => { + it('replies with and logs the error message', () => { + const { errorResponse, logMesssage, route } = testRoute({ licenseType, licenseState }); + + // We depend on the call to `response.forbidden()` to generate the 403 status code, + // so we can't assert for it here. + expect(errorResponse).toEqual({ + body: { + message: expectedMessage, + }, + }); + + expect(logMesssage).toBe(expectedMessage); + expect(route).not.toHaveBeenCalled(); + }); }); }); }); diff --git a/x-pack/plugins/license_api_guard/server/license.ts b/x-pack/plugins/license_api_guard/server/license.ts index 3b0fbc8422d63..66e47f02b6e28 100644 --- a/x-pack/plugins/license_api_guard/server/license.ts +++ b/x-pack/plugins/license_api_guard/server/license.ts @@ -44,6 +44,12 @@ export class License { } start({ pluginId, minimumLicenseType, licensing }: StartSettings) { + if (minimumLicenseType === 'basic') { + throw Error( + `Basic licenses don't restrict the use of plugins. Please don't use license_api_guard in the ${pluginId} plugin, or provide a more restrictive minimumLicenseType.` + ); + } + licensing.license$.subscribe((license: ILicense) => { this.licenseType = license.type; this.licenseCheckState = license.check(pluginId, minimumLicenseType!).state; From 1bc7e5462f821feff24f0470d5921d456670f646 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 19 Apr 2021 09:28:44 +0200 Subject: [PATCH 68/68] [Exploratory view] integerate page views to exploratory view (#97258) --- .../app/RumDashboard/PageViewsTrend/index.tsx | 48 +++++++++++++++++-- .../components/empty_view.tsx | 25 ++++++++-- .../exploratory_view/exploratory_view.tsx | 4 +- .../series_builder/series_builder.tsx | 9 ++-- 4 files changed, 72 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx index 85df933bcb9e2..52668cf712b8c 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx @@ -6,25 +6,37 @@ */ import React, { useState } from 'react'; -import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'; +import { + EuiButton, + EuiFlexGroup, + EuiFlexItem, + EuiSpacer, + EuiTitle, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useFetcher } from '../../../../hooks/use_fetcher'; import { I18LABELS } from '../translations'; import { BreakdownFilter } from '../Breakdowns/BreakdownFilter'; import { PageViewsChart } from '../Charts/PageViewsChart'; import { BreakdownItem } from '../../../../../typings/ui_filters'; +import { createExploratoryViewUrl } from '../../../../../../observability/public'; +import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; export function PageViewsTrend() { + const { + services: { http }, + } = useKibana(); + const { urlParams, uiFilters } = useUrlParams(); + const { serviceName } = uiFilters; - const { start, end, searchTerm } = urlParams; + const { start, end, searchTerm, rangeTo, rangeFrom } = urlParams; const [breakdown, setBreakdown] = useState(null); const { data, status } = useFetcher( (callApmApi) => { - const { serviceName } = uiFilters; - if (start && end && serviceName) { return callApmApi({ endpoint: 'GET /api/apm/rum-client/page-view-trends', @@ -45,7 +57,21 @@ export function PageViewsTrend() { } return Promise.resolve(undefined); }, - [end, start, uiFilters, breakdown, searchTerm] + [start, end, serviceName, uiFilters, searchTerm, breakdown] + ); + + const exploratoryViewLink = createExploratoryViewUrl( + { + [`${serviceName}-page-views`]: { + reportType: 'kpi', + time: { from: rangeFrom!, to: rangeTo! }, + reportDefinitions: { + 'service.name': serviceName?.[0] as string, + }, + ...(breakdown ? { breakdown: breakdown.fieldName } : {}), + }, + }, + http?.basePath.get() ); return ( @@ -63,6 +89,18 @@ export function PageViewsTrend() { dataTestSubj={'pvBreakdownFilter'} />
+ + + + + diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/components/empty_view.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/components/empty_view.tsx index 17f1b039667d0..69b8b6eb89e46 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/components/empty_view.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/components/empty_view.tsx @@ -6,27 +6,44 @@ */ import React from 'react'; -import { EuiImage } from '@elastic/eui'; +import { EuiImage, EuiProgress, EuiSpacer, EuiText } from '@elastic/eui'; import styled from 'styled-components'; import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; +import { INITIATING_VIEW } from '../series_builder/series_builder'; -export function EmptyView() { +export function EmptyView({ loading }: { loading: boolean }) { const { services: { http }, } = useKibana(); return ( - + )} + + + {INITIATING_VIEW} ); } +const ImageWrap = styled(EuiImage)` + opacity: 0.4; +`; + const Wrapper = styled.div` text-align: center; - opacity: 0.4; height: 550px; + position: relative; `; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.tsx index 7b5dde852cf90..6bc91be876cf7 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/exploratory_view.tsx @@ -27,7 +27,7 @@ export function ExploratoryView() { null ); - const { loadIndexPattern } = useAppIndexPatternContext(); + const { loadIndexPattern, loading } = useAppIndexPatternContext(); const LensComponent = lens?.EmbeddableComponent; @@ -61,7 +61,7 @@ export function ExploratoryView() { attributes={lensAttributes} /> ) : ( - + )} diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/series_builder.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/series_builder.tsx index 5831b8be04c38..db6e075cc90fb 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/series_builder.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/series_builder.tsx @@ -228,9 +228,12 @@ export function SeriesBuilder() { ); } -const INITIATING_VIEW = i18n.translate('xpack.observability.expView.seriesBuilder.initView', { - defaultMessage: 'Initiating view ...', -}); +export const INITIATING_VIEW = i18n.translate( + 'xpack.observability.expView.seriesBuilder.initView', + { + defaultMessage: 'Initiating view ...', + } +); const SELECT_REPORT_TYPE = i18n.translate( 'xpack.observability.expView.seriesBuilder.selectReportType',