Skip to content

Commit

Permalink
Move PromiseReturnType to observability typings
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed May 5, 2020
1 parent e941a37 commit dd6348c
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { getAllEnvironments } from './get_all_environments';
import { Setup } from '../../../helpers/setup_request';
import { PromiseReturnType } from '../../../../../typings/common';
import { PromiseReturnType } from '../../../../../../observability/typings/common';
import { getExistingEnvironmentsForService } from './get_existing_environments_for_service';

export type AgentConfigurationEnvironmentsAPIResponse = PromiseReturnType<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { Setup } from '../../helpers/setup_request';
import { PromiseReturnType } from '../../../../typings/common';
import { PromiseReturnType } from '../../../../../observability/typings/common';
import {
PROCESSOR_EVENT,
SERVICE_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 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 } from '../../helpers/setup_request';
import { AgentConfiguration } from '../../../../common/agent_configuration/configuration_types';
import { convertConfigSettingsToString } from './convert_settings_to_string';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { merge } from 'lodash';
import { Server } from 'hapi';
import { SavedObjectsClient } from 'src/core/server';
import { PromiseReturnType } from '../../../../typings/common';
import { PromiseReturnType } from '../../../../../observability/typings/common';
import {
APM_INDICES_SAVED_OBJECT_TYPE,
APM_INDICES_SAVED_OBJECT_ID
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/apm/server/lib/traces/get_trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 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 { getTraceItems } from './get_trace_items';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '../../../common/elasticsearch_fieldnames';
import { getTransactionGroupsProjection } from '../../../common/projections/transaction_groups';
import { mergeProjection } from '../../../common/projections/util/merge_projection';
import { PromiseReturnType } from '../../../typings/common';
import { PromiseReturnType } from '../../../../observability/typings/common';
import { SortOptions } from '../../../typings/elasticsearch/aggregations';
import { Transaction } from '../../../typings/es_schemas/ui/transaction';
import {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/apm/server/lib/transaction_groups/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '../helpers/setup_request';
import { transactionGroupsFetcher, Options } from './fetcher';
import { transactionGroupsTransformer } from './transform';
import { PromiseReturnType } from '../../../typings/common';
import { PromiseReturnType } from '../../../../observability/typings/common';

export type TransactionGroupListAPIResponse = PromiseReturnType<
typeof getTransactionGroupList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { ESFilter } from '../../../../typings/elasticsearch';
import { PromiseReturnType } from '../../../../typings/common';
import { PromiseReturnType } from '../../../../../observability/typings/common';
import {
PROCESSOR_EVENT,
SERVICE_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { getMlIndex } from '../../../../../common/ml_job_constants';
import { PromiseReturnType } from '../../../../../typings/common';
import { PromiseReturnType } from '../../../../../../observability/typings/common';
import { Setup, SetupTimeRange } from '../../../helpers/setup_request';

export type ESResponse = Exclude<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { getAnomalySeries } from '.';
import { mlAnomalyResponse } from './mock_responses/ml_anomaly_response';
import { mlBucketSpanResponse } from './mock_responses/ml_bucket_span_response';
import { PromiseReturnType } from '../../../../../typings/common';
import { PromiseReturnType } from '../../../../../../observability/typings/common';
import { APMConfig } from '../../../..';

describe('getAnomalySeries', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
TRANSACTION_RESULT,
TRANSACTION_TYPE
} from '../../../../../common/elasticsearch_fieldnames';
import { PromiseReturnType } from '../../../../../typings/common';
import { PromiseReturnType } from '../../../../../../observability/typings/common';
import { getBucketSize } from '../../../helpers/get_bucket_size';
import { rangeFilter } from '../../../helpers/range_filter';
import {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/apm/server/lib/transactions/charts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 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 { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { bucketFetcher } from './fetcher';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { cloneDeep, sortByOrder } from 'lodash';
import { UIFilters } from '../../../../typings/ui_filters';
import { Projection } from '../../../../common/projections/typings';
import { PromiseReturnType } from '../../../../typings/common';
import { PromiseReturnType } from '../../../../../observability/typings/common';
import { getLocalFilterQuery } from './get_local_filter_query';
import { Setup } from '../../helpers/setup_request';
import { localUIFilters, LocalUIFilterName } from './config';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { CoreSetup, PluginInitializerContext, KibanaRequest } from 'kibana/server';
import { PromiseReturnType } from '../../../../apm/typings/common';
import { PromiseReturnType } from '../../../typings/common';
import { createAnnotationsClient } from './create_annotations_client';
import { registerAnnotationAPIs } from './register_annotation_apis';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Annotation,
getAnnotationByIdRt,
} from '../../../common/annotations';
import { PromiseReturnType } from '../../../../apm/typings/common';
import { PromiseReturnType } from '../../../typings/common';
import { createOrUpdateIndex } from '../../utils/create_or_update_index';
import { mappings } from './mappings';

Expand Down
9 changes: 9 additions & 0 deletions x-pack/plugins/observability/typings/common.ts
Original file line number Diff line number Diff line change
@@ -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;
* you may not use this file except in compliance with the Elastic License.
*/

export type PromiseReturnType<Func> = Func extends (...args: any[]) => Promise<infer Value>
? Value
: Func;

0 comments on commit dd6348c

Please sign in to comment.