Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza K committed Jun 29, 2021
1 parent d5df964 commit 028d7da
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ esFilters: {
FILTERS: typeof FILTERS;
FilterStateStore: typeof FilterStateStore;
buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter;
buildPhrasesFilter: (field: import("../common").FieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
buildExistsFilter: (field: import("../common").FieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
buildPhraseFilter: (field: import("../common").FieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
buildPhrasesFilter: (field: import("../common").IndexPatternFieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
buildPhraseFilter: (field: import("../common").IndexPatternFieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter;
buildRangeFilter: (field: import("../common").FieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
buildRangeFilter: (field: import("../common").IndexPatternFieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
isPhraseFilter: (filter: any) => filter is import("../common").PhraseFilter;
isExistsFilter: (filter: any) => filter is import("../common").ExistsFilter;
isPhrasesFilter: (filter: any) => filter is import("../common").PhrasesFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ esFilters: {
buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter;
buildCustomFilter: typeof buildCustomFilter;
buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter;
buildExistsFilter: (field: import("../common").FieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
buildFilter: typeof buildFilter;
buildPhraseFilter: (field: import("../common").FieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
buildPhrasesFilter: (field: import("../common").FieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
buildRangeFilter: (field: import("../common").FieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
buildPhraseFilter: (field: import("../common").IndexPatternFieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
buildPhrasesFilter: (field: import("../common").IndexPatternFieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
buildRangeFilter: (field: import("../common").IndexPatternFieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
isFilterDisabled: (filter: import("../common").Filter) => boolean;
}
```
2 changes: 1 addition & 1 deletion src/plugins/data/common/es_query/es_query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export { buildQueryFromFilters } from './from_filters';
export { luceneStringToDsl } from './lucene_string_to_dsl';
export { decorateQuery } from './decorate_query';
export { getEsQueryConfig } from './get_es_query_config';
export { IndexPatternBase, FieldBase, IFieldSubType } from './types';
export { IndexPatternBase, IndexPatternFieldBase, IFieldSubType } from './types';
4 changes: 2 additions & 2 deletions src/plugins/data/common/es_query/es_query/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface IFieldSubType {
multi?: { parent: string };
nested?: { path: string };
}
export interface FieldBase {
export interface IndexPatternFieldBase {
name: string;
type: string;
subType?: IFieldSubType;
Expand All @@ -29,6 +29,6 @@ export interface FieldBase {
}

export interface IndexPatternBase {
fields: FieldBase[];
fields: IndexPatternFieldBase[];
id?: string;
}
6 changes: 3 additions & 3 deletions src/plugins/data/common/es_query/filters/build_filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { FieldBase, IndexPatternBase } from '../..';
import { IndexPatternFieldBase, IndexPatternBase } from '../..';

import {
Filter,
Expand All @@ -21,7 +21,7 @@ import {

export function buildFilter(
indexPattern: IndexPatternBase,
field: FieldBase,
field: IndexPatternFieldBase,
type: FILTERS,
negate: boolean,
disabled: boolean,
Expand Down Expand Up @@ -61,7 +61,7 @@ export function buildCustomFilter(

function buildBaseFilter(
indexPattern: IndexPatternBase,
field: FieldBase,
field: IndexPatternFieldBase,
type: FILTERS,
params: any
): Filter {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/es_query/filters/exists_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { Filter, FilterMeta } from './meta_filter';
import { FieldBase, IndexPatternBase } from '..';
import { IndexPatternFieldBase, IndexPatternBase } from '..';

export type ExistsFilterMeta = FilterMeta;

Expand All @@ -26,7 +26,7 @@ export const getExistsFilterField = (filter: ExistsFilter) => {
return filter.exists && filter.exists.field;
};

export const buildExistsFilter = (field: FieldBase, indexPattern: IndexPatternBase) => {
export const buildExistsFilter = (field: IndexPatternFieldBase, indexPattern: IndexPatternBase) => {
return {
meta: {
index: indexPattern.id,
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/data/common/es_query/filters/phrase_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import type { estypes } from '@elastic/elasticsearch';
import { get, isPlainObject } from 'lodash';
import { Filter, FilterMeta } from './meta_filter';
import { FieldBase, IndexPatternBase } from '..';
import { IndexPatternFieldBase, IndexPatternBase } from '..';

export type PhraseFilterMeta = FilterMeta & {
params?: {
Expand Down Expand Up @@ -58,7 +58,7 @@ export const getPhraseFilterValue = (filter: PhraseFilter): PhraseFilterValue =>
};

export const buildPhraseFilter = (
field: FieldBase,
field: IndexPatternFieldBase,
value: any,
indexPattern: IndexPatternBase
): PhraseFilter => {
Expand All @@ -81,7 +81,7 @@ export const buildPhraseFilter = (
}
};

export const getPhraseScript = (field: FieldBase, value: string) => {
export const getPhraseScript = (field: IndexPatternFieldBase, value: string) => {
const convertedValue = getConvertedValueForField(field, value);
const script = buildInlineScriptForPhraseFilter(field);

Expand All @@ -105,7 +105,7 @@ export const getPhraseScript = (field: FieldBase, value: string) => {
* https://github.com/elastic/elasticsearch/issues/20941
* https://github.com/elastic/elasticsearch/pull/22201
**/
export const getConvertedValueForField = (field: FieldBase, value: any) => {
export const getConvertedValueForField = (field: IndexPatternFieldBase, value: any) => {
if (typeof value !== 'boolean' && field.type === 'boolean') {
if ([1, 'true'].includes(value)) {
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/es_query/filters/phrases_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { Filter, FilterMeta } from './meta_filter';
import { getPhraseScript } from './phrase_filter';
import { FILTERS } from './index';
import { FieldBase, IndexPatternBase } from '../es_query';
import { IndexPatternFieldBase, IndexPatternBase } from '../es_query';

export type PhrasesFilterMeta = FilterMeta & {
params: string[]; // The unformatted values
Expand All @@ -32,7 +32,7 @@ export const getPhrasesFilterField = (filter: PhrasesFilter) => {
// Creates a filter where the given field matches one or more of the given values
// params should be an array of values
export const buildPhrasesFilter = (
field: FieldBase,
field: IndexPatternFieldBase,
params: any[],
indexPattern: IndexPatternBase
) => {
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/data/common/es_query/filters/range_filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { each } from 'lodash';
import { buildRangeFilter, getRangeFilterField, RangeFilter } from './range_filter';
import { fields, getField } from '../../index_patterns/mocks';
import { IndexPatternBase, FieldBase } from '../es_query';
import { IndexPatternBase, IndexPatternFieldBase } from '../es_query';

describe('Range filter builder', () => {
let indexPattern: IndexPatternBase;
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('Range filter builder', () => {
});

describe('when given params where one side is infinite', () => {
let field: FieldBase;
let field: IndexPatternFieldBase;
let filter: RangeFilter;

beforeEach(() => {
Expand Down Expand Up @@ -160,7 +160,7 @@ describe('Range filter builder', () => {
});

describe('when given params where both sides are infinite', () => {
let field: FieldBase;
let field: IndexPatternFieldBase;
let filter: RangeFilter;

beforeEach(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/data/common/es_query/filters/range_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import type { estypes } from '@elastic/elasticsearch';
import { map, reduce, mapValues, get, keys, pickBy } from 'lodash';
import { Filter, FilterMeta } from './meta_filter';
import { IndexPatternBase, FieldBase } from '..';
import { IndexPatternBase, IndexPatternFieldBase } from '..';

const OPERANDS_IN_RANGE = 2;

Expand Down Expand Up @@ -88,7 +88,7 @@ const formatValue = (params: any[]) =>
// Creates a filter where the value for the given field is in the given range
// params should be an object containing `lt`, `lte`, `gt`, and/or `gte`
export const buildRangeFilter = (
field: FieldBase,
field: IndexPatternFieldBase,
params: RangeFilterParams,
indexPattern: IndexPatternBase,
formattedValue?: string
Expand Down Expand Up @@ -134,7 +134,7 @@ export const buildRangeFilter = (
return filter as RangeFilter;
};

export const getRangeScript = (field: FieldBase, params: RangeFilterParams) => {
export const getRangeScript = (field: IndexPatternFieldBase, params: RangeFilterParams) => {
const knownParams = mapValues(
pickBy(params, (val, key: any) => key in operators),
(value) => (field.type === 'number' && typeof value === 'string' ? parseFloat(value) : value)
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/es_query/kuery/functions/exists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import * as literal from '../node_types/literal';
import { KueryNode, FieldBase, IndexPatternBase } from '../../..';
import { KueryNode, IndexPatternFieldBase, IndexPatternBase } from '../../..';

export function buildNodeParams(fieldName: string) {
return {
Expand All @@ -29,7 +29,7 @@ export function toElasticsearchQuery(
value: context?.nested ? `${context.nested.path}.${fieldNameArg.value}` : fieldNameArg.value,
};
const fieldName = literal.toElasticsearchQuery(fullFieldNameArg);
const field = indexPattern?.fields?.find((fld: FieldBase) => fld.name === fieldName);
const field = indexPattern?.fields?.find((fld: IndexPatternFieldBase) => fld.name === fieldName);

if (field?.scripted) {
throw new Error(`Exists query does not support scripted fields`);
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/es_query/kuery/functions/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getPhraseScript } from '../../filters';
import { getFields } from './utils/get_fields';
import { getTimeZoneFromSettings } from '../../utils';
import { getFullFieldNameNode } from './utils/get_full_field_name_node';
import { IndexPatternBase, KueryNode, FieldBase } from '../../..';
import { IndexPatternBase, KueryNode, IndexPatternFieldBase } from '../../..';

import * as ast from '../ast';

Expand Down Expand Up @@ -100,7 +100,7 @@ export function toElasticsearchQuery(
return { match_all: {} };
}

const queries = fields!.reduce((accumulator: any, field: FieldBase) => {
const queries = fields!.reduce((accumulator: any, field: IndexPatternFieldBase) => {
const wrapWithNestedQuery = (query: any) => {
// Wildcards can easily include nested and non-nested fields. There isn't a good way to let
// users handle this themselves so we automatically add nested queries in this scenario.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { getFields } from './get_fields';
import { IndexPatternBase, FieldBase, KueryNode } from '../../../..';
import { IndexPatternBase, IndexPatternFieldBase, KueryNode } from '../../../..';

export function getFullFieldNameNode(
rootNameNode: any,
Expand All @@ -27,7 +27,7 @@ export function getFullFieldNameNode(
}
const fields = getFields(fullFieldNameNode, indexPattern);

const errors = fields!.reduce((acc: any, field: FieldBase) => {
const errors = fields!.reduce((acc: any, field: IndexPatternFieldBase) => {
const nestedPathFromField =
field.subType && field.subType.nested ? field.subType.nested.path : undefined;

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/index_patterns/fields/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { FieldBase, FieldSpec, IndexPattern } from '../..';
import { IndexPatternFieldBase, FieldSpec, IndexPattern } from '../..';

/**
* @deprecated
* Use IndexPatternField or FieldSpec instead
*/
export interface IFieldType extends FieldBase {
export interface IFieldType extends IndexPatternFieldBase {
count?: number;
// esTypes might be undefined on old index patterns that have not been refreshed since we added
// this prop. It is also undefined on scripted fields.
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/index_patterns/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { estypes } from '@elastic/elasticsearch';
import { ToastInputFields, ErrorToastOptions } from 'src/core/public/notifications';
// eslint-disable-next-line
import type { SavedObject } from 'src/core/server';
import type { FieldBase, IFieldSubType, IndexPatternBase } from '../es_query';
import type { IndexPatternFieldBase, IFieldSubType, IndexPatternBase } from '../es_query';
import { IFieldType } from './fields';
import { RUNTIME_FIELD_TYPES } from './constants';
import { SerializedFieldFormat } from '../../../expressions/common';
Expand Down Expand Up @@ -178,7 +178,7 @@ export interface FieldSpecExportFmt {
/**
* Serialized version of IndexPatternField
*/
export interface FieldSpec extends FieldBase {
export interface FieldSpec extends IndexPatternFieldBase {
/**
* Popularity count is used by discover
*/
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,11 @@ export const esFilters: {
FILTERS: typeof FILTERS;
FilterStateStore: typeof FilterStateStore;
buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter;
buildPhrasesFilter: (field: import("../common").FieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
buildExistsFilter: (field: import("../common").FieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
buildPhraseFilter: (field: import("../common").FieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
buildPhrasesFilter: (field: import("../common").IndexPatternFieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
buildPhraseFilter: (field: import("../common").IndexPatternFieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter;
buildRangeFilter: (field: import("../common").FieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
buildRangeFilter: (field: import("../common").IndexPatternFieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
isPhraseFilter: (filter: any) => filter is import("../common").PhraseFilter;
isExistsFilter: (filter: any) => filter is import("../common").ExistsFilter;
isPhrasesFilter: (filter: any) => filter is import("../common").PhrasesFilter;
Expand Down Expand Up @@ -1242,11 +1242,11 @@ export interface IFieldSubType {
};
}

// Warning: (ae-forgotten-export) The symbol "FieldBase" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "IndexPatternFieldBase" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "IFieldType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export interface IFieldType extends FieldBase {
export interface IFieldType extends IndexPatternFieldBase {
// (undocumented)
aggregatable?: boolean;
// (undocumented)
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/data/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,11 @@ export const esFilters: {
buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter;
buildCustomFilter: typeof buildCustomFilter;
buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter;
buildExistsFilter: (field: import("../common").FieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
buildFilter: typeof buildFilter;
buildPhraseFilter: (field: import("../common").FieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
buildPhrasesFilter: (field: import("../common").FieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
buildRangeFilter: (field: import("../common").FieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
buildPhraseFilter: (field: import("../common").IndexPatternFieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
buildPhrasesFilter: (field: import("../common").IndexPatternFieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
buildRangeFilter: (field: import("../common").IndexPatternFieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
isFilterDisabled: (filter: import("../common").Filter) => boolean;
};

Expand Down Expand Up @@ -693,11 +693,11 @@ export interface IFieldSubType {
};
}

// Warning: (ae-forgotten-export) The symbol "FieldBase" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "IndexPatternFieldBase" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "IFieldType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export interface IFieldType extends FieldBase {
export interface IFieldType extends IndexPatternFieldBase {
// (undocumented)
aggregatable?: boolean;
// (undocumented)
Expand Down

0 comments on commit 028d7da

Please sign in to comment.