From 45a839b6ce2076e6ea96f66913bf0672f40a8af8 Mon Sep 17 00:00:00 2001 From: Wylie Conlon Date: Tue, 1 Sep 2020 15:36:27 -0400 Subject: [PATCH] Fix whitespace --- .../apm/typings/elasticsearch/aggregations.ts | 113 +++++++++--------- 1 file changed, 57 insertions(+), 56 deletions(-) diff --git a/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts b/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts index 104719f4fe2c69..f4f7e41ad8147d 100644 --- a/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts +++ b/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts @@ -13,11 +13,11 @@ export type SortOptions = SortOrder | SortInstruction | SortInstruction[]; type Script = | string | { - lang?: string; - id?: string; - source?: string; - params?: Record; - }; + lang?: string; + id?: string; + source?: string; + params?: Record; + }; type BucketsPath = string | Record; @@ -25,12 +25,12 @@ type SourceOptions = string | string[]; type MetricsAggregationOptions = | { - field: string; - missing?: number; - } + field: string; + missing?: number; + } | { - script?: Script; - }; + script?: Script; + }; interface MetricsAggregationResponsePart { value: number | null; @@ -43,9 +43,9 @@ interface DateHistogramBucket { type GetCompositeKeys< TAggregationOptionsMap extends AggregationOptionsMap - > = TAggregationOptionsMap extends { - composite: { sources: Array }; - } +> = TAggregationOptionsMap extends { + composite: { sources: Array }; +} ? keyof Source : never; @@ -68,7 +68,8 @@ export interface AggregationOptionsByType { min: number; max: number; }; - } & ({ calendar_interval: string } | { fixed_interval: string }) & MetricsAggregationOptions; + } & ({ calendar_interval: string } | { fixed_interval: string }) & + MetricsAggregationOptions; histogram: { interval: number; min_doc_count?: number; @@ -171,14 +172,14 @@ export interface AggregationInputMap { type BucketSubAggregationResponse< TAggregationInputMap extends AggregationInputMap | undefined, TDocument - > = TAggregationInputMap extends AggregationInputMap +> = TAggregationInputMap extends AggregationInputMap ? AggregationResponseMap : {}; interface AggregationResponsePart< TAggregationOptionsMap extends AggregationOptionsMap, TDocument - > { +> { terms: { buckets: Array< { @@ -204,7 +205,7 @@ interface AggregationResponsePart< date_histogram: { buckets: Array< DateHistogramBucket & - BucketSubAggregationResponse + BucketSubAggregationResponse >; }; avg: MetricsAggregationResponsePart; @@ -248,38 +249,38 @@ interface AggregationResponsePart< doc_count: number; } & AggregationResponseMap; filters: TAggregationOptionsMap extends { filters: { filters: any[] } } - ? Array< - { doc_count: number } & AggregationResponseMap< - TAggregationOptionsMap['aggs'], - TDocument - > - > - : TAggregationOptionsMap extends { - filters: { - filters: Record; - }; - } - ? { - buckets: { - [key in keyof TAggregationOptionsMap['filters']['filters']]: { - doc_count: number; - } & AggregationResponseMap; - }; - } - : never; + ? Array< + { doc_count: number } & AggregationResponseMap< + TAggregationOptionsMap['aggs'], + TDocument + > + > + : TAggregationOptionsMap extends { + filters: { + filters: Record; + }; + } + ? { + buckets: { + [key in keyof TAggregationOptionsMap['filters']['filters']]: { + doc_count: number; + } & AggregationResponseMap; + }; + } + : never; sampler: { doc_count: number; } & AggregationResponseMap; derivative: - | { - value: number; - } - | undefined; + | { + value: number; + } + | undefined; bucket_script: - | { - value: number | null; - } - | undefined; + | { + value: number | null; + } + | undefined; composite: { after_key: Record< GetCompositeKeys, @@ -303,13 +304,13 @@ interface AggregationResponsePart< }; date_range: { buckets: TAggregationOptionsMap extends { date_range: { keyed: true } } - ? Record - : { buckets: DateRangeBucket[] }; + ? Record + : { buckets: DateRangeBucket[] }; }; auto_date_histogram: { buckets: Array< DateHistogramBucket & - AggregationResponseMap + AggregationResponseMap >; interval: string; }; @@ -318,8 +319,8 @@ interface AggregationResponsePart< values: TAggregationOptionsMap extends { percentile_ranks: { keyed: false }; } - ? Array<{ key: number; value: number }> - : Record; + ? Array<{ key: number; value: number }> + : Record; }; } @@ -340,16 +341,16 @@ interface AggregationResponsePart< // types, e.g. { foo: string; bar?: undefined } | { foo?: undefined; bar: string }; export type ValidAggregationKeysOf< T extends Record - > = keyof (UnionToIntersection extends never ? T : UnionToIntersection); +> = keyof (UnionToIntersection extends never ? T : UnionToIntersection); export type AggregationResponseMap< TAggregationInputMap extends AggregationInputMap | undefined, TDocument - > = TAggregationInputMap extends AggregationInputMap +> = TAggregationInputMap extends AggregationInputMap ? { - [TName in keyof TAggregationInputMap]: AggregationResponsePart< - TAggregationInputMap[TName], - TDocument - >[AggregationType & ValidAggregationKeysOf]; - } + [TName in keyof TAggregationInputMap]: AggregationResponsePart< + TAggregationInputMap[TName], + TDocument + >[AggregationType & ValidAggregationKeysOf]; + } : undefined;