diff --git a/x-pack/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts b/x-pack/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts index 74d7ace20dae0..ca2096bc1d0e7 100644 --- a/x-pack/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts +++ b/x-pack/plugins/apm/public/components/shared/KueryBar/get_bool_filter.ts @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +import { ESFilter } from '../../../../../../typings/elasticsearch'; import { ERROR_GROUP_ID, PROCESSOR_EVENT, @@ -12,7 +13,6 @@ import { TRANSACTION_TYPE, } from '../../../../common/elasticsearch_fieldnames'; import { UIProcessorEvent } from '../../../../common/processor_event'; -import { ESFilter } from '../../../../typings/elasticsearch'; import { IUrlParams } from '../../../context/UrlParamsContext/types'; export function getBoolFilter({ diff --git a/x-pack/plugins/apm/public/utils/testHelpers.tsx b/x-pack/plugins/apm/public/utils/testHelpers.tsx index 8e8f2acc2a3e7..87dfeb95b6326 100644 --- a/x-pack/plugins/apm/public/utils/testHelpers.tsx +++ b/x-pack/plugins/apm/public/utils/testHelpers.tsx @@ -6,25 +6,25 @@ /* global jest */ -import React from 'react'; -import { ReactWrapper, mount, MountRendererProps } from 'enzyme'; +import { render, waitFor } from '@testing-library/react'; +import { mount, MountRendererProps, ReactWrapper } from 'enzyme'; import enzymeToJson from 'enzyme-to-json'; import { Location } from 'history'; import moment from 'moment'; import { Moment } from 'moment-timezone'; -import { render, waitFor } from '@testing-library/react'; +import React from 'react'; import { MemoryRouter } from 'react-router-dom'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { APMConfig } from '../../server'; -import { PromiseReturnType } from '../../typings/common'; -import { EuiThemeProvider } from '../../../observability/public'; import { ESFilter, - ESSearchResponse, ESSearchRequest, -} from '../../typings/elasticsearch'; -import { MockApmPluginContextWrapper } from '../context/ApmPluginContext/MockApmPluginContext'; + ESSearchResponse, +} from '../../../../typings/elasticsearch'; +import { EuiThemeProvider } from '../../../observability/public'; +import { PromiseReturnType } from '../../../observability/typings/common'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { APMConfig } from '../../server'; import { UIFilters } from '../../typings/ui_filters'; +import { MockApmPluginContextWrapper } from '../context/ApmPluginContext/MockApmPluginContext'; import { UrlParamsProvider } from '../context/UrlParamsContext'; const originalConsoleWarn = console.warn; // eslint-disable-line no-console diff --git a/x-pack/plugins/apm/scripts/shared/get_es_client.ts b/x-pack/plugins/apm/scripts/shared/get_es_client.ts index 86dfd92190fdf..912c8943b1edf 100644 --- a/x-pack/plugins/apm/scripts/shared/get_es_client.ts +++ b/x-pack/plugins/apm/scripts/shared/get_es_client.ts @@ -6,7 +6,10 @@ import { Client } from '@elastic/elasticsearch'; import { ApiKeyAuth, BasicAuth } from '@elastic/elasticsearch/lib/pool'; -import { ESSearchResponse, ESSearchRequest } from '../../typings/elasticsearch'; +import { + ESSearchResponse, + ESSearchRequest, +} from '../../../../typings/elasticsearch'; export type ESClient = ReturnType; 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 ecda5b0e8504b..464a737c50ea2 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 @@ -9,6 +9,7 @@ import { isEmpty } from 'lodash'; import { Observable } from 'rxjs'; import { take } from 'rxjs/operators'; import { APMConfig } from '../..'; +import { ESSearchResponse } from '../../../../../typings/elasticsearch'; import { AlertingPlugin } from '../../../../alerts/server'; import { AlertType, ALERT_TYPES_CONFIG } from '../../../common/alert_types'; import { @@ -17,7 +18,6 @@ import { SERVICE_NAME, } from '../../../common/elasticsearch_fieldnames'; import { ProcessorEvent } from '../../../common/processor_event'; -import { ESSearchResponse } from '../../../typings/elasticsearch'; import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es'; import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; import { apmActionVariables } from './action_variables'; 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 d9e69c8f3b7d7..602ee99970f8a 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 @@ -7,21 +7,21 @@ import { schema } from '@kbn/config-schema'; import { Observable } from 'rxjs'; import { take } from 'rxjs/operators'; -import { getDurationFormatter } from '../../../common/utils/formatters'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { APMConfig } from '../..'; +import { ESSearchResponse } from '../../../../../typings/elasticsearch'; +import { AlertingPlugin } from '../../../../alerts/server'; import { AlertType, ALERT_TYPES_CONFIG } from '../../../common/alert_types'; -import { ESSearchResponse } from '../../../typings/elasticsearch'; import { PROCESSOR_EVENT, + SERVICE_ENVIRONMENT, SERVICE_NAME, - TRANSACTION_TYPE, TRANSACTION_DURATION, - SERVICE_ENVIRONMENT, + TRANSACTION_TYPE, } from '../../../common/elasticsearch_fieldnames'; -import { AlertingPlugin } from '../../../../alerts/server'; -import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; -import { APMConfig } from '../..'; +import { ProcessorEvent } from '../../../common/processor_event'; +import { getDurationFormatter } from '../../../common/utils/formatters'; import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es'; +import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; import { apmActionVariables } from './action_variables'; interface RegisterAlertParams { 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 06b296db5a485..0506e1b4c3aed 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 @@ -5,25 +5,25 @@ */ import { schema } from '@kbn/config-schema'; +import { isEmpty } from 'lodash'; import { Observable } from 'rxjs'; import { take } from 'rxjs/operators'; -import { isEmpty } from 'lodash'; -import { asDecimalOrInteger } from '../../../common/utils/formatters'; -import { ProcessorEvent } from '../../../common/processor_event'; -import { EventOutcome } from '../../../common/event_outcome'; +import { APMConfig } from '../..'; +import { ESSearchResponse } from '../../../../../typings/elasticsearch'; +import { AlertingPlugin } from '../../../../alerts/server'; import { AlertType, ALERT_TYPES_CONFIG } from '../../../common/alert_types'; -import { ESSearchResponse } from '../../../typings/elasticsearch'; import { + EVENT_OUTCOME, PROCESSOR_EVENT, + SERVICE_ENVIRONMENT, SERVICE_NAME, TRANSACTION_TYPE, - EVENT_OUTCOME, - SERVICE_ENVIRONMENT, } from '../../../common/elasticsearch_fieldnames'; -import { AlertingPlugin } from '../../../../alerts/server'; -import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; -import { APMConfig } from '../..'; +import { EventOutcome } from '../../../common/event_outcome'; +import { ProcessorEvent } from '../../../common/processor_event'; +import { asDecimalOrInteger } from '../../../common/utils/formatters'; import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es'; +import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; import { apmActionVariables } from './action_variables'; interface RegisterAlertParams { diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts index e53a0e24b4723..730645c609cb6 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts @@ -9,7 +9,7 @@ import { IndicesStatsParams, Client } from 'elasticsearch'; import { ESSearchRequest, ESSearchResponse, -} from '../../../../typings/elasticsearch'; +} from '../../../../../../typings/elasticsearch'; import { ApmIndicesConfig } from '../../settings/apm_indices/get_apm_indices'; import { tasks } from './tasks'; import { APMDataTelemetry } from '../types'; diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts index ac82d353417b4..ec2eb7c8dd99a 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts @@ -5,7 +5,7 @@ */ import { ValuesType } from 'utility-types'; import { flatten, merge, sortBy, sum, pickBy } from 'lodash'; -import { AggregationOptionsByType } from '../../../../typings/elasticsearch/aggregations'; +import { AggregationOptionsByType } from '../../../../../../typings/elasticsearch/aggregations'; import { ProcessorEvent } from '../../../../common/processor_event'; import { TelemetryTask } from '.'; import { AGENT_NAMES, RUM_AGENT_NAMES } from '../../../../common/agent_name'; diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts index b12dd73a20986..9e18c81e4aaeb 100644 --- a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts +++ b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts @@ -4,12 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ProcessorEvent } from '../../../../common/processor_event'; -import { ESFilter } from '../../../../typings/elasticsearch'; +import { ESFilter } from '../../../../../../typings/elasticsearch'; import { ERROR_GROUP_ID, SERVICE_NAME, } from '../../../../common/elasticsearch_fieldnames'; +import { ProcessorEvent } from '../../../../common/processor_event'; import { rangeFilter } from '../../../../common/utils/range_filter'; import { Setup, SetupTimeRange } from '../../helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts index dea518cad8e40..7866c99353451 100644 --- a/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts +++ b/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { PromiseReturnType } from '../../../../typings/common'; +import { PromiseReturnType } from '../../../../../observability/typings/common'; import { Setup, SetupTimeRange } from '../../helpers/setup_request'; -import { getBuckets } from './get_buckets'; import { BUCKET_TARGET_COUNT } from '../../transactions/constants'; +import { getBuckets } from './get_buckets'; function getBucketSize({ start, end }: SetupTimeRange) { return Math.floor((end - start) / BUCKET_TARGET_COUNT); diff --git a/x-pack/plugins/apm/server/lib/errors/get_error_group.ts b/x-pack/plugins/apm/server/lib/errors/get_error_group.ts index 0fbc7720f7111..37be72beedeb1 100644 --- a/x-pack/plugins/apm/server/lib/errors/get_error_group.ts +++ b/x-pack/plugins/apm/server/lib/errors/get_error_group.ts @@ -4,13 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ProcessorEvent } from '../../../common/processor_event'; +import { PromiseReturnType } from '../../../../observability/typings/common'; import { ERROR_GROUP_ID, SERVICE_NAME, TRANSACTION_SAMPLED, } from '../../../common/elasticsearch_fieldnames'; -import { PromiseReturnType } from '../../../typings/common'; +import { ProcessorEvent } from '../../../common/processor_event'; import { rangeFilter } from '../../../common/utils/range_filter'; import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { getTransaction } from '../transactions/get_transaction'; diff --git a/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts b/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts index 006d2fae3d4fb..d734a1395fc5e 100644 --- a/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts +++ b/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +import { SortOptions } from '../../../../../typings/elasticsearch/aggregations'; +import { PromiseReturnType } from '../../../../observability/typings/common'; import { ERROR_CULPRIT, ERROR_EXC_HANDLED, @@ -12,11 +14,9 @@ import { ERROR_GROUP_ID, ERROR_LOG_MESSAGE, } from '../../../common/elasticsearch_fieldnames'; -import { PromiseReturnType } from '../../../typings/common'; -import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { getErrorGroupsProjection } from '../../projections/errors'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { SortOptions } from '../../../typings/elasticsearch/aggregations'; +import { Setup, SetupTimeRange } from '../helpers/setup_request'; export type ErrorGroupListAPIResponse = PromiseReturnType< typeof getErrorGroups diff --git a/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_environment_ui_filter_es.ts b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_environment_ui_filter_es.ts index ea8d02eb833cf..dd9f0b0333c01 100644 --- a/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_environment_ui_filter_es.ts +++ b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_environment_ui_filter_es.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESFilter } from '../../../../typings/elasticsearch'; +import { ESFilter } from '../../../../../../typings/elasticsearch'; import { ENVIRONMENT_NOT_DEFINED, ENVIRONMENT_ALL, diff --git a/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_es_filter.ts b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_es_filter.ts index 1b8f32d4de8b9..0592f13bdf54f 100644 --- a/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_es_filter.ts +++ b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_es_filter.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESFilter } from '../../../../typings/elasticsearch'; +import { ESFilter } from '../../../../../../typings/elasticsearch'; import { UIFilters } from '../../../../typings/ui_filters'; import { getEnvironmentUiFilterES } from './get_environment_ui_filter_es'; import { diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/add_filter_to_exclude_legacy_data.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/add_filter_to_exclude_legacy_data.ts index 494cd6cbf0eec..921b46daee2a9 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/add_filter_to_exclude_legacy_data.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/add_filter_to_exclude_legacy_data.ts @@ -9,7 +9,7 @@ import { OBSERVER_VERSION_MAJOR } from '../../../../../common/elasticsearch_fiel import { ESSearchRequest, ESFilter, -} from '../../../../../typings/elasticsearch'; +} from '../../../../../../../typings/elasticsearch'; /* Adds a range query to the ES request to exclude legacy data diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts index d23d729db3924..870997efb77de 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts @@ -14,7 +14,7 @@ import { ProcessorEvent } from '../../../../../common/processor_event'; import { ESSearchRequest, ESSearchResponse, -} from '../../../../../typings/elasticsearch'; +} from '../../../../../../../typings/elasticsearch'; import { ApmIndicesConfig } from '../../../settings/apm_indices/get_apm_indices'; import { addFilterToExcludeLegacyData } from './add_filter_to_exclude_legacy_data'; import { callClientWithDebug } from '../call_client_with_debug'; diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts index 736c7ad2d1089..add522a5c7f84 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts @@ -10,7 +10,7 @@ import { ProcessorEvent } from '../../../../../common/processor_event'; import { ESSearchRequest, ESFilter, -} from '../../../../../typings/elasticsearch'; +} from '../../../../../../../typings/elasticsearch'; import { APMEventESSearchRequest } from '.'; import { ApmIndicesConfig, diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_internal_es_client/index.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_internal_es_client/index.ts index 072391606d574..8e74a7992e9ea 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_internal_es_client/index.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_internal_es_client/index.ts @@ -15,7 +15,7 @@ import { APMRequestHandlerContext } from '../../../../routes/typings'; import { ESSearchResponse, ESSearchRequest, -} from '../../../../../typings/elasticsearch'; +} from '../../../../../../../typings/elasticsearch'; import { callClientWithDebug } from '../call_client_with_debug'; // `type` was deprecated in 7.0 diff --git a/x-pack/plugins/apm/server/lib/helpers/get_internal_saved_objects_client.ts b/x-pack/plugins/apm/server/lib/helpers/get_internal_saved_objects_client.ts index e0bb9ad354f58..097538076de25 100644 --- a/x-pack/plugins/apm/server/lib/helpers/get_internal_saved_objects_client.ts +++ b/x-pack/plugins/apm/server/lib/helpers/get_internal_saved_objects_client.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import { CoreSetup } from 'src/core/server'; -import { PromiseReturnType } from '../../../typings/common'; +import { PromiseReturnType } from '../../../../observability/typings/common'; export type InternalSavedObjectsClient = PromiseReturnType< typeof getInternalSavedObjectsClient diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts index 363c4128137e0..65d36c8b36af8 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts @@ -4,20 +4,21 @@ * you may not use this file except in compliance with the Elastic License. */ -import moment from 'moment'; import { Logger } from 'kibana/server'; -import { isActivePlatinumLicense } from '../../../common/service_map'; -import { UI_SETTINGS } from '../../../../../../src/plugins/data/common'; -import { KibanaRequest } from '../../../../../../src/core/server'; +import moment from 'moment'; import { APMConfig } from '../..'; +import { KibanaRequest } from '../../../../../../src/core/server'; +import { UI_SETTINGS } from '../../../../../../src/plugins/data/common'; +import { ESFilter } from '../../../../../typings/elasticsearch'; +import { ProcessorEvent } from '../../../common/processor_event'; +import { isActivePlatinumLicense } from '../../../common/service_map'; +import { UIFilters } from '../../../typings/ui_filters'; +import { APMRequestHandlerContext } from '../../routes/typings'; import { - getApmIndices, ApmIndicesConfig, + getApmIndices, } from '../settings/apm_indices/get_apm_indices'; -import { ESFilter } from '../../../typings/elasticsearch'; import { getEsFilter } from './convert_ui_filters/get_es_filter'; -import { APMRequestHandlerContext } from '../../routes/typings'; -import { ProcessorEvent } from '../../../common/processor_event'; import { APMEventClient, createApmEventClient, @@ -26,7 +27,6 @@ import { APMInternalClient, createInternalESClient, } from './create_es_client/create_internal_es_client'; -import { UIFilters } from '../../../typings/ui_filters'; // Explicitly type Setup to prevent TS initialization errors // https://github.com/microsoft/TypeScript/issues/34933 diff --git a/x-pack/plugins/apm/server/lib/helpers/transaction_error_rate.ts b/x-pack/plugins/apm/server/lib/helpers/transaction_error_rate.ts index ccc7ba7e22b50..03a44e77ba2d3 100644 --- a/x-pack/plugins/apm/server/lib/helpers/transaction_error_rate.ts +++ b/x-pack/plugins/apm/server/lib/helpers/transaction_error_rate.ts @@ -9,7 +9,7 @@ import { EventOutcome } from '../../../common/event_outcome'; import { AggregationOptionsByType, AggregationResultOf, -} from '../../../typings/elasticsearch/aggregations'; +} from '../../../../../typings/elasticsearch/aggregations'; import { getTransactionDurationFieldForAggregatedTransactions } from './aggregated_transactions'; export function getOutcomeAggregation({ diff --git a/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts b/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts index 3ccba8c7586dc..57eae26593305 100644 --- a/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts +++ b/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts @@ -4,15 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Unionize, Overwrite } from 'utility-types'; -import { Setup, SetupTimeRange } from '../helpers/setup_request'; -import { getMetricsDateHistogramParams } from '../helpers/metrics'; -import { ChartBase } from './types'; -import { transformDataToMetricsChart } from './transform_metrics_chart'; +import { Overwrite, Unionize } from 'utility-types'; +import { AggregationOptionsByType } from '../../../../../typings/elasticsearch'; import { getMetricsProjection } from '../../projections/metrics'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { AggregationOptionsByType } from '../../../typings/elasticsearch/aggregations'; import { APMEventESSearchRequest } from '../helpers/create_es_client/create_apm_event_client'; +import { getMetricsDateHistogramParams } from '../helpers/metrics'; +import { Setup, SetupTimeRange } from '../helpers/setup_request'; +import { transformDataToMetricsChart } from './transform_metrics_chart'; +import { ChartBase } from './types'; type MetricsAggregationMap = Unionize<{ min: AggregationOptionsByType['min']; diff --git a/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts b/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts index a191d5400e36c..bcf8b412f350a 100644 --- a/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts +++ b/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ import theme from '@elastic/eui/dist/eui_theme_light.json'; -import { ChartBase } from './types'; -import { ESSearchResponse } from '../../../typings/elasticsearch'; +import { ESSearchResponse } from '../../../../../typings/elasticsearch'; import { getVizColorForIndex } from '../../../common/viz_colors'; import { GenericMetricsRequest } from './fetch_and_transform_metrics'; +import { ChartBase } from './types'; export type GenericMetricsChart = ReturnType< typeof transformDataToMetricsChart diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts index 5f4bc61af4c69..8f8d7763970b7 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts @@ -4,21 +4,21 @@ * you may not use this file except in compliance with the Elastic License. */ import Boom from '@hapi/boom'; +import { MlPluginSetup } from '../../../../ml/server'; +import { PromiseReturnType } from '../../../../observability/typings/common'; +import { + getSeverity, + ML_ERRORS, + ServiceAnomalyStats, +} from '../../../common/anomaly_detection'; +import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values'; import { getServiceHealthStatus } from '../../../common/service_health_status'; -import { Setup, SetupTimeRange } from '../helpers/setup_request'; -import { PromiseReturnType } from '../../../typings/common'; import { TRANSACTION_PAGE_LOAD, TRANSACTION_REQUEST, } from '../../../common/transaction_types'; -import { - ServiceAnomalyStats, - getSeverity, - ML_ERRORS, -} from '../../../common/anomaly_detection'; import { getMlJobsWithAPMGroup } from '../anomaly_detection/get_ml_jobs_with_apm_group'; -import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values'; -import { MlPluginSetup } from '../../../../ml/server'; +import { Setup, SetupTimeRange } from '../helpers/setup_request'; export const DEFAULT_ANOMALIES = { mlJobIds: [], serviceAnomalies: {} }; diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts index 330bb936c9e88..ccebbfa44538a 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts @@ -3,8 +3,9 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { chunk } from 'lodash'; import { Logger } from 'kibana/server'; +import { chunk } from 'lodash'; +import { PromiseReturnType } from '../../../../observability/typings/common'; import { AGENT_NAME, SERVICE_ENVIRONMENT, @@ -12,17 +13,16 @@ import { } from '../../../common/elasticsearch_fieldnames'; import { getServicesProjection } from '../../projections/services'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { PromiseReturnType } from '../../../typings/common'; -import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es'; -import { transformServiceMapResponses } from './transform_service_map_responses'; -import { getServiceMapFromTraceIds } from './get_service_map_from_trace_ids'; -import { getTraceSampleIds } from './get_trace_sample_ids'; +import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { + DEFAULT_ANOMALIES, getServiceAnomalies, ServiceAnomaliesResponse, - DEFAULT_ANOMALIES, } from './get_service_anomalies'; +import { getServiceMapFromTraceIds } from './get_service_map_from_trace_ids'; +import { getTraceSampleIds } from './get_trace_sample_ids'; +import { transformServiceMapResponses } from './transform_service_map_responses'; export interface IEnvOptions { setup: Setup & SetupTimeRange; diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts index 37b34641435fb..82d339686f7ec 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts @@ -4,33 +4,33 @@ * you may not use this file except in compliance with the Elastic License. */ +import { ESFilter } from '../../../../../typings/elasticsearch'; import { - TRANSACTION_REQUEST, - TRANSACTION_PAGE_LOAD, -} from '../../../common/transaction_types'; -import { - SERVICE_NAME, + METRIC_CGROUP_MEMORY_USAGE_BYTES, METRIC_SYSTEM_CPU_PERCENT, METRIC_SYSTEM_FREE_MEMORY, METRIC_SYSTEM_TOTAL_MEMORY, - METRIC_CGROUP_MEMORY_USAGE_BYTES, + SERVICE_NAME, TRANSACTION_TYPE, } from '../../../common/elasticsearch_fieldnames'; import { ProcessorEvent } from '../../../common/processor_event'; +import { + TRANSACTION_PAGE_LOAD, + TRANSACTION_REQUEST, +} from '../../../common/transaction_types'; import { rangeFilter } from '../../../common/utils/range_filter'; -import { ESFilter } from '../../../typings/elasticsearch'; +import { + getDocumentTypeFilterForAggregatedTransactions, + getProcessorEventForAggregatedTransactions, + getTransactionDurationFieldForAggregatedTransactions, +} from '../helpers/aggregated_transactions'; +import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es'; import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { percentCgroupMemoryUsedScript, percentSystemMemoryUsedScript, } from '../metrics/by_agent/shared/memory'; -import { - getProcessorEventForAggregatedTransactions, - getTransactionDurationFieldForAggregatedTransactions, - getDocumentTypeFilterForAggregatedTransactions, -} from '../helpers/aggregated_transactions'; import { getErrorRate } from '../transaction_groups/get_error_rate'; -import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es'; interface Options { setup: Setup & SetupTimeRange; diff --git a/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts b/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts index 22c655bb96f50..db11ab2d9ce3a 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts @@ -3,20 +3,20 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { uniq, take, sortBy } from 'lodash'; import Boom from '@hapi/boom'; -import { ProcessorEvent } from '../../../common/processor_event'; -import { Setup, SetupTimeRange } from '../helpers/setup_request'; -import { rangeFilter } from '../../../common/utils/range_filter'; -import { ESFilter } from '../../../typings/elasticsearch'; +import { sortBy, take, uniq } from 'lodash'; +import { ESFilter } from '../../../../../typings/elasticsearch'; import { - SERVICE_NAME, SERVICE_ENVIRONMENT, - TRACE_ID, + SERVICE_NAME, SPAN_DESTINATION_SERVICE_RESOURCE, + TRACE_ID, } from '../../../common/elasticsearch_fieldnames'; -import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es'; +import { ProcessorEvent } from '../../../common/processor_event'; import { SERVICE_MAP_TIMEOUT_ERROR } from '../../../common/service_map'; +import { rangeFilter } from '../../../common/utils/range_filter'; +import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es'; +import { Setup, SetupTimeRange } from '../helpers/setup_request'; const MAX_TRACES_TO_INSPECT = 1000; diff --git a/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts b/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts index b80e86d53f292..367cf2faf6a8e 100644 --- a/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts +++ b/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts @@ -4,19 +4,19 @@ * you may not use this file except in compliance with the Elastic License. */ import { isNumber } from 'lodash'; +import { ESFilter } from '../../../../../../typings/elasticsearch'; import { Annotation, AnnotationType } from '../../../../common/annotations'; -import { SetupTimeRange, Setup } from '../../helpers/setup_request'; -import { ESFilter } from '../../../../typings/elasticsearch'; -import { rangeFilter } from '../../../../common/utils/range_filter'; import { SERVICE_NAME, SERVICE_VERSION, } from '../../../../common/elasticsearch_fieldnames'; -import { getEnvironmentUiFilterES } from '../../helpers/convert_ui_filters/get_environment_ui_filter_es'; +import { rangeFilter } from '../../../../common/utils/range_filter'; import { getDocumentTypeFilterForAggregatedTransactions, getProcessorEventForAggregatedTransactions, } from '../../helpers/aggregated_transactions'; +import { getEnvironmentUiFilterES } from '../../helpers/convert_ui_filters/get_environment_ui_filter_es'; +import { Setup, SetupTimeRange } from '../../helpers/setup_request'; export async function getDerivedServiceAnnotations({ setup, diff --git a/x-pack/plugins/apm/server/lib/services/annotations/get_stored_annotations.ts b/x-pack/plugins/apm/server/lib/services/annotations/get_stored_annotations.ts index 6e3ae0181ddee..623abf6930297 100644 --- a/x-pack/plugins/apm/server/lib/services/annotations/get_stored_annotations.ts +++ b/x-pack/plugins/apm/server/lib/services/annotations/get_stored_annotations.ts @@ -5,13 +5,13 @@ */ import { LegacyAPICaller, Logger } from 'kibana/server'; -import { SERVICE_NAME } from '../../../../common/elasticsearch_fieldnames'; -import { ESSearchResponse } from '../../../../typings/elasticsearch'; +import { ESSearchResponse } from '../../../../../../typings/elasticsearch'; +import { Annotation as ESAnnotation } from '../../../../../observability/common/annotations'; import { ScopedAnnotationsClient } from '../../../../../observability/server'; import { Annotation, AnnotationType } from '../../../../common/annotations'; -import { Annotation as ESAnnotation } from '../../../../../observability/common/annotations'; -import { SetupTimeRange, Setup } from '../../helpers/setup_request'; +import { SERVICE_NAME } from '../../../../common/elasticsearch_fieldnames'; import { getEnvironmentUiFilterES } from '../../helpers/convert_ui_filters/get_environment_ui_filter_es'; +import { Setup, SetupTimeRange } from '../../helpers/setup_request'; export async function getStoredAnnotations({ setup, diff --git a/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts b/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts index f30b77f147710..16c46be78cb28 100644 --- a/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts +++ b/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts @@ -6,7 +6,7 @@ import { ESSearchRequest, ESSearchResponse, -} from '../../../../typings/elasticsearch'; +} from '../../../../../../typings/elasticsearch'; import { inspectSearchParams, SearchParamsMock, diff --git a/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts b/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts index 5ea3714e81b6f..89915e798b7cd 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts +++ b/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts @@ -4,17 +4,17 @@ * you may not use this file except in compliance with the Elastic License. */ import { Logger } from '@kbn/logging'; +import { PromiseReturnType } from '../../../../../observability/typings/common'; import { joinByKey } from '../../../../common/utils/join_by_key'; -import { PromiseReturnType } from '../../../../typings/common'; -import { Setup, SetupTimeRange } from '../../helpers/setup_request'; import { getServicesProjection } from '../../../projections/services'; +import { Setup, SetupTimeRange } from '../../helpers/setup_request'; import { - getTransactionDurationAverages, getAgentNames, - getTransactionRates, - getTransactionErrorRates, getEnvironments, getHealthStatuses, + getTransactionDurationAverages, + getTransactionErrorRates, + getTransactionRates, } from './get_services_items_stats'; export type ServiceListAPIResponse = PromiseReturnType; diff --git a/x-pack/plugins/apm/server/lib/services/get_services/index.ts b/x-pack/plugins/apm/server/lib/services/get_services/index.ts index 5f39d6c836930..9d450804e421d 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/index.ts +++ b/x-pack/plugins/apm/server/lib/services/get_services/index.ts @@ -4,13 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { isEmpty } from 'lodash'; import { Logger } from '@kbn/logging'; -import { PromiseReturnType } from '../../../../typings/common'; +import { isEmpty } from 'lodash'; +import { PromiseReturnType } from '../../../../../observability/typings/common'; import { Setup, SetupTimeRange } from '../../helpers/setup_request'; -import { hasHistoricalAgentData } from './has_historical_agent_data'; import { getLegacyDataStatus } from './get_legacy_data_status'; import { getServicesItems } from './get_services_items'; +import { hasHistoricalAgentData } from './has_historical_agent_data'; export type ServiceListAPIResponse = PromiseReturnType; diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/convert_settings_to_string.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/convert_settings_to_string.ts index ab01a68733a7a..6791bf85a7b6a 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/convert_settings_to_string.ts +++ b/x-pack/plugins/apm/server/lib/settings/agent_configuration/convert_settings_to_string.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESSearchHit } from '../../../../typings/elasticsearch'; +import { ESSearchHit } from '../../../../../../typings/elasticsearch'; import { AgentConfiguration } from '../../../../common/agent_configuration/configuration_types'; // needed for backwards compatability diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/find_exact_configuration.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/find_exact_configuration.ts index 3a9623c777516..bd10df76b85c7 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/find_exact_configuration.ts +++ b/x-pack/plugins/apm/server/lib/settings/agent_configuration/find_exact_configuration.ts @@ -4,13 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ +import { ESSearchHit } from '../../../../../../typings/elasticsearch'; +import { AgentConfiguration } from '../../../../common/agent_configuration/configuration_types'; import { - SERVICE_NAME, SERVICE_ENVIRONMENT, + SERVICE_NAME, } from '../../../../common/elasticsearch_fieldnames'; import { Setup } from '../../helpers/setup_request'; -import { AgentConfiguration } from '../../../../common/agent_configuration/configuration_types'; -import { ESSearchHit } from '../../../../typings/elasticsearch'; import { convertConfigSettingsToString } from './convert_settings_to_string'; export async function findExactConfiguration({ diff --git a/x-pack/plugins/apm/server/lib/settings/agent_configuration/search_configurations.ts b/x-pack/plugins/apm/server/lib/settings/agent_configuration/search_configurations.ts index 2585f88c2aa43..43ae4995ce672 100644 --- a/x-pack/plugins/apm/server/lib/settings/agent_configuration/search_configurations.ts +++ b/x-pack/plugins/apm/server/lib/settings/agent_configuration/search_configurations.ts @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { ESSearchHit } from '../../../../typings/elasticsearch'; +import { ESSearchHit } from '../../../../../../typings/elasticsearch'; import { SERVICE_NAME, SERVICE_ENVIRONMENT, diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_correlations_for_slow_transactions.ts b/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_correlations_for_slow_transactions.ts index 3efc65afdfd28..76e595c928cf2 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_correlations_for_slow_transactions.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_correlations_for_slow_transactions.ts @@ -4,9 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { asDuration } from '../../../../common/utils/formatters'; -import { ESFilter } from '../../../../typings/elasticsearch'; -import { rangeFilter } from '../../../../common/utils/range_filter'; +import { ESFilter } from '../../../../../../typings/elasticsearch'; import { SERVICE_NAME, TRANSACTION_DURATION, @@ -14,6 +12,8 @@ import { TRANSACTION_TYPE, } from '../../../../common/elasticsearch_fieldnames'; import { ProcessorEvent } from '../../../../common/processor_event'; +import { asDuration } from '../../../../common/utils/formatters'; +import { rangeFilter } from '../../../../common/utils/range_filter'; import { Setup, SetupTimeRange } from '../../helpers/setup_request'; import { getDurationForPercentile } from './get_duration_for_percentile'; import { diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_duration_for_percentile.ts b/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_duration_for_percentile.ts index 37ee19ff40f62..a94540df10fff 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_duration_for_percentile.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_duration_for_percentile.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESFilter } from '../../../../typings/elasticsearch'; +import { ESFilter } from '../../../../../../typings/elasticsearch'; import { TRANSACTION_DURATION } from '../../../../common/elasticsearch_fieldnames'; import { ProcessorEvent } from '../../../../common/processor_event'; import { Setup, SetupTimeRange } from '../../helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_significant_terms_agg.ts b/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_significant_terms_agg.ts index 1cf0787c1d970..c5ab8d8f1d111 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_significant_terms_agg.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/correlations/get_significant_terms_agg.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESFilter } from '../../../../typings/elasticsearch'; +import { ESFilter } from '../../../../../../typings/elasticsearch'; import { SignificantTermsScoring } from './scoring_rt'; export function getSignificantTermsAgg({ diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts index 0a4d9748f2597..89fff260a7d23 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts @@ -3,24 +3,24 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { take, sortBy } from 'lodash'; -import { Unionize } from 'utility-types'; +import { sortBy, take } from 'lodash'; import moment from 'moment'; -import { joinByKey } from '../../../common/utils/join_by_key'; +import { Unionize } from 'utility-types'; +import { AggregationOptionsByType } from '../../../../../typings/elasticsearch'; +import { PromiseReturnType } from '../../../../observability/typings/common'; import { SERVICE_NAME, TRANSACTION_NAME, } from '../../../common/elasticsearch_fieldnames'; +import { joinByKey } from '../../../common/utils/join_by_key'; import { getTransactionGroupsProjection } from '../../projections/transaction_groups'; import { mergeProjection } from '../../projections/util/merge_projection'; -import { PromiseReturnType } from '../../../../observability/typings/common'; -import { AggregationOptionsByType } from '../../../typings/elasticsearch/aggregations'; import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { getAverages, - getSums, - getPercentiles, getCounts, + getPercentiles, + getSums, } from './get_transaction_group_stats'; interface TopTransactionOptions { diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts index 2550bd70c527d..cfd3540446172 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts @@ -6,7 +6,7 @@ import { merge } from 'lodash'; import { TRANSACTION_TYPE } from '../../../common/elasticsearch_fieldnames'; import { arrayUnionToCallable } from '../../../common/utils/array_union_to_callable'; -import { AggregationInputMap } from '../../../typings/elasticsearch/aggregations'; +import { AggregationInputMap } from '../../../../../typings/elasticsearch'; import { TransactionGroupRequestBase, TransactionGroupSetup } from './fetcher'; import { getTransactionDurationFieldForAggregatedTransactions } from '../helpers/aggregated_transactions'; diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts index 8c999b445d799..aad67c43f48e2 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts @@ -5,7 +5,7 @@ */ import { Logger } from 'kibana/server'; -import { ESSearchResponse } from '../../../../../typings/elasticsearch'; +import { ESSearchResponse } from '../../../../../../../typings/elasticsearch'; import { PromiseReturnType } from '../../../../../../observability/typings/common'; import { Setup, SetupTimeRange } from '../../../helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts index e2edbbec63d47..a2da3977b81c7 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts @@ -4,22 +4,22 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESFilter } from '../../../../../typings/elasticsearch'; +import { ESFilter } from '../../../../../../../typings/elasticsearch'; +import { PromiseReturnType } from '../../../../../../observability/typings/common'; import { SERVICE_NAME, TRANSACTION_NAME, TRANSACTION_RESULT, TRANSACTION_TYPE, } from '../../../../../common/elasticsearch_fieldnames'; -import { PromiseReturnType } from '../../../../../../observability/typings/common'; -import { getBucketSize } from '../../../helpers/get_bucket_size'; import { rangeFilter } from '../../../../../common/utils/range_filter'; -import { Setup, SetupTimeRange } from '../../../helpers/setup_request'; import { + getDocumentTypeFilterForAggregatedTransactions, getProcessorEventForAggregatedTransactions, getTransactionDurationFieldForAggregatedTransactions, - getDocumentTypeFilterForAggregatedTransactions, } from '../../../helpers/aggregated_transactions'; +import { getBucketSize } from '../../../helpers/get_bucket_size'; +import { Setup, SetupTimeRange } from '../../../helpers/setup_request'; export type ESResponse = PromiseReturnType; export function timeseriesFetcher({ diff --git a/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts b/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts index 34d01627a2869..010acd09239a3 100644 --- a/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts +++ b/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts @@ -4,9 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import { ValuesType } from 'utility-types'; -import { PromiseReturnType } from '../../../../../typings/common'; -import { joinByKey } from '../../../../../common/utils/join_by_key'; -import { ProcessorEvent } from '../../../../../common/processor_event'; +import { PromiseReturnType } from '../../../../../../observability/typings/common'; import { SERVICE_NAME, TRACE_ID, @@ -16,13 +14,15 @@ import { TRANSACTION_SAMPLED, TRANSACTION_TYPE, } from '../../../../../common/elasticsearch_fieldnames'; +import { ProcessorEvent } from '../../../../../common/processor_event'; +import { joinByKey } from '../../../../../common/utils/join_by_key'; import { rangeFilter } from '../../../../../common/utils/range_filter'; -import { Setup, SetupTimeRange } from '../../../helpers/setup_request'; import { getDocumentTypeFilterForAggregatedTransactions, getProcessorEventForAggregatedTransactions, getTransactionDurationFieldForAggregatedTransactions, } from '../../../helpers/aggregated_transactions'; +import { Setup, SetupTimeRange } from '../../../helpers/setup_request'; function getHistogramAggOptions({ bucketSize, diff --git a/x-pack/plugins/apm/server/lib/ui_filters/get_environments.ts b/x-pack/plugins/apm/server/lib/ui_filters/get_environments.ts index b9f25e20f9f73..8109becbed45e 100644 --- a/x-pack/plugins/apm/server/lib/ui_filters/get_environments.ts +++ b/x-pack/plugins/apm/server/lib/ui_filters/get_environments.ts @@ -4,16 +4,16 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ProcessorEvent } from '../../../common/processor_event'; +import { ESFilter } from '../../../../../typings/elasticsearch'; import { SERVICE_ENVIRONMENT, SERVICE_NAME, } from '../../../common/elasticsearch_fieldnames'; -import { rangeFilter } from '../../../common/utils/range_filter'; -import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { ENVIRONMENT_NOT_DEFINED } from '../../../common/environment_filter_values'; -import { ESFilter } from '../../../typings/elasticsearch'; +import { ProcessorEvent } from '../../../common/processor_event'; +import { rangeFilter } from '../../../common/utils/range_filter'; import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { Setup, SetupTimeRange } from '../helpers/setup_request'; export async function getEnvironments({ setup, diff --git a/x-pack/plugins/apm/server/projections/typings.ts b/x-pack/plugins/apm/server/projections/typings.ts index 332ac533e78c6..b6d6ffbb7ddbf 100644 --- a/x-pack/plugins/apm/server/projections/typings.ts +++ b/x-pack/plugins/apm/server/projections/typings.ts @@ -4,11 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ESSearchBody } from '../../typings/elasticsearch'; import { AggregationOptionsByType, AggregationInputMap, -} from '../../typings/elasticsearch/aggregations'; + ESSearchBody, +} from '../../../../typings/elasticsearch'; import { APMEventESSearchRequest } from '../lib/helpers/create_es_client/create_apm_event_client'; export type Projection = Omit & { diff --git a/x-pack/plugins/apm/server/projections/util/merge_projection/index.ts b/x-pack/plugins/apm/server/projections/util/merge_projection/index.ts index ea7267dd337c2..2782b039958e1 100644 --- a/x-pack/plugins/apm/server/projections/util/merge_projection/index.ts +++ b/x-pack/plugins/apm/server/projections/util/merge_projection/index.ts @@ -3,12 +3,14 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { mergeWith, isPlainObject, cloneDeep } from 'lodash'; +import { cloneDeep, isPlainObject, mergeWith } from 'lodash'; import { DeepPartial } from 'utility-types'; -import { AggregationInputMap } from '../../../../typings/elasticsearch/aggregations'; -import { ESSearchBody } from '../../../../typings/elasticsearch'; -import { Projection } from '../../typings'; +import { + AggregationInputMap, + ESSearchBody, +} from '../../../../../../typings/elasticsearch'; import { APMEventESSearchRequest } from '../../../lib/helpers/create_es_client/create_apm_event_client'; +import { Projection } from '../../typings'; type PlainObject = Record; diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx index 21b59dc516d06..9093b16fada0d 100644 --- a/x-pack/plugins/apm/server/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx @@ -3,14 +3,14 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ +import { APMConfig } from '../'; +import { PromiseReturnType } from '../../../observability/typings/common'; import { ESFilter, - ESSearchResponse, ESSearchRequest, -} from '../../typings/elasticsearch'; -import { PromiseReturnType } from '../../typings/common'; + ESSearchResponse, +} from '../../../../typings/elasticsearch'; import { UIFilters } from '../../typings/ui_filters'; -import { APMConfig } from '..'; interface Options { mockResponse?: ( diff --git a/x-pack/plugins/apm/typings/common.d.ts b/x-pack/plugins/apm/typings/common.d.ts index 754529a198552..9133315c4c16a 100644 --- a/x-pack/plugins/apm/typings/common.d.ts +++ b/x-pack/plugins/apm/typings/common.d.ts @@ -25,10 +25,4 @@ export type PromiseValueType = Value extends Promise ? Value : Value; -export type PromiseReturnType = Func extends ( - ...args: any[] -) => Promise - ? Value - : Func; - export type Maybe = T | null | undefined; diff --git a/x-pack/plugins/lens/server/routes/field_stats.ts b/x-pack/plugins/lens/server/routes/field_stats.ts index a884aeffa6134..29e2416b74618 100644 --- a/x-pack/plugins/lens/server/routes/field_stats.ts +++ b/x-pack/plugins/lens/server/routes/field_stats.ts @@ -9,7 +9,7 @@ import DateMath from '@elastic/datemath'; import { schema } from '@kbn/config-schema'; import { CoreSetup } from 'src/core/server'; import { IFieldType } from 'src/plugins/data/common'; -import { ESSearchResponse } from '../../../apm/typings/elasticsearch'; +import { ESSearchResponse } from '../../../../typings/elasticsearch'; import { FieldStatsResponse, BASE_API_URL } from '../../common'; const SHARD_SIZE = 5000; diff --git a/x-pack/plugins/lens/server/usage/task.ts b/x-pack/plugins/lens/server/usage/task.ts index 83cdbd62f3484..014193fb6566e 100644 --- a/x-pack/plugins/lens/server/usage/task.ts +++ b/x-pack/plugins/lens/server/usage/task.ts @@ -15,7 +15,7 @@ import { } from '../../../task_manager/server'; import { getVisualizationCounts } from './visualization_counts'; -import { ESSearchResponse } from '../../../apm/typings/elasticsearch'; +import { ESSearchResponse } from '../../../../typings/elasticsearch'; // This task is responsible for running daily and aggregating all the Lens click event objects // into daily rolled-up documents, which will be used in reporting click stats diff --git a/x-pack/plugins/task_manager/server/monitoring/workload_statistics.test.ts b/x-pack/plugins/task_manager/server/monitoring/workload_statistics.test.ts index cb6e48530b027..d1c5256c81c63 100644 --- a/x-pack/plugins/task_manager/server/monitoring/workload_statistics.test.ts +++ b/x-pack/plugins/task_manager/server/monitoring/workload_statistics.test.ts @@ -13,8 +13,7 @@ import { estimateRecurringTaskScheduling, } from './workload_statistics'; import { ConcreteTaskInstance } from '../task'; -import { ESSearchResponse } from '../../../apm/typings/elasticsearch'; -import { AggregationResultOf } from '../../../apm/typings/elasticsearch/aggregations'; +import { AggregationResultOf, ESSearchResponse } from '../../../../typings/elasticsearch'; import { times } from 'lodash'; import { taskStoreMock } from '../task_store.mock'; import { of, Subject } from 'rxjs'; diff --git a/x-pack/plugins/task_manager/server/monitoring/workload_statistics.ts b/x-pack/plugins/task_manager/server/monitoring/workload_statistics.ts index 17448ea412ae6..a27b5e2282e32 100644 --- a/x-pack/plugins/task_manager/server/monitoring/workload_statistics.ts +++ b/x-pack/plugins/task_manager/server/monitoring/workload_statistics.ts @@ -11,7 +11,7 @@ import { JsonObject } from 'src/plugins/kibana_utils/common'; import { keyBy, mapValues } from 'lodash'; import { AggregatedStatProvider } from './runtime_statistics_aggregator'; import { parseIntervalAsSecond, asInterval, parseIntervalAsMillisecond } from '../lib/intervals'; -import { AggregationResultOf } from '../../../apm/typings/elasticsearch/aggregations'; +import { AggregationResultOf } from '../../../../typings/elasticsearch'; import { HealthStatus } from './monitoring_stats_stream'; import { TaskStore } from '../task_store'; diff --git a/x-pack/plugins/task_manager/server/task_store.ts b/x-pack/plugins/task_manager/server/task_store.ts index 8c0d7764e009f..cb44144d2fefe 100644 --- a/x-pack/plugins/task_manager/server/task_store.ts +++ b/x-pack/plugins/task_manager/server/task_store.ts @@ -56,7 +56,7 @@ import { } from './queries/mark_available_tasks_as_claimed'; import { TaskTypeDictionary } from './task_type_dictionary'; -import { ESSearchResponse, ESSearchBody } from '../../apm/typings/elasticsearch'; +import { ESSearchResponse, ESSearchBody } from '../../../typings/elasticsearch'; export interface StoreOpts { esClient: ElasticsearchClient; diff --git a/x-pack/test/apm_api_integration/basic/tests/correlations/ranges.ts b/x-pack/test/apm_api_integration/basic/tests/correlations/ranges.ts index f013520fa163b..0a730217e53f5 100644 --- a/x-pack/test/apm_api_integration/basic/tests/correlations/ranges.ts +++ b/x-pack/test/apm_api_integration/basic/tests/correlations/ranges.ts @@ -6,10 +6,10 @@ import expect from '@kbn/expect'; import { format } from 'url'; -import { expectSnapshot } from '../../../common/match_snapshot'; -import { PromiseReturnType } from '../../../../../plugins/apm/typings/common'; -import { FtrProviderContext } from '../../../common/ftr_provider_context'; +import { PromiseReturnType } from '../../../../../plugins/observability/typings/common'; import archives_metadata from '../../../common/archives_metadata'; +import { FtrProviderContext } from '../../../common/ftr_provider_context'; +import { expectSnapshot } from '../../../common/match_snapshot'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); diff --git a/x-pack/test/apm_api_integration/basic/tests/correlations/slow_durations.ts b/x-pack/test/apm_api_integration/basic/tests/correlations/slow_durations.ts index 085a81c5f1bf4..0cfdf3ec474d5 100644 --- a/x-pack/test/apm_api_integration/basic/tests/correlations/slow_durations.ts +++ b/x-pack/test/apm_api_integration/basic/tests/correlations/slow_durations.ts @@ -6,10 +6,10 @@ import expect from '@kbn/expect'; import { format } from 'url'; -import { PromiseReturnType } from '../../../../../plugins/apm/typings/common'; +import { PromiseReturnType } from '../../../../../plugins/observability/typings/common'; +import archives_metadata from '../../../common/archives_metadata'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; import { expectSnapshot } from '../../../common/match_snapshot'; -import archives_metadata from '../../../common/archives_metadata'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); diff --git a/x-pack/test/apm_api_integration/basic/tests/services/top_services.ts b/x-pack/test/apm_api_integration/basic/tests/services/top_services.ts index b4bbec1e0f861..cd2bdb7fde19e 100644 --- a/x-pack/test/apm_api_integration/basic/tests/services/top_services.ts +++ b/x-pack/test/apm_api_integration/basic/tests/services/top_services.ts @@ -6,7 +6,7 @@ import expect from '@kbn/expect'; import { isEmpty, pick } from 'lodash'; -import { PromiseReturnType } from '../../../../../plugins/apm/typings/common'; +import { PromiseReturnType } from '../../../../../plugins/observability/typings/common'; import { expectSnapshot } from '../../../common/match_snapshot'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; import archives_metadata from '../../../common/archives_metadata'; diff --git a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/transaction_charts.ts b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/transaction_charts.ts index d7d6d613281ef..c3b969d765664 100644 --- a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/transaction_charts.ts +++ b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/transaction_charts.ts @@ -5,7 +5,7 @@ */ import expect from '@kbn/expect'; import archives_metadata from '../../../common/archives_metadata'; -import { PromiseReturnType } from '../../../../../plugins/apm/typings/common'; +import { PromiseReturnType } from '../../../../../plugins/observability/typings/common'; import { expectSnapshot } from '../../../common/match_snapshot'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; diff --git a/x-pack/test/apm_api_integration/common/authentication.ts b/x-pack/test/apm_api_integration/common/authentication.ts index 46401224f0d8c..3d1e03aa032f0 100644 --- a/x-pack/test/apm_api_integration/common/authentication.ts +++ b/x-pack/test/apm_api_integration/common/authentication.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { PromiseReturnType } from '../../../plugins/apm/typings/common'; +import { PromiseReturnType } from '../../../plugins/observability/typings/common'; import { SecurityServiceProvider } from '../../../../test/common/services/security'; type SecurityService = PromiseReturnType; diff --git a/x-pack/test/apm_api_integration/common/config.ts b/x-pack/test/apm_api_integration/common/config.ts index db073cb967423..f94bd6bd3be6f 100644 --- a/x-pack/test/apm_api_integration/common/config.ts +++ b/x-pack/test/apm_api_integration/common/config.ts @@ -9,7 +9,7 @@ import supertestAsPromised from 'supertest-as-promised'; import { format, UrlObject } from 'url'; import path from 'path'; import { InheritedFtrProviderContext, InheritedServices } from './ftr_provider_context'; -import { PromiseReturnType } from '../../../plugins/apm/typings/common'; +import { PromiseReturnType } from '../../../plugins/observability/typings/common'; import { createApmUser, APM_TEST_PASSWORD, ApmUser } from './authentication'; interface Settings { diff --git a/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts b/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts index 0cd91eb46a5e2..25c3f753341d1 100644 --- a/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts +++ b/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts @@ -8,7 +8,7 @@ import querystring from 'querystring'; import expect from '@kbn/expect'; import { isEmpty, uniq } from 'lodash'; import archives_metadata from '../../../common/archives_metadata'; -import { PromiseReturnType } from '../../../../../plugins/apm/typings/common'; +import { PromiseReturnType } from '../../../../../plugins/observability/typings/common'; import { expectSnapshot } from '../../../common/match_snapshot'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; diff --git a/x-pack/test/apm_api_integration/trial/tests/services/top_services.ts b/x-pack/test/apm_api_integration/trial/tests/services/top_services.ts index 9a6c6f94dbb60..bb611013351d7 100644 --- a/x-pack/test/apm_api_integration/trial/tests/services/top_services.ts +++ b/x-pack/test/apm_api_integration/trial/tests/services/top_services.ts @@ -6,7 +6,7 @@ import expect from '@kbn/expect'; import { expectSnapshot } from '../../../common/match_snapshot'; -import { PromiseReturnType } from '../../../../../plugins/apm/typings/common'; +import { PromiseReturnType } from '../../../../../plugins/observability/typings/common'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; import archives_metadata from '../../../common/archives_metadata'; diff --git a/x-pack/test/apm_api_integration/trial/tests/services/transaction_groups_charts.ts b/x-pack/test/apm_api_integration/trial/tests/services/transaction_groups_charts.ts index c35dfcc3817a4..47e465596e0d7 100644 --- a/x-pack/test/apm_api_integration/trial/tests/services/transaction_groups_charts.ts +++ b/x-pack/test/apm_api_integration/trial/tests/services/transaction_groups_charts.ts @@ -6,7 +6,7 @@ import expect from '@kbn/expect'; import { expectSnapshot } from '../../../common/match_snapshot'; -import { PromiseReturnType } from '../../../../../plugins/apm/typings/common'; +import { PromiseReturnType } from '../../../../../plugins/observability/typings/common'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; import archives_metadata from '../../../common/archives_metadata'; diff --git a/x-pack/test/observability_api_integration/trial/tests/annotations.ts b/x-pack/test/observability_api_integration/trial/tests/annotations.ts index 18298b2ed3645..a5ea17ac63413 100644 --- a/x-pack/test/observability_api_integration/trial/tests/annotations.ts +++ b/x-pack/test/observability_api_integration/trial/tests/annotations.ts @@ -7,7 +7,7 @@ import expect from '@kbn/expect'; import { JsonObject } from 'src/plugins/kibana_utils/common'; import { Annotation } from '../../../../plugins/observability/common/annotations'; -import { ESSearchHit } from '../../../../plugins/apm/typings/elasticsearch'; +import { ESSearchHit } from '../../../../typings/elasticsearch'; import { FtrProviderContext } from '../../common/ftr_provider_context'; const DEFAULT_INDEX_NAME = 'observability-annotations'; diff --git a/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts b/x-pack/typings/elasticsearch/aggregations.d.ts similarity index 91% rename from x-pack/plugins/apm/typings/elasticsearch/aggregations.ts rename to x-pack/typings/elasticsearch/aggregations.d.ts index a869c1e1186fa..29c78e9383175 100644 --- a/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts +++ b/x-pack/typings/elasticsearch/aggregations.d.ts @@ -202,10 +202,7 @@ type SubAggregationResponseOf< ? AggregationResponseMap : {}; -interface AggregationResponsePart< - TAggregationOptionsMap extends AggregationOptionsMap, - TDocument -> { +interface AggregationResponsePart { terms: { buckets: Array< { @@ -224,8 +221,7 @@ interface AggregationResponsePart< }; date_histogram: { buckets: Array< - DateHistogramBucket & - SubAggregationResponseOf + DateHistogramBucket & SubAggregationResponseOf >; }; avg: MetricsAggregationResponsePart; @@ -277,10 +273,7 @@ interface AggregationResponsePart< } & SubAggregationResponseOf; filters: TAggregationOptionsMap extends { filters: { filters: any[] } } ? Array< - { doc_count: number } & AggregationResponseMap< - TAggregationOptionsMap['aggs'], - TDocument - > + { doc_count: number } & AggregationResponseMap > : TAggregationOptionsMap extends { filters: { @@ -291,10 +284,7 @@ interface AggregationResponsePart< buckets: { [key in keyof TAggregationOptionsMap['filters']['filters']]: { doc_count: number; - } & SubAggregationResponseOf< - TAggregationOptionsMap['aggs'], - TDocument - >; + } & SubAggregationResponseOf; }; } : never; @@ -337,18 +327,15 @@ interface AggregationResponsePart< buckets: TAggregationOptionsMap extends { range: { keyed: true } } ? Record< string, - DateRangeBucket & - SubAggregationResponseOf + DateRangeBucket & SubAggregationResponseOf > : Array< - DateRangeBucket & - SubAggregationResponseOf + DateRangeBucket & SubAggregationResponseOf >; }; auto_date_histogram: { buckets: Array< - DateHistogramBucket & - AggregationResponseMap + DateHistogramBucket & AggregationResponseMap >; interval: string; }; @@ -389,9 +376,11 @@ interface AggregationResponsePart< // Union keys are not included in keyof. The type will fall back to keyof T if // UnionToIntersection fails, which happens when there are conflicts between the union // types, e.g. { foo: string; bar?: undefined } | { foo?: undefined; bar: string }; -export type ValidAggregationKeysOf< - T extends Record -> = keyof (UnionToIntersection extends never ? T : UnionToIntersection); +export type ValidAggregationKeysOf> = keyof (UnionToIntersection< + T +> extends never + ? T + : UnionToIntersection); export type AggregationResultOf< TAggregationOptionsMap extends AggregationOptionsMap, diff --git a/x-pack/plugins/apm/typings/elasticsearch/index.ts b/x-pack/typings/elasticsearch/index.d.ts similarity index 76% rename from x-pack/plugins/apm/typings/elasticsearch/index.ts rename to x-pack/typings/elasticsearch/index.d.ts index 9a05fe631e888..f5d595edcd71e 100644 --- a/x-pack/plugins/apm/typings/elasticsearch/index.ts +++ b/x-pack/typings/elasticsearch/index.d.ts @@ -6,6 +6,17 @@ import { SearchParams, SearchResponse } from 'elasticsearch'; import { AggregationResponseMap, AggregationInputMap } from './aggregations'; +export { + AggregationInputMap, + AggregationOptionsByType, + AggregationResponseMap, + AggregationResultOf, + SortOptions, + ValidAggregationKeysOf, +} from './aggregations'; + +// Typings for Elasticsearch queries and aggregations. These are intended to be +// moved to the Elasticsearch JS client at some point (see #77720.) interface CollapseQuery { field: string; @@ -42,10 +53,7 @@ export type ESSearchResponse< > = Omit, 'aggregations' | 'hits'> & (TSearchRequest extends { body: { aggs: AggregationInputMap } } ? { - aggregations?: AggregationResponseMap< - TSearchRequest['body']['aggs'], - TDocument - >; + aggregations?: AggregationResponseMap; } : {}) & { hits: Omit['hits'], 'total'> & @@ -63,12 +71,6 @@ export type ESSearchResponse< export interface ESFilter { [key: string]: { - [key: string]: - | string - | string[] - | number - | boolean - | Record - | ESFilter[]; + [key: string]: string | string[] | number | boolean | Record | ESFilter[]; }; }